Tainacan importer - show status label on list processes

This commit is contained in:
Eduardo Humberto 2018-12-03 20:57:06 -02:00
parent 6ae4b2aea7
commit 3481d640c1
4 changed files with 44 additions and 3 deletions

View File

@ -159,6 +159,7 @@
class="actions-cell column-small-width"
:label="$i18n.get('label_status')">
<div class="actions-container">
<span class="label-status">{{ getStatusLabel(bgProcess.status) }}</span>
<span
v-if="bgProcess.done <= 0"
class="icon has-text-success loading-icon">
@ -341,6 +342,31 @@
},
pauseProcess(index) {
this.updateProcess({ id: this.processes[index].ID, status: 'closed' });
},
getStatusLabel(status) {
switch(status) {
case 'finished':
return this.$i18n.get('info_process_status_finished');
case 'finished-errors':
return this.$i18n.get('info_process_status_finished_errors');
case 'errored':
return this.$i18n.get('info_process_status_errored');
case 'cancelled':
return this.$i18n.get('info_process_status_cancelled');
case 'paused':
return this.$i18n.get('info_process_status_paused');
case 'running':
return this.$i18n.get('info_process_status_running');
default:
return this.$i18n.get('info_process_status_finished');
}
}
},
mounted() {
@ -377,6 +403,11 @@
}
}
.label-status {
font-size: 9pt;
margin-right: 3px;
}
.loading-icon .control.is-loading::after {
position: relative !important;
right: 0;

View File

@ -499,6 +499,12 @@ return apply_filters( 'tainacan-admin-i18n', [
'info_current_view_mode_metadata_not_allowed' => __( 'Current view mode does not allow displayed metadata selection.', 'tainacan' ),
'info_cant_select_metadata_without_items' => __( 'Can not select displayed metadata without items on list.', 'tainacan' ),
'info_available_exporters_helper' => __( '?', 'tainacan' ),
'info_process_status_finished' => __('Finished', 'tainacan'),
'info_process_status_finished_errors' => __('Finished with errors', 'tainacan'),
'info_process_status_errored' => __('Error', 'tainacan'),
'info_process_status_cancelled' => __('Cancelled', 'tainacan'),
'info_process_status_paused' => __('Paused', 'tainacan'),
'info_process_status_running' => __('Running', 'tainacan'),
// Tainacan Metadatum Types
'tainacan-text' => __( 'Text', 'tainacan' ),

View File

@ -222,7 +222,7 @@ class REST_Background_Processes_Controller extends REST_Controller {
$status_q = "done = 0";
}
if ( $body['status'] == 'closed' ) {
$status_q = "done = 1, status = 'cancelled'";
$status_q = "done = 1, status = 'paused'";
}
$id_q = $wpdb->prepare("AND ID = %d", $id);

View File

@ -71,6 +71,10 @@ class Migrations {
ADD name text NOT NULL
");
}
}
static function create_importer_status_column(){
global $wpdb;
$column_exists = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '{$wpdb->prefix}tnc_bg_process' AND column_name = 'status'" );
@ -80,8 +84,8 @@ class Migrations {
ADD status ENUM('waiting','running','paused','cancelled','errored','finished','finished-errors')
");
}
}
}
static function init_capabilites() {
$Tainacan_Capabilities = \Tainacan\Capabilities::get_instance();