From 7d7620593dfd316394b1e197fb060a0cfb9d6c52 Mon Sep 17 00:00:00 2001 From: "Fuhui Peng (c)" Date: Fri, 19 Jan 2018 17:44:21 +0800 Subject: [PATCH] Modify create multiple replication rules with same name --- .../confirmation-dialog.component.css.ts | 2 +- .../list-replication-rule.component.html.ts | 2 +- .../replication/replication.component.html.ts | 2 +- .../src/replication/replication.component.ts | 7 ++++++- src/ui_ng/lib/src/tag/tag.component.html.ts | 8 +++---- src/ui_ng/package.json | 2 +- .../replication-rule.component.ts | 9 +++++--- .../replication-rule/replication-rule.html | 21 +++++++++++++------ .../confirmation-dialog.component.css | 2 +- src/ui_ng/src/i18n/lang/en-us-lang.json | 12 +++++++++++ src/ui_ng/src/i18n/lang/es-es-lang.json | 12 +++++++++++ src/ui_ng/src/i18n/lang/zh-cn-lang.json | 12 +++++++++++ 12 files changed, 72 insertions(+), 19 deletions(-) diff --git a/src/ui_ng/lib/src/confirmation-dialog/confirmation-dialog.component.css.ts b/src/ui_ng/lib/src/confirmation-dialog/confirmation-dialog.component.css.ts index 72c0569f0..ce4251e8a 100644 --- a/src/ui_ng/lib/src/confirmation-dialog/confirmation-dialog.component.css.ts +++ b/src/ui_ng/lib/src/confirmation-dialog/confirmation-dialog.component.css.ts @@ -24,7 +24,7 @@ export const CONFIRMATION_DIALOG_STYLE: string = ` .batchInfoUl li {line-height: 24px;border-bottom: 1px solid #e8e8e8;} .batchInfoUl li span:first-child {padding-right: 20px; width: 240px; display: inline-block; color:#666; text-overflow: ellipsis; overflow: hidden; vertical-align: middle;} -.batchInfoUl li span:last-child {width: 230px; display: inline-block; color:#666;} +.batchInfoUl li span:last-child {width: 220px; display: inline-block; color:#666;} .batchInfoUl li span i {display: inline-block; line-height: 1.2em; font-size: 0.8em; color: #999;} .batchInfoUl li span a{cursor: pointer; text-decoration: underline;} `; \ No newline at end of file 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 82800307d..82a8d219f 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 @@ -13,7 +13,7 @@ export const LIST_REPLICATION_RULE_TEMPLATE: string = ` {{'REPLICATION.PROJECT' | translate}} {{'REPLICATION.DESCRIPTION' | translate}} {{'REPLICATION.DESTINATION_NAME' | translate}} - {{'REPLICATION.MODE' | translate}} + {{'REPLICATION.TRIGGER_MODE' | translate}} {{'REPLICATION.PLACEHOLDER' | translate }} {{p.name}} 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 9e419cc4f..011924a7c 100644 --- a/src/ui_ng/lib/src/replication/replication.component.html.ts +++ b/src/ui_ng/lib/src/replication/replication.component.html.ts @@ -40,7 +40,7 @@ export const REPLICATION_TEMPLATE: string = `
- +
{{'REPLICATION.NAME' | translate}} diff --git a/src/ui_ng/lib/src/replication/replication.component.ts b/src/ui_ng/lib/src/replication/replication.component.ts index cb284eb0d..feb17a6f4 100644 --- a/src/ui_ng/lib/src/replication/replication.component.ts +++ b/src/ui_ng/lib/src/replication/replication.component.ts @@ -111,6 +111,7 @@ export class ReplicationComponent implements OnInit, OnDestroy { rules: ReplicationRule[]; loading: boolean; + isStopOnGoing: boolean; jobs: ReplicationJobItem[]; batchDelectionInfos: BatchInfo[] = []; @@ -362,8 +363,12 @@ export class ReplicationComponent implements OnInit, OnDestroy { stopJobs() { if (this.jobs && this.jobs.length) { + this.isStopOnGoing = true; toPromise(this.replicationService.stopJobs(this.jobs[0].policy_id)) - .then(res => {this.refreshJobs(); }) + .then(res => { + this.refreshJobs(); + this.isStopOnGoing = false; + }) .catch(error => this.errorHandler.error(error)); } } diff --git a/src/ui_ng/lib/src/tag/tag.component.html.ts b/src/ui_ng/lib/src/tag/tag.component.html.ts index b6a504a69..5024f6b32 100644 --- a/src/ui_ng/lib/src/tag/tag.component.html.ts +++ b/src/ui_ng/lib/src/tag/tag.component.html.ts @@ -36,8 +36,8 @@ export const TAG_TEMPLATE = ` {{'REPOSITORY.VULNERABILITY' | translate}} {{'REPOSITORY.SIGNED' | translate}} {{'REPOSITORY.AUTHOR' | translate}} - {{'REPOSITORY.CREATED' | translate}} - {{'REPOSITORY.DOCKER_VERSION' | translate}} + {{'REPOSITORY.CREATED' | translate}} + {{'REPOSITORY.DOCKER_VERSION' | translate}} {{'TAG.PLACEHOLDER' | translate }} @@ -60,8 +60,8 @@ export const TAG_TEMPLATE = ` {{t.author}} - {{t.created | date: 'short'}} - {{t.docker_version}} + {{t.created | date: 'short'}} + {{t.docker_version}} {{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} {{'REPOSITORY.OF' | translate}} diff --git a/src/ui_ng/package.json b/src/ui_ng/package.json index 809a8b4b3..e07339a9d 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.24", + "harbor-ui": "0.6.27", "intl": "^1.2.5", "mutationobserver-shim": "^0.3.2", "ngx-cookie": "^1.0.0", 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 19b563f64..529759f2b 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 @@ -48,6 +48,7 @@ export class ReplicationRuleComponent implements OnInit, OnDestroy { inProgress: boolean = false; inNameChecking: boolean = false; isRuleNameExist: boolean = false; + isSubmitOver: boolean = false; nameChecker: Subject = new Subject(); confirmSub: Subscription; @@ -147,7 +148,7 @@ export class ReplicationRuleComponent implements OnInit, OnDestroy { } get isVaild() { - return !(this.isRuleNameExist || this.noProjectInfo || this.noEndpointInfo); + return !(this.isRuleNameExist || this.noProjectInfo || this.noEndpointInfo || this.inProgress || this.isSubmitOver); } createForm() { @@ -412,6 +413,7 @@ export class ReplicationRuleComponent implements OnInit, OnDestroy { onSubmit() { // add new Replication rule + this.inProgress = true; let copyRuleForm: ReplicationRule = this.ruleForm.value; copyRuleForm.trigger = this.setTriggerVaule(copyRuleForm.trigger); if (!this.policyId) { @@ -419,6 +421,7 @@ export class ReplicationRuleComponent implements OnInit, OnDestroy { .then(() => { this.msgHandler.showSuccess('REPLICATION.CREATED_SUCCESS'); this.inProgress = false; + this.isSubmitOver = true; setTimeout(() => { this.copyUpdateForm = Object.assign({}, this.ruleForm.value); if (this.projectId) { @@ -426,7 +429,6 @@ export class ReplicationRuleComponent implements OnInit, OnDestroy { }else { this.router.navigate(['/harbor/replications']); } - }, 2000); }).catch((error: any) => { @@ -438,6 +440,7 @@ export class ReplicationRuleComponent implements OnInit, OnDestroy { .then(() => { this.msgHandler.showSuccess('REPLICATION.UPDATED_SUCCESS'); this.inProgress = false; + this.isSubmitOver = true; setTimeout(() => { this.copyUpdateForm = Object.assign({}, this.ruleForm.value); if (this.projectId) { @@ -452,7 +455,7 @@ export class ReplicationRuleComponent implements OnInit, OnDestroy { this.msgHandler.handleError(error); }); } - this.inProgress = true; + } openModal() { diff --git a/src/ui_ng/src/app/replication/replication-rule/replication-rule.html b/src/ui_ng/src/app/replication/replication-rule/replication-rule.html index 62abc53b9..e7090e398 100644 --- a/src/ui_ng/src/app/replication/replication-rule/replication-rule.html +++ b/src/ui_ng/src/app/replication/replication-rule/replication-rule.html @@ -72,23 +72,32 @@
-
+
-
+
on    -
+
diff --git a/src/ui_ng/src/app/shared/confirmation-dialog/confirmation-dialog.component.css b/src/ui_ng/src/app/shared/confirmation-dialog/confirmation-dialog.component.css index 349f53e74..356980070 100644 --- a/src/ui_ng/src/app/shared/confirmation-dialog/confirmation-dialog.component.css +++ b/src/ui_ng/src/app/shared/confirmation-dialog/confirmation-dialog.component.css @@ -23,6 +23,6 @@ .batchInfoUl li {line-height: 24px;border-bottom: 1px solid #e8e8e8;} .batchInfoUl li span:first-child {padding-right: 20px; width: 240px; display: inline-block; color:#666; text-overflow: ellipsis; overflow: hidden; vertical-align: middle;} -.batchInfoUl li span:last-child {width: 230px; display: inline-block; color:#666;} +.batchInfoUl li span:last-child {width: 220px; display: inline-block; color:#666;} .batchInfoUl li span i {display: inline-block; line-height: 1.2em; font-size: 0.8em; color: #999;} .batchInfoUl li span a{cursor: pointer; text-decoration: underline;} 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 065b7676d..9f97b4449 100644 --- a/src/ui_ng/src/i18n/lang/en-us-lang.json +++ b/src/ui_ng/src/i18n/lang/en-us-lang.json @@ -326,10 +326,13 @@ "SCHEDULE": "Scheduled", "MANUAL": "Manual", "IMMEDIATE": "Immediate", + "DAILY": "Daily", + "WEEKLY": "Weekly", "SETTING":"Options", "TRIGGER":"Triggering Condition", "TARGETS":"Target", "MODE": "Mode", + "TRIGGER_MODE": "Trigger Mode", "SOURCE": "Source", "REPLICATE": "Replicate", "DELETE_REMOTE_IMAGES":"Delete remote images when locally deleted", @@ -606,6 +609,15 @@ "COPY_ERROR": "Copy failed, please try to manually copy.", "FILTER_FOR_TAGS": "Filter Tags" }, + "WEEKLY": { + "MONDAY": "Monday", + "TUESDAY": "Tuesday", + "WEDNESDAY": "Wednesday", + "THURSDAY": "Thursday", + "FRIDAY": "Friday", + "SATURDAY": "Saturday", + "SUNDAY": "Sunday" + }, "UNKNOWN_ERROR": "Unknown errors have occurred. Please try again later.", "UNAUTHORIZED_ERROR": "Your session is invalid or has expired. You need to sign in to continue your action.", "FORBIDDEN_ERROR": "You do not have the proper privileges to perform the action.", 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 1836704fe..2bccd8aad 100644 --- a/src/ui_ng/src/i18n/lang/es-es-lang.json +++ b/src/ui_ng/src/i18n/lang/es-es-lang.json @@ -326,10 +326,13 @@ "SCHEDULE": "Scheduled", "MANUAL": "Manual", "IMMEDIATE": "Immediate", + "DAILY": "Daily", + "WEEKLY": "Weekly", "SETTING":"Options", "TRIGGER":"Triggering Condition", "TARGETS":"Target", "MODE": "Mode", + "TRIGGER_MODE": "Trigger Mode", "SOURCE": "Source", "REPLICATE": "Replicate", "DELETE_REMOTE_IMAGES":"Delete remote images when locally deleted", @@ -606,6 +609,15 @@ "COPY_ERROR": "Copy failed, please try to manually copy.", "FILTER_FOR_TAGS": "Etiquetas de filtro" }, + "WEEKLY": { + "MONDAY": "Monday", + "TUESDAY": "Tuesday", + "WEDNESDAY": "Wednesday", + "THURSDAY": "Thursday", + "FRIDAY": "Friday", + "SATURDAY": "Saturday", + "SUNDAY": "Sunday" + }, "UNKNOWN_ERROR": "Ha ocurrido un error desconocido. Por favor, inténtelo de nuevo más tarde.", "UNAUTHORIZED_ERROR": "La sesión no es válida o ha caducado. Necesita identificarse de nuevo para llevar a cabo esa acción.", "FORBIDDEN_ERROR": "No tienes permisos para llevar a cabo esa acción.", 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 13a3ef70c..21d154e75 100644 --- a/src/ui_ng/src/i18n/lang/zh-cn-lang.json +++ b/src/ui_ng/src/i18n/lang/zh-cn-lang.json @@ -326,10 +326,13 @@ "SCHEDULE": "定时", "MANUAL": "手动", "IMMEDIATE": "即刻", + "DAILY": "每天", + "WEEKLY": "每周", "SETTING":"设置", "TRIGGER":"触发条件", "TARGETS":"目标", "MODE": "模式", + "TRIGGER_MODE": "触发模式", "SOURCE": "资源", "REPLICATE": "复制", "DELETE_REMOTE_IMAGES":"删除本地镜像时同时也删除远程的镜像。", @@ -606,6 +609,15 @@ "COPY_ERROR": "拷贝失败,请尝试手动拷贝。", "FILTER_FOR_TAGS": "过滤项目" }, + "WEEKLY": { + "MONDAY": "周一", + "TUESDAY": "周二", + "WEDNESDAY": "周三", + "THURSDAY": "周四", + "FRIDAY": "周五", + "SATURDAY": "周六", + "SUNDAY": "周日" + }, "UNKNOWN_ERROR": "发生未知错误,请稍后再试。", "UNAUTHORIZED_ERROR": "会话无效或者已经过期, 请重新登录以继续。", "FORBIDDEN_ERROR": "当前操作被禁止,请确认你有合法的权限。",