Update the name checking for the robot account (#19645)

1. Fixes #19612

Signed-off-by: AllForNothing <shijun.sun@broadcom.com>
This commit is contained in:
Shijun Sun 2023-12-05 11:01:40 +08:00 committed by GitHub
parent 3c56f2d1a0
commit 7fee99b5fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 4 deletions

View File

@ -269,7 +269,7 @@
<ng-template clrPageTitle>{{ <ng-template clrPageTitle>{{
'ROBOT_ACCOUNT.SELECT_PROJECT_PERMISSIONS' | translate 'ROBOT_ACCOUNT.SELECT_PROJECT_PERMISSIONS' | translate
}}</ng-template> }}</ng-template>
<inline-alert class="modal-title"></inline-alert> <inline-alert></inline-alert>
<form class="clr-form clr-form-horizontal pb-0 pt-0"> <form class="clr-form clr-form-horizontal pb-0 pt-0">
<section class="form-block"> <section class="form-block">
<div class="clr-form-control mt-1"> <div class="clr-form-control mt-1">

View File

@ -16,6 +16,7 @@ import {
distinctUntilChanged, distinctUntilChanged,
filter, filter,
finalize, finalize,
map,
switchMap, switchMap,
} from 'rxjs/operators'; } from 'rxjs/operators';
import { import {
@ -119,7 +120,6 @@ export class NewRobotComponent implements OnInit, OnDestroy {
if (!this._nameSubscription) { if (!this._nameSubscription) {
this._nameSubscription = this._nameSubject this._nameSubscription = this._nameSubject
.pipe( .pipe(
debounceTime(500),
distinctUntilChanged(), distinctUntilChanged(),
filter(name => { filter(name => {
if ( if (
@ -131,6 +131,11 @@ export class NewRobotComponent implements OnInit, OnDestroy {
} }
return name?.length > 0; return name?.length > 0;
}), }),
map(name => {
this.checkNameOnGoing = !!name;
return name;
}),
debounceTime(500),
switchMap(name => { switchMap(name => {
this.isNameExisting = false; this.isNameExisting = false;
this.checkNameOnGoing = true; this.checkNameOnGoing = true;
@ -490,6 +495,7 @@ export class NewRobotComponent implements OnInit, OnDestroy {
} }
clrWizardPageOnLoad() { clrWizardPageOnLoad() {
this.inlineAlertComponent.close();
this.showPage3 = true; this.showPage3 = true;
} }

View File

@ -235,13 +235,14 @@
</clr-wizard-page> </clr-wizard-page>
<clr-wizard-page <clr-wizard-page
(clrWizardPageOnLoad)="clrWizardPageOnLoad()"
(clrWizardPageOnCommit)="save()" (clrWizardPageOnCommit)="save()"
[clrWizardPagePreventDefaultNext]="true" [clrWizardPagePreventDefaultNext]="true"
[clrWizardPageNextDisabled]="disabled()"> [clrWizardPageNextDisabled]="disabled()">
<ng-template clrPageTitle>{{ <ng-template clrPageTitle>{{
'ROBOT_ACCOUNT.SELECT_PERMISSIONS' | translate 'ROBOT_ACCOUNT.SELECT_PERMISSIONS' | translate
}}</ng-template> }}</ng-template>
<inline-alert class="modal-title"></inline-alert> <inline-alert></inline-alert>
<form class="clr-form clr-form-horizontal mt-1"> <form class="clr-form clr-form-horizontal mt-1">
<section class="form-block"> <section class="form-block">
<robot-permissions-panel <robot-permissions-panel

View File

@ -12,6 +12,7 @@ import {
distinctUntilChanged, distinctUntilChanged,
filter, filter,
finalize, finalize,
map,
switchMap, switchMap,
} from 'rxjs/operators'; } from 'rxjs/operators';
import { MessageHandlerService } from '../../../../shared/services/message-handler.service'; import { MessageHandlerService } from '../../../../shared/services/message-handler.service';
@ -87,7 +88,6 @@ export class AddRobotComponent implements OnInit, OnDestroy {
if (!this._nameSubscription) { if (!this._nameSubscription) {
this._nameSubscription = this._nameSubject this._nameSubscription = this._nameSubject
.pipe( .pipe(
debounceTime(500),
distinctUntilChanged(), distinctUntilChanged(),
filter(name => { filter(name => {
if ( if (
@ -99,6 +99,11 @@ export class AddRobotComponent implements OnInit, OnDestroy {
} }
return name?.length > 0; return name?.length > 0;
}), }),
map(name => {
this.checkNameOnGoing = !!name;
return name;
}),
debounceTime(500),
switchMap(name => { switchMap(name => {
this.isNameExisting = false; this.isNameExisting = false;
this.checkNameOnGoing = true; this.checkNameOnGoing = true;
@ -295,5 +300,9 @@ export class AddRobotComponent implements OnInit, OnDestroy {
return new Date() >= this.calculateExpiresAt(); return new Date() >= this.calculateExpiresAt();
} }
clrWizardPageOnLoad() {
this.inlineAlertComponent.close();
}
protected readonly PermissionSelectPanelModes = PermissionSelectPanelModes; protected readonly PermissionSelectPanelModes = PermissionSelectPanelModes;
} }