mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-17 15:55:26 +01:00
Fix some issues of replication
Signed-off-by: FangyuanCheng <fangyuanc@vmware.com>
This commit is contained in:
parent
66087aac82
commit
5e34cd3cf9
@ -66,12 +66,12 @@
|
||||
</div>
|
||||
<label *ngIf="supportedFilters[i]?.style==='input'" aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left"
|
||||
[class.invalid]='(filter.value.dirty || filter.value.touched) && filter.value.invalid'>
|
||||
<input type="text" #filterValue required size="14" formControlName="value">
|
||||
<input type="text" #filterValue required size="14" formControlName="value" id="{{'filter_'+ supportedFilters[i]?.type}}">
|
||||
<span class="tooltip-content">{{'TOOLTIP.EMPTY' | translate}}</span>
|
||||
</label>
|
||||
<div class="select inline-block" *ngIf="supportedFilters[i]?.style==='radio'">
|
||||
<select formControlName="value" #selectedValue id="{{i}}" name="{{supportedFilters[i]?.type}}">
|
||||
<option value="">-- {{'REPLICATION.PLEASE_SELECT' | translate}} --</option>
|
||||
<select formControlName="value" #selectedValue id="{{'select_'+ supportedFilters[i]?.type}}" name="{{supportedFilters[i]?.type}}">
|
||||
<option value="">{{'REPLICATION.BOTH' | translate}}</option>
|
||||
<option *ngFor="let value of supportedFilters[i]?.values;" value="{{value}}">{{value}}</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -156,11 +156,11 @@
|
||||
<div class="clr-form-control rule-width override-box">
|
||||
<clr-checkbox-wrapper>
|
||||
<input type="checkbox" clrCheckbox [checked]="true" id="overridePolicy" formControlName="override" class="clr-checkbox">
|
||||
<label for="overridePolicy" class="clr-control-label">{{'REPLICATION.OVERRIDE' | translate}}</label>
|
||||
<label for="overridePolicy" class="clr-control-label">{{'REPLICATION.OVERRIDE_INFO' | translate}}</label>
|
||||
</clr-checkbox-wrapper>
|
||||
<clr-tooltip class="override-tooltip">
|
||||
<clr-icon clrTooltipTrigger shape="info-circle" size="24"></clr-icon>
|
||||
<clr-tooltip-content clrPosition="top-right" clrSize="md" *clrIfOpen>
|
||||
<clr-tooltip-content clrPosition="top-left" clrSize="md" *clrIfOpen>
|
||||
<span>{{'TOOLTIP.OVERRIDE' | translate}}</span>
|
||||
</clr-tooltip-content>
|
||||
</clr-tooltip>
|
||||
|
@ -19,7 +19,7 @@ import {
|
||||
ChangeDetectionStrategy,
|
||||
ChangeDetectorRef
|
||||
} from "@angular/core";
|
||||
import { Subscription, Observable, forkJoin } from "rxjs";
|
||||
import { Subscription, Observable, forkJoin, throwError as observableThrowError } from "rxjs";
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
import { Comparator } from "../service/interface";
|
||||
|
||||
@ -210,19 +210,17 @@ export class EndpointComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
})
|
||||
, catchError(error => {
|
||||
if (error && error.status === 412) {
|
||||
return forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
||||
this.translateService.get('DESTINATION.FAILED_TO_DELETE_TARGET_IN_USED')).pipe(map(res => {
|
||||
operateChanges(operMessage, OperationState.failure, res[1]);
|
||||
}));
|
||||
if (error && error._body) {
|
||||
const message = JSON.parse(error._body).message;
|
||||
operateChanges(operMessage, OperationState.failure, message);
|
||||
return observableThrowError(message);
|
||||
} else {
|
||||
return this.translateService.get('BATCH.DELETED_FAILURE').pipe(map(res => {
|
||||
operateChanges(operMessage, OperationState.failure, res);
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
));
|
||||
));
|
||||
}
|
||||
|
||||
// Forcely refresh the view
|
||||
|
@ -80,7 +80,6 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges {
|
||||
rules: ReplicationRule[];
|
||||
changedRules: ReplicationRule[];
|
||||
ruleName: string;
|
||||
canDeleteRule: boolean;
|
||||
|
||||
selectedRow: ReplicationRule;
|
||||
|
||||
@ -149,21 +148,6 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges {
|
||||
this.replicateManual.emit(rule);
|
||||
}
|
||||
|
||||
hasDeletedLabel(rule: any) {
|
||||
if (rule.filters) {
|
||||
let count = 0;
|
||||
rule.filters.forEach((data: any) => {
|
||||
if (data.kind === 'label' && data.value.deleted) {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
if (count === 0) {
|
||||
return 'enabled';
|
||||
} else { return 'disabled'; }
|
||||
}
|
||||
return 'enabled';
|
||||
}
|
||||
|
||||
deletionConfirm(message: ConfirmationAcknowledgement) {
|
||||
if (
|
||||
message &&
|
||||
@ -193,27 +177,6 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges {
|
||||
this.editOne.emit(rule);
|
||||
}
|
||||
|
||||
jobList(id: string | number): Observable<void> {
|
||||
let ruleData: ReplicationJobItem[];
|
||||
this.canDeleteRule = true;
|
||||
let count = 0;
|
||||
|
||||
return this.replicationService.getExecutions(id)
|
||||
.pipe(map(response => {
|
||||
ruleData = response.data;
|
||||
if (ruleData.length) {
|
||||
ruleData.forEach(job => {
|
||||
if (
|
||||
job.status === jobstatus
|
||||
) {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
}
|
||||
this.canDeleteRule = count > 0 ? false : true;
|
||||
}), catchError(error => observableThrowError(error)));
|
||||
}
|
||||
|
||||
deleteRule(rule: ReplicationRule) {
|
||||
if (rule) {
|
||||
let deletionMessage = new ConfirmationMessage(
|
||||
@ -231,15 +194,13 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges {
|
||||
deleteOpe(rule: ReplicationRule) {
|
||||
if (rule) {
|
||||
let observableLists: any[] = [];
|
||||
this.jobList(rule.id).subscribe(items => {
|
||||
observableLists.push(this.delOperate(rule));
|
||||
observableLists.push(this.delOperate(rule));
|
||||
|
||||
forkJoin(...observableLists).subscribe(item => {
|
||||
this.selectedRow = null;
|
||||
this.reload.emit(true);
|
||||
let hnd = setInterval(() => this.ref.markForCheck(), 200);
|
||||
setTimeout(() => clearInterval(hnd), 2000);
|
||||
});
|
||||
forkJoin(...observableLists).subscribe(item => {
|
||||
this.selectedRow = null;
|
||||
this.reload.emit(true);
|
||||
let hnd = setInterval(() => this.ref.markForCheck(), 200);
|
||||
setTimeout(() => clearInterval(hnd), 2000);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -253,13 +214,6 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges {
|
||||
operMessage.data.name = rule.name;
|
||||
this.operationService.publishInfo(operMessage);
|
||||
|
||||
if (!this.canDeleteRule) {
|
||||
return forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
||||
this.translateService.get('REPLICATION.DELETION_SUMMARY_FAILURE')).pipe(map(res => {
|
||||
operateChanges(operMessage, OperationState.failure, res[1]);
|
||||
}));
|
||||
}
|
||||
|
||||
return this.replicationService
|
||||
.deleteReplicationRule(+rule.id)
|
||||
.pipe(map(() => {
|
||||
@ -267,15 +221,16 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges {
|
||||
.subscribe(res => operateChanges(operMessage, OperationState.success));
|
||||
})
|
||||
, catchError(error => {
|
||||
if (error && error.status === 412) {
|
||||
return forkJoin(this.translateService.get('BATCH.DELETED_FAILURE'),
|
||||
this.translateService.get('REPLICATION.FAILED_TO_DELETE_POLICY_ENABLED')).pipe(map(res => {
|
||||
operateChanges(operMessage, OperationState.failure, res[1]);
|
||||
}));
|
||||
if (error && error._body) {
|
||||
const message = JSON.parse(error._body).message;
|
||||
operateChanges(operMessage, OperationState.failure, message);
|
||||
return observableThrowError(message);
|
||||
} else {
|
||||
return this.translateService.get('BATCH.DELETED_FAILURE').pipe(map(res => {
|
||||
return this.translateService.get("BATCH.DELETED_FAILURE").pipe(
|
||||
map(res => {
|
||||
operateChanges(operMessage, OperationState.failure, res);
|
||||
}));
|
||||
})
|
||||
);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
@ -111,13 +111,9 @@
|
||||
<clr-dg-cell>{{t.start_time | date: 'short'}}</clr-dg-cell>
|
||||
<clr-dg-cell>{{t.end_time | date: 'short'}}</clr-dg-cell>
|
||||
<clr-dg-cell>
|
||||
<span *ngIf="t.status=='InProgress'; else elseBlock" class="label">{{'REPLICATION.NO_LOGS'
|
||||
| translate}}</span>
|
||||
<ng-template #elseBlock>
|
||||
<a target="_blank" [href]="viewLog(t.id)">
|
||||
<clr-icon shape="list"></clr-icon>
|
||||
</a>
|
||||
</ng-template>
|
||||
<a target="_blank" [href]="viewLog(t.id)">
|
||||
<clr-icon shape="list"></clr-icon>
|
||||
</a>
|
||||
</clr-dg-cell>
|
||||
</clr-dg-row>
|
||||
<clr-dg-footer>
|
||||
|
@ -22,7 +22,7 @@ import {
|
||||
} from "@angular/core";
|
||||
import { Comparator, State } from "../service/interface";
|
||||
import { finalize, catchError, map } from "rxjs/operators";
|
||||
import { Subscription, forkJoin, timer, Observable, throwError } from "rxjs";
|
||||
import { Subscription, forkJoin, timer, Observable, throwError as observableThrowError, observable } from "rxjs";
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
|
||||
import { ListReplicationRuleComponent } from "../list-replication-rule/list-replication-rule.component";
|
||||
@ -327,19 +327,14 @@ export class ReplicationComponent implements OnInit, OnDestroy {
|
||||
);
|
||||
}),
|
||||
catchError(error => {
|
||||
if (error && error.status === 412) {
|
||||
return forkJoin(
|
||||
this.translateService.get("BATCH.REPLICATE_FAILURE"),
|
||||
this.translateService.get("REPLICATION.REPLICATE_SUMMARY_FAILURE")
|
||||
).pipe(
|
||||
map(function(res) {
|
||||
operateChanges(operMessage, OperationState.failure, res[1]);
|
||||
})
|
||||
);
|
||||
if (error && error._body) {
|
||||
const message = JSON.parse(error._body).message;
|
||||
operateChanges(operMessage, OperationState.failure, message);
|
||||
return observableThrowError(message);
|
||||
} else {
|
||||
return this.translateService.get("BATCH.REPLICATE_FAILURE").pipe(
|
||||
map(res => {
|
||||
operateChanges(operMessage, OperationState.failure, res);
|
||||
operateChanges(operMessage, OperationState.failure, res);
|
||||
})
|
||||
);
|
||||
}
|
||||
@ -409,7 +404,7 @@ export class ReplicationComponent implements OnInit, OnDestroy {
|
||||
let ExecutionsStop$ = targets.map(target => this.StopOperate(target));
|
||||
forkJoin(ExecutionsStop$)
|
||||
.pipe(
|
||||
catchError(err => throwError(err)),
|
||||
catchError(err => observableThrowError(err)),
|
||||
finalize(() => {
|
||||
this.refreshJobs();
|
||||
this.isStopOnGoing = false;
|
||||
@ -431,10 +426,26 @@ export class ReplicationComponent implements OnInit, OnDestroy {
|
||||
return this.replicationService
|
||||
.stopJobs(targets.id)
|
||||
.pipe(
|
||||
map(
|
||||
() => operateChanges(operMessage, OperationState.success),
|
||||
err => operateChanges(operMessage, OperationState.failure, err)
|
||||
)
|
||||
map(response => {
|
||||
this.translateService
|
||||
.get("BATCH.STOP_SUCCESS")
|
||||
.subscribe(res =>
|
||||
operateChanges(operMessage, OperationState.success)
|
||||
);
|
||||
}),
|
||||
catchError(error => {
|
||||
if (error && error._body) {
|
||||
const message = JSON.parse(error._body).message;
|
||||
operateChanges(operMessage, OperationState.failure, message);
|
||||
return observableThrowError(message);
|
||||
} else {
|
||||
return this.translateService.get("BATCH.STOP_FAILURE").pipe(
|
||||
map(res => {
|
||||
operateChanges(operMessage, OperationState.failure, res);
|
||||
})
|
||||
);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,9 @@
|
||||
"SWITCH_SUCCESS": "Switch successfully",
|
||||
"SWITCH_FAILURE": "Switch failed",
|
||||
"REPLICATE_SUCCESS": "Started successfully",
|
||||
"REPLICATE_FAILURE": "Started failed"
|
||||
"REPLICATE_FAILURE": "Started failed",
|
||||
"STOP_SUCCESS": "Stop successfully",
|
||||
"STOP_FAILURE": "Stop execution failed"
|
||||
},
|
||||
"TOOLTIP": {
|
||||
"NAME_FILTER": "Filter the name part of the resources. Leaving empty or '**' matches all; 'library/**' only matches the resources under 'library'. For more patterns please refer to the user guide.",
|
||||
@ -358,11 +360,12 @@
|
||||
"REPLICATION": {
|
||||
"TOTAL": "Total",
|
||||
"OVERRIDE": "Override",
|
||||
"OVERRIDE_INFO": "Override the destination resources if name conflicts",
|
||||
"OPERATION": "Operation",
|
||||
"CURRENT": "current",
|
||||
"FILTER_PLACEHOLDER": "Filter Tasks",
|
||||
"STOP_TITLE": "Confirm Stop Executions",
|
||||
"PLEASE_SELECT": "select an option",
|
||||
"BOTH": "both",
|
||||
"STOP_SUCCESS": "Stop Execution {{param}} Successful",
|
||||
"STOP_SUMMARY": "Do you want to stop the executions {{param}}?",
|
||||
"TASK_ID":"Task ID",
|
||||
|
@ -50,7 +50,9 @@
|
||||
"SWITCH_SUCCESS": "Switch successfully",
|
||||
"SWITCH_FAILURE": "Switch failed",
|
||||
"REPLICATE_SUCCESS": "Started successfully",
|
||||
"REPLICATE_FAILURE": "Started failed"
|
||||
"REPLICATE_FAILURE": "Started failed",
|
||||
"STOP_SUCCESS": "Stop successfully",
|
||||
"STOP_FAILURE": "Stop execution failed"
|
||||
},
|
||||
"TOOLTIP": {
|
||||
"NAME_FILTER": "Filter the name part of the resources. Leaving empty or '**' matches all; 'library/**' only matches the resources under 'library'. For more patterns please refer to the user guide.",
|
||||
@ -356,10 +358,12 @@
|
||||
},
|
||||
"REPLICATION": {
|
||||
"TOTAL": "Total",
|
||||
"OVERRIDE": "Anular",
|
||||
"OVERRIDE": "Override",
|
||||
"OVERRIDE_INFO": "Override the destination resources if name conflicts",
|
||||
"CURRENT": "current",
|
||||
"FILTER_PLACEHOLDER": "Filter Tasks",
|
||||
"STOP_TITLE": "Confirme Stop Executions",
|
||||
"BOTH": "both",
|
||||
"PLEASE_SELECT": "select an option",
|
||||
"STOP_SUCCESS": "Stop Execution {{param}} Successful",
|
||||
"STOP_SUMMARY": "De que desea detener las ejecuciones {{param}}?",
|
||||
|
@ -41,6 +41,16 @@
|
||||
"UPLOAD": "Upload",
|
||||
"NO_FILE": "No file selected"
|
||||
},
|
||||
"BATCH": {
|
||||
"DELETED_SUCCESS": "Deleted successfully",
|
||||
"DELETED_FAILURE": "Deleted failed",
|
||||
"SWITCH_SUCCESS": "Switch successfully",
|
||||
"SWITCH_FAILURE": "Switch failed",
|
||||
"REPLICATE_SUCCESS": "Started successfully",
|
||||
"REPLICATE_FAILURE": "Started failed",
|
||||
"STOP_SUCCESS": "Stop successfully",
|
||||
"STOP_FAILURE": "Stop execution failed"
|
||||
},
|
||||
"TOOLTIP": {
|
||||
"NAME_FILTER": "Filter the name part of the resources. Leaving empty or '**' matches all; 'library/**' only matches the resources under 'library'. For more patterns please refer to the user guide.",
|
||||
"TAG_FILTER": "Filter the tag/version part of the resources. Leaving empty or '**' matches all; '1.0*' only matches the tags that starts with '1.0'. For more patterns please refer to the user guide.",
|
||||
@ -341,10 +351,12 @@
|
||||
},
|
||||
"REPLICATION": {
|
||||
"TOTAL": "Total",
|
||||
"OVERRIDE": "Passer outre",
|
||||
"OVERRIDE": "Override",
|
||||
"OVERRIDE_INFO": "Override the destination resources if name conflicts",
|
||||
"CURRENT": "current",
|
||||
"FILTER_PLACEHOLDER": "Filter Tasks",
|
||||
"STOP_TITLE": "Confirmer arrêter les exécutions",
|
||||
"BOTH": "both",
|
||||
"PLEASE_SELECT": "select an option",
|
||||
"STOP_SUCCESS": "Stop Execution {{param}} Successful",
|
||||
"STOP_SUMMARY": "Voulez-vous arrêter les exécutions {{param}}?",
|
||||
|
@ -50,7 +50,9 @@
|
||||
"SWITCH_SUCCESS": "Alterado com sucesso",
|
||||
"SWITCH_FAILURE": "Falha ao alterar",
|
||||
"REPLICATE_SUCCESS": "Iniciado com sucesso",
|
||||
"REPLICATE_FAILURE": "Falha ao iniciar"
|
||||
"REPLICATE_FAILURE": "Falha ao iniciar",
|
||||
"STOP_SUCCESS": "Stop successfully",
|
||||
"STOP_FAILURE": "Stop execution failed"
|
||||
},
|
||||
"TOOLTIP": {
|
||||
"NAME_FILTER": "Filter the name part of the resources. Leaving empty or '**' matches all; 'library/**' only matches the resources under 'library'. For more patterns please refer to the user guide.",
|
||||
@ -355,10 +357,12 @@
|
||||
},
|
||||
"REPLICATION": {
|
||||
"TOTAL": "Total",
|
||||
"OVERRIDE": "Substituir",
|
||||
"OVERRIDE": "Override",
|
||||
"OVERRIDE_INFO": "Override the destination resources if name conflicts",
|
||||
"CURRENT": "current",
|
||||
"FILTER_PLACEHOLDER": "Filter Tasks",
|
||||
"STOP_TITLE": "Confirme as execuções de parada",
|
||||
"BOTH": "both",
|
||||
"PLEASE_SELECT": "select an option",
|
||||
"STOP_SUCCESS": "Stop Execution {{param}} Successful",
|
||||
"STOP_SUMMARY": "Você quer parar as execuções? {{param}}?",
|
||||
|
@ -50,7 +50,9 @@
|
||||
"SWITCH_SUCCESS": "切换成功",
|
||||
"SWITCH_FAILURE": "切换失败",
|
||||
"REPLICATE_SUCCESS": "开始成功",
|
||||
"REPLICATE_FAILURE": "开始失败"
|
||||
"REPLICATE_FAILURE": "开始失败",
|
||||
"STOP_SUCCESS": "停止任务成功",
|
||||
"STOP_FAILURE": "停止任务失败"
|
||||
},
|
||||
"TOOLTIP": {
|
||||
"NAME_FILTER": "过滤资源的名字。不填或者“”匹配所有资源;“library/”只匹配“library”下的资源。更多的匹配模式请参考用户手册。",
|
||||
@ -357,9 +359,11 @@
|
||||
"REPLICATION": {
|
||||
"TOTAL": "总数",
|
||||
"OVERRIDE": "覆盖",
|
||||
"OVERRIDE_INFO": "如果名称冲突则覆盖目标资源",
|
||||
"CURRENT": "当前仓库",
|
||||
"FILTER_PLACEHOLDER": "过滤任务",
|
||||
"STOP_TITLE": "确认停止任务",
|
||||
"BOTH": "全部",
|
||||
"PLEASE_SELECT": "请选择",
|
||||
"STOP_SUCCESS": "停止任务 {{param}} 成功",
|
||||
"STOP_SUMMARY": "确认停止任务{{param}}?",
|
||||
|
Loading…
Reference in New Issue
Block a user