mirror of
https://github.com/goharbor/harbor
synced 2024-09-20 14:35:34 +00:00
Merge pull request #5392 from zhoumeina/new_label_fix
Fix configuration->label->new sometimes not enable.
This commit is contained in:
commit
9fba539bd4
|
@ -16,7 +16,7 @@
|
||||||
<label for="color">{{'LABEL.COLOR' | translate}}</label>
|
<label for="color">{{'LABEL.COLOR' | translate}}</label>
|
||||||
<clr-dropdown [clrCloseMenuOnItemClick]="false">
|
<clr-dropdown [clrCloseMenuOnItemClick]="false">
|
||||||
<button type="button" class="btn btn-outline btnColor btn-sm" clrDropdownTrigger>
|
<button type="button" class="btn btn-outline btnColor btn-sm" clrDropdownTrigger>
|
||||||
<clr-icon shape="caret down" size="20" style='right:2px; width:24px; height:18px;'></clr-icon>
|
<clr-icon shape="angle down"></clr-icon>
|
||||||
</button>
|
</button>
|
||||||
<clr-dropdown-menu *clrIfOpen>
|
<clr-dropdown-menu *clrIfOpen>
|
||||||
<label class="dropdown-item" (click)="labelModel.color=i.color" *ngFor="let i of labelColor"
|
<label class="dropdown-item" (click)="labelModel.color=i.color" *ngFor="let i of labelColor"
|
||||||
|
|
|
@ -1,77 +1,65 @@
|
||||||
.form-group-label-override {
|
form {
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 400;
|
|
||||||
}
|
|
||||||
|
|
||||||
form {
|
|
||||||
margin-bottom: -10px;
|
margin-bottom: -10px;
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
}
|
|
||||||
|
|
||||||
form .form-group {
|
section {
|
||||||
display: inline-flex;
|
padding: .5rem 0;
|
||||||
padding-left: 70px;
|
}
|
||||||
}
|
|
||||||
|
section>label {
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
form .form-group>label:first-child {
|
.btnColor {
|
||||||
width: auto;
|
margin: 0 !important;
|
||||||
}
|
padding: 0 !important;
|
||||||
|
width: 26px;
|
||||||
|
height: 22px;
|
||||||
|
min-width: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
section {
|
.colorPanel {
|
||||||
padding: .5rem 0;
|
span {
|
||||||
}
|
margin: 5px 4px;
|
||||||
|
width: 30px;
|
||||||
|
height: 24px;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 24px;
|
||||||
|
font-size: 12px;
|
||||||
|
border: 1px solid #A1A1A1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-menu {
|
||||||
|
display: inline-block;
|
||||||
|
width: 166px;
|
||||||
|
padding: 6px;
|
||||||
|
.dropdown-item {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 2px 4px;
|
||||||
|
padding: 0;
|
||||||
|
width: 30px;
|
||||||
|
height: 24px;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 24px;
|
||||||
|
border: 0;
|
||||||
|
color: white;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown .dropdown-toggle.btn {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
section>label {
|
.borderSty
|
||||||
margin-left: 20px;
|
{
|
||||||
}
|
border: 1px solid #A1A1A1 !important;
|
||||||
|
line-height: 22px;
|
||||||
|
}
|
||||||
|
}
|
||||||
.btnColor {
|
|
||||||
margin: 0 !important;
|
|
||||||
padding: 0 !important;
|
|
||||||
width: 26px;
|
|
||||||
height: 22px;
|
|
||||||
min-width: 26px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.colorPanel span {
|
|
||||||
margin: 5px 4px;
|
|
||||||
width: 30px;
|
|
||||||
height: 24px;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 24px;
|
|
||||||
font-size: 12px;
|
|
||||||
border: 1px solid #A1A1A1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-menu {
|
|
||||||
display: inline-block;
|
|
||||||
width: 166px;
|
|
||||||
padding: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-menu .dropdown-item {
|
|
||||||
display: inline-block;
|
|
||||||
margin: 2px 4px;
|
|
||||||
padding: 0px;
|
|
||||||
width: 30px;
|
|
||||||
height: 24px;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-item {
|
|
||||||
border: 0px;
|
|
||||||
color: white;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown .dropdown-toggle.btn {
|
|
||||||
padding: 0 !important;
|
|
||||||
}
|
|
||||||
.borderSty{border: 1px solid #A1A1A1 !important; line-height: 22px;}
|
|
|
@ -46,7 +46,6 @@ export class CreateEditLabelComponent implements OnInit, OnDestroy {
|
||||||
labelModel: Label = this.initLabel();
|
labelModel: Label = this.initLabel();
|
||||||
labelId = 0;
|
labelId = 0;
|
||||||
|
|
||||||
checkOnGoing: boolean;
|
|
||||||
isLabelNameExist = false;
|
isLabelNameExist = false;
|
||||||
|
|
||||||
nameChecker = new Subject<string>();
|
nameChecker = new Subject<string>();
|
||||||
|
@ -66,26 +65,24 @@ export class CreateEditLabelComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.nameChecker.debounceTime(500).subscribe((name: string) => {
|
this.nameChecker.debounceTime(500).subscribe((name: string) => {
|
||||||
this.checkOnGoing = true;
|
|
||||||
let labelName = this.currentForm.controls["name"].value;
|
|
||||||
toPromise<Label[]>(
|
toPromise<Label[]>(
|
||||||
this.labelService.getLabels(this.scope, this.projectId, labelName)
|
this.labelService.getLabels(this.scope, this.projectId, name)
|
||||||
)
|
)
|
||||||
.then(targets => {
|
.then(targets => {
|
||||||
|
this.isLabelNameExist = false;
|
||||||
if (targets && targets.length) {
|
if (targets && targets.length) {
|
||||||
this.isLabelNameExist = true;
|
if (targets.find((target) => {
|
||||||
} else {
|
return target.name === name;
|
||||||
this.isLabelNameExist = false;
|
})) {
|
||||||
|
this.isLabelNameExist = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.checkOnGoing = false;
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
this.checkOnGoing = false;
|
|
||||||
this.errorHandler.error(error);
|
this.errorHandler.error(error);
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
let hnd = setInterval(() => this.ref.markForCheck(), 100);
|
||||||
setInterval(() => this.ref.markForCheck(), 100);
|
setTimeout(() => clearInterval(hnd), 5000);
|
||||||
}, 3000);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +124,6 @@ export class CreateEditLabelComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
public get isValid(): boolean {
|
public get isValid(): boolean {
|
||||||
return !(
|
return !(
|
||||||
this.checkOnGoing ||
|
|
||||||
this.isLabelNameExist ||
|
this.isLabelNameExist ||
|
||||||
!(this.currentForm && this.currentForm.valid) ||
|
!(this.currentForm && this.currentForm.valid) ||
|
||||||
!this.hasChanged ||
|
!this.hasChanged ||
|
||||||
|
@ -138,6 +134,8 @@ export class CreateEditLabelComponent implements OnInit, OnDestroy {
|
||||||
existValid(text: string): void {
|
existValid(text: string): void {
|
||||||
if (text) {
|
if (text) {
|
||||||
this.nameChecker.next(text);
|
this.nameChecker.next(text);
|
||||||
|
} else {
|
||||||
|
this.isLabelNameExist = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<clr-icon [ngClass]="{'is-highlight': isCardView || isHovering('card') }" shape="view-cards"></clr-icon>
|
<clr-icon [ngClass]="{'is-highlight': isCardView || isHovering('card') }" shape="view-cards"></clr-icon>
|
||||||
</span>
|
</span>
|
||||||
<span class="list-btn" (click)="showCard(false)" (mouseenter) ="mouseEnter('list') " (mouseleave) ="mouseLeave('list')">
|
<span class="list-btn" (click)="showCard(false)" (mouseenter) ="mouseEnter('list') " (mouseleave) ="mouseLeave('list')">
|
||||||
<clr-icon [ngClass]="{'is-highlight': !isCardView || isHovering('list') }"shape="view-list"></clr-icon>
|
<clr-icon [ngClass]="{'is-highlight': !isCardView || isHovering('list') }" shape="view-list"></clr-icon>
|
||||||
</span>
|
</span>
|
||||||
<span class="filter-divider"></span>
|
<span class="filter-divider"></span>
|
||||||
<span class="refresh-btn" (click)="refresh()"><clr-icon shape="refresh"></clr-icon></span>
|
<span class="refresh-btn" (click)="refresh()"><clr-icon shape="refresh"></clr-icon></span>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user