diff --git a/components/automate-ui/src/app/entities/servers/server.actions.ts b/components/automate-ui/src/app/entities/servers/server.actions.ts index 4cc07d9b203..9d34b19f3ae 100644 --- a/components/automate-ui/src/app/entities/servers/server.actions.ts +++ b/components/automate-ui/src/app/entities/servers/server.actions.ts @@ -71,6 +71,7 @@ export interface CreateServerPayload { name: string; fqdn: string; ip_address: string; + webui_key: string; } export class CreateServer implements Action { diff --git a/components/automate-ui/src/app/entities/servers/server.model.ts b/components/automate-ui/src/app/entities/servers/server.model.ts index 990f3dfda53..83d6a211144 100644 --- a/components/automate-ui/src/app/entities/servers/server.model.ts +++ b/components/automate-ui/src/app/entities/servers/server.model.ts @@ -4,6 +4,7 @@ export interface Server { fqdn: string; ip_address: string; orgs_count?: number; + webui_key?: string; } export interface User { diff --git a/components/automate-ui/src/app/modules/infra-proxy/chef-server-details/chef-server-details.component.html b/components/automate-ui/src/app/modules/infra-proxy/chef-server-details/chef-server-details.component.html index 6c951b3b3a2..a5035c4dcc3 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/chef-server-details/chef-server-details.component.html +++ b/components/automate-ui/src/app/modules/infra-proxy/chef-server-details/chef-server-details.component.html @@ -27,7 +27,7 @@ Orgs - Users + Details diff --git a/components/automate-ui/src/app/modules/infra-proxy/chef-server-details/chef-server-details.component.ts b/components/automate-ui/src/app/modules/infra-proxy/chef-server-details/chef-server-details.component.ts index 98b989b6072..99556abd645 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/chef-server-details/chef-server-details.component.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/chef-server-details/chef-server-details.component.ts @@ -18,7 +18,7 @@ import { import { Server } from 'app/entities/servers/server.model'; import { GetServer, UpdateServer - // , GetUsers + // , GetUsers } from 'app/entities/servers/server.actions'; import { GetOrgs, CreateOrg, DeleteOrg } from 'app/entities/orgs/org.actions'; import { Org } from 'app/entities/orgs/org.model'; diff --git a/components/automate-ui/src/app/modules/infra-proxy/chef-servers-list/chef-servers-list.component.html b/components/automate-ui/src/app/modules/infra-proxy/chef-servers-list/chef-servers-list.component.html index fb94f087a06..1d369dd082c 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/chef-servers-list/chef-servers-list.component.html +++ b/components/automate-ui/src/app/modules/infra-proxy/chef-servers-list/chef-servers-list.component.html @@ -6,17 +6,18 @@ Chef Infra Servers Manage Chef Infra Servers with Chef Automate - - + { id: '1', name: 'new server', fqdn: 'xyz.com', - ip_address: '1.1.1.1' + ip_address: '1.1.1.1', + webui_key: 'test WebUI Key' }; beforeEach(() => { @@ -143,11 +144,13 @@ describe('ChefServersListComponent', () => { component.createChefServerForm.controls['name'].setValue('any'); component.fqdnForm.controls['fqdn'].setValue('any'); component.ipForm.controls['ip_address'].setValue('any'); + component.webUIKeyForm.controls['webui_key'].setValue('any'); component.openCreateModal(); expect(component.createChefServerForm.controls['id'].value).toBe(null); expect(component.createChefServerForm.controls['name'].value).toBe(null); expect(component.fqdnForm.controls['fqdn'].value).toBe(null); expect(component.ipForm.controls['ip_address'].value).toBe(null); + expect(component.webUIKeyForm.controls['webui_key'].value).toBe(null); }); it('on success, closes slider and adds new server', () => { @@ -155,6 +158,7 @@ describe('ChefServersListComponent', () => { component.createChefServerForm.controls['name'].setValue(server.name); component.fqdnForm.controls['fqdn'].setValue(server.fqdn); component.ipForm.controls['ip_address'].setValue(server.ip_address); + component.webUIKeyForm.controls['webui_key'].setValue(server.webui_key); component.createChefServer(); store.dispatch(new CreateServerSuccess({ 'server': server })); @@ -169,6 +173,7 @@ describe('ChefServersListComponent', () => { component.createChefServerForm.controls['name'].setValue(server.name); component.fqdnForm.controls['fqdn'].setValue(server.fqdn); component.ipForm.controls['ip_address'].setValue(server.ip_address); + component.webUIKeyForm.controls['webui_key'].setValue(server.webui_key); component.createChefServer(); const conflict = { @@ -188,6 +193,7 @@ describe('ChefServersListComponent', () => { component.createChefServerForm.controls['name'].setValue(server.name); component.fqdnForm.controls['fqdn'].setValue(server.fqdn); component.ipForm.controls['ip_address'].setValue(server.ip_address); + component.webUIKeyForm.controls['webui_key'].setValue(server.webui_key); component.createChefServer(); const error = { diff --git a/components/automate-ui/src/app/modules/infra-proxy/chef-servers-list/chef-servers-list.component.ts b/components/automate-ui/src/app/modules/infra-proxy/chef-servers-list/chef-servers-list.component.ts index 62d1fd083ac..d320b8e8a72 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/chef-servers-list/chef-servers-list.component.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/chef-servers-list/chef-servers-list.component.ts @@ -36,6 +36,7 @@ export class ChefServersListComponent implements OnInit, OnDestroy { public conflictErrorEvent = new EventEmitter(); public fqdnForm: FormGroup; public ipForm: FormGroup; + public webUIKeyForm: FormGroup; private isDestroyed = new Subject(); public serverToDelete: Server; public deleteModalVisible = false; @@ -68,6 +69,11 @@ export class ChefServersListComponent implements OnInit, OnDestroy { Validators.pattern(Regex.patterns.VALID_IP_ADDRESS) ]] }); + this.webUIKeyForm = this.fb.group({ + webui_key: ['', [Validators.required, + Validators.pattern(Regex.patterns.NON_BLANK) + ]] + }); } ngOnInit() { @@ -136,7 +142,8 @@ export class ChefServersListComponent implements OnInit, OnDestroy { id: this.createChefServerForm.controls['id'].value, name: this.createChefServerForm.controls['name'].value.trim(), fqdn: this.fqdnForm.controls['fqdn'].value?.trim() || '', - ip_address: this.ipForm.controls['ip_address'].value?.trim() || '' + ip_address: this.ipForm.controls['ip_address'].value?.trim() || '', + webui_key: this.webUIKeyForm.controls['webui_key'].value || '' }; this.store.dispatch(new CreateServer(server)); this.telemetryService.track('InfraServer_Add_Chef_InfraServer'); @@ -150,6 +157,7 @@ export class ChefServersListComponent implements OnInit, OnDestroy { this.createChefServerForm.reset(); this.fqdnForm.reset(); this.ipForm.reset(); + this.webUIKeyForm.reset(); this.conflictErrorEvent.emit(false); } diff --git a/components/automate-ui/src/app/modules/infra-proxy/create-chef-server-modal/create-chef-server-modal.component.html b/components/automate-ui/src/app/modules/infra-proxy/create-chef-server-slider/create-chef-server-slider.component.html similarity index 82% rename from components/automate-ui/src/app/modules/infra-proxy/create-chef-server-modal/create-chef-server-modal.component.html rename to components/automate-ui/src/app/modules/infra-proxy/create-chef-server-slider/create-chef-server-slider.component.html index 68f22c98d5a..56cd2d652ed 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/create-chef-server-modal/create-chef-server-modal.component.html +++ b/components/automate-ui/src/app/modules/infra-proxy/create-chef-server-slider/create-chef-server-slider.component.html @@ -1,5 +1,8 @@
+ + arrow_back +

Add Chef Infra Server

Add Chef Infra Server
-
+ +
+
+ + + + WEB UI KEY is required. + + Note: A web UI Key is located Here(Need Better Help Text). + +
+
Cancel - - Add Chef Infra Server + Add Adding Chef Infra Server ...
diff --git a/components/automate-ui/src/app/modules/infra-proxy/create-chef-server-modal/create-chef-server-modal.component.scss b/components/automate-ui/src/app/modules/infra-proxy/create-chef-server-slider/create-chef-server-slider.component.scss similarity index 91% rename from components/automate-ui/src/app/modules/infra-proxy/create-chef-server-modal/create-chef-server-modal.component.scss rename to components/automate-ui/src/app/modules/infra-proxy/create-chef-server-slider/create-chef-server-slider.component.scss index 656164839f1..9c1c7e5cf4a 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/create-chef-server-modal/create-chef-server-modal.component.scss +++ b/components/automate-ui/src/app/modules/infra-proxy/create-chef-server-slider/create-chef-server-slider.component.scss @@ -19,6 +19,10 @@ line-height: 27px; margin-bottom: 10px; } + + .back-button { + margin-left: 0; + } } .flex-container { @@ -46,6 +50,12 @@ color: $chef-primary-dark; font-size: 12px; } + + #webui_key { + height: 150px; + overflow-y: auto; + overflow-x: hidden; + } } #button-bar { @@ -136,3 +146,9 @@ border-radius: 4px; } } + +.note_text { + font-weight: 400; + font-size: 14px; + letter-spacing: 0.2px; +} diff --git a/components/automate-ui/src/app/modules/infra-proxy/create-chef-server-modal/create-chef-server-modal.component.spec.ts b/components/automate-ui/src/app/modules/infra-proxy/create-chef-server-slider/create-chef-server-slider.component.spec.ts similarity index 86% rename from components/automate-ui/src/app/modules/infra-proxy/create-chef-server-modal/create-chef-server-modal.component.spec.ts rename to components/automate-ui/src/app/modules/infra-proxy/create-chef-server-slider/create-chef-server-slider.component.spec.ts index 72853571922..91100b85375 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/create-chef-server-modal/create-chef-server-modal.component.spec.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/create-chef-server-slider/create-chef-server-slider.component.spec.ts @@ -6,16 +6,16 @@ import { MockComponent } from 'ng2-mock-component'; import { Regex } from 'app/helpers/auth/regex'; import { using } from 'app/testing/spec-helpers'; -import { CreateChefServerModalComponent } from './create-chef-server-modal.component'; +import { CreateChefServerSliderComponent } from './create-chef-server-slider.component'; -describe('CreateChefServerModalComponent', () => { - let component: CreateChefServerModalComponent; - let fixture: ComponentFixture; +describe('CreateChefServerSliderComponent', () => { + let component: CreateChefServerSliderComponent; + let fixture: ComponentFixture; let createForm: FormGroup; let fqdnForm: FormGroup; let ipForm: FormGroup; - + let webUIKeyForm: FormGroup; let errors = {}; beforeEach( waitForAsync(() => { @@ -32,7 +32,7 @@ describe('CreateChefServerModalComponent', () => { inputs: ['visible'], outputs: ['close'] }), - CreateChefServerModalComponent + CreateChefServerSliderComponent ], imports: [ ReactiveFormsModule @@ -43,7 +43,7 @@ describe('CreateChefServerModalComponent', () => { })); beforeEach(() => { - fixture = TestBed.createComponent(CreateChefServerModalComponent); + fixture = TestBed.createComponent(CreateChefServerSliderComponent); component = fixture.componentInstance; // This form must mimic the createForm including Validators component.createForm = new FormBuilder().group({ @@ -63,10 +63,17 @@ describe('CreateChefServerModalComponent', () => { Validators.pattern(Regex.patterns.VALID_IP_ADDRESS) ]] }); + component.webUIKeyForm = new FormBuilder().group({ + webui_key: ['', [Validators.required, + Validators.pattern(Regex.patterns.NON_BLANK) + ]] + }); + component.conflictErrorEvent = new EventEmitter(); createForm = component.createForm; fqdnForm = component.fqdnForm; ipForm = component.ipForm; + webUIKeyForm = component.webUIKeyForm; fixture.detectChanges(); }); @@ -80,12 +87,14 @@ describe('CreateChefServerModalComponent', () => { expect(createForm.valid).toBeFalsy(); expect(fqdnForm.valid).toBeFalsy(); expect(ipForm.valid).toBeFalsy(); + expect(webUIKeyForm).toBeFalsy(); }); it('when name is missing', () => { createForm.controls['id'].setValue('test'); fqdnForm.controls['fqdn'].setValue('test.net'); ipForm.controls['ip_address'].setValue('1.2.3.4'); + webUIKeyForm.controls['webui_key'].setValue('testWebUIKey'); errors = createForm.controls['name'].errors || {}; @@ -97,6 +106,7 @@ describe('CreateChefServerModalComponent', () => { createForm.controls['name'].setValue('test'); fqdnForm.controls['fqdn'].setValue('test.net'); ipForm.controls['ip_address'].setValue('1.2.3.4'); + webUIKeyForm.controls['webui_key'].setValue('testWebUIKey'); errors = createForm.controls['id'].errors || {}; @@ -108,6 +118,7 @@ describe('CreateChefServerModalComponent', () => { createForm.controls['name'].setValue('test'); createForm.controls['id'].setValue('test'); ipForm.controls['ip_address'].setValue('1.2.3.4'); + webUIKeyForm.controls['webui_key'].setValue('testWebUIKey'); errors = fqdnForm.controls['fqdn'].errors || {}; @@ -119,6 +130,7 @@ describe('CreateChefServerModalComponent', () => { createForm.controls['name'].setValue('test'); createForm.controls['id'].setValue('test'); fqdnForm.controls['fqdn'].setValue('test.net'); + webUIKeyForm.controls['webui_key'].setValue('testWebUIKey'); errors = ipForm.controls['ip_address'].errors || {}; @@ -130,6 +142,7 @@ describe('CreateChefServerModalComponent', () => { createForm.controls['name'].setValue('test'); createForm.controls['id'].setValue('test'); fqdnForm.controls['fqdn'].setValue('chef.internal'); + webUIKeyForm.controls['webui_key'].setValue('testWebUIKey'); ipForm.controls['ip_address'].setValue('1.2234.3.4'); errors = ipForm.controls['ip_address'].errors || {}; @@ -162,6 +175,7 @@ describe('CreateChefServerModalComponent', () => { createForm.controls['name'].setValue('test'); createForm.controls['id'].setValue('test'); ipForm.controls['ip_address'].setValue('1.2.3.4'); + webUIKeyForm.controls['webui_key'].setValue('testWebUIKey'); fqdnForm.controls['fqdn'].setValue(input); errors = fqdnForm.controls['fqdn'].errors || {}; @@ -181,6 +195,7 @@ describe('CreateChefServerModalComponent', () => { createForm.controls['id'].setValue('test'); fqdnForm.controls['fqdn'].setValue('chef.internal'); ipForm.controls['ip_address'].setValue('1.2.3.4'); + webUIKeyForm.controls['webui_key'].setValue('testWebUIKey'); expect(createForm.valid).toBeTruthy(); }); @@ -202,6 +217,7 @@ describe('CreateChefServerModalComponent', () => { createForm.controls['name'].setValue('test'); createForm.controls['id'].setValue('test'); ipForm.controls['ip_address'].setValue('1.2.3.4'); + webUIKeyForm.controls['webui_key'].setValue('testWebUIKey'); fqdnForm.controls['fqdn'].setValue(input); errors = fqdnForm.controls['fqdn'].errors || {}; diff --git a/components/automate-ui/src/app/modules/infra-proxy/create-chef-server-modal/create-chef-server-modal.component.ts b/components/automate-ui/src/app/modules/infra-proxy/create-chef-server-slider/create-chef-server-slider.component.ts similarity index 87% rename from components/automate-ui/src/app/modules/infra-proxy/create-chef-server-modal/create-chef-server-modal.component.ts rename to components/automate-ui/src/app/modules/infra-proxy/create-chef-server-slider/create-chef-server-slider.component.ts index 16116009081..fc717c1db1f 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/create-chef-server-modal/create-chef-server-modal.component.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/create-chef-server-slider/create-chef-server-slider.component.ts @@ -4,11 +4,11 @@ import { FormGroup } from '@angular/forms'; import { Utilities } from 'app/helpers/utilities/utilities'; @Component({ - selector: 'app-create-chef-server-modal', - templateUrl: './create-chef-server-modal.component.html', - styleUrls: ['./create-chef-server-modal.component.scss'] + selector: 'app-create-chef-server-slider', + templateUrl: './create-chef-server-slider.component.html', + styleUrls: ['./create-chef-server-slider.component.scss'] }) -export class CreateChefServerModalComponent implements OnInit { +export class CreateChefServerSliderComponent implements OnInit { @Input() visible = false; @Input() creating = false; @Input() conflictErrorEvent: EventEmitter; @@ -17,6 +17,7 @@ export class CreateChefServerModalComponent implements OnInit { @Input() createForm: FormGroup; @Input() fqdnForm: FormGroup; @Input() ipForm: FormGroup; + @Input() webUIKeyForm: FormGroup; @HostBinding('class.active') isSlideOpen = false; public modifyID = false; // Whether the edit ID form is open or not. diff --git a/components/automate-ui/src/app/modules/infra-proxy/infra-proxy.module.ts b/components/automate-ui/src/app/modules/infra-proxy/infra-proxy.module.ts index 67be93ea58a..d244b968f80 100644 --- a/components/automate-ui/src/app/modules/infra-proxy/infra-proxy.module.ts +++ b/components/automate-ui/src/app/modules/infra-proxy/infra-proxy.module.ts @@ -14,7 +14,7 @@ import { CookbooksComponent } from './cookbooks/cookbooks.component'; import { CookbookDetailsComponent } from './cookbook-details/cookbook-details.component'; import { CookbookDependenciesComponent } from './cookbook-dependencies/cookbook-dependencies.component'; import { CookbookDependenciesDetailsComponent } from './cookbook-dependencies-details/cookbook-dependencies-details.component'; -import { CreateChefServerModalComponent } from './create-chef-server-modal/create-chef-server-modal.component'; +import { CreateChefServerSliderComponent } from './create-chef-server-slider/create-chef-server-slider.component'; import { CreateEnvironmentModalComponent } from './create-environment-modal/create-environment-modal.component'; import { CreateOrgModalComponent } from './create-org-modal/create-org-modal.component'; import { CreateDataBagModalComponent } from './create-data-bag-modal/create-data-bag-modal.component'; @@ -74,7 +74,7 @@ import { TreeTableModule } from './tree-table/tree-table.module'; CookbookDetailsComponent, CookbookDependenciesComponent, CookbookDependenciesDetailsComponent, - CreateChefServerModalComponent, + CreateChefServerSliderComponent, CreateEnvironmentModalComponent, CreateOrgModalComponent, CreateDataBagModalComponent, diff --git a/e2e/cypress/integration/ui/infra-proxy/chef-servers.spec.ts b/e2e/cypress/integration/ui/infra-proxy/chef-servers.spec.ts index e9b5cdaca85..307d465dfa2 100644 --- a/e2e/cypress/integration/ui/infra-proxy/chef-servers.spec.ts +++ b/e2e/cypress/integration/ui/infra-proxy/chef-servers.spec.ts @@ -139,7 +139,6 @@ describe('chef server', () => { cy.get('[data-cy=chef-infra-server-slider]').should('exist'); cy.get('[data-cy=add-name]').type(serverName); cy.get('[data-cy=id-label]').contains(generatedServerID); - cy.get('[data-cy=add-fqdn]').type(serverFQDN); // check for disabled cy.get('[data-cy=add-button]')