diff --git a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.html b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.html index 04f52c614..9705eccbd 100644 --- a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.html +++ b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.html @@ -46,7 +46,8 @@ [disabled]=" imageNameInput.projectName.invalid || imageNameInput.repoName.invalid || - imageNameInput.noProjectInfo !== '' + imageNameInput.notExist || + imageNameInput.checkingName " class="btn btn-primary" (click)="onRetag()"> diff --git a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts index 127867629..9d4e9895e 100644 --- a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts +++ b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-list-tab.component.ts @@ -849,7 +849,9 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy { this.retagDialogOpened = true; this.imageNameInput.imageNameForm.reset({ repoName: this.repoName, + projectName: null, }); + this.imageNameInput.notExist = false; this.retagSrcImage = this.repoName + ':' + this.selectedRow[0].digest; } diff --git a/src/portal/src/app/shared/components/image-name-input/image-name-input.component.html b/src/portal/src/app/shared/components/image-name-input/image-name-input.component.html index 4fffa121c..664c5ecb9 100644 --- a/src/portal/src/app/shared/components/image-name-input/image-name-input.component.html +++ b/src/portal/src/app/shared/components/image-name-input/image-name-input.component.html @@ -9,7 +9,9 @@
+
- {{ noProjectInfo | translate }} + + {{ 'PROJECT.NAME_TOOLTIP' | translate }} + + + {{ 'REPLICATION.NO_PROJECT_INFO' | translate }} +
diff --git a/src/portal/src/app/shared/components/image-name-input/image-name-input.component.ts b/src/portal/src/app/shared/components/image-name-input/image-name-input.component.ts index f3bc92bd2..5c9561bfa 100644 --- a/src/portal/src/app/shared/components/image-name-input/image-name-input.component.ts +++ b/src/portal/src/app/shared/components/image-name-input/image-name-input.component.ts @@ -1,6 +1,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { Subject } from 'rxjs'; -import { debounceTime, switchMap } from 'rxjs/operators'; +import { debounceTime, finalize, switchMap } from 'rxjs/operators'; import { AbstractControl, FormBuilder, @@ -17,10 +17,11 @@ import { Project } from 'ng-swagger-gen/models/project'; styleUrls: ['./image-name-input.component.scss'], }) export class ImageNameInputComponent implements OnInit, OnDestroy { - noProjectInfo = ''; selectedProjectList: Project[] = []; proNameChecker: Subject = new Subject(); imageNameForm: FormGroup; + notExist: boolean = false; + checkingName: boolean = false; public project: string; public repo: string; public tag: string; @@ -57,13 +58,16 @@ export class ImageNameInputComponent implements OnInit, OnDestroy { .pipe(debounceTime(200)) .pipe( switchMap(name => { - this.noProjectInfo = ''; + this.notExist = false; + this.checkingName = true; this.selectedProjectList = []; - return this.proService.listProjects({ - name: name, - page: 1, - pageSize: 10, - }); + return this.proService + .listProjects({ + name: name, + page: 1, + pageSize: 10, + }) + .pipe(finalize(() => (this.checkingName = false))); }) ) .subscribe( @@ -76,18 +80,14 @@ export class ImageNameInputComponent implements OnInit, OnDestroy { data.name === this.imageNameForm.controls['projectName'].value ); - if (!exist) { - this.noProjectInfo = 'REPLICATION.NO_PROJECT_INFO'; - } else { - this.noProjectInfo = ''; - } + this.notExist = !exist; } else { - this.noProjectInfo = 'REPLICATION.NO_PROJECT_INFO'; + this.notExist = true; } }, (error: any) => { this.errorHandler.error(error); - this.noProjectInfo = 'REPLICATION.NO_PROJECT_INFO'; + this.notExist = true; } ); } @@ -96,8 +96,6 @@ export class ImageNameInputComponent implements OnInit, OnDestroy { let cont = this.imageNameForm.controls['projectName']; if (cont && cont.valid) { this.proNameChecker.next(cont.value); - } else { - this.noProjectInfo = 'PROJECT.NAME_TOOLTIP'; } } @@ -126,6 +124,6 @@ export class ImageNameInputComponent implements OnInit, OnDestroy { selectedProjectName(projectName: string) { this.imageNameForm.controls['projectName'].setValue(projectName); this.selectedProjectList = []; - this.noProjectInfo = ''; + this.notExist = false; } } diff --git a/src/portal/src/i18n/lang/en-us-lang.json b/src/portal/src/i18n/lang/en-us-lang.json index d2d3604ad..453e77296 100644 --- a/src/portal/src/i18n/lang/en-us-lang.json +++ b/src/portal/src/i18n/lang/en-us-lang.json @@ -601,7 +601,7 @@ "JOB_PLACEHOLDER": "We couldn't find any replication jobs!", "NO_ENDPOINT_INFO": "Please add an endpoint first", "NO_LABEL_INFO": "Please add a label first", - "NO_PROJECT_INFO": "This project is not exist", + "NO_PROJECT_INFO": "This project does not exist", "SOURCE_RESOURCE_FILTER": "Source resource filter", "SCHEDULED": "Scheduled", "MANUAL": "Manual", diff --git a/src/portal/src/i18n/lang/es-es-lang.json b/src/portal/src/i18n/lang/es-es-lang.json index f99edeb12..0e2ad743e 100644 --- a/src/portal/src/i18n/lang/es-es-lang.json +++ b/src/portal/src/i18n/lang/es-es-lang.json @@ -603,7 +603,7 @@ "JOB_PLACEHOLDER": "We couldn't find any replication jobs!", "NO_ENDPOINT_INFO": "Please add an endpoint first", "NO_LABEL_INFO": "Please add a label first", - "NO_PROJECT_INFO": "This project is not exist", + "NO_PROJECT_INFO": "This project does not exist", "SOURCE_RESOURCE_FILTER": "Source resource filter", "SCHEDULED": "Scheduled", "MANUAL": "Manual",