mirror of
https://github.com/goharbor/harbor.git
synced 2025-03-02 10:41:59 +01: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>
|
||||
<clr-dropdown [clrCloseMenuOnItemClick]="false">
|
||||
<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>
|
||||
<clr-dropdown-menu *clrIfOpen>
|
||||
<label class="dropdown-item" (click)="labelModel.color=i.color" *ngFor="let i of labelColor"
|
||||
|
@ -1,77 +1,65 @@
|
||||
.form-group-label-override {
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
form {
|
||||
form {
|
||||
margin-bottom: -10px;
|
||||
padding-top: 0;
|
||||
margin-top: 20px;
|
||||
width: 100%;
|
||||
background-color: #eee;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
form .form-group {
|
||||
display: inline-flex;
|
||||
padding-left: 70px;
|
||||
}
|
||||
section {
|
||||
padding: .5rem 0;
|
||||
}
|
||||
|
||||
section>label {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
form .form-group>label:first-child {
|
||||
width: auto;
|
||||
}
|
||||
.btnColor {
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
width: 26px;
|
||||
height: 22px;
|
||||
min-width: 26px;
|
||||
}
|
||||
|
||||
section {
|
||||
padding: .5rem 0;
|
||||
}
|
||||
.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-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 {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.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;}
|
||||
.borderSty
|
||||
{
|
||||
border: 1px solid #A1A1A1 !important;
|
||||
line-height: 22px;
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ export class CreateEditLabelComponent implements OnInit, OnDestroy {
|
||||
labelModel: Label = this.initLabel();
|
||||
labelId = 0;
|
||||
|
||||
checkOnGoing: boolean;
|
||||
isLabelNameExist = false;
|
||||
|
||||
nameChecker = new Subject<string>();
|
||||
@ -66,26 +65,24 @@ export class CreateEditLabelComponent implements OnInit, OnDestroy {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.nameChecker.debounceTime(500).subscribe((name: string) => {
|
||||
this.checkOnGoing = true;
|
||||
let labelName = this.currentForm.controls["name"].value;
|
||||
toPromise<Label[]>(
|
||||
this.labelService.getLabels(this.scope, this.projectId, labelName)
|
||||
this.labelService.getLabels(this.scope, this.projectId, name)
|
||||
)
|
||||
.then(targets => {
|
||||
this.isLabelNameExist = false;
|
||||
if (targets && targets.length) {
|
||||
this.isLabelNameExist = true;
|
||||
} else {
|
||||
this.isLabelNameExist = false;
|
||||
if (targets.find((target) => {
|
||||
return target.name === name;
|
||||
})) {
|
||||
this.isLabelNameExist = true;
|
||||
}
|
||||
}
|
||||
this.checkOnGoing = false;
|
||||
})
|
||||
.catch(error => {
|
||||
this.checkOnGoing = false;
|
||||
this.errorHandler.error(error);
|
||||
});
|
||||
setTimeout(() => {
|
||||
setInterval(() => this.ref.markForCheck(), 100);
|
||||
}, 3000);
|
||||
let hnd = setInterval(() => this.ref.markForCheck(), 100);
|
||||
setTimeout(() => clearInterval(hnd), 5000);
|
||||
});
|
||||
}
|
||||
|
||||
@ -127,7 +124,6 @@ export class CreateEditLabelComponent implements OnInit, OnDestroy {
|
||||
|
||||
public get isValid(): boolean {
|
||||
return !(
|
||||
this.checkOnGoing ||
|
||||
this.isLabelNameExist ||
|
||||
!(this.currentForm && this.currentForm.valid) ||
|
||||
!this.hasChanged ||
|
||||
@ -138,6 +134,8 @@ export class CreateEditLabelComponent implements OnInit, OnDestroy {
|
||||
existValid(text: string): void {
|
||||
if (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>
|
||||
</span>
|
||||
<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 class="filter-divider"></span>
|
||||
<span class="refresh-btn" (click)="refresh()"><clr-icon shape="refresh"></clr-icon></span>
|
||||
|
Loading…
Reference in New Issue
Block a user