diff --git a/src/ui_ng/lib/src/list-replication-rule/list-replication-rule.component.html.ts b/src/ui_ng/lib/src/list-replication-rule/list-replication-rule.component.html.ts index 420a519b6..a7d114c12 100644 --- a/src/ui_ng/lib/src/list-replication-rule/list-replication-rule.component.html.ts +++ b/src/ui_ng/lib/src/list-replication-rule/list-replication-rule.component.html.ts @@ -1,38 +1,28 @@ export const LIST_REPLICATION_RULE_TEMPLATE: string = ` -
+
- - - + + + +
{{'REPLICATION.NAME' | translate}} {{'REPLICATION.PROJECT' | translate}} {{'REPLICATION.DESCRIPTION' | translate}} {{'REPLICATION.DESTINATION_NAME' | translate}} - {{'REPLICATION.LAST_START_TIME' | translate}} - {{'REPLICATION.ACTIVATION' | translate}} + {{'REPLICATION.SCHEDULE' | translate}} {{'REPLICATION.PLACEHOLDER' | translate }} - - - {{p.name}} - - - {{p.name}} - + {{p.name}} + + {{p.projects?.length>0 ? p.projects[0].name : ''}} {{p.description ? p.description : '-'}} {{p.targets?.length>0 ? p.targets[0].name : ''}} - - - - {{p.start_time | date: 'short'}} - - - {{ (p.enabled === 1 ? 'REPLICATION.ENABLED' : 'REPLICATION.DISABLED') | translate}} - + {{p.trigger ? p.trigger.kind : ''}} {{pagination.firstItem + 1}} - {{pagination.lastItem +1 }} {{'REPLICATION.OF' | translate}} {{pagination.totalItems }} {{'REPLICATION.ITEMS' | translate}} diff --git a/src/ui_ng/lib/src/list-replication-rule/list-replication-rule.component.ts b/src/ui_ng/lib/src/list-replication-rule/list-replication-rule.component.ts index b76bc3982..17960e01a 100644 --- a/src/ui_ng/lib/src/list-replication-rule/list-replication-rule.component.ts +++ b/src/ui_ng/lib/src/list-replication-rule/list-replication-rule.component.ts @@ -67,6 +67,7 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges { @Output() toggleOne = new EventEmitter(); @Output() redirect = new EventEmitter(); @Output() openNewRule = new EventEmitter(); + @Output() replicateManual = new EventEmitter(); projectScope: boolean = false; @@ -96,7 +97,7 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges { } public get creationAvailable(): boolean { - return !this.readonly && this.projectId ? true : false; + return !this.readonly && !this.projectId ? true : false; } @@ -221,6 +222,10 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges { this.editOne.emit(rules); } + replicateRule(rule: ReplicationRule) { + this.replicateManual.emit(rule); + } + toggleRule(rule: ReplicationRule) { let toggleConfirmMessage: ConfirmationMessage = new ConfirmationMessage( rule.enabled === 1 ? 'REPLICATION.TOGGLE_DISABLE_TITLE' : 'REPLICATION.TOGGLE_ENABLE_TITLE', diff --git a/src/ui_ng/lib/src/replication/replication.component.css.ts b/src/ui_ng/lib/src/replication/replication.component.css.ts index 473cfc00e..51f755820 100644 --- a/src/ui_ng/lib/src/replication/replication.component.css.ts +++ b/src/ui_ng/lib/src/replication/replication.component.css.ts @@ -21,4 +21,11 @@ export const REPLICATION_STYLE: string = ` .option-right-down { padding-right: 16px; margin-top: 24px; +} + .rightPos{ + position: absolute; + right: 35px; + margin-top: 5px; + z-index: 100; + height: 32px; }`; \ No newline at end of file diff --git a/src/ui_ng/lib/src/replication/replication.component.html.ts b/src/ui_ng/lib/src/replication/replication.component.html.ts index be054f729..59880e698 100644 --- a/src/ui_ng/lib/src/replication/replication.component.html.ts +++ b/src/ui_ng/lib/src/replication/replication.component.html.ts @@ -1,13 +1,8 @@ export const REPLICATION_TEMPLATE: string = `
-
-
+
+
-
- -
@@ -16,7 +11,7 @@ export const REPLICATION_TEMPLATE: string = `
- +
@@ -72,5 +67,4 @@ export const REPLICATION_TEMPLATE: string = `
-
`; \ No newline at end of file diff --git a/src/ui_ng/lib/src/replication/replication.component.ts b/src/ui_ng/lib/src/replication/replication.component.ts index 89d9a18d8..7b7a81c5a 100644 --- a/src/ui_ng/lib/src/replication/replication.component.ts +++ b/src/ui_ng/lib/src/replication/replication.component.ts @@ -148,7 +148,6 @@ export class ReplicationComponent implements OnInit, OnDestroy { this.currentRuleStatus = this.ruleStatus[0]; this.currentJobStatus = this.jobStatus[0]; this.currentJobSearchOption = 0; - console.log('readonly', this.readonly); } ngOnDestroy() { @@ -265,6 +264,14 @@ export class ReplicationComponent implements OnInit, OnDestroy { } } + replicateManualRule(rule: ReplicationRule): void { + toPromise(this.replicationService.replicateRule(rule.id)) + .then(response => { + this.refreshJobs(); + }) + .catch(error => this.errorHandler.error(error)); + } + customRedirect(rule: ReplicationRule) { this.redirect.emit(rule); } @@ -274,14 +281,6 @@ export class ReplicationComponent implements OnInit, OnDestroy { this.listReplicationRule.retrieveRules(ruleName); } - /*doFilterRuleStatus($event: any) { - if ($event && $event.target && $event.target["value"]) { - let status = $event.target["value"]; - this.currentRuleStatus = this.ruleStatus.find((r: any) => r.key === status); - this.listReplicationRule.filterRuleStatus(this.currentRuleStatus.key); - } - }*/ - doFilterJobStatus($event: any) { if ($event && $event.target && $event.target["value"]) { let status = $event.target["value"]; diff --git a/src/ui_ng/lib/src/service/replication.service.ts b/src/ui_ng/lib/src/service/replication.service.ts index 3c27faff0..c0f3bce2a 100644 --- a/src/ui_ng/lib/src/service/replication.service.ts +++ b/src/ui_ng/lib/src/service/replication.service.ts @@ -226,8 +226,8 @@ export class ReplicationDefaultService extends ReplicationService { return Promise.reject("Bad argument"); } - let url: string = `${this._replicateUrl}/${ruleId}`; - return this.http.post(url, HTTP_JSON_OPTIONS).toPromise() + let url: string = `${this._replicateUrl}`; + return this.http.post(url, {policy_id: ruleId}, HTTP_JSON_OPTIONS).toPromise() .then(response => response) .catch(error => Promise.reject(error)); } diff --git a/src/ui_ng/package.json b/src/ui_ng/package.json index 7b608e743..740814b00 100644 --- a/src/ui_ng/package.json +++ b/src/ui_ng/package.json @@ -31,7 +31,7 @@ "clarity-icons": "^0.10.17", "clarity-ui": "^0.10.17", "core-js": "^2.4.1", - "harbor-ui": "0.6.5", + "harbor-ui": "^0.6.0-test-5", "intl": "^1.2.5", "mutationobserver-shim": "^0.3.2", "ngx-cookie": "^1.0.0", diff --git a/src/ui_ng/src/app/harbor-routing.module.ts b/src/ui_ng/src/app/harbor-routing.module.ts index 9314590ae..7e541d41f 100644 --- a/src/ui_ng/src/app/harbor-routing.module.ts +++ b/src/ui_ng/src/app/harbor-routing.module.ts @@ -86,13 +86,13 @@ const harborRoutes: Routes = [ canActivate: [SystemAdminGuard], canActivateChild: [SystemAdminGuard], }, - { - path: 'replications/:id/rule', - component: ReplicationRuleComponent, - canActivate: [SystemAdminGuard], - canActivateChild: [SystemAdminGuard], - canDeactivate: [LeavingNewRuleRouteDeactivate] - }, + { + path: 'replications/:id/rule', + component: ReplicationRuleComponent, + canActivate: [SystemAdminGuard], + canActivateChild: [SystemAdminGuard], + canDeactivate: [LeavingNewRuleRouteDeactivate] + }, { path: 'replications/new-rule', component: ReplicationRuleComponent, diff --git a/src/ui_ng/src/app/replication/replication-rule/replication-rule.component.ts b/src/ui_ng/src/app/replication/replication-rule/replication-rule.component.ts index ca98fb10f..3a1f76a4d 100644 --- a/src/ui_ng/src/app/replication/replication-rule/replication-rule.component.ts +++ b/src/ui_ng/src/app/replication/replication-rule/replication-rule.component.ts @@ -121,14 +121,6 @@ export class ReplicationRuleComponent implements OnInit, AfterViewInit, OnDestro this.inNameChecking = false; }); }); - /*this.confirmSub = this.confirmService.confirmationConfirm$.subscribe(confirmation => { - if (confirmation && - confirmation.state === ConfirmationState.CONFIRMED) { - if (confirmation.source === ConfirmationTargets.CONFIG) { - this.router.navigate(['/harbor/replications']); - } - } - });*/ } ngAfterViewInit(): void { @@ -180,38 +172,11 @@ export class ReplicationRuleComponent implements OnInit, AfterViewInit, OnDestro this.updateFilter(rule.filters); } - - // Force refresh view let hnd = setInterval(() => this.ref.markForCheck(), 100); setTimeout(() => clearInterval(hnd), 2000); } - /* initFom(): void { - this.ruleForm.reset({ - name: '', - description: '', - trigger: {kind: this.triggerNames[0], schedule_param: { - type: this.scheduleNames[0], - weekday: 1, - offtime: '08:00' - }}, - replicate_existing_image_now: true, - replicate_deletion: false - }); - this.setProject([]); - this.setTarget([this.targetList[0]]); - this.setFilter([]); - - this.isFilterHide = false; - this.filterListData = []; - this.isScheduleOpt = false; - this.weeklySchedule = false; - this.isRuleNameExist = true; - this.ruleNameTooltip = 'TOOLTIP.EMPTY'; - }*/ - - get projects(): FormArray { return this.ruleForm.get('projects') as FormArray; } @@ -277,7 +242,6 @@ export class ReplicationRuleComponent implements OnInit, AfterViewInit, OnDestro } selectedProject(project: Project): void { - console.log('project', project) this.setProject([project]); } @@ -469,18 +433,6 @@ export class ReplicationRuleComponent implements OnInit, AfterViewInit, OnDestro onCancel(): void { this.router.navigate(['/harbor/replications']); - - /*if (this.hasFormChange()) { - let msg = new ConfirmationMessage( - 'CONFIG.CONFIRM_TITLE', - 'CONFIG.CONFIRM_SUMMARY', - '', - null, - ConfirmationTargets.CONFIG - ); - - this.confirmService.openComfirmDialog(msg); - }*/ } // UTC time diff --git a/src/ui_ng/src/app/replication/total-replication/total-replication-page.component.ts b/src/ui_ng/src/app/replication/total-replication/total-replication-page.component.ts index 5da340b1d..6f89caa2a 100644 --- a/src/ui_ng/src/app/replication/total-replication/total-replication-page.component.ts +++ b/src/ui_ng/src/app/replication/total-replication/total-replication-page.component.ts @@ -26,7 +26,7 @@ export class TotalReplicationPageComponent { private activeRoute: ActivatedRoute){} customRedirect(rule: ReplicationRule): void { if (rule) { - this.router.navigate(['../projects', rule.projects[0].project_id, "replications"], { relativeTo: this.activeRoute }); + this.router.navigate(['../projects', rule.projects[0].project_id, 'replications'], { relativeTo: this.activeRoute }); } } diff --git a/src/ui_ng/src/app/shared/confirmation-dialog/confirmation-dialog.component.html b/src/ui_ng/src/app/shared/confirmation-dialog/confirmation-dialog.component.html index 4e74a1da7..5af5b73b8 100644 --- a/src/ui_ng/src/app/shared/confirmation-dialog/confirmation-dialog.component.html +++ b/src/ui_ng/src/app/shared/confirmation-dialog/confirmation-dialog.component.html @@ -29,7 +29,7 @@ - + diff --git a/src/ui_ng/src/app/shared/confirmation-dialog/confirmation-dialog.component.ts b/src/ui_ng/src/app/shared/confirmation-dialog/confirmation-dialog.component.ts index 0d8d693b2..9182f66cb 100644 --- a/src/ui_ng/src/app/shared/confirmation-dialog/confirmation-dialog.component.ts +++ b/src/ui_ng/src/app/shared/confirmation-dialog/confirmation-dialog.component.ts @@ -112,7 +112,7 @@ export class ConfirmationDialogComponent implements OnDestroy { this.close(); } - confirm(): void { + delete(): void { if(!this.message){//Inproper condition this.close(); return; @@ -130,6 +130,21 @@ export class ConfirmationDialogComponent implements OnDestroy { data, target )); + } + confirm(): void { + if(!this.message){//Inproper condition + this.close(); + return; + } + + let data: any = this.message.data ? this.message.data : {}; + let target = this.message.targetId ? this.message.targetId : ConfirmationTargets.EMPTY; + this.confirmationService.confirm(new ConfirmationAcknowledgement( + ConfirmationState.CONFIRMED, + data, + target + )); + this.close(); } } \ No newline at end of file diff --git a/src/ui_ng/src/app/shared/route/leaving-new-rule-deactivate.service.ts b/src/ui_ng/src/app/shared/route/leaving-new-rule-deactivate.service.ts index 3a8088290..60ea8de74 100644 --- a/src/ui_ng/src/app/shared/route/leaving-new-rule-deactivate.service.ts +++ b/src/ui_ng/src/app/shared/route/leaving-new-rule-deactivate.service.ts @@ -36,9 +36,7 @@ export class LeavingNewRuleRouteDeactivate implements CanDeactivate | boolean { //Confirmation before leaving config route - console.log('ccc'); return new Promise((resolve, reject) => { - console.log("ddd", replicateRule.hasFormChange()); if (replicateRule && replicateRule.hasFormChange()) { let msg: ConfirmationMessage = new ConfirmationMessage( "CONFIG.LEAVING_CONFIRMATION_TITLE", diff --git a/src/ui_ng/src/i18n/lang/en-us-lang.json b/src/ui_ng/src/i18n/lang/en-us-lang.json index 512c6f948..5942d5c54 100644 --- a/src/ui_ng/src/i18n/lang/en-us-lang.json +++ b/src/ui_ng/src/i18n/lang/en-us-lang.json @@ -303,7 +303,17 @@ "INVALID_DATE": "Invalid date.", "PLACEHOLDER": "We couldn't find any replication rules!", "JOB_PLACEHOLDER": "We couldn't find any replication jobs!", - "JOB_LOG_VIEWER": "View Replication Job Log" + "JOB_LOG_VIEWER": "View Replication Job Log", + "BACKINFO": "Please add project and endpoint first", + "FILTER": "Filter", + "SCHEDULE": "Schedule", + "SETTING":"Setting", + "TRIGGER":"Trigger", + "TARGETS":"Target", + "SOURCE": "Source", + "REPLICATE": "Replicate", + "DELETE_REMOTE_IMAGES":"Delete remote images when locally deleted", + "REPLICATE_IMMEDIATE":"Replicate exiting images immediately" }, "DESTINATION": { "NEW_ENDPOINT": "New Endpoint", @@ -317,7 +327,7 @@ "TEST_CONNECTION": "Test Connection", "TITLE_EDIT": "Edit Endpoint", "TITLE_ADD": "Create Endpoint", - "DELETE": "Delete", + "DELETE": "Delete Endpoint", "TESTING_CONNECTION": "Testing Connection...", "TEST_CONNECTION_SUCCESS": "Connection tested successfully.", "TEST_CONNECTION_FAILURE": "Failed to ping endpoint.", diff --git a/src/ui_ng/src/i18n/lang/es-es-lang.json b/src/ui_ng/src/i18n/lang/es-es-lang.json index f0f7a7e6f..6134cd1ab 100644 --- a/src/ui_ng/src/i18n/lang/es-es-lang.json +++ b/src/ui_ng/src/i18n/lang/es-es-lang.json @@ -299,7 +299,16 @@ "INVALID_DATE": "Fecha invalida.", "PLACEHOLDER": "We couldn't find any replication rules!", "JOB_PLACEHOLDER": "We couldn't find any replication jobs!", - "JOB_LOG_VIEWER": "View Replication Job Log" + "JOB_LOG_VIEWER": "View Replication Job Log", + "BACKINFO": "Please add project and endpoint first", + "FILTER": "Filter", + "SCHEDULE": "Schedule", + "SETTING":"Setting", + "TRIGGER":"Trigger", + "TARGETS":"Target", + "SOURCE": "Source", + "DELETE_REMOTE_IMAGES":"Delete remote images when locally deleted", + "REPLICATE_IMMEDIATE":"Replicate exiting images immediately" }, "DESTINATION": { "NEW_ENDPOINT": "Nuevo Endpoint", @@ -313,7 +322,7 @@ "TEST_CONNECTION": "Comprobar conexión", "TITLE_EDIT": "Editar Endpoint", "TITLE_ADD": "Crear Endpoint", - "DELETE": "Eliminar", + "DELETE": "Eliminar Endpoint", "TESTING_CONNECTION": "Comprobar conexión...", "TEST_CONNECTION_SUCCESS": "Conexión comprobada satisfactoriamente.", "TEST_CONNECTION_FAILURE": "Fallo al comprobar el endpoint.", diff --git a/src/ui_ng/src/i18n/lang/zh-cn-lang.json b/src/ui_ng/src/i18n/lang/zh-cn-lang.json index 357723079..9418ec356 100644 --- a/src/ui_ng/src/i18n/lang/zh-cn-lang.json +++ b/src/ui_ng/src/i18n/lang/zh-cn-lang.json @@ -299,7 +299,16 @@ "INVALID_DATE": "无效日期。", "PLACEHOLDER": "未发现任何复制规则!", "JOB_PLACEHOLDER": "未发现任何复制任务!", - "JOB_LOG_VIEWER": "查看复制任务日志" + "JOB_LOG_VIEWER": "查看复制任务日志", + "BACKINFO": "请先添加项目名称和目标", + "FILTER": "过滤", + "SCHEDULE": "日程", + "SETTING":"设置", + "TRIGGER":"触发器", + "TARGETS":"目标", + "SOURCE": "资源", + "DELETE_REMOTE_IMAGES":"删除本地镜像时同时也删除远程的镜像。", + "REPLICATE_IMMEDIATE":"立即复制现有的镜像。" }, "DESTINATION": { "NEW_ENDPOINT": "新建目标", @@ -313,7 +322,7 @@ "TEST_CONNECTION": "测试连接", "TITLE_EDIT": "编辑目标", "TITLE_ADD": "新建目标", - "DELETE": "删除", + "DELETE": "删除目标", "TESTING_CONNECTION": "正在测试连接...", "TEST_CONNECTION_SUCCESS": "测试连接成功。", "TEST_CONNECTION_FAILURE": "测试连接失败。",