mirror of
https://github.com/goharbor/harbor
synced 2025-04-20 19:52:53 +00:00
Fix create project name doesn't tooltip
This commit is contained in:
parent
2f4950b80c
commit
56e438b9c3
|
@ -1,7 +1,7 @@
|
||||||
<clr-modal [(clrModalOpen)]="createProjectOpened" [clrModalStaticBackdrop]="staticBackdrop" [clrModalClosable]="closable">
|
<clr-modal [(clrModalOpen)]="createProjectOpened" [clrModalStaticBackdrop]="staticBackdrop" [clrModalClosable]="closable">
|
||||||
<h3 class="modal-title">{{'PROJECT.NEW_PROJECT' | translate}}</h3>
|
<h3 class="modal-title">{{'PROJECT.NEW_PROJECT' | translate}}</h3>
|
||||||
<inline-alert class="modal-title"></inline-alert>
|
<inline-alert class="modal-title"></inline-alert>
|
||||||
<div class="modal-body" style="height: 16.8em; overflow-y: hidden;">
|
<div class="modal-body" style="height: 12.8em; overflow-y: hidden;">
|
||||||
<form #projectForm="ngForm">
|
<form #projectForm="ngForm">
|
||||||
<section class="form-block">
|
<section class="form-block">
|
||||||
<div class="form-group" style="padding-left: 135px;">
|
<div class="form-group" style="padding-left: 135px;">
|
||||||
|
|
|
@ -16,7 +16,6 @@ import {
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
Output,
|
Output,
|
||||||
ViewChild,
|
ViewChild,
|
||||||
AfterViewChecked,
|
|
||||||
OnInit,
|
OnInit,
|
||||||
OnDestroy
|
OnDestroy
|
||||||
} from "@angular/core";
|
} from "@angular/core";
|
||||||
|
@ -41,7 +40,7 @@ import { ProjectService } from "../project.service";
|
||||||
templateUrl: "create-project.component.html",
|
templateUrl: "create-project.component.html",
|
||||||
styleUrls: ["create-project.scss"]
|
styleUrls: ["create-project.scss"]
|
||||||
})
|
})
|
||||||
export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestroy {
|
export class CreateProjectComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
projectForm: NgForm;
|
projectForm: NgForm;
|
||||||
|
|
||||||
|
@ -74,10 +73,10 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.proNameChecker
|
this.proNameChecker
|
||||||
.debounceTime(500)
|
.debounceTime(300)
|
||||||
.subscribe((name: string) => {
|
.subscribe((name: string) => {
|
||||||
let cont = this.currentForm.controls["create_project_name"];
|
let cont = this.currentForm.controls["create_project_name"];
|
||||||
if (cont && this.hasChanged) {
|
if (cont) {
|
||||||
this.isNameValid = cont.valid;
|
this.isNameValid = cont.valid;
|
||||||
if (this.isNameValid) {
|
if (this.isNameValid) {
|
||||||
// Check exiting from backend
|
// Check exiting from backend
|
||||||
|
@ -141,27 +140,8 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr
|
||||||
|
|
||||||
onCancel() {
|
onCancel() {
|
||||||
this.createProjectOpened = false;
|
this.createProjectOpened = false;
|
||||||
this.projectForm.reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewChecked(): void {
|
|
||||||
this.projectForm = this.currentForm;
|
|
||||||
if (this.projectForm) {
|
|
||||||
this.projectForm.valueChanges.subscribe(data => {
|
|
||||||
for (let i = 0; i < data.length; i++) {
|
|
||||||
let origin = this.initVal[i];
|
|
||||||
let current = data[i];
|
|
||||||
if (current && current !== origin) {
|
|
||||||
this.hasChanged = true;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
this.hasChanged = false;
|
|
||||||
this.inlineAlert.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
newProject() {
|
newProject() {
|
||||||
this.project = new Project();
|
this.project = new Project();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user