Skip to content

Commit

Permalink
Sachin/automate infra proxy server ui (#2581)
Browse files Browse the repository at this point in the history
* added chef infra server module in automate

Signed-off-by: Sachin Bachhav <[email protected]>

* added FQDN and IP Address validations

Signed-off-by: Sachin Bachhav <[email protected]>

* env const added for infra proxy url

Signed-off-by: Sachin Bachhav <[email protected]>

* Added tests for component and FQDN field

Signed-off-by: Sachin Bachhav <[email protected]>

* added some more test cases to validated FQDN field inputs

Signed-off-by: Sachin Bachhav <[email protected]>

* replced chef-control-menu with angular mat-select

Signed-off-by: Sachin Bachhav <[email protected]>
  • Loading branch information
sachin-msys authored Jan 30, 2020
1 parent b3ba31e commit f414394
Show file tree
Hide file tree
Showing 30 changed files with 1,244 additions and 21 deletions.
44 changes: 32 additions & 12 deletions components/automate-ui/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { SigninComponent } from './pages/signin/signin.component';

// Components
import { AutomateSettingsComponent } from './pages/automate-settings/automate-settings.component';
import { ChefServersListComponent } from './modules/infra-proxy/chef-servers-list/chef-servers-list.component';
import { NodeDetailsComponent } from './pages/node-details/node-details.component';
import {
NodeNoRunsDetailsComponent
Expand Down Expand Up @@ -201,25 +202,44 @@ const routes: Routes = [
.then(m => m.ComplianceModule)
},
{
path: 'infrastructure/client-runs',
path: 'infrastructure',
children: [
{
path: '',
component: ClientRunsComponent
redirectTo: '/infrastructure/client-runs',
pathMatch: 'full'
},
{
path: ':node-id/missing-runs',
component: NodeNoRunsDetailsComponent,
resolve: {
node: NodeNoRunsDetailsResolverService
}
path: 'client-runs',
children: [
{
path: '',
component: ClientRunsComponent
},
{
path: ':node-id/missing-runs',
component: NodeNoRunsDetailsComponent,
resolve: {
node: NodeNoRunsDetailsResolverService
}
},
{
path: ':node-id/runs/:run-id',
component: NodeDetailsComponent,
resolve: {
nodeRun: NodeDetailsResolverService
}
}
]
},
{
path: ':node-id/runs/:run-id',
component: NodeDetailsComponent,
resolve: {
nodeRun: NodeDetailsResolverService
}
path: 'chef-servers',
children: [
{
path: '',
component: ChefServersListComponent
}
]
}
]
},
Expand Down
10 changes: 5 additions & 5 deletions components/automate-ui/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { RoleModule } from './modules/roles/roles.module';
import { LicenseModule } from 'app/modules/license/license.module';
import { UserModule } from 'app/modules/user/user.module';
import { TeamModule } from 'app/modules/team/team.module';
import { InfraProxyModule } from 'app/modules/infra-proxy/infra-proxy.module';

// Services
import { AttributesService } from './services/attributes/attributes.service';
Expand Down Expand Up @@ -75,9 +76,10 @@ import { ManagerRequests } from './entities/managers/manager.requests';
import { PolicyRequests } from './entities/policies/policy.requests';
import { ProfileRequests } from './entities/profiles/profile.requests';
import { ProjectRequests } from './entities/projects/project.requests';
import { ServiceGroupsRequests } from './entities/service-groups/service-groups.requests';
import { RoleRequests } from './entities/roles/role.requests';
import { RuleRequests } from './entities/rules/rule.requests';
import { ServerRequests } from './entities/servers/server.requests';
import { ServiceGroupsRequests } from './entities/service-groups/service-groups.requests';
import { TeamRequests } from './entities/teams/team.requests';
import { UserPermsRequests } from './entities/userperms/userperms.requests';
import { UserRequests } from './entities/users/user.requests';
Expand All @@ -94,9 +96,6 @@ import { ApplicationsComponent } from './pages/applications/applications.compone
import { AttributesComponent } from './page-components/attributes/attributes.component';
import { AutomateSettingsComponent } from './pages/automate-settings/automate-settings.component';
import { ClientRunsComponent } from './pages/client-runs/client-runs.component';
import {
ClientRunsSidebarComponent
} from './page-components/client-runs-sidebar/client-runs-sidebar.component';
import {
ClientRunsTableComponent
} from './page-components/client-runs-table/client-runs-table.component';
Expand Down Expand Up @@ -200,7 +199,6 @@ import { WelcomeModalComponent } from './page-components/welcome-modal/welcome-m
AttributesComponent,
AutomateSettingsComponent,
ClientRunsComponent,
ClientRunsSidebarComponent,
ClientRunsTableComponent,
ConvergeRadialGraphComponent,
DatafeedComponent,
Expand Down Expand Up @@ -269,6 +267,7 @@ import { WelcomeModalComponent } from './page-components/welcome-modal/welcome-m
CookieModule.forRoot(),
FormsModule,
HttpClientModule,
InfraProxyModule,
IntegrationsModule,
NgrxEffectsModule,
PolicyModule,
Expand Down Expand Up @@ -321,6 +320,7 @@ import { WelcomeModalComponent } from './page-components/welcome-modal/welcome-m
RuleRequests,
RulesService,
RunHistoryStore,
ServerRequests,
ServiceGroupsRequests,
SessionStorageService,
SidebarService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { BreadcrumbsComponent } from './breadcrumbs/breadcrumbs.component';
import { BreadcrumbComponent } from './breadcrumb/breadcrumb.component';
import { CalendarComponent } from './calendar/calendar.component';
import { ChefNotificationsComponent } from './notifications/notifications.component';
import { ClientRunsSidebarComponent } from './client-runs-sidebar/client-runs-sidebar.component';
import { CreateObjectModalComponent } from './create-object-modal/create-object-modal.component';
import { CreateUserModalComponent } from 'app/page-components/create-user-modal/create-user-modal.component';
import { CreateV1TeamModalComponent } from 'app/page-components/create-v1-team-modal/create-v1-team-modal.component';
Expand Down Expand Up @@ -76,6 +77,7 @@ import { TableHeaderComponent } from './table/table-header/table-header.componen
BreadcrumbComponent,
CalendarComponent,
ChefNotificationsComponent,
ClientRunsSidebarComponent,
CreateObjectModalComponent,
CreateUserModalComponent,
CreateV1TeamModalComponent,
Expand Down Expand Up @@ -113,6 +115,7 @@ import { TableHeaderComponent } from './table/table-header/table-header.componen
BreadcrumbComponent,
CalendarComponent,
ChefNotificationsComponent,
ClientRunsSidebarComponent,
CreateObjectModalComponent,
CreateUserModalComponent,
CreateV1TeamModalComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
<div class="group">Infrastructure</div>
<chef-sidebar-entry route="/infrastructure/client-runs" icon="storage">Client Runs</chef-sidebar-entry>
<chef-sidebar-entry *ngIf="isWorkflowEnabled$ | async" route="/workflow" icon="local_shipping">Workflow</chef-sidebar-entry>
<chef-sidebar-entry route="/infrastructure/chef-servers" icon="storage">Chef Servers</chef-sidebar-entry>
</div>
</chef-sidebar>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { MenuItemGroup } from './layout.model';
providedIn: 'root'
})
export class LayoutSidebarService {
public applicationsFeatureFlagOn: boolean;
public chefInfraServerViewsFeatureFlagOn: boolean;
public isIAMv2$: Observable<boolean>;
public ServiceNowfeatureFlagOn: boolean;
private workflowEnabled: boolean;
Expand All @@ -26,6 +28,8 @@ export class LayoutSidebarService {
private featureFlagsService: FeatureFlagsService
) {
this.isIAMv2$ = this.store.select(isIAMv2);
this.chefInfraServerViewsFeatureFlagOn = this.featureFlagsService.getFeatureStatus('chefInfraServerViews');
this.applicationsFeatureFlagOn = this.featureFlagsService.getFeatureStatus('applications');
this.ServiceNowfeatureFlagOn = this.featureFlagsService.getFeatureStatus('servicenow_cmdb');
this.clientRunsStore.select(clientRunsWorkflowEnabled).subscribe(
(workflowEnabled) => this.workflowEnabled = workflowEnabled
Expand Down Expand Up @@ -79,6 +83,12 @@ export class LayoutSidebarService {
route: '/infrastructure/client-runs',
visible: true
},
{
name: 'Chef Servers',
icon: 'storage',
route: '/infrastructure/chef-servers',
visible: this.chefInfraServerViewsFeatureFlagOn
},
{
name: 'Workflow',
icon: 'local_shipping',
Expand Down
136 changes: 136 additions & 0 deletions components/automate-ui/src/app/entities/servers/server.actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
import { HttpErrorResponse } from '@angular/common/http';
import { Action } from '@ngrx/store';

import { Server } from './server.model';

export enum ServerActionTypes {
GET_ALL = 'SERVER::GET_ALL',
GET_ALL_SUCCESS = 'SERVER::GET_ALL::SUCCESS',
GET_ALL_FAILURE = 'SERVER::GET_ALL::FAILURE',
GET = 'SERVER::GET',
GET_SUCCESS = 'SERVER::GET::SUCCESS',
GET_FAILURE = 'SERVER::GET::FAILURE',
CREATE = 'SERVER::CREATE',
CREATE_SUCCESS = 'SERVER::CREATE::SUCCESS',
CREATE_FAILURE = 'SERVER::CREATE::FAILURE',
UPDATE = 'SERVER::UPDATE',
UPDATE_SUCCESS = 'SERVER::UPDATE::SUCCESS',
UPDATE_FAILURE = 'SERVER::UPDATE::FAILURE',
DELETE = 'SERVER::CREATE::DELETE',
DELETE_SUCCESS = 'SERVER::CREATE::DELETE::SUCCESS',
DELETE_FAILURE = 'SERVER::CREATE::DELETE::FAILURE'
}


export interface ServerSuccessPayload {
server: Server;
}

export interface GetServersSuccessPayload {
servers: Server[];
}

export class GetServers implements Action {
readonly type = ServerActionTypes.GET_ALL;
}

export class GetServersSuccess implements Action {
readonly type = ServerActionTypes.GET_ALL_SUCCESS;

constructor(public payload: GetServersSuccessPayload) { }
}

export class GetServersFailure implements Action {
readonly type = ServerActionTypes.GET_ALL_FAILURE;
constructor(public payload: HttpErrorResponse) { }
}

export class GetServer implements Action {
readonly type = ServerActionTypes.GET;

constructor(public payload: { id: string }) { }
}

export class GetServerSuccess implements Action {
readonly type = ServerActionTypes.GET_SUCCESS;

constructor(public payload: ServerSuccessPayload) { }
}

export class GetServerFailure implements Action {
readonly type = ServerActionTypes.GET_FAILURE;

constructor(public payload: HttpErrorResponse, public id: string) { }
}

export interface CreateServerPayload {
name: string;
description: string;
fqdn: string;
ip_address: string;
}

export class CreateServer implements Action {
readonly type = ServerActionTypes.CREATE;
constructor(public payload: CreateServerPayload) { }
}

export class CreateServerSuccess implements Action {
readonly type = ServerActionTypes.CREATE_SUCCESS;
constructor(public payload: ServerSuccessPayload) { }
}

export class CreateServerFailure implements Action {
readonly type = ServerActionTypes.CREATE_FAILURE;
constructor(public payload: HttpErrorResponse) { }
}

export class DeleteServer implements Action {
readonly type = ServerActionTypes.DELETE;
constructor(public payload: { id: string, name: string }) { }
}

export class DeleteServerSuccess implements Action {
readonly type = ServerActionTypes.DELETE_SUCCESS;
constructor(public payload: { id: string, name: string }) { }
}

export class DeleteServerFailure implements Action {
readonly type = ServerActionTypes.DELETE_FAILURE;
constructor(public payload: HttpErrorResponse) { }
}

export class UpdateServer implements Action {
readonly type = ServerActionTypes.UPDATE;

constructor(public payload: { server: Server }) { }
}

export class UpdateServerSuccess implements Action {
readonly type = ServerActionTypes.UPDATE_SUCCESS;

constructor(public payload: ServerSuccessPayload) { }
}

export class UpdateServerFailure implements Action {
readonly type = ServerActionTypes.UPDATE_FAILURE;

constructor(public payload: HttpErrorResponse) { }
}

export type ServerActions =
| GetServers
| GetServersSuccess
| GetServersFailure
| GetServer
| GetServerSuccess
| GetServerFailure
| CreateServer
| CreateServerSuccess
| CreateServerFailure
| UpdateServer
| UpdateServerSuccess
| UpdateServerFailure
| DeleteServer
| DeleteServerSuccess
| DeleteServerFailure;
Loading

0 comments on commit f414394

Please sign in to comment.