-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* converted server modal into slider Signed-off-by: chaitali-mane <cmane@progress.com> * Updated test cases Signed-off-by: chaitali-mane <cmane@progress.com>
- Loading branch information
1 parent
93fabbc
commit 02e6bb4
Showing
8 changed files
with
212 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
266 changes: 130 additions & 136 deletions
266
.../app/modules/infra-proxy/create-chef-server-modal/create-chef-server-modal.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,141 +1,135 @@ | ||
<chef-modal [visible]="visible" (closeModal)="closeEvent()"> | ||
<h2 slot="title">Add Chef Infra Server </h2> | ||
<div class="flex-container"> | ||
<form [formGroup]="createForm"> | ||
<div class="input-margin"> | ||
<chef-form-field> | ||
<label> | ||
<span class="label">Name <span aria-hidden="true">*</span></span> | ||
<input | ||
chefInput | ||
firstFocus | ||
formControlName="name" | ||
data-cy="add-name" | ||
type="text" | ||
id="name-input" | ||
(keyup)="handleNameInput($event)" | ||
autocomplete="off"/> | ||
</label> | ||
<chef-error | ||
*ngIf="(createForm.get('name').hasError('required') || createForm.get('name').hasError('pattern')) && createForm.get('name').dirty"> | ||
Name is required. | ||
</chef-error> | ||
</chef-form-field> | ||
<span class="detail light">Don't worry, server names can be changed later.</span> | ||
</div> | ||
<div *ngIf="modifyID" class="id-margin"> | ||
<chef-form-field> | ||
<label> | ||
<span class="label">ID <span aria-hidden="true">*</span></span> | ||
<input | ||
chefInput | ||
formControlName="id" | ||
type="text" | ||
(keyup)="handleInput($event)" | ||
id="id-input" | ||
data-cy="add-id" | ||
autocomplete="off"/> | ||
</label> | ||
<chef-error *ngIf="createForm.get('id').hasError('maxlength') && createForm.get('id').dirty"> | ||
ID must be 64 characters or less. | ||
</chef-error> | ||
<chef-error *ngIf="createForm.get('id').hasError('required') && createForm.get('id').dirty"> | ||
ID is required. | ||
</chef-error> | ||
<chef-error *ngIf="createForm.get('id').hasError('pattern') && createForm.get('id').dirty"> | ||
Only lowercase letters, numbers, hyphens, and underscores are allowed. | ||
</chef-error> | ||
<chef-error *ngIf="conflictError"> | ||
Server ID "{{createForm.get('id').value}}" already exists. | ||
<div data-cy="chef-infra-server-slider" ngClass="{slide : isSlideOpen}"> | ||
<div class="sidenav-header"> | ||
<h2 slot="title">Add Chef Infra Server </h2> | ||
<chef-button | ||
class="close" | ||
secondary | ||
(click)="closeSeverSlider()" | ||
data-cy="close-chef-infra-button"> | ||
<chef-icon>close</chef-icon> | ||
</chef-button> | ||
</div> | ||
<div class="sidenav-body"> | ||
<div class="flex-container"> | ||
<form [formGroup]="createForm"> | ||
<div class="input-margin"> | ||
<chef-form-field> | ||
<label> | ||
<span class="label">Name <span aria-hidden="true">*</span></span> | ||
<input | ||
chefInput | ||
firstFocus | ||
formControlName="name" | ||
data-cy="add-name" | ||
type="text" | ||
id="name-input" | ||
(keyup)="handleNameInput($event)" | ||
autocomplete="off"/> | ||
</label> | ||
<chef-error | ||
*ngIf="(createForm.get('name').hasError('required') || createForm.get('name').hasError('pattern')) && createForm.get('name').dirty"> | ||
Name is required. | ||
</chef-error> | ||
</chef-form-field> | ||
<span class="detail light">Server IDs are unique, permanent, and cannot be changed later.</span> | ||
</div> | ||
<div *ngIf="!modifyID" class="id-margin"> | ||
<div id="id-fields"> | ||
<span class="key-label">ID: </span> | ||
<span data-cy="id-label" class="object-id">{{ this.createForm?.value.id }}</span> | ||
</chef-form-field> | ||
<span class="detail light">Don't worry, server names can be changed later.</span> | ||
</div> | ||
<chef-toolbar> | ||
<chef-button tertiary (click)="modifyID = true" id="edit-button-object-modal" data-cy="edit-button">Edit ID</chef-button> | ||
</chef-toolbar> | ||
</div> | ||
</form> | ||
<div class="input-margin"> | ||
<chef-form-field id="create-type"> | ||
<label> | ||
<span class="label">Type <span aria-hidden="true">*</span></span> | ||
<div class="version-dropdown"> | ||
<chef-select #li [value]="selected" (change)="updateFormDisplay(li.value)" data-cy="type"> | ||
<chef-option value="fqdn">FQDN</chef-option> | ||
<chef-option value="ip">IP Address</chef-option> | ||
</chef-select> | ||
<div *ngIf="modifyID" class="id-margin" data-cy="chef-form-field"> | ||
<chef-form-field> | ||
<label> | ||
<span class="label">ID <span aria-hidden="true">*</span></span> | ||
<input | ||
chefInput | ||
formControlName="id" | ||
type="text" | ||
(keyup)="handleInput($event)" | ||
id="id-input" | ||
data-cy="add-id" | ||
autocomplete="off"/> | ||
</label> | ||
<chef-error *ngIf="createForm.get('id').hasError('maxlength') && createForm.get('id').dirty"> | ||
ID must be 64 characters or less. | ||
</chef-error> | ||
<chef-error *ngIf="createForm.get('id').hasError('required') && createForm.get('id').dirty"> | ||
ID is required. | ||
</chef-error> | ||
<chef-error *ngIf="createForm.get('id').hasError('pattern') && createForm.get('id').dirty"> | ||
Only lowercase letters, numbers, hyphens, and underscores are allowed. | ||
</chef-error> | ||
<chef-error *ngIf="conflictError"> | ||
Server ID "{{createForm.get('id').value}}" already exists. | ||
</chef-error> | ||
</chef-form-field> | ||
<span class="detail light">Server IDs are unique, permanent, and cannot be changed later.</span> | ||
</div> | ||
<div *ngIf="!modifyID" class="id-margin"> | ||
<div id="id-fields"> | ||
<span class="key-label">ID: </span> | ||
<span data-cy="id-label" class="object-id">{{ this.createForm?.value.id }}</span> | ||
</div> | ||
</label> | ||
</chef-form-field> | ||
<chef-toolbar> | ||
<chef-button tertiary (click)="modifyID = true" id="edit-button-object-modal" data-cy="edit-button">Edit ID</chef-button> | ||
</chef-toolbar> | ||
</div> | ||
<div class="input-margin"> | ||
<chef-form-field> | ||
<label> | ||
<span class="label">FQDN <span aria-hidden="true">*</span></span> | ||
<input | ||
chefInput | ||
formControlName="fqdn" | ||
data-cy="add-fqdn" | ||
type="text" | ||
id="fqdn-input" | ||
(keyup)="handleInput($event)" | ||
autocomplete="off"/> | ||
</label> | ||
<chef-error | ||
*ngIf="createForm.get('fqdn').hasError('required') && createForm.get('fqdn').dirty"> | ||
FQDN is required. | ||
</chef-error> | ||
<chef-error | ||
*ngIf="createForm.get('fqdn').hasError('pattern')"> | ||
FQDN is invalid. | ||
</chef-error> | ||
</chef-form-field> | ||
</div> | ||
<div class="input-margin"> | ||
<chef-form-field> | ||
<label> | ||
<span class="label">IP Address <span aria-hidden="true">*</span></span> | ||
<input | ||
chefInput | ||
formControlName="ip_address" | ||
type="text" | ||
data-cy="add-ip-address" | ||
id="ip-address-input" | ||
(keyup)="handleInput($event)" | ||
autocomplete="off" | ||
/> | ||
</label> | ||
<chef-error | ||
*ngIf="createForm.get('ip_address').hasError('required') && createForm.get('ip_address').dirty"> | ||
IP Address is required. | ||
</chef-error> | ||
<chef-error | ||
*ngIf="createForm.get('ip_address').hasError('pattern')"> | ||
IP Address is invalid. | ||
</chef-error> | ||
</chef-form-field> | ||
</div> | ||
<div id="button-bar"> | ||
<chef-button id="cancel-server-popup" tertiary [disabled]="creating" (click)="closeSeverSlider()">Cancel</chef-button> | ||
<chef-button [disabled]="!createForm?.valid || creating || conflictError" | ||
primary | ||
data-cy="add-button" | ||
id="create-button-object-modal" | ||
(click)="createChefServer()"> | ||
<chef-loading-spinner *ngIf="creating"></chef-loading-spinner> | ||
<span *ngIf="!creating">Add Chef Infra Server</span> | ||
<span *ngIf="creating">Adding Chef Infra Server ...</span> | ||
</chef-button> | ||
</div> | ||
</form> | ||
</div> | ||
<form [formGroup]="fqdnForm"> | ||
<div class="input-margin" *ngIf="selected === 'fqdn'"> | ||
<chef-form-field> | ||
<label> | ||
<span class="label">FQDN <span aria-hidden="true">*</span></span> | ||
<input | ||
chefInput | ||
formControlName="fqdn" | ||
data-cy="add-fqdn" | ||
type="text" | ||
id="fqdn-input" | ||
(keyup)="handleInput($event)" | ||
autocomplete="off"/> | ||
</label> | ||
<chef-error | ||
*ngIf="fqdnForm.get('fqdn').hasError('required') && fqdnForm.get('fqdn').dirty"> | ||
FQDN is required. | ||
</chef-error> | ||
<chef-error | ||
*ngIf="fqdnForm.get('fqdn').hasError('pattern')"> | ||
FQDN is invalid. | ||
</chef-error> | ||
</chef-form-field> | ||
</div> | ||
</form> | ||
<form [formGroup]="ipForm"> | ||
<div class="input-margin" *ngIf="selected === 'ip'"> | ||
<chef-form-field> | ||
<label> | ||
<span class="label">IP Address <span aria-hidden="true">*</span></span> | ||
<input | ||
chefInput | ||
formControlName="ip_address" | ||
type="text" | ||
data-cy="add-ip-address" | ||
id="ip-address-input" | ||
(keyup)="handleInput($event)" | ||
autocomplete="off" | ||
/> | ||
</label> | ||
<chef-error | ||
*ngIf="ipForm.get('ip_address').hasError('required') && ipForm.get('ip_address').dirty"> | ||
IP Address is required. | ||
</chef-error> | ||
<chef-error | ||
*ngIf="ipForm.get('ip_address').hasError('pattern')"> | ||
IP Address is invalid. | ||
</chef-error> | ||
</chef-form-field> | ||
</div> | ||
<div id="button-bar"> | ||
<chef-button id="cancel-server-popup" tertiary [disabled]="creating" (click)="closeEvent()">Cancel</chef-button> | ||
<chef-button [disabled]="!createForm?.valid || creating || conflictError || (selected === 'fqdn') ? !fqdnForm?.valid : !ipForm?.valid" | ||
primary | ||
data-cy="add-button" | ||
id="create-button-object-modal" | ||
(click)="createChefServer()"> | ||
<chef-loading-spinner *ngIf="creating"></chef-loading-spinner> | ||
<span *ngIf="!creating">Add Chef Infra Server</span> | ||
<span *ngIf="creating">Adding Chef Infra Server ...</span> | ||
</chef-button> | ||
</div> | ||
</form> | ||
</div> | ||
</chef-modal> | ||
</div> |
Oops, something went wrong.