diff options
Diffstat (limited to 'cds-ui/client/src/app/common')
48 files changed, 1938 insertions, 0 deletions
diff --git a/cds-ui/client/src/app/common/constants/app-constants.ts b/cds-ui/client/src/app/common/constants/app-constants.ts new file mode 100644 index 000000000..0efabebf5 --- /dev/null +++ b/cds-ui/client/src/app/common/constants/app-constants.ts @@ -0,0 +1,94 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ +export const GlobalContants = { + endpoints: { + + }, + // cbawizard: { + // stepsRequired: {stepCount: 3, + // steps: [{name:'CBA Metadata', componentURL:'/controllerBlueprint/selectTemplate'}, + // {name:'Controller Blueprint Designer', componentURL:'/controllerBlueprint/modifyTemplate'}, + // {name:'Test', componentURL:'/controllerBlueprint/testTemplate'}, + // {name:'Deploy', componentURL:'/controllerBlueprint/deployTemplate'}] + // } + // } + cbawizard: { + stepsRequired: + { + stepCount: 4, + steps: [{ + name: 'CBA Metadata', + componentURL: '/controllerBlueprint/selectTemplate', + label: 'CBA Metadata', + link: '/blueprint/selectTemplate', + index: 0, + component: 'SelectTemplateComponent' + }, + { + name: 'Controller Blueprint Designer', + componentURL: '/controllerBlueprint/modifyTemplate', + label: 'Controller Blueprint Designer', + link: '/blueprint/modifyTemplate', + index: 1, + component: 'ModifyTemplateComponent' + }, + { + name: 'Test', + componentURL: '/controllerBlueprint/testTemplate', + label: 'Test', + link: '/blueprint/testTemplate', + index: 2, + component: 'TestTemplateComponent' + }, + { + name: 'Deploy', + componentURL: '/controllerBlueprint/deployTemplate', + label: 'Deploy', + link: '/blueprint/deployTemplate', + index: 3, + component: 'DeployTemplateComponent' + }] + } + }, + datadictionary: { + stepsRequired: + { + stepCount: 3, + steps: [{ + name: 'Resource Creation', componentURL: '/dataDictionary/selectTemplate', + label: 'Resource Creation', + component: 'ResourceCreationComponent' + + }, + { + name: 'Edit/Validate', componentURL: '/dataDictionary/modifyTemplate', + label: 'Edit/Validate', + component: 'ResourceEditComponent' + }, + { + name: 'Save', componentURL: '/dataDictionary/saveTemplate', + label: 'Save Resource', + component: 'SaveResourceComponent' + }] + } + + } +};
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/README.md b/cds-ui/client/src/app/common/core/README.md new file mode 100644 index 000000000..6b30b8a64 --- /dev/null +++ b/cds-ui/client/src/app/common/core/README.md @@ -0,0 +1,22 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +This folder contains Core services. Services which should have single instance across the application.
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/core.module.ts b/cds-ui/client/src/app/common/core/core.module.ts new file mode 100644 index 000000000..807065ebc --- /dev/null +++ b/cds-ui/client/src/app/common/core/core.module.ts @@ -0,0 +1,47 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { StoreModule, Store } from '@ngrx/store'; +import { EffectsModule } from '@ngrx/effects'; +import { StoreRouterConnectingModule } from '@ngrx/router-store'; +import { HttpClientModule } from '@angular/common/http'; + +import { appReducers } from './store/reducers/app.reducer'; +import { BlueprintEffects } from './store/effects/blueprint.effects'; +import { ResourcesEffects } from './store/effects/resources.effects'; +import { ApiService } from './services/api.service'; +// import { BlueprintService } from './services/blueprint.service'; + +@NgModule({ + declarations: [ + ], + imports: [ + CommonModule, + StoreModule.forRoot(appReducers), + EffectsModule.forRoot([BlueprintEffects,ResourcesEffects]), + StoreRouterConnectingModule.forRoot({stateKey: 'router'}), + HttpClientModule + ], + providers : [ ApiService ] +}) +export class CoreModule { } diff --git a/cds-ui/client/src/app/common/core/services/api.service.ts b/cds-ui/client/src/app/common/core/services/api.service.ts new file mode 100644 index 000000000..0ee3c6a78 --- /dev/null +++ b/cds-ui/client/src/app/common/core/services/api.service.ts @@ -0,0 +1,52 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + + +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +//import { IBlueprintHttp } from '../store/models/blueprint-http.model'; + +@Injectable() +export class ApiService { + // blueprintUrl = '../../constants/blueprint.json'; + + constructor(private _http: HttpClient) { + } + + get(url: string, params?: any): Observable<any> { + return this._http.get(url); + } + + post() { + // to do + } + + put() { + // to do + } + + delete() { + // to do + } + +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/README.md b/cds-ui/client/src/app/common/core/store/README.md new file mode 100644 index 000000000..c9584c84a --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/README.md @@ -0,0 +1,22 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +This folder contains the code related to ngrx/store, for application state management.
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/actions/blueprint.action.ts b/cds-ui/client/src/app/common/core/store/actions/blueprint.action.ts new file mode 100644 index 000000000..8dc5067e7 --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/actions/blueprint.action.ts @@ -0,0 +1,78 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +import { Injectable } from '@angular/core'; +import { Action, Store } from '@ngrx/store'; +import { IBlueprint } from '../models/blueprint.model'; +import { IBlueprintState } from '../models/blueprintState.model'; + +export const LOAD_BLUEPRINT = 'LOAD_BLUEPRINT'; +export const LOAD_BLUEPRINT_SUCCESS = 'LOAD_BLUEPRINT_SUCCESS'; +export const LOAD_BLUEPRINT_FAILURE = 'LOAD_BLUEPRINT_FAILURE'; +export const UPDATE_BLUEPRINT ='UPDATE_BLUEPRINT'; +export const UPDATE_BLUEPRINT_SUCCESS = 'UPDATE_BLUEPRINT_SUCCESS'; +export const UPDATE_BLUEPRINT_FAILURE = 'UPDATE_BLUEPRINT_FAILURE'; +export const SAVE_BLUEPRINT = 'SAVE_BLUEPRINT'; +export const SAVE_BLUEPRINT_SUCCESS = 'SAVE_BLUEPRINT_SUCCESS'; +export const SAVE_BLUEPRINT_FAILURE = 'SAVE_BLUEPRINT_FAILURE'; + +export const SET_BLUEPRINT = 'SET Blueprint'; +export const REMOVE_BLUEPRINT = 'Remove Blueprint'; + +export const SET_BLUEPRINT_STATE = 'SET Blueprint state'; + + +export class LoadBlueprint implements Action { + readonly type = LOAD_BLUEPRINT; + constructor(public startLoadSuccess?: boolean) {} +} + +export class LoadBlueprintSuccess implements Action { + readonly type = LOAD_BLUEPRINT_SUCCESS; + constructor(public payload: IBlueprint) {} +} + +export class LoadBlueprintFailure implements Action { + readonly type = LOAD_BLUEPRINT_FAILURE; + constructor(public error: any) {} +} + +export class SetBlueprintState implements Action { + readonly type = SET_BLUEPRINT_STATE; + constructor(public payload: IBlueprintState) {} +} + +// export class SetBlueprint implements Action { +// readonly type = SET_BLUEPRINT; +// constructor(public payload: Blueprint) {} +// } + +// export class RemoveBlueprint implements Action { +// readonly type = REMOVE_BLUEPRINT; +// constructor(public payload: Blueprint) {} +// } + +export class UpdateBlueprint implements Action { + readonly type = UPDATE_BLUEPRINT; + constructor(public payload: IBlueprint) {} +} + +export type Actions = LoadBlueprint | LoadBlueprintSuccess | LoadBlueprintFailure | SetBlueprintState;
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/actions/resources.action.ts b/cds-ui/client/src/app/common/core/store/actions/resources.action.ts new file mode 100644 index 000000000..d5a723b6d --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/actions/resources.action.ts @@ -0,0 +1,57 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +import { Injectable } from '@angular/core'; +import { Action, Store } from '@ngrx/store'; +import { IResources } from '../models/resources.model'; +import { IResourcesState } from '../models/resourcesState.model'; + +export const LOAD_RESOURCES = 'LOAD_RESOURCES'; +export const LOAD_RESOURCES_SUCCESS = 'LOAD_RESOURCES_SUCCESS'; +export const LOAD_RESOURCES_FAILURE = 'LOAD_RESOURCES_FAILURE'; +export const UPDATE_RESOURCES ='UPDATE_RESOURCES'; +export const SET_RESOURCES_STATE = 'SET Resources state'; + + +export class LoadResources implements Action { + readonly type = LOAD_RESOURCES; + constructor(public startLoadSuccess?: boolean) {} +} + +export class LoadResourcesSuccess implements Action { + readonly type = LOAD_RESOURCES_SUCCESS; + constructor(public payload: IResources) {} +} + +export class LoadResourcesFailure implements Action { + readonly type = LOAD_RESOURCES_FAILURE; + constructor(public error: any) {} +} + +export class SetResourcesState implements Action { + readonly type = SET_RESOURCES_STATE; + constructor(public payload: IResourcesState) {} +} + +export class UpdateResources implements Action { + readonly type = UPDATE_RESOURCES; + constructor(public payload: IResources) {} +} + +export type Actions = LoadResources | LoadResourcesSuccess | LoadResourcesFailure | SetResourcesState;
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/effects/blueprint.effects.ts b/cds-ui/client/src/app/common/core/store/effects/blueprint.effects.ts new file mode 100644 index 000000000..e1b1c2fd9 --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/effects/blueprint.effects.ts @@ -0,0 +1,56 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +import { Injectable } from '@angular/core'; +import { Effect, ofType, Actions } from '@ngrx/effects'; +import { Store, select } from '@ngrx/store'; +import { of } from 'rxjs'; +import { switchMap, map, withLatestFrom, catchError } from 'rxjs/operators'; + +import { IAppState } from '../state/app.state'; +import * as BlueprintActions from '../actions/blueprint.action'; +// import { IBlueprintHttp } from '../models/blueprint-http.model'; +// import { BlueprintService } from '../../services/blueprint.service'; +// import { BlueprintService } from '../../../feature-modules/blueprint/blueprint.service'; + +@Injectable() +export class BlueprintEffects { + + + constructor( + // private blueprintService: BlueprintService, + private _actions$: Actions, + private _store: Store<IAppState> + ) {} + + // @Effect() + // getBlueprint$ = this._actions$.pipe( + // ofType<BlueprintActions.LoadBlueprint>(BlueprintActions.LOAD_BLUEPRINT), + // switchMap(() => + // this.blueprintService.loadBlueprint().pipe( + // map((blueprintResponse: any) => new BlueprintActions.LoadBlueprintSuccess(blueprintResponse)), + // catchError((error : any) => of(new BlueprintActions.LoadBlueprintSuccess(error))) + // ), + // , + // switchMap((blueprintResponse: any) => of(new BlueprintActions.LoadBlueprintSuccess(blueprintResponse))) +// ), +// ) +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/effects/resources.effects.ts b/cds-ui/client/src/app/common/core/store/effects/resources.effects.ts new file mode 100644 index 000000000..f48f28497 --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/effects/resources.effects.ts @@ -0,0 +1,37 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ + +import { Injectable } from '@angular/core'; +import { Effect, ofType, Actions } from '@ngrx/effects'; +import { Store, select } from '@ngrx/store'; +import { of } from 'rxjs'; +import { switchMap, map, withLatestFrom, catchError } from 'rxjs/operators'; + +import { IAppState } from '../state/app.state'; +import * as ResourcesActions from '../actions/resources.action'; + +@Injectable() +export class ResourcesEffects { + + constructor( + private _actions$: Actions, + private _store: Store<IAppState> + ) {} +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/models/blueprint-http.model.ts b/cds-ui/client/src/app/common/core/store/models/blueprint-http.model.ts new file mode 100644 index 000000000..e0e98d580 --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/models/blueprint-http.model.ts @@ -0,0 +1,25 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ +import { IBlueprint } from '../models/blueprint.model'; + +export interface IBlueprintHttp { + blueprint: IBlueprint; +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/models/blueprint.model.ts b/cds-ui/client/src/app/common/core/store/models/blueprint.model.ts new file mode 100644 index 000000000..f4989fb73 --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/models/blueprint.model.ts @@ -0,0 +1,30 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +import { IMetaData } from './metadata.model'; +import { IImportModel } from './imports.model'; +import { ITopologyTemplate } from './itopologytemplate.model'; + +export interface IBlueprint { + metadata: IMetaData; + fileImports: Array<IImportModel> + toplogyTemplates: ITopologyTemplate; +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/models/blueprintState.model.ts b/cds-ui/client/src/app/common/core/store/models/blueprintState.model.ts new file mode 100644 index 000000000..6d2659248 --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/models/blueprintState.model.ts @@ -0,0 +1,34 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ +import { IMetaData } from './metadata.model'; +import { IImportModel } from './imports.model'; +import { IBlueprint } from './blueprint.model'; + + +export interface IBlueprintState { + blueprint: IBlueprint, + name?: string; + files?: any; + filesData?: any; + isLoadSuccess?: boolean; + isUpdateSuccess?: boolean; + isSaveSuccess?: boolean; +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/models/entrySchema.model.ts b/cds-ui/client/src/app/common/core/store/models/entrySchema.model.ts new file mode 100644 index 000000000..8e9659051 --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/models/entrySchema.model.ts @@ -0,0 +1,23 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ + +export interface IEntrySchema{ + Type:string; +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/models/imports.model.ts b/cds-ui/client/src/app/common/core/store/models/imports.model.ts new file mode 100644 index 000000000..9510ed3cf --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/models/imports.model.ts @@ -0,0 +1,24 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +export interface IImportModel { + file: string; +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/models/itopologytemplate.model.ts b/cds-ui/client/src/app/common/core/store/models/itopologytemplate.model.ts new file mode 100644 index 000000000..7457f2f8c --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/models/itopologytemplate.model.ts @@ -0,0 +1,26 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +export interface ITopologyTemplate { + inputs: object[]; + node_template: object[]; + workflow: object[]; +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/models/metadata.model.ts b/cds-ui/client/src/app/common/core/store/models/metadata.model.ts new file mode 100644 index 000000000..6ee427504 --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/models/metadata.model.ts @@ -0,0 +1,28 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ +export interface IMetaData { + template_author: string; + author_email: String; + user_groups: string; + template_name: string; + template_version: string; + template_tags: string; +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/models/propertyData.model.ts b/cds-ui/client/src/app/common/core/store/models/propertyData.model.ts new file mode 100644 index 000000000..94cff8991 --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/models/propertyData.model.ts @@ -0,0 +1,27 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +import {IEntrySchema} from './entrySchema.model'; + +export interface IPropertyData{ + discription:string; + _type:string; + required:boolean; + entry_schema:IEntrySchema; +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/models/resources-http.model.ts b/cds-ui/client/src/app/common/core/store/models/resources-http.model.ts new file mode 100644 index 000000000..3f2556a50 --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/models/resources-http.model.ts @@ -0,0 +1,24 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +import { IResources } from '../models/resources.model'; + +export interface IResourcesHttp { + resources: IResources; +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/models/resources.model.ts b/cds-ui/client/src/app/common/core/store/models/resources.model.ts new file mode 100644 index 000000000..019c2684a --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/models/resources.model.ts @@ -0,0 +1,30 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ + +import { ISourcesData } from './sourcesData.model'; +import { IPropertyData } from './propertyData.model'; + +export interface IResources { + name:string ; + tags:string; + updated_bt:string; + property: IPropertyData; + sources: ISourcesData; +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/models/resourcesState.model.ts b/cds-ui/client/src/app/common/core/store/models/resourcesState.model.ts new file mode 100644 index 000000000..7dacf3242 --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/models/resourcesState.model.ts @@ -0,0 +1,28 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ + +import { IResources } from './resources.model'; + +export interface IResourcesState { + resources: IResources, + isLoadSuccess: boolean; + isUpdateSuccess: boolean; + isSaveSuccess: boolean; +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/models/sourcesData.model.ts b/cds-ui/client/src/app/common/core/store/models/sourcesData.model.ts new file mode 100644 index 000000000..ed43fc969 --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/models/sourcesData.model.ts @@ -0,0 +1,23 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ + +export interface ISourcesData{ +sources: object[]; +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/reducers/app.reducer.ts b/cds-ui/client/src/app/common/core/store/reducers/app.reducer.ts new file mode 100644 index 000000000..6f583202c --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/reducers/app.reducer.ts @@ -0,0 +1,33 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +import { ActionReducerMap } from '@ngrx/store'; +import { routerReducer } from '@ngrx/router-store'; + +import { IAppState } from '../state/app.state'; +import { blueprintReducer } from '../reducers/blueprint.reducer'; +import { resourcesReducer } from '../reducers/resources.reducer'; + +export const appReducers: ActionReducerMap<IAppState, any> = { + router: routerReducer, + blueprint: blueprintReducer, + resources:resourcesReducer +};
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts b/cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts new file mode 100644 index 000000000..37a659da6 --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts @@ -0,0 +1,63 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +import { Action } from '@ngrx/store'; +import { IBlueprint } from '../models/blueprint.model'; +import { IBlueprintState } from '../models/blueprintState.model'; +import { initialBlueprintState } from '../state/blueprint.state'; +import * as BlueprintActions from '../actions/blueprint.action'; + +// const initialState: BlueprintState = { +// blueprint: { +// metadata: { +// template_author: '', +// author_email: '', +// user_groups: '', +// template_name: '', +// template_version: '', +// template_tags: '' +// }, +// fileImports: [{file:''}], +// toplogyTemplates: 'temp' +// }, +// isLoadSuccess: false, +// isUpdateSuccess: false, +// isSaveSuccess: false +// } + + +export function blueprintReducer(state: IBlueprintState = initialBlueprintState, action: BlueprintActions.Actions) : IBlueprintState { + switch(action.type) { + case BlueprintActions.LOAD_BLUEPRINT_SUCCESS: + return {...state, + blueprint: action.payload + } + case BlueprintActions.SET_BLUEPRINT_STATE : + return {...state, + blueprint: action.payload.blueprint, + name: action.payload.name, + files: action.payload.files, + filesData: action.payload.filesData + } + default: + return state; + } +} diff --git a/cds-ui/client/src/app/common/core/store/reducers/resources.reducer.ts b/cds-ui/client/src/app/common/core/store/reducers/resources.reducer.ts new file mode 100644 index 000000000..c9d587d16 --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/reducers/resources.reducer.ts @@ -0,0 +1,35 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +import { Action } from '@ngrx/store'; +import { IResources } from '../models/resources.model'; +import { IResourcesState } from '../models/resourcesState.model'; +import { initialResourcesState } from '../state/resources.state'; +import * as ResourcesActions from '../actions/resources.action'; + +export function resourcesReducer(state: IResourcesState = initialResourcesState, action: ResourcesActions.Actions) : IResourcesState { + switch(action.type) { + case ResourcesActions.LOAD_RESOURCES_SUCCESS: + return {...state, + resources: action.payload + } + default: + return state; + } +} diff --git a/cds-ui/client/src/app/common/core/store/selectors/blueprint.selectors.ts b/cds-ui/client/src/app/common/core/store/selectors/blueprint.selectors.ts new file mode 100644 index 000000000..d23221cce --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/selectors/blueprint.selectors.ts @@ -0,0 +1,31 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ +import { createSelector } from '@ngrx/store'; + +import { IAppState } from '../state/app.state'; +import { IBlueprintState } from '../models/blueprintState.model'; + +const selectBlueprintFromAppState = (state: IAppState) => state.blueprint; + +export const selectBlueprint = createSelector( + selectBlueprintFromAppState, + (state: IBlueprintState) => state.blueprint +);
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/selectors/resources.selectors.ts b/cds-ui/client/src/app/common/core/store/selectors/resources.selectors.ts new file mode 100644 index 000000000..96ec4d3ec --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/selectors/resources.selectors.ts @@ -0,0 +1,30 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +import { createSelector } from '@ngrx/store'; + +import { IAppState } from '../state/app.state'; +import { IResourcesState } from '../models/resourcesState.model'; + +const selectResourcesFromAppState = (state: IAppState) => state.resources; + +export const selectResources = createSelector( + selectResourcesFromAppState, + (state: IResourcesState) => state.resources +);
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/state/app.state.ts b/cds-ui/client/src/app/common/core/store/state/app.state.ts new file mode 100644 index 000000000..052eb2c5b --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/state/app.state.ts @@ -0,0 +1,37 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +import { RouterReducerState } from '@ngrx/router-store'; +import { IBlueprintState } from '../models/blueprintState.model'; +import { initialBlueprintState } from './blueprint.state'; +import { IResourcesState } from '../models/resourcesState.model'; +import { initialResourcesState } from './resources.state'; + +export interface IAppState { + router? : RouterReducerState, + blueprint: IBlueprintState, + resources: IResourcesState +} + +export const initialAppState: IAppState = { + blueprint: initialBlueprintState, + resources: initialResourcesState +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/state/blueprint.state.ts b/cds-ui/client/src/app/common/core/store/state/blueprint.state.ts new file mode 100644 index 000000000..19a837693 --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/state/blueprint.state.ts @@ -0,0 +1,34 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +import { IBlueprintState } from '../models/blueprintState.model'; +import { IBlueprint } from '../models/blueprint.model'; + + +export const initialBlueprintState : IBlueprintState = { + blueprint : {} as IBlueprint, + name: '', + files: [], + filesData: [], + isLoadSuccess: false, + isUpdateSuccess: false, + isSaveSuccess: false, +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/core/store/state/resources.state.ts b/cds-ui/client/src/app/common/core/store/state/resources.state.ts new file mode 100644 index 000000000..046667a04 --- /dev/null +++ b/cds-ui/client/src/app/common/core/store/state/resources.state.ts @@ -0,0 +1,28 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ +import { IResourcesState } from '../models/resourcesState.model'; +import { IResources } from '../models/resources.model'; + +export const initialResourcesState : IResourcesState = { + resources : {} as IResources, + isLoadSuccess: false, + isUpdateSuccess: false, + isSaveSuccess: false, +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/modules/README.md b/cds-ui/client/src/app/common/modules/README.md new file mode 100644 index 000000000..196842e93 --- /dev/null +++ b/cds-ui/client/src/app/common/modules/README.md @@ -0,0 +1,22 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +This folder contains common module. All the third party imports/libraries, that could be used at many components, should be imported here into a single module and that module can be used across.
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/modules/app-material.module.ts b/cds-ui/client/src/app/common/modules/app-material.module.ts new file mode 100644 index 000000000..9ad2063f5 --- /dev/null +++ b/cds-ui/client/src/app/common/modules/app-material.module.ts @@ -0,0 +1,137 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { MatAutocompleteModule, + MatBottomSheetModule, + MatButtonModule, + MatButtonToggleModule, + MatCardModule, + MatCheckboxModule, + MatChipsModule, + MatDatepickerModule, + MatDialogModule, + MatDividerModule, + MatExpansionModule, + MatGridListModule, + MatIconModule, + MatInputModule, + MatListModule, + MatMenuModule, + MatNativeDateModule, + MatPaginatorModule, + MatProgressBarModule, + MatProgressSpinnerModule, + MatRadioModule, + MatRippleModule, + MatSelectModule, + MatSidenavModule, + MatSliderModule, + MatSlideToggleModule, + MatSnackBarModule, + MatSortModule, + MatStepperModule, + MatTableModule, + MatTabsModule, + MatToolbarModule, + MatTooltipModule, + MatTreeModule, + MatFormFieldModule } from '@angular/material'; + +@NgModule({ + imports: [ + CommonModule, + MatAutocompleteModule, + MatBottomSheetModule, + MatButtonModule, + MatButtonToggleModule, + MatCardModule, + MatCheckboxModule, + MatChipsModule, + MatDatepickerModule, + MatDialogModule, + MatDividerModule, + MatExpansionModule, + MatGridListModule, + MatIconModule, + MatInputModule, + MatMenuModule, + MatNativeDateModule, + MatPaginatorModule, + MatProgressBarModule, + MatProgressSpinnerModule, + MatRadioModule, + MatRippleModule, + MatSelectModule, + MatSidenavModule, + MatSliderModule, + MatSlideToggleModule, + MatSnackBarModule, + MatSortModule, + MatStepperModule, + MatTableModule, + MatTabsModule, + MatToolbarModule, + MatTooltipModule, + MatTreeModule, + MatListModule, + MatFormFieldModule + ], + exports: [ + MatAutocompleteModule, + MatBottomSheetModule, + MatButtonModule, + MatButtonToggleModule, + MatCardModule, + MatCheckboxModule, + MatChipsModule, + MatDatepickerModule, + MatDialogModule, + MatDividerModule, + MatExpansionModule, + MatGridListModule, + MatIconModule, + MatInputModule, + MatListModule, + MatMenuModule, + MatNativeDateModule, + MatPaginatorModule, + MatProgressBarModule, + MatProgressSpinnerModule, + MatRadioModule, + MatRippleModule, + MatSelectModule, + MatSidenavModule, + MatSliderModule, + MatSlideToggleModule, + MatSnackBarModule, + MatSortModule, + MatStepperModule, + MatTableModule, + MatTabsModule, + MatToolbarModule, + MatTooltipModule, + MatTreeModule, + MatFormFieldModule + ] +}) +export class AppMaterialModule { } diff --git a/cds-ui/client/src/app/common/shared/components/cbawizard/cbawizard.component.html b/cds-ui/client/src/app/common/shared/components/cbawizard/cbawizard.component.html new file mode 100644 index 000000000..b7c59b25e --- /dev/null +++ b/cds-ui/client/src/app/common/shared/components/cbawizard/cbawizard.component.html @@ -0,0 +1,62 @@ +<!-- +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +--> +<!-- <mat-card class="CBAform"> + <mat-card-content> + <mat-horizontal-stepper [linear]=true #stepper (selectionChange)="changeRoute($event)"> + <div *ngFor="let step of stepDetails"> + <mat-step> + <ng-template matStepLabel>{{step.name}} + </ng-template> + </mat-step> + </div> + </mat-horizontal-stepper> + </mat-card-content> +</mat-card> --> + +<!-- <mat-card class="CBAform"> + <mat-card-content> + <mat-horizontal-stepper [linear]=true #stepper (selectionChange)="changeRoute($event)"> + <a *ngFor="let routeLink of stepsRequired; let i = index;"> + <mat-step style="display: none;"> + <ng-template matStepLabel>{{routeLink.label}} + </ng-template> + </mat-step> + </a> + </mat-horizontal-stepper> + </mat-card-content> +</mat-card> --> + +<mat-card class="CBAform"> + <!-- <label>{{appName}}</label> --> + <mat-card-content> + <mat-horizontal-stepper [linear]=true #stepper > + <!-- <mat-step style="display: none;" *ngFor="let routeLink of stepsRequired; let i = index;"> --> + <mat-step style="display: none;" *ngFor="let routeLink of steps"> + <ng-template matStepLabel>{{routeLink.label}}</ng-template> + <!-- {{appToLoad.component}} --> + <template #steppercontainer> </template> + </mat-step> + <div style="position:relative"> + <button mat-button matStepperNext style="color:white;background:gray; right: 20px; position: absolute;bottom:5px; ">Next</button> + </div> + </mat-horizontal-stepper> + </mat-card-content> +</mat-card>
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/shared/components/cbawizard/cbawizard.component.scss b/cds-ui/client/src/app/common/shared/components/cbawizard/cbawizard.component.scss new file mode 100644 index 000000000..119a7d796 --- /dev/null +++ b/cds-ui/client/src/app/common/shared/components/cbawizard/cbawizard.component.scss @@ -0,0 +1,31 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ +// .mat-horizontal-content-container { +// display: none !important; +// } + +.mat-card { + padding: 0px !important; +} + +mat-horizontal-stepper .mat-horizontal-content-container { + display: none !important; +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/shared/components/cbawizard/cbawizard.component.spec.ts b/cds-ui/client/src/app/common/shared/components/cbawizard/cbawizard.component.spec.ts new file mode 100644 index 000000000..62aca172f --- /dev/null +++ b/cds-ui/client/src/app/common/shared/components/cbawizard/cbawizard.component.spec.ts @@ -0,0 +1,45 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CBAWizardComponent } from './cbawizard.component'; + +describe('CBAWizardComponent', () => { + let component: CBAWizardComponent; + let fixture: ComponentFixture<CBAWizardComponent>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CBAWizardComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CBAWizardComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/cds-ui/client/src/app/common/shared/components/cbawizard/cbawizard.component.ts b/cds-ui/client/src/app/common/shared/components/cbawizard/cbawizard.component.ts new file mode 100644 index 000000000..fc284b3a6 --- /dev/null +++ b/cds-ui/client/src/app/common/shared/components/cbawizard/cbawizard.component.ts @@ -0,0 +1,96 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ +import { Component, OnInit, Input, Output, EventEmitter, ViewChild } from '@angular/core'; +import { Router } from '@angular/router'; +import { MatStepper } from '@angular/material'; + +import { GlobalContants } from '../../../constants/app-constants'; + +@Component({ + selector: 'app-cbawizard', + templateUrl: './cbawizard.component.html', + styleUrls: ['./cbawizard.component.scss'] +}) +export class CBAWizardComponent implements OnInit { + // @Input() stepsRequired: any[]; + @Input() appName: any; + @ViewChild('stepper') stepper: MatStepper; + @Output() stepChanged = new EventEmitter(); + public stepDetails = GlobalContants.cbawizard.stepsRequired.steps; + private routeLinks : any[]; + activeLinkIndex = -1; + stepsRequired: any; + steps: any[]; + + constructor(private router: Router) { + // this.routeLinks = [ + // { + // label: 'CBA Metadata', + // link: '/blueprint/selectTemplate', + // index: 0 + // }, { + // label: 'Controller Blueprint Designer', + // link: '/blueprint/modifyTemplate', + // index: 1 + // }, { + // label: 'Test', + // link: '/blueprint/testTemplate', + // index: 2 + // }, { + // label: 'Deploy', + // link: '/blueprint/deployTemplate', + // index: 3 + // } + // ]; + + } + + ngOnInit() { + // this.router.events.subscribe((res) => { + // this.activeLinkIndex = this.routeLinks.indexOf(this.routeLinks.find(tab => tab.link === this.router.url)); + // this.stepper.selectedIndex = this.activeLinkIndex; + // }); + // this.stepsRequired.forEach((step, index)=>{ + // if(step.link == this.router.url) { + // this.stepper.selectedIndex = step.index + // } + // }); + if (this.appName == "cba") { + this.stepsRequired = GlobalContants.cbawizard.stepsRequired.stepCount; + this.steps = GlobalContants.cbawizard.stepsRequired.steps; + // this.createComponent(); + } + if (this.appName == "datadict") { + this.stepsRequired = GlobalContants.datadictionary.stepsRequired.stepCount; + this.steps = GlobalContants.datadictionary.stepsRequired.steps; + // this.createComponent(); + } + } + + changeRoute(event){ + this.stepsRequired.forEach((step, index)=>{ + if(index == event.selectedIndex) { + this.router.navigate([step.link]); + } + }); + } + +} diff --git a/cds-ui/client/src/app/common/shared/components/header/header.component.html b/cds-ui/client/src/app/common/shared/components/header/header.component.html new file mode 100644 index 000000000..e1ed84227 --- /dev/null +++ b/cds-ui/client/src/app/common/shared/components/header/header.component.html @@ -0,0 +1,23 @@ +<!-- +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +--> +<mat-toolbar color="primary"> + <span>Controller Blueprint Design Studio</span> +</mat-toolbar> diff --git a/cds-ui/client/src/app/common/shared/components/header/header.component.scss b/cds-ui/client/src/app/common/shared/components/header/header.component.scss new file mode 100644 index 000000000..22941b5fa --- /dev/null +++ b/cds-ui/client/src/app/common/shared/components/header/header.component.scss @@ -0,0 +1,20 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/shared/components/header/header.component.spec.ts b/cds-ui/client/src/app/common/shared/components/header/header.component.spec.ts new file mode 100644 index 000000000..99bb63b8e --- /dev/null +++ b/cds-ui/client/src/app/common/shared/components/header/header.component.spec.ts @@ -0,0 +1,45 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HeaderComponent } from './header.component'; + +describe('HeaderComponent', () => { + let component: HeaderComponent; + let fixture: ComponentFixture<HeaderComponent>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ HeaderComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HeaderComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/cds-ui/client/src/app/common/shared/components/header/header.component.ts b/cds-ui/client/src/app/common/shared/components/header/header.component.ts new file mode 100644 index 000000000..40a337579 --- /dev/null +++ b/cds-ui/client/src/app/common/shared/components/header/header.component.ts @@ -0,0 +1,35 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-header', + templateUrl: './header.component.html', + styleUrls: ['./header.component.scss'] +}) +export class HeaderComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/cds-ui/client/src/app/common/shared/components/home/home.component.html b/cds-ui/client/src/app/common/shared/components/home/home.component.html new file mode 100644 index 000000000..f8cfc888e --- /dev/null +++ b/cds-ui/client/src/app/common/shared/components/home/home.component.html @@ -0,0 +1,48 @@ +<!-- ============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +--> +<!-- <mat-toolbar color="warn"> + <mat-toolbar-row> + <button type="button" aria-label="Toggle sidenav" mat-icon-button (click)="drawer.toggle()" color="primary"> + <mat-icon aria-label="Side nav toggle icon">menu</mat-icon> + </button> + <span>MY Image</span> + </mat-toolbar-row> +</mat-toolbar> --> +<mat-toolbar color="primary"> + <mat-toolbar-row> + <!-- <button type="button" aria-label="Toggle sidenav" mat-icon-button (click)="drawer.toggle()" color="primary"> --> + <a class="menuBar" (click)="drawer.toggle()">☰</a> + <!-- </button> --> + <span class="title">Controller Blueprint Design Studio</span> + </mat-toolbar-row> +</mat-toolbar> +<mat-sidenav-container class="example-container"> + <mat-sidenav #drawer mode="side" [(opened)]="opened" (opened)="events.push('open!')" (closed)="events.push('close!')"> + <mat-toolbar color="" primary>Menu</mat-toolbar> + <mat-nav-list> + <a mat-list-item [routerLink]="['/blueprint']">Controller Blueprint</a> + <a mat-list-item [routerLink]="['/resource-definition']">Resource Definition</a> + </mat-nav-list> + </mat-sidenav> + + <mat-sidenav-content (click)="drawer.close()"> + <router-outlet></router-outlet> + </mat-sidenav-content> +</mat-sidenav-container>
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/shared/components/home/home.component.scss b/cds-ui/client/src/app/common/shared/components/home/home.component.scss new file mode 100644 index 000000000..df9a48de5 --- /dev/null +++ b/cds-ui/client/src/app/common/shared/components/home/home.component.scss @@ -0,0 +1,47 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +// .example-container { +// // position: absolute; +// top: 0; +// bottom: 0; +// left: 0; +// right: 0; +// } + +// .example-events { +// width: 300px; +// height: 200px; +// overflow: auto; +// border: 1px solid #555; +// } +.mat-sidenav-container{ + height: 652px; +} +.mat-button.mat-primary, .mat-icon-button.mat-primary, .mat-stroked-button.mat-primary { + color: white !important; +} +.menuBar{ + cursor: pointer; +} +.title{ + margin: 1em; +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/shared/components/home/home.component.spec.ts b/cds-ui/client/src/app/common/shared/components/home/home.component.spec.ts new file mode 100644 index 000000000..5bfec0399 --- /dev/null +++ b/cds-ui/client/src/app/common/shared/components/home/home.component.spec.ts @@ -0,0 +1,46 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HomeComponent } from './home.component'; + +describe('HomeComponent', () => { + let component: HomeComponent; + let fixture: ComponentFixture<HomeComponent>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ HomeComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/cds-ui/client/src/app/common/shared/components/home/home.component.ts b/cds-ui/client/src/app/common/shared/components/home/home.component.ts new file mode 100644 index 000000000..d5ea7f6ce --- /dev/null +++ b/cds-ui/client/src/app/common/shared/components/home/home.component.ts @@ -0,0 +1,37 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-home', + templateUrl: './home.component.html', + styleUrls: ['./home.component.scss'] +}) +export class HomeComponent implements OnInit { + events: string[] = []; + opened: boolean = true; + constructor() { } + + ngOnInit() { + } + +} diff --git a/cds-ui/client/src/app/common/shared/directives/README.md b/cds-ui/client/src/app/common/shared/directives/README.md new file mode 100644 index 000000000..d82b915d7 --- /dev/null +++ b/cds-ui/client/src/app/common/shared/directives/README.md @@ -0,0 +1,22 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +This folder contains common directives used across the application. diff --git a/cds-ui/client/src/app/common/shared/pipes/README.md b/cds-ui/client/src/app/common/shared/pipes/README.md new file mode 100644 index 000000000..8470fee4e --- /dev/null +++ b/cds-ui/client/src/app/common/shared/pipes/README.md @@ -0,0 +1,22 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +This folder contains common pipes used across the application
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/shared/pipes/search.pipe.ts b/cds-ui/client/src/app/common/shared/pipes/search.pipe.ts new file mode 100644 index 000000000..b0d37c3d1 --- /dev/null +++ b/cds-ui/client/src/app/common/shared/pipes/search.pipe.ts @@ -0,0 +1,37 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : CDS +* ================================================================================ +* Copyright (C) 2019 TechMahindra +*================================================================================= +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ + +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'search' +}) + +export class SearchPipe implements PipeTransform{ + + transform(items: any[], searchText: string): any[] { + if(!items) return []; + if(!searchText) return items; + searchText = searchText.toLowerCase(); + return items.filter( it => { + return it.toLowerCase().includes(searchText); + }); + } +}
\ No newline at end of file diff --git a/cds-ui/client/src/app/common/shared/shared.module.ts b/cds-ui/client/src/app/common/shared/shared.module.ts new file mode 100644 index 000000000..8db020d52 --- /dev/null +++ b/cds-ui/client/src/app/common/shared/shared.module.ts @@ -0,0 +1,63 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { HomeComponent } from './components/home/home.component'; +import { CBAWizardComponent } from './components/cbawizard/cbawizard.component'; +import { MatToolbarModule,MatIconModule, MatButtonModule, MatSidenavModule, MatListModule, MatGridListModule, MatCardModule, MatMenuModule, MatTableModule, MatPaginatorModule, MatSortModule, MatInputModule, MatSelectModule, MatRadioModule, MatFormFieldModule, MatStepperModule} from '@angular/material'; +import { RouterModule } from "@angular/router"; +import { SearchPipe } from './pipes/search.pipe'; + +@NgModule({ + declarations: [ + HomeComponent, + CBAWizardComponent, + SearchPipe + + ], + exports: [ + HomeComponent, + CBAWizardComponent, + SearchPipe + ], + imports: [ + CommonModule, + MatToolbarModule, + MatButtonModule, + MatSidenavModule, + MatIconModule, + MatListModule, + MatGridListModule, + MatCardModule, + MatMenuModule, + MatTableModule, + MatPaginatorModule, + MatSortModule, + MatInputModule, + MatSelectModule, + MatRadioModule, + MatFormFieldModule, + MatStepperModule, + RouterModule + ] +}) +export class SharedModule { } diff --git a/cds-ui/client/src/app/common/utility/README.md b/cds-ui/client/src/app/common/utility/README.md new file mode 100644 index 000000000..e4b0cce96 --- /dev/null +++ b/cds-ui/client/src/app/common/utility/README.md @@ -0,0 +1,22 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + +This folder contains utility files
\ No newline at end of file |