Skip to content

Commit

Permalink
Add changes for the create server slider (#5755)
Browse files Browse the repository at this point in the history
* added some changes for the create server slider

Signed-off-by: Vinay Sharma <vsharma@chef.io>

* added some minor changes

Signed-off-by: Vinay Sharma <vsharma@chef.io>
  • Loading branch information
vinay033 committed Sep 22, 2021
1 parent 27ff369 commit 7114c83
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ export class ChefServersListComponent implements OnInit, OnDestroy {
ip_address: this.ipForm.controls['ip_address'].value?.trim() || ''
};
this.store.dispatch(new CreateServer(server));
this.creatingChefServer = false;
this.createChefServerForm.reset();
this.resetCreateModal();
}

private resetCreateModal(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,22 @@ <h2 slot="title">Add Chef Infra Server </h2>
<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">
</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>
</label>
</chef-form-field>
</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>
Expand All @@ -84,16 +99,18 @@ <h2 slot="title">Add Chef Infra Server </h2>
autocomplete="off"/>
</label>
<chef-error
*ngIf="createForm.get('fqdn').hasError('required') && createForm.get('fqdn').dirty">
*ngIf="fqdnForm.get('fqdn').hasError('required') && fqdnForm.get('fqdn').dirty">
FQDN is required.
</chef-error>
<chef-error
*ngIf="createForm.get('fqdn').hasError('pattern')">
*ngIf="fqdnForm.get('fqdn').hasError('pattern')">
FQDN is invalid.
</chef-error>
</chef-form-field>
</div>
<div class="input-margin">
</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>
Expand All @@ -108,18 +125,18 @@ <h2 slot="title">Add Chef Infra Server </h2>
/>
</label>
<chef-error
*ngIf="createForm.get('ip_address').hasError('required') && createForm.get('ip_address').dirty">
*ngIf="ipForm.get('ip_address').hasError('required') && ipForm.get('ip_address').dirty">
IP Address is required.
</chef-error>
<chef-error
*ngIf="createForm.get('ip_address').hasError('pattern')">
*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)="closeSeverSlider()">Cancel</chef-button>
<chef-button [disabled]="!createForm?.valid || creating || conflictError"
<chef-button [disabled]="!createForm?.valid || creating || conflictError || (selected === 'fqdn') ? !fqdnForm?.valid : !ipForm?.valid"
primary
data-cy="add-button"
id="create-button-object-modal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,14 @@
margin-right: 15px;
}

chef-select {
::ng-deep chef-select {
font-size: 14px;
font-weight: 100;
width: 96%;
}

::ng-deep chef-select .selected-value {
height: 36px;
width: 464px;
background: $chef-white;
padding: 0.5em;
border: 1px solid $chef-form-input;
Expand Down

0 comments on commit 7114c83

Please sign in to comment.