diff --git a/src/portal/lib/src/create-edit-rule/create-edit-rule.component.html b/src/portal/lib/src/create-edit-rule/create-edit-rule.component.html index e6133f334..4e9038465 100644 --- a/src/portal/lib/src/create-edit-rule/create-edit-rule.component.html +++ b/src/portal/lib/src/create-edit-rule/create-edit-rule.component.html @@ -121,13 +121,13 @@ -
+
-
+
diff --git a/src/portal/lib/src/list-replication-rule/list-replication-rule.component.ts b/src/portal/lib/src/list-replication-rule/list-replication-rule.component.ts index ebc4f3a7c..91834463d 100644 --- a/src/portal/lib/src/list-replication-rule/list-replication-rule.component.ts +++ b/src/portal/lib/src/list-replication-rule/list-replication-rule.component.ts @@ -46,7 +46,7 @@ import { ErrorHandler } from "../error-handler/error-handler"; import { CustomComparator } from "../utils"; import { operateChanges, OperateInfo, OperationState } from "../operation/operate"; import { OperationService } from "../operation/operation.service"; - +const jobstatus = "InProgress"; @Component({ selector: "hbr-list-replication-rule", @@ -204,9 +204,7 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges { if (ruleData.length) { ruleData.forEach(job => { if ( - job.status === "pending" || - job.status === "running" || - job.status === "retrying" + job.status === jobstatus ) { count++; } diff --git a/src/portal/lib/src/replication/replication-tasks/replication-tasks.component.html b/src/portal/lib/src/replication/replication-tasks/replication-tasks.component.html index f5b5db321..ece741915 100644 --- a/src/portal/lib/src/replication/replication-tasks/replication-tasks.component.html +++ b/src/portal/lib/src/replication/replication-tasks/replication-tasks.component.html @@ -91,26 +91,19 @@
- + {{'REPLICATION.TASK_ID'| translate}} - {{'REPLICATION.RESOURCE_TYPE' - | translate}} - {{'REPLICATION.SOURCE' | - translate}} - {{'REPLICATION.DESTINATION' | - translate}} - {{'REPLICATION.OPERATION' | - translate}} - {{'REPLICATION.STATUS' | - translate}} - {{'REPLICATION.CREATION_TIME' - | translate}} - {{'REPLICATION.END_TIME' - | translate}} + {{'REPLICATION.RESOURCE_TYPE' | translate}} + {{'REPLICATION.SOURCE' | translate}} + {{'REPLICATION.DESTINATION' | translate}} + {{'REPLICATION.OPERATION' | translate}} + {{'REPLICATION.STATUS' | translate}} + {{'REPLICATION.CREATION_TIME' | translate}} + {{'REPLICATION.END_TIME' | translate}} {{'REPLICATION.LOGS' | translate}} {{t.id}} - {{t.resource_type}} + {{t.resource_type}} {{t.src_resource}} {{t.dst_resource}} {{t.operation}} @@ -128,12 +121,8 @@ - {{pagination.firstItem + 1}} - - - {{pagination.lastItem +1 }} {{'ROBOT_ACCOUNT.OF' | - translate}} - {{pagination.totalItems }} {{'ROBOT_ACCOUNT.ITEMS' | translate}} - + {{pagination.firstItem + 1}} - {{pagination.lastItem +1 }} {{'REPLICATION.OF' | translate}} {{pagination.totalItems }} {{'REPLICATION.ITEMS' | translate}} +
diff --git a/src/portal/lib/src/replication/replication-tasks/replication-tasks.component.scss b/src/portal/lib/src/replication/replication-tasks/replication-tasks.component.scss index cb5f3cf31..0a16d9471 100644 --- a/src/portal/lib/src/replication/replication-tasks/replication-tasks.component.scss +++ b/src/portal/lib/src/replication/replication-tasks/replication-tasks.component.scss @@ -105,6 +105,9 @@ } clr-datagrid { margin-top: 20px; + .resource-width { + width: 150px; + } } } } diff --git a/src/portal/lib/src/replication/replication-tasks/replication-tasks.component.ts b/src/portal/lib/src/replication/replication-tasks/replication-tasks.component.ts index 2010a2f8c..df293a5da 100644 --- a/src/portal/lib/src/replication/replication-tasks/replication-tasks.component.ts +++ b/src/portal/lib/src/replication/replication-tasks/replication-tasks.component.ts @@ -20,12 +20,9 @@ const taskStatus: any = { }) export class ReplicationTasksComponent implements OnInit, OnDestroy { isOpenFilterTag: boolean; - selectedRow: []; currentPage: number = 1; - currentPagePvt: number = 0; - totalCount: number = 0; + selectedRow: []; pageSize: number = DEFAULT_PAGE_SIZE; - currentState: State; loading = true; searchTask: string; defaultFilter = "resource_type"; @@ -53,6 +50,7 @@ export class ReplicationTasksComponent implements OnInit, OnDestroy { ngOnInit(): void { this.searchTask = ''; this.getExecutionDetail(); + this.clrLoadTasks(); } getExecutionDetail(): void { @@ -120,30 +118,16 @@ export class ReplicationTasksComponent implements OnInit, OnDestroy { } } - clrLoadTasks(state: State): void { - if (!state || !state.page) { - return; - } - // Keep it for future filter - this.currentState = state; - - let pageNumber: number = calculatePage(state); - if (pageNumber !== this.currentPagePvt) { - // load data - let params: RequestQueryParams = new RequestQueryParams(); - params.set("page", '' + pageNumber); - params.set("page_size", '' + this.pageSize); - if (this.searchTask && this.searchTask !== "") { - params.set(this.defaultFilter, this.searchTask); - } - + clrLoadTasks(): void { this.loading = true; + let params: RequestQueryParams = new RequestQueryParams(); + if (this.searchTask && this.searchTask !== "") { + params.set(this.defaultFilter, this.searchTask); + } this.replicationService.getReplicationTasks(this.executionId, params) .pipe(finalize(() => (this.loading = false))) .subscribe(res => { - this.totalCount = res.length; this.tasks = res; // Keep the data - this.taskItem = this.tasks.filter(tasks => tasks.resource_type !== ""); if (!this.timerDelay) { this.timerDelay = timer(10000, 10000).subscribe(() => { let count: number = 0; @@ -157,31 +141,17 @@ export class ReplicationTasksComponent implements OnInit, OnDestroy { } }); if (count > 0) { - this.clrLoadTasks(this.currentState); + this.clrLoadTasks(); } else { this.timerDelay.unsubscribe(); this.timerDelay = null; } }); } - this.taskItem = doFiltering(this.taskItem, state); - - this.taskItem = doSorting(this.taskItem, state); - - this.currentPagePvt = pageNumber; }, error => { this.errorHandler.error(error); }); - } else { - - this.taskItem = this.tasks.filter(tasks => tasks.resource_type !== ""); - // Do customized filter - this.taskItem = doFiltering(this.taskItem, state); - - // Do customized sorting - this.taskItem = doSorting(this.taskItem, state); - } } onBack(): void { this.router.navigate(["harbor", "replications"]); @@ -194,8 +164,8 @@ export class ReplicationTasksComponent implements OnInit, OnDestroy { // refresh icon refreshTasks(): void { - this.searchTask = ''; this.loading = true; + this.currentPage = 1; this.replicationService.getReplicationTasks(this.executionId) .subscribe(res => { this.tasks = res; @@ -213,23 +183,7 @@ export class ReplicationTasksComponent implements OnInit, OnDestroy { } this.searchTask = value.trim(); this.loading = true; - this.currentPage = 1; - if (this.currentPagePvt === 1) { - // Force reloading - let st: State = this.currentState; - if (!st) { - st = { - page: {} - }; - } - st.page.from = 0; - st.page.to = this.pageSize - 1; - st.page.size = this.pageSize; - - this.currentPagePvt = 0; - - this.clrLoadTasks(st); - } + this.clrLoadTasks(); } openFilter(isOpen: boolean): void {