Skip to content

Commit

Permalink
Update the name checking for the robot account
Browse files Browse the repository at this point in the history
1. Fixes #19612

Signed-off-by: AllForNothing <[email protected]>
  • Loading branch information
AllForNothing committed Dec 5, 2023
1 parent 3c56f2d commit 88bf660
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ <h3 *ngIf="isEditMode" class="modal-title">
<ng-template clrPageTitle>{{
'ROBOT_ACCOUNT.SELECT_PROJECT_PERMISSIONS' | translate
}}</ng-template>
<inline-alert class="modal-title"></inline-alert>
<inline-alert></inline-alert>
<form class="clr-form clr-form-horizontal pb-0 pt-0">
<section class="form-block">
<div class="clr-form-control mt-1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
distinctUntilChanged,
filter,
finalize,
map,
switchMap,
} from 'rxjs/operators';
import {
Expand Down Expand Up @@ -119,7 +120,6 @@ export class NewRobotComponent implements OnInit, OnDestroy {
if (!this._nameSubscription) {
this._nameSubscription = this._nameSubject
.pipe(
debounceTime(500),
distinctUntilChanged(),
filter(name => {
if (
Expand All @@ -131,6 +131,11 @@ export class NewRobotComponent implements OnInit, OnDestroy {
}
return name?.length > 0;
}),
map(name => {
this.checkNameOnGoing = !!name;
return name;

Check warning on line 136 in src/portal/src/app/base/left-side-nav/system-robot-accounts/new-robot/new-robot.component.ts

View check run for this annotation

Codecov / codecov/patch

src/portal/src/app/base/left-side-nav/system-robot-accounts/new-robot/new-robot.component.ts#L135-L136

Added lines #L135 - L136 were not covered by tests
}),
debounceTime(500),
switchMap(name => {
this.isNameExisting = false;
this.checkNameOnGoing = true;
Expand Down Expand Up @@ -490,6 +495,7 @@ export class NewRobotComponent implements OnInit, OnDestroy {
}

clrWizardPageOnLoad() {
this.inlineAlertComponent.close();

Check warning on line 498 in src/portal/src/app/base/left-side-nav/system-robot-accounts/new-robot/new-robot.component.ts

View check run for this annotation

Codecov / codecov/patch

src/portal/src/app/base/left-side-nav/system-robot-accounts/new-robot/new-robot.component.ts#L498

Added line #L498 was not covered by tests
this.showPage3 = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,14 @@ <h3 *ngIf="isEditMode" class="modal-title">
</clr-wizard-page>

<clr-wizard-page
(clrWizardPageOnLoad)="clrWizardPageOnLoad()"
(clrWizardPageOnCommit)="save()"
[clrWizardPagePreventDefaultNext]="true"
[clrWizardPageNextDisabled]="disabled()">
<ng-template clrPageTitle>{{
'ROBOT_ACCOUNT.SELECT_PERMISSIONS' | translate
}}</ng-template>
<inline-alert class="modal-title"></inline-alert>
<inline-alert></inline-alert>
<form class="clr-form clr-form-horizontal mt-1">
<section class="form-block">
<robot-permissions-panel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
distinctUntilChanged,
filter,
finalize,
map,
switchMap,
} from 'rxjs/operators';
import { MessageHandlerService } from '../../../../shared/services/message-handler.service';
Expand Down Expand Up @@ -87,7 +88,6 @@ export class AddRobotComponent implements OnInit, OnDestroy {
if (!this._nameSubscription) {
this._nameSubscription = this._nameSubject
.pipe(
debounceTime(500),
distinctUntilChanged(),
filter(name => {
if (
Expand All @@ -99,6 +99,11 @@ export class AddRobotComponent implements OnInit, OnDestroy {
}
return name?.length > 0;
}),
map(name => {
this.checkNameOnGoing = !!name;
return name;

Check warning on line 104 in src/portal/src/app/base/project/robot-account/add-robot/add-robot.component.ts

View check run for this annotation

Codecov / codecov/patch

src/portal/src/app/base/project/robot-account/add-robot/add-robot.component.ts#L103-L104

Added lines #L103 - L104 were not covered by tests
}),
debounceTime(500),
switchMap(name => {
this.isNameExisting = false;
this.checkNameOnGoing = true;
Expand Down Expand Up @@ -295,5 +300,9 @@ export class AddRobotComponent implements OnInit, OnDestroy {
return new Date() >= this.calculateExpiresAt();
}

clrWizardPageOnLoad() {
this.inlineAlertComponent.close();

Check warning on line 304 in src/portal/src/app/base/project/robot-account/add-robot/add-robot.component.ts

View check run for this annotation

Codecov / codecov/patch

src/portal/src/app/base/project/robot-account/add-robot/add-robot.component.ts#L304

Added line #L304 was not covered by tests
}

protected readonly PermissionSelectPanelModes = PermissionSelectPanelModes;
}

0 comments on commit 88bf660

Please sign in to comment.