-
-
-
-
- {{'REPLICATION.SUCCESS'| translate}}
- {{'1'}}
-
-
- {{'REPLICATION.FAILTURE'| translate}}
- {{'2'}}
-
-
- {{'REPLICATION.IN_PROGRESS'| translate}}
- {{'3'}}
-
-
-
+
+
+
{{'REPLICATION.REPLICATION_EXECUTION'|
+ translate}}
+
+ {{executionId}}
+
+
+
+
+ {{'REPLICATION.IN_PROGRESS'| translate}}
-
-
-
-
- {{'My 1st policy'}}
-
-
-
- {{'Schedule'}}
-
-
-
- {{'3/14/19, 2:26 PM'}}
-
-
+
+
+ {{'REPLICATION.SUCCESS'| translate}}
+
+
+ {{'REPLICATION.FAILTURE'| translate}}
+
+
+
+
+
-
+
-
-
Tasks
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{'REPLICATION.TASK_ID'| translate}}
- {{'REPLICATION.RECOURCE_TYPE' | translate}}
- {{'REPLICATION.RECOURCE' | translate}}
- {{'REPLICATION.DESTINATION' | translate}}
- {{'REPLICATION.STATUS' | translate}}
- {{'REPLICATION.CREATION_TIME' | translate}}
- {{'REPLICATION.END_TIME' | translate}}
- {{'REPLICATION.LOGS' | translate}}
-
- {{t.id}}
- {{t.resource_type}}
- {{t.src_resource}}
- {{t.dst_resource}}
- {{t.status}}
- {{t.start_time | date: 'short'}}
- {{t.end_time | date: 'short'}}
-
- {{'REPLICATION.NO_LOGS' | translate}}
-
-
-
-
-
-
-
-
- {{pagination.firstItem + 1}}
- -
- {{pagination.lastItem +1 }} {{'ROBOT_ACCOUNT.OF' |
- translate}}
- {{pagination.totalItems }} {{'ROBOT_ACCOUNT.ITEMS' | translate}}
-
-
-
+
+
+
+
+ {{'My 1st policy'}}
+
+
+
+ {{'Schedule'}}
+
+
+
+ {{'3/14/19, 2:26 PM'}}
+
+
+
+
+
+ {{'REPLICATION.SUCCESS'| translate}}
+ {{'1'}}
+
+
+ {{'REPLICATION.FAILTURE'| translate}}
+ {{'2'}}
+
+
+ {{'REPLICATION.IN_PROGRESS'| translate}}
+ {{'3'}}
+
+
+
+
+
+
+
+
Tasks
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{'REPLICATION.TASK_ID'| translate}}
+ {{'REPLICATION.RECOURCE_TYPE'
+ | translate}}
+ {{'REPLICATION.RECOURCE' |
+ translate}}
+ {{'REPLICATION.DESTINATION' |
+ translate}}
+ {{'REPLICATION.STATUS' |
+ translate}}
+ {{'REPLICATION.CREATION_TIME'
+ | translate}}
+ {{'REPLICATION.END_TIME'
+ | translate}}
+ {{'REPLICATION.LOGS' | translate}}
+
+ {{t.id}}
+ {{t.resource_type}}
+ {{t.src_resource}}
+ {{t.dst_resource}}
+ {{t.status}}
+ {{t.start_time | date: 'short'}}
+ {{t.end_time | date: 'short'}}
+
+ {{'REPLICATION.NO_LOGS'
+ | translate}}
+
+
+
+
+
+
+
+
+ {{pagination.firstItem + 1}}
+ -
+ {{pagination.lastItem +1 }} {{'ROBOT_ACCOUNT.OF' |
+ translate}}
+ {{pagination.totalItems }} {{'ROBOT_ACCOUNT.ITEMS' | translate}}
+
+
+
+
\ No newline at end of file
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 30aca0902..3c3af43e0 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
@@ -3,11 +3,33 @@
.title-wrapper {
.onback{
color: #007cbb;
- font-size: 12px;
+ font-size: 14px;
cursor: pointer;
}
- h4 {
- margin-top: 8px;
+ .title-block {
+ display: flex;
+ align-items: center;
+ >div:first-child {
+ width: 210px;
+ }
+ >div:nth-child(2) {
+ width: 140px;
+ span {
+ color: #007cbb;
+ font-size: 12px;
+ margin-left: 10px;
+ }
+ }
+ .id-divider {
+ display: inline-block;
+ height: 25px;
+ width: 2px;
+ background-color: #cccccc;
+ margin: 0 20px;
+ }
+ .h2-style {
+ display: inline-block;
+ }
}
}
.execution-block {
@@ -21,7 +43,6 @@
display: flex;
.detail-span {
flex:0 0 100px;
- font-weight: 600;
margin-top: 10px;
}
.execution-details {
@@ -31,9 +52,14 @@
}
}
.executions-detail {
- font-weight: 600;
- span {
- margin-left: 5px;
+ width: 400px;
+ label {
+ display: inline-block;
+ color: black;
+ width: 120px;
+ }
+ >div {
+ margin-top: 10px;
}
}
}
@@ -60,4 +86,4 @@
}
}
}
-}
\ No newline at end of file
+}
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 eedbc58ff..4f7769c5c 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
@@ -1,8 +1,8 @@
import { Component, OnInit, Input } from '@angular/core';
import { Router } from '@angular/router';
import { ReplicationService } from "../../service/replication.service";
-import { map, catchError } from "rxjs/operators";
-import { Observable, forkJoin, throwError as observableThrowError } from "rxjs";
+import { TranslateService } from '@ngx-translate/core';
+import { finalize } from "rxjs/operators";
import { ErrorHandler } from "../../error-handler/error-handler";
import { ReplicationJob, ReplicationTasks, Comparator, ReplicationJobItem } from "../../service/interface";
import { CustomComparator } from "../../utils";
@@ -14,7 +14,11 @@ import { CustomComparator } from "../../utils";
export class ReplicationTasksComponent implements OnInit {
isOpenFilterTag: boolean;
selectedRow: [];
+ loading = false;
+ searchTask: string;
+ defaultFilter = "recourceType";
tasks: ReplicationTasks[] = [];
+ tasksCopy: ReplicationTasks[] = [];
stopOnGoing: boolean;
executions: string = 'InProgress';
@Input() executionId: string;
@@ -26,15 +30,16 @@ export class ReplicationTasksComponent implements OnInit {
>("end_time", "date");
constructor(
+ private translate: TranslateService,
private router: Router,
private replicationService: ReplicationService,
private errorHandler: ErrorHandler,
) { }
ngOnInit(): void {
- // this.getExecutions();
- this.getTasks();
+ this.clrLoadTasks();
// this.executions.status = 'success';
+ this.searchTask = '';
}
// getExecutions(): void {
@@ -54,9 +59,12 @@ export class ReplicationTasksComponent implements OnInit {
stopJob() {
this.stopOnGoing = true;
this.replicationService.stopJobs(this.executionId)
- .subscribe(res => {
+ .subscribe(response => {
this.stopOnGoing = false;
// this.getExecutions();
+ this.translate.get("REPLICATION.STOP_SUCCESS", { param: this.executionId }).subscribe((res: string) => {
+ this.errorHandler.info(res);
+ });
},
error => {
this.errorHandler.error(error);
@@ -64,13 +72,33 @@ export class ReplicationTasksComponent implements OnInit {
}
viewLog(taskId: number | string): string {
- return this.replicationService.getJobBaseUrl() + "/" + this.executionId + "/tasks/" + taskId + "/log";
+ return this.replicationService.getJobBaseUrl() + "/executions/" + this.executionId + "/tasks/" + taskId + "/log";
}
- getTasks(): void {
+ clrLoadTasks(): void {
+ this.loading = true;
this.replicationService.getReplicationTasks(this.executionId)
+ .pipe(finalize(() => (this.loading = false)))
.subscribe(tasks => {
- this.tasks = tasks.map(x => Object.assign({}, x));
+ if (this.defaultFilter === 'recourceType') {
+ this.tasks = tasks.filter(x =>
+ x.resource_type.includes(this.searchTask)
+ );
+ } else if (this.defaultFilter === 'recource') {
+ this.tasks = tasks.filter(x =>
+ x.src_resource.includes(this.searchTask)
+ );
+ } else if (this.defaultFilter === 'destination') {
+ this.tasks = tasks.filter(x =>
+ x.dst_resource.includes(this.searchTask)
+ );
+ } else {
+ this.tasks = tasks.filter(x =>
+ x.status.includes(this.searchTask)
+ );
+ }
+
+ this.tasksCopy = tasks.map(x => Object.assign({}, x));
},
error => {
this.errorHandler.error(error);
@@ -80,12 +108,31 @@ export class ReplicationTasksComponent implements OnInit {
this.router.navigate(["harbor", "replications"]);
}
+ selectFilter($event: any): void {
+ this.defaultFilter = $event['target'].value;
+ this.doSearch(this.searchTask);
+ }
+
+ // refresh icon
+ refreshTasks(): void {
+ this.searchTask = '';
+ this.clrLoadTasks();
+ }
+
+ doSearch(value: string): void {
+ if (!value) {
+ return;
+ }
+ this.searchTask = value.trim();
+ this.clrLoadTasks();
+ }
+
openFilter(isOpen: boolean): void {
if (isOpen) {
this.isOpenFilterTag = true;
} else {
this.isOpenFilterTag = false;
}
-}
+ }
}
diff --git a/src/portal/lib/src/replication/replication.component.html b/src/portal/lib/src/replication/replication.component.html
index 4d077b62e..4ff26293c 100644
--- a/src/portal/lib/src/replication/replication.component.html
+++ b/src/portal/lib/src/replication/replication.component.html
@@ -26,7 +26,7 @@
{{'REPLICATION.REPLICATION_EXECUTIONS' | translate}}
-
diff --git a/src/portal/lib/src/replication/replication.component.scss b/src/portal/lib/src/replication/replication.component.scss
index 16104b61f..75448d29b 100644
--- a/src/portal/lib/src/replication/replication.component.scss
+++ b/src/portal/lib/src/replication/replication.component.scss
@@ -28,7 +28,7 @@
}
.row-right {
- padding-right: 50px;
+ margin-left: 564px;
}
.replication-row {
diff --git a/src/portal/lib/src/replication/replication.component.spec.ts b/src/portal/lib/src/replication/replication.component.spec.ts
index 9dcd83547..d39885d9e 100644
--- a/src/portal/lib/src/replication/replication.component.spec.ts
+++ b/src/portal/lib/src/replication/replication.component.spec.ts
@@ -27,6 +27,20 @@ import { of } from 'rxjs';
describe('Replication Component (inline template)', () => {
+ let mockEndpoint: Endpoint = {
+ id: 1,
+ credential: {
+ access_key: "admin",
+ access_secret: "",
+ type: "basic"
+ },
+ description: "test",
+ insecure: false,
+ name: "target_01",
+ type: "Harbor",
+ url: "https://10.117.4.151"
+ };
+
let mockRules: ReplicationRule[] = [
{
@@ -128,6 +142,7 @@ describe('Replication Component (inline template)', () => {
let spyRules: jasmine.Spy;
let spyJobs: jasmine.Spy;
let spyEndpoint: jasmine.Spy;
+ let spyEndpoints: jasmine.Spy;
let deGrids: DebugElement[];
let deRules: DebugElement;
@@ -138,7 +153,7 @@ describe('Replication Component (inline template)', () => {
let config: IServiceConfig = {
replicationRuleEndpoint: '/api/policies/replication/testing',
- replicationBaseEndpoint: '/api/replication/testing'
+ systemInfoEndpoint: "/api/endpoints/testing"
};
beforeEach(async(() => {
@@ -187,8 +202,8 @@ describe('Replication Component (inline template)', () => {
spyJobs = spyOn(replicationService, 'getExecutions').and.returnValues(of(mockJob));
- spyEndpoint = spyOn(endpointService, 'getEndpoints').and.returnValues(of(mockEndpoints));
-
+ spyEndpoints = spyOn(endpointService, 'getEndpoints').and.returnValues(of(mockEndpoints));
+ spyEndpoint = spyOn(endpointService, "getEndpoint").and.returnValue(of(mockEndpoint));
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
diff --git a/src/portal/lib/src/service/replication.service.ts b/src/portal/lib/src/service/replication.service.ts
index 58f2e7a53..400288769 100644
--- a/src/portal/lib/src/service/replication.service.ts
+++ b/src/portal/lib/src/service/replication.service.ts
@@ -278,7 +278,7 @@ export class ReplicationDefaultService extends ReplicationService {
if (!executionId) {
return observableThrowError("Bad argument");
}
- let url: string = `${this._replicateUrl}/${executionId}/tasks`;
+ let url: string = `${this._replicateUrl}/executions/${executionId}/tasks`;
return this.http
.get(url, HTTP_GET_OPTIONS)
.pipe(map(response => response.json() as ReplicationTasks)
@@ -385,10 +385,10 @@ export class ReplicationDefaultService extends ReplicationService {
if (!queryParams) {
queryParams = new RequestQueryParams();
}
-
+ let url: string = `${this._replicateUrl}/executions`;
queryParams.set("policy_id", "" + ruleId);
return this.http
- .get(this._replicateUrl, buildHttpRequestOptions(queryParams))
+ .get(url, buildHttpRequestOptions(queryParams))
.pipe(map(response => {
let result: ReplicationJob = {
metadata: {
@@ -435,7 +435,7 @@ export class ReplicationDefaultService extends ReplicationService {
if (!jobId || jobId <= 0) {
return observableThrowError("Bad request argument.");
}
- let requestUrl: string = `${this._replicateUrl}/${jobId}`;
+ let requestUrl: string = `${this._replicateUrl}/executions/${jobId}`;
return this.http
.put(
diff --git a/src/portal/src/i18n/lang/en-us-lang.json b/src/portal/src/i18n/lang/en-us-lang.json
index 3bc723c39..dc5514134 100644
--- a/src/portal/src/i18n/lang/en-us-lang.json
+++ b/src/portal/src/i18n/lang/en-us-lang.json
@@ -331,7 +331,10 @@
"OF": "of"
},
"REPLICATION": {
+ "CURRENT": "current",
+ "FILTER_PLACEHOLDER": "Filter Tasks",
"STOP_TITLE": "Confirm Stop Executions",
+ "STOP_SUCCESS": "Stop Execution {{param}} Successful",
"STOP_SUMMARY": "Do you want to stop the executions {{param}}?",
"TASK_ID":"Task ID",
"RECOURCE_TYPE": "Recource Type",
@@ -340,14 +343,14 @@
"POLICY": "Policy",
"DURATION": "Duration",
"SUCCESS_RATE": "Success Rate",
- "SUCCESS": "Success",
- "FAILTURE": "Failture",
- "IN_PROGRESS": "In Progress",
+ "SUCCESS": "SUCCESS",
+ "FAILTURE": "FAILTURE",
+ "IN_PROGRESS": "IN PROGRESS",
"REPLICATION_RULE": "Replication Rule",
"NEW_REPLICATION_RULE": "New Replication Rule",
"ENDPOINTS": "Endpoints",
"FILTER_POLICIES_PLACEHOLDER": "Filter Rules",
- "FILTER_JOBS_PLACEHOLDER": "Filter Jobs",
+ "FILTER_EXECUTIONS_PLACEHOLDER": "Filter Executions",
"DELETION_TITLE": "Confirm Rules Deletion",
"DELETION_SUMMARY": "Do you want to delete rules {{param}}?",
"REPLICATION_TITLE": "Confirm Rules replication",
diff --git a/src/portal/src/i18n/lang/es-es-lang.json b/src/portal/src/i18n/lang/es-es-lang.json
index 29dfc582b..d6544c721 100644
--- a/src/portal/src/i18n/lang/es-es-lang.json
+++ b/src/portal/src/i18n/lang/es-es-lang.json
@@ -330,7 +330,10 @@
"OF": "of"
},
"REPLICATION": {
+ "CURRENT": "current",
+ "FILTER_PLACEHOLDER": "Filter Tasks",
"STOP_TITLE": "Confirme Stop Executions",
+ "STOP_SUCCESS": "Stop Execution {{param}} Successful",
"STOP_SUMMARY": "De que desea detener las ejecuciones {{param}}?",
"TASK_ID":"Task ID",
"RECOURCE_TYPE": "Recource Type",
@@ -339,16 +342,16 @@
"POLICY": "Policy",
"DURATION": "Duration",
"SUCCESS_RATE": "Success Rate",
- "SUCCESS": "Success",
- "FAILTURE": "Failture",
- "IN_PROGRESS": "In Progress",
+ "SUCCESS": "SUCCESS",
+ "FAILTURE": "FAILTURE",
+ "IN_PROGRESS": "IN PROGRESS",
"STOP_EXECUTIONS": "Stop Execution",
"ID":"ID",
"REPLICATION_RULE": "Reglas de Replicación",
"NEW_REPLICATION_RULE": "Nueva Regla de Replicación",
"ENDPOINTS": "Endpoints",
"FILTER_POLICIES_PLACEHOLDER": "Filtrar Reglas",
- "FILTER_JOBS_PLACEHOLDER": "Filtrar Trabajos",
+ "FILTER_EXECUTIONS_PLACEHOLDER": "Filter Ejecuciones",
"DELETION_TITLE": "Confirmar Eliminación de Regla",
"DELETION_SUMMARY": "¿Quiere eliminar la regla {{param}}?",
"DELETION_TITLE_FAILURE": "failed to delete Rule Deletion",
diff --git a/src/portal/src/i18n/lang/fr-fr-lang.json b/src/portal/src/i18n/lang/fr-fr-lang.json
index 56ad122b4..8015c35c1 100644
--- a/src/portal/src/i18n/lang/fr-fr-lang.json
+++ b/src/portal/src/i18n/lang/fr-fr-lang.json
@@ -315,7 +315,10 @@
"OF": "de"
},
"REPLICATION": {
+ "CURRENT": "current",
+ "FILTER_PLACEHOLDER": "Filter Tasks",
"STOP_TITLE": "Confirmer arrêter les exécutions",
+ "STOP_SUCCESS": "Stop Execution {{param}} Successful",
"STOP_SUMMARY": "Voulez-vous arrêter les exécutions {{param}}?",
"TASK_ID":"Task ID",
"RECOURCE_TYPE": "Recource Type",
@@ -324,16 +327,16 @@
"POLICY": "Policy",
"DURATION": "Duration",
"SUCCESS_RATE": "Success Rate",
- "SUCCESS": "Success",
- "FAILTURE": "Failture",
- "IN_PROGRESS": "In Progress",
+ "SUCCESS": "SUCCESS",
+ "FAILTURE": "FAILTURE",
+ "IN_PROGRESS": "IN PROGRESS",
"STOP_EXECUTIONS": "Stop Execution",
"ID":"ID",
"REPLICATION_RULE": "Règle de Réplication",
"NEW_REPLICATION_RULE": "Nouvelle Règle de Réplication",
"ENDPOINTS": "Points finaux",
"FILTER_POLICIES_PLACEHOLDER": "Filtrer les Règles",
- "FILTER_JOBS_PLACEHOLDER": "Filtrer les Travaux",
+ "FILTER_EXECUTIONS_PLACEHOLDER": "Filter Exécutions",
"DELETION_TITLE": "Confirmer la suppression de la Règle",
"DELETION_SUMMARY": "Voulez-vous supprimer la règle {{param}} ?",
"DELETION_TITLE_FAILURE": "n'a pas supprimé la règle",
diff --git a/src/portal/src/i18n/lang/pt-br-lang.json b/src/portal/src/i18n/lang/pt-br-lang.json
index 01ab55faf..278ec5012 100644
--- a/src/portal/src/i18n/lang/pt-br-lang.json
+++ b/src/portal/src/i18n/lang/pt-br-lang.json
@@ -329,7 +329,10 @@
"OF": "de"
},
"REPLICATION": {
+ "CURRENT": "current",
+ "FILTER_PLACEHOLDER": "Filter Tasks",
"STOP_TITLE": "Confirme as execuções de parada",
+ "STOP_SUCCESS": "Stop Execution {{param}} Successful",
"STOP_SUMMARY": "Você quer parar as execuções? {{param}}?",
"TASK_ID":"Task ID",
"RECOURCE_TYPE": "Recource Type",
@@ -338,16 +341,16 @@
"POLICY": "Policy",
"DURATION": "Duration",
"SUCCESS_RATE": "Success Rate",
- "SUCCESS": "Success",
- "FAILTURE": "Failture",
- "IN_PROGRESS": "In Progress",
+ "SUCCESS": "SUCCESS",
+ "FAILTURE": "FAILTURE",
+ "IN_PROGRESS": "IN PROGRESS",
"STOP_EXECUTIONS": "Stop Execution",
"ID":"ID",
"REPLICATION_RULE": "Regra de replicação",
"NEW_REPLICATION_RULE": "Nova regra de replicação",
"ENDPOINTS": "Endpoints",
"FILTER_POLICIES_PLACEHOLDER": "Filtrar regras",
- "FILTER_JOBS_PLACEHOLDER": "Filtrar tarefas",
+ "FILTER_EXECUTIONS_PLACEHOLDER": "Execuções de Filtro",
"DELETION_TITLE": "Confirmar remoção de regras",
"DELETION_SUMMARY": "Você quer remover a regra {{param}}?",
"REPLICATION_TITLE": "Confirmar regras de replicação",
diff --git a/src/portal/src/i18n/lang/zh-cn-lang.json b/src/portal/src/i18n/lang/zh-cn-lang.json
index 1a1b78a1b..cba971c1c 100644
--- a/src/portal/src/i18n/lang/zh-cn-lang.json
+++ b/src/portal/src/i18n/lang/zh-cn-lang.json
@@ -330,7 +330,10 @@
"OF": "共计"
},
"REPLICATION": {
+ "CURRENT": "当前仓库",
+ "FILTER_PLACEHOLDER": "过滤任务",
"STOP_TITLE": "确认停止任务",
+ "STOP_SUCCESS": "停止任务 {{param}} 成功",
"STOP_SUMMARY": "确认停止任务{{param}}?",
"TASK_ID":"任务ID",
"RECOURCE_TYPE": "源类型",
@@ -348,7 +351,7 @@
"NEW_REPLICATION_RULE": "新建规则",
"ENDPOINTS": "目标",
"FILTER_POLICIES_PLACEHOLDER": "过滤规则",
- "FILTER_JOBS_PLACEHOLDER": "过滤任务",
+ "FILTER_EXECUTIONS_PLACEHOLDER": "过滤任务",
"DELETION_TITLE": "删除规则确认",
"DELETION_SUMMARY": "确认删除规则 {{param}}?",
"DELETION_TITLE_FAILURE": "规则确认删除失败",