mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-31 03:51:23 +01:00
Merge pull request #12642 from AllForNothing/cron
Improve cron component and create project component
This commit is contained in:
commit
18196edaa8
@ -78,7 +78,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clr-form-control mt-0" *ngIf="isSystemAdmin && enableProxyCache">
|
<div class="clr-form-control mt-0" [style.visibility]="(isSystemAdmin && enableProxyCache) ? 'visible' : 'hidden'">
|
||||||
<label for="create_project_storage_limit" class="clr-control-label"></label>
|
<label for="create_project_storage_limit" class="clr-control-label"></label>
|
||||||
<div class="clr-control-container input-width">
|
<div class="clr-control-container input-width">
|
||||||
<div class="space-between" *ngIf=" enableProxyCache && !registries.length" >
|
<div class="space-between" *ngIf=" enableProxyCache && !registries.length" >
|
||||||
@ -87,7 +87,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clr-form-control mt-05" *ngIf="isSystemAdmin && enableProxyCache">
|
<div class="clr-form-control mt-05" [style.visibility]="(isSystemAdmin && enableProxyCache) ? 'visible' : 'hidden'">
|
||||||
<label for="create_project_storage_limit" class="clr-control-label"></label>
|
<label for="create_project_storage_limit" class="clr-control-label"></label>
|
||||||
<div class="clr-control-container">
|
<div class="clr-control-container">
|
||||||
<div class="clr-input-wrapper">
|
<div class="clr-input-wrapper">
|
||||||
|
@ -247,7 +247,7 @@
|
|||||||
"QUOTA_UNLIMIT_TIP": "For unlimited quota enter '-1'.",
|
"QUOTA_UNLIMIT_TIP": "For unlimited quota enter '-1'.",
|
||||||
"TYPE": "Type",
|
"TYPE": "Type",
|
||||||
"PROXY_CACHE": "Proxy Cache",
|
"PROXY_CACHE": "Proxy Cache",
|
||||||
"PROXY_CACHE_TOOLTIP": "Enable this to allow this project to act as a pull-through cache for a particular namespace within a target registry.Harbor can only act a proxy for DockerHub and Harbor registries.",
|
"PROXY_CACHE_TOOLTIP": "Enable this to allow this project to act as a pull-through cache for a particular namespace within a target registry. Harbor can only act a proxy for DockerHub and Harbor registries.",
|
||||||
"ENDPOINT": "Endpoint",
|
"ENDPOINT": "Endpoint",
|
||||||
"PROXY_CACHE_ENDPOINT": "Proxy Cache Endpoint"
|
"PROXY_CACHE_ENDPOINT": "Proxy Cache Endpoint"
|
||||||
},
|
},
|
||||||
|
@ -248,7 +248,7 @@
|
|||||||
"QUOTA_UNLIMIT_TIP": "For unlimited quota enter '-1'.",
|
"QUOTA_UNLIMIT_TIP": "For unlimited quota enter '-1'.",
|
||||||
"TYPE": "Type",
|
"TYPE": "Type",
|
||||||
"PROXY_CACHE": "Proxy Cache",
|
"PROXY_CACHE": "Proxy Cache",
|
||||||
"PROXY_CACHE_TOOLTIP": "Enable this to allow this project to act as a pull-through cache for a particular namespace within a target registry.Harbor can only act a proxy for DockerHub and Harbor registries.",
|
"PROXY_CACHE_TOOLTIP": "Enable this to allow this project to act as a pull-through cache for a particular namespace within a target registry. Harbor can only act a proxy for DockerHub and Harbor registries.",
|
||||||
"ENDPOINT": "Endpoint",
|
"ENDPOINT": "Endpoint",
|
||||||
"PROXY_CACHE_ENDPOINT": "Proxy Cache Endpoint"
|
"PROXY_CACHE_ENDPOINT": "Proxy Cache Endpoint"
|
||||||
},
|
},
|
||||||
|
@ -241,7 +241,7 @@
|
|||||||
"QUOTA_UNLIMIT_TIP": "For unlimited quota enter '-1'.",
|
"QUOTA_UNLIMIT_TIP": "For unlimited quota enter '-1'.",
|
||||||
"TYPE": "Type",
|
"TYPE": "Type",
|
||||||
"PROXY_CACHE": "Proxy Cache",
|
"PROXY_CACHE": "Proxy Cache",
|
||||||
"PROXY_CACHE_TOOLTIP": "Enable this to allow this project to act as a pull-through cache for a particular namespace within a target registry.Harbor can only act a proxy for DockerHub and Harbor registries.",
|
"PROXY_CACHE_TOOLTIP": "Enable this to allow this project to act as a pull-through cache for a particular namespace within a target registry. Harbor can only act a proxy for DockerHub and Harbor registries.",
|
||||||
"ENDPOINT": "Endpoint",
|
"ENDPOINT": "Endpoint",
|
||||||
"PROXY_CACHE_ENDPOINT": "Proxy Cache Endpoint"
|
"PROXY_CACHE_ENDPOINT": "Proxy Cache Endpoint"
|
||||||
},
|
},
|
||||||
|
@ -245,7 +245,7 @@
|
|||||||
"QUOTA_UNLIMIT_TIP": "For unlimited quota enter '-1'.",
|
"QUOTA_UNLIMIT_TIP": "For unlimited quota enter '-1'.",
|
||||||
"TYPE": "Type",
|
"TYPE": "Type",
|
||||||
"PROXY_CACHE": "Proxy Cache",
|
"PROXY_CACHE": "Proxy Cache",
|
||||||
"PROXY_CACHE_TOOLTIP": "Enable this to allow this project to act as a pull-through cache for a particular namespace within a target registry.Harbor can only act a proxy for DockerHub and Harbor registries.",
|
"PROXY_CACHE_TOOLTIP": "Enable this to allow this project to act as a pull-through cache for a particular namespace within a target registry. Harbor can only act a proxy for DockerHub and Harbor registries.",
|
||||||
"ENDPOINT": "Endpoint",
|
"ENDPOINT": "Endpoint",
|
||||||
"PROXY_CACHE_ENDPOINT": "Proxy Cache Endpoint"
|
"PROXY_CACHE_ENDPOINT": "Proxy Cache Endpoint"
|
||||||
},
|
},
|
||||||
|
@ -247,7 +247,7 @@
|
|||||||
"QUOTA_UNLIMIT_TIP": "Bu kotayı sınırsız istiyorsanız, lütfen -1 girin.",
|
"QUOTA_UNLIMIT_TIP": "Bu kotayı sınırsız istiyorsanız, lütfen -1 girin.",
|
||||||
"TYPE": "Type",
|
"TYPE": "Type",
|
||||||
"PROXY_CACHE": "Proxy Cache",
|
"PROXY_CACHE": "Proxy Cache",
|
||||||
"PROXY_CACHE_TOOLTIP": "Enable this to allow this project to act as a pull-through cache for a particular namespace within a target registry.Harbor can only act a proxy for DockerHub and Harbor registries.",
|
"PROXY_CACHE_TOOLTIP": "Enable this to allow this project to act as a pull-through cache for a particular namespace within a target registry. Harbor can only act a proxy for DockerHub and Harbor registries.",
|
||||||
"ENDPOINT": "Endpoint",
|
"ENDPOINT": "Endpoint",
|
||||||
"PROXY_CACHE_ENDPOINT": "Proxy Cache Endpoint"
|
"PROXY_CACHE_ENDPOINT": "Proxy Cache Endpoint"
|
||||||
},
|
},
|
||||||
|
@ -244,7 +244,7 @@
|
|||||||
"QUOTA_UNLIMIT_TIP": "如果你想要對存儲不設置上限,請輸入-1。",
|
"QUOTA_UNLIMIT_TIP": "如果你想要對存儲不設置上限,請輸入-1。",
|
||||||
"TYPE": "Type",
|
"TYPE": "Type",
|
||||||
"PROXY_CACHE": "Proxy Cache",
|
"PROXY_CACHE": "Proxy Cache",
|
||||||
"PROXY_CACHE_TOOLTIP": "Enable this to allow this project to act as a pull-through cache for a particular namespace within a target registry.Harbor can only act a proxy for DockerHub and Harbor registries.",
|
"PROXY_CACHE_TOOLTIP": "Enable this to allow this project to act as a pull-through cache for a particular namespace within a target registry. Harbor can only act a proxy for DockerHub and Harbor registries.",
|
||||||
"ENDPOINT": "Endpoint",
|
"ENDPOINT": "Endpoint",
|
||||||
"PROXY_CACHE_ENDPOINT": "Proxy Cache Endpoint"
|
"PROXY_CACHE_ENDPOINT": "Proxy Cache Endpoint"
|
||||||
},
|
},
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
{{ "BUTTON.EDIT" | translate }}
|
{{ "BUTTON.EDIT" | translate }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="normal-wrapper-box" *ngIf="isEditMode">
|
<div class="normal-wrapper-box" *ngIf="isEditMode" [ngClass]="{'mb-05' : dateInvalid}">
|
||||||
<span class="font-style" [style.width]="labelWidth">{{ labelEdit | translate }}</span>
|
<span class="font-style" [style.width]="labelWidth">{{ labelEdit | translate }}</span>
|
||||||
<div class="select select-schedule clr-select-wrapper">
|
<div class="select select-schedule clr-select-wrapper">
|
||||||
<select name="selectPolicy" id="selectPolicy" [(ngModel)]="scheduleType">
|
<select name="selectPolicy" id="selectPolicy" [(ngModel)]="scheduleType">
|
||||||
@ -37,19 +37,20 @@
|
|||||||
</div>
|
</div>
|
||||||
<span class="required" [hidden]="scheduleType!==SCHEDULE_TYPE.CUSTOM">{{ "SCHEDULE.CRON" | translate }}</span>
|
<span class="required" [hidden]="scheduleType!==SCHEDULE_TYPE.CUSTOM">{{ "SCHEDULE.CRON" | translate }}</span>
|
||||||
<div [hidden]="scheduleType!==SCHEDULE_TYPE.CUSTOM" class="cron-input">
|
<div [hidden]="scheduleType!==SCHEDULE_TYPE.CUSTOM" class="cron-input">
|
||||||
<label for="targetCron" aria-haspopup="true" role="tooltip" [class.clr-error]="dateInvalid"
|
<div class="height-1rem clr-input-wrapper">
|
||||||
class="tooltip tooltip-validation tooltip-md tooltip-top-left cron-label">
|
<label for="targetCron" aria-haspopup="true" role="tooltip" [class.clr-error]="dateInvalid"
|
||||||
<input type="text" (blur)="blurInvalid()" (input)="inputInvalid()" name="targetCron" id="targetCron"
|
class="tooltip tooltip-validation tooltip-md tooltip-top-left cron-label">
|
||||||
#cronStringInput="ngModel" required class="clr-input form-control ml-1" [(ngModel)]="cronString">
|
<input type="text" (blur)="blurInvalid()" (input)="inputInvalid($event)" name="targetCron" id="targetCron"
|
||||||
<clr-control-error *ngIf="dateInvalid">{{'TOOLTIP.CRON_REQUIRED' | translate}}</clr-control-error>
|
#cronStringInput="ngModel" required class="clr-input form-control ml-1" [(ngModel)]="cronString">
|
||||||
</label>
|
<clr-tooltip>
|
||||||
<a href="javascript:void(0)" role="tooltip" aria-haspopup="true"
|
<clr-icon clrTooltipTrigger shape="info-circle" size="24"></clr-icon>
|
||||||
class="tooltip tooltip-lg tooltip-right top-7 cron-tooltip">
|
<clr-tooltip-content clrPosition="bottom-right" clrSize="lg" *clrIfOpen>
|
||||||
<clr-icon shape="info-circle" class="info-tips-icon" size="24"></clr-icon>
|
<cron-tooltip></cron-tooltip>
|
||||||
<div class="tooltip-content table-box">
|
</clr-tooltip-content>
|
||||||
<cron-tooltip></cron-tooltip>
|
</clr-tooltip>
|
||||||
</div>
|
<clr-control-error class="ml-1" *ngIf="dateInvalid">{{'TOOLTIP.CRON_REQUIRED' | translate}}</clr-control-error>
|
||||||
</a>
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-link " (click)="save()" id="config-save">
|
<button class="btn btn-link " (click)="save()" id="config-save">
|
||||||
{{ "BUTTON.SAVE" | translate }}
|
{{ "BUTTON.SAVE" | translate }}
|
||||||
@ -97,7 +98,7 @@
|
|||||||
<div [ngClass]="{'mt-1': dateInvalid}" *ngIf="scheduleType===SCHEDULE_TYPE.CUSTOM" class="clr-control-container" [class.clr-error]="dateInvalid">
|
<div [ngClass]="{'mt-1': dateInvalid}" *ngIf="scheduleType===SCHEDULE_TYPE.CUSTOM" class="clr-control-container" [class.clr-error]="dateInvalid">
|
||||||
<div class="clr-input-wrapper">
|
<div class="clr-input-wrapper">
|
||||||
<label class="required ml-1">{{ "SCHEDULE.CRON" | translate }}</label>
|
<label class="required ml-1">{{ "SCHEDULE.CRON" | translate }}</label>
|
||||||
<input autocomplete="off" type="text" (blur)="blurInvalid()" (input)="inputInvalid()" name="targetCron" id="inline-target"
|
<input autocomplete="off" type="text" (blur)="blurInvalid()" (input)="inputInvalid($event)" name="targetCron" id="inline-target"
|
||||||
#cronStringInput="ngModel" required class="clr-input" [(ngModel)]="cronString">
|
#cronStringInput="ngModel" required class="clr-input" [(ngModel)]="cronString">
|
||||||
<clr-tooltip>
|
<clr-tooltip>
|
||||||
<clr-icon clrTooltipTrigger shape="info-circle" size="24"></clr-icon>
|
<clr-icon clrTooltipTrigger shape="info-circle" size="24"></clr-icon>
|
||||||
|
@ -27,3 +27,6 @@ span.required {
|
|||||||
.mt-05 {
|
.mt-05 {
|
||||||
margin-top: 0.5rem;
|
margin-top: 0.5rem;
|
||||||
}
|
}
|
||||||
|
.mb-05 {
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
@ -18,6 +18,7 @@ const SCHEDULE_TYPE = {
|
|||||||
HOURLY: "Hourly",
|
HOURLY: "Hourly",
|
||||||
CUSTOM: "Custom"
|
CUSTOM: "Custom"
|
||||||
};
|
};
|
||||||
|
const PREFIX: string = '0 ';
|
||||||
@Component({
|
@Component({
|
||||||
selector: "cron-selection",
|
selector: "cron-selection",
|
||||||
templateUrl: "./cron-schedule.component.html",
|
templateUrl: "./cron-schedule.component.html",
|
||||||
@ -58,16 +59,17 @@ export class CronScheduleComponent implements OnChanges {
|
|||||||
this.isEditMode = true;
|
this.isEditMode = true;
|
||||||
this.scheduleType = this.originScheduleType;
|
this.scheduleType = this.originScheduleType;
|
||||||
if (this.scheduleType && this.scheduleType === SCHEDULE_TYPE.CUSTOM) {
|
if (this.scheduleType && this.scheduleType === SCHEDULE_TYPE.CUSTOM) {
|
||||||
this.cronString = this.oriCron;
|
this.cronString = this.oriCron || PREFIX;
|
||||||
this.dateInvalid = !cronRegex(this.cronString);
|
this.dateInvalid = !cronRegex(this.cronString);
|
||||||
} else {
|
} else {
|
||||||
this.cronString = "";
|
this.cronString = PREFIX;
|
||||||
this.dateInvalid = false;
|
this.dateInvalid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inputInvalid() {
|
inputInvalid(e: any) {
|
||||||
this.dateInvalid = !cronRegex(this.cronString);
|
this.dateInvalid = !cronRegex(this.cronString);
|
||||||
|
this.setPrefix(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
blurInvalid() {
|
blurInvalid() {
|
||||||
@ -107,4 +109,12 @@ export class CronScheduleComponent implements OnChanges {
|
|||||||
scheduleTerm = scheduleTerm.replace(/\s+/g, " ").trim();
|
scheduleTerm = scheduleTerm.replace(/\s+/g, " ").trim();
|
||||||
this.inputvalue.emit(scheduleTerm);
|
this.inputvalue.emit(scheduleTerm);
|
||||||
}
|
}
|
||||||
|
// set prefix '0 ', so user can not set item of 'seconds'
|
||||||
|
setPrefix(e: any) {
|
||||||
|
if (e && e.target) {
|
||||||
|
if (!e.target.value || (e.target.value && e.target.value.indexOf(PREFIX)) !== 0) {
|
||||||
|
e.target.value = PREFIX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user