summaryrefslogtreecommitdiffstats
path: root/cds-ui/client/src/app/common
diff options
context:
space:
mode:
Diffstat (limited to 'cds-ui/client/src/app/common')
-rw-r--r--cds-ui/client/src/app/common/constants/app-constants.ts9
-rw-r--r--cds-ui/client/src/app/common/core/core.module.ts4
-rw-r--r--cds-ui/client/src/app/common/core/store/actions/catalog.action.ts77
-rw-r--r--cds-ui/client/src/app/common/core/store/effects/catalog.effect.ts37
-rw-r--r--cds-ui/client/src/app/common/core/store/models/catalog-http.model.ts25
-rw-r--r--cds-ui/client/src/app/common/core/store/models/catalog.model.ts29
-rw-r--r--cds-ui/client/src/app/common/core/store/models/catalogState.model.ts28
-rw-r--r--cds-ui/client/src/app/common/core/store/reducers/app.reducer.ts5
-rw-r--r--cds-ui/client/src/app/common/core/store/reducers/catalog.reducer.ts39
-rw-r--r--cds-ui/client/src/app/common/core/store/selectors/catalog.selectors.ts31
-rw-r--r--cds-ui/client/src/app/common/core/store/state/app.state.ts9
-rw-r--r--cds-ui/client/src/app/common/core/store/state/catalog.state.ts29
-rw-r--r--cds-ui/client/src/app/common/shared/components/home/home.component.html3
13 files changed, 318 insertions, 7 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
index 78fefd803..5beb6af74 100644
--- a/cds-ui/client/src/app/common/constants/app-constants.ts
+++ b/cds-ui/client/src/app/common/constants/app-constants.ts
@@ -2,6 +2,8 @@
============LICENSE_START==========================================
===================================================================
Copyright (C) 2018 IBM Intellectual Property. All rights reserved.
+
+Modifications Copyright (C) 2019 TechMahindra
===================================================================
Unless otherwise specified, all software contained herein is licensed
@@ -110,4 +112,11 @@ export const ResourceDictionaryURLs = {
getSources: '/resourcedictionary/source-mapping',
getModelType: '/resourcedictionary/model-type',
getDataType: '/resourcedictionary/model-type/by-definition/data_type'
+}
+
+export const ControllerCatalogURLs = {
+ searchControllerCatalogByTags: '/controllercatalog/search',
+ saveControllerCatalog: '/controllercatalog/save',
+ getDefinition: '/controllercatalog/model-type/by-definition',
+ getDerivedFrom: '/controllercatalog/model-type/by-derivedfrom'
} \ 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
index 7207178a9..3743ab3b1 100644
--- a/cds-ui/client/src/app/common/core/core.module.ts
+++ b/cds-ui/client/src/app/common/core/core.module.ts
@@ -25,13 +25,13 @@ 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 { NotificationHandlerService } from './services/notification-handler.service';
import { LoaderService } from './services/loader.service';
+import { CatalogEffects } from './store/effects/catalog.effect';
// import { BlueprintService } from './services/blueprint.service';
@NgModule({
@@ -40,7 +40,7 @@ import { LoaderService } from './services/loader.service';
imports: [
CommonModule,
StoreModule.forRoot(appReducers),
- EffectsModule.forRoot([BlueprintEffects, ResourcesEffects]),
+ EffectsModule.forRoot([BlueprintEffects, ResourcesEffects, CatalogEffects]),
StoreRouterConnectingModule.forRoot({ stateKey: 'router' }),
HttpClientModule
],
diff --git a/cds-ui/client/src/app/common/core/store/actions/catalog.action.ts b/cds-ui/client/src/app/common/core/store/actions/catalog.action.ts
new file mode 100644
index 000000000..938cdb110
--- /dev/null
+++ b/cds-ui/client/src/app/common/core/store/actions/catalog.action.ts
@@ -0,0 +1,77 @@
+/*
+* ============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 { ICatalog } from '../models/catalog.model';
+import { ICatalogState } from '../models/catalogState.model';
+
+export const LOAD_CATALOG = 'LOAD_CATALOG';
+export const LOAD_CATALOG_SUCCESS = 'LOAD_CATALOG_SUCCESS';
+export const LOAD_CATALOG_FAILURE = 'LOAD_CATALOG_FAILURE';
+export const UPDATE_CATALOG ='UPDATE_CATALOG';
+export const UPDATE_CATALOG_SUCCESS = 'UPDATE_CATALOG_SUCCESS';
+export const UPDATE_CATALOG_FAILURE = 'UPDATE_CATALOG_FAILURE';
+export const SAVE_CATALOG = 'SAVE_CATALOG';
+export const SAVE_CATALOG_SUCCESS = 'SAVE_CATALOG_SUCCESS';
+export const SAVE_CATALOG_FAILURE = 'SAVE_CATALOG_FAILURE';
+
+export const SET_CATALOG = 'SET CATALOG';
+export const REMOVE_CATALOG = 'Remove CATALOG';
+
+export const SET_CATALOG_STATE = 'SET CATALOG state';
+
+
+export class LoadCatalog implements Action {
+ readonly type = LOAD_CATALOG;
+ constructor(public startLoadSuccess?: boolean) {}
+}
+
+export class LoadCatalogSuccess implements Action {
+ readonly type = LOAD_CATALOG_SUCCESS;
+ constructor(public payload: ICatalog) {}
+}
+
+export class LoadCatalogFailure implements Action {
+ readonly type = LOAD_CATALOG_FAILURE;
+ constructor(public error: any) {}
+}
+
+export class SetCatalogState implements Action {
+ readonly type = SET_CATALOG_STATE;
+ constructor(public payload: ICatalogState) {}
+}
+
+// export class SetCatalog implements Action {
+// readonly type = SET_CATALOG;
+// constructor(public payload: Catalog) {}
+// }
+
+// export class RemoveCatalog implements Action {
+// readonly type = REMOVE_CATALOG;
+// constructor(public payload: Catalog) {}
+// }
+
+export class UpdateCatalog implements Action {
+ readonly type = UPDATE_CATALOG;
+ constructor(public payload: ICatalog) {}
+}
+
+export type Actions = LoadCatalog | LoadCatalogSuccess | LoadCatalogFailure | SetCatalogState; \ No newline at end of file
diff --git a/cds-ui/client/src/app/common/core/store/effects/catalog.effect.ts b/cds-ui/client/src/app/common/core/store/effects/catalog.effect.ts
new file mode 100644
index 000000000..db2296eb7
--- /dev/null
+++ b/cds-ui/client/src/app/common/core/store/effects/catalog.effect.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 CatalogActions from '../actions/catalog.action';
+
+@Injectable()
+export class CatalogEffects {
+
+ 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/catalog-http.model.ts b/cds-ui/client/src/app/common/core/store/models/catalog-http.model.ts
new file mode 100644
index 000000000..dde1f979c
--- /dev/null
+++ b/cds-ui/client/src/app/common/core/store/models/catalog-http.model.ts
@@ -0,0 +1,25 @@
+/*
+* ============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 { ICatalog } from './catalog.model';
+
+export interface ICatalogHttp {
+ catalog: ICatalog;
+} \ No newline at end of file
diff --git a/cds-ui/client/src/app/common/core/store/models/catalog.model.ts b/cds-ui/client/src/app/common/core/store/models/catalog.model.ts
new file mode 100644
index 000000000..2344f3336
--- /dev/null
+++ b/cds-ui/client/src/app/common/core/store/models/catalog.model.ts
@@ -0,0 +1,29 @@
+/*
+* ============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 ICatalog {
+ Model_Name: string;
+ User_id: string;
+ _tags: string;
+ _type: string;
+ Derived_From: string;
+ _description : string;
+ definition: object[];
+} \ No newline at end of file
diff --git a/cds-ui/client/src/app/common/core/store/models/catalogState.model.ts b/cds-ui/client/src/app/common/core/store/models/catalogState.model.ts
new file mode 100644
index 000000000..937dd87e0
--- /dev/null
+++ b/cds-ui/client/src/app/common/core/store/models/catalogState.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 { ICatalog } from './catalog.model';
+
+export interface ICatalogState {
+ catalog: ICatalog,
+ isLoadSuccess?: boolean;
+ isUpdateSuccess?: boolean;
+ isSaveSuccess?: boolean;
+} \ 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
index 6f583202c..785939040 100644
--- 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
@@ -21,13 +21,14 @@ limitations under the License.
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';
+import { catalogReducer } from '../reducers/catalog.reducer';
export const appReducers: ActionReducerMap<IAppState, any> = {
router: routerReducer,
blueprint: blueprintReducer,
- resources:resourcesReducer
+ resources:resourcesReducer,
+ catalog: catalogReducer
}; \ No newline at end of file
diff --git a/cds-ui/client/src/app/common/core/store/reducers/catalog.reducer.ts b/cds-ui/client/src/app/common/core/store/reducers/catalog.reducer.ts
new file mode 100644
index 000000000..ae5ca4e1e
--- /dev/null
+++ b/cds-ui/client/src/app/common/core/store/reducers/catalog.reducer.ts
@@ -0,0 +1,39 @@
+/*
+* ============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 { initialCatalogState } from '../state/catalog.state';
+import * as CatalogActions from '../actions/catalog.action';
+import { ICatalogState } from '../models/catalogState.model';
+
+export function catalogReducer(state: ICatalogState = initialCatalogState, action: CatalogActions.Actions) : ICatalogState {
+ switch(action.type) {
+ case CatalogActions.LOAD_CATALOG_SUCCESS:
+ return {...state,
+ catalog: action.payload
+ }
+ case CatalogActions.SET_CATALOG_STATE:
+ return {...state,
+ catalog: action.payload.catalog
+ }
+ default:
+ return state;
+ }
+}
diff --git a/cds-ui/client/src/app/common/core/store/selectors/catalog.selectors.ts b/cds-ui/client/src/app/common/core/store/selectors/catalog.selectors.ts
new file mode 100644
index 000000000..172448f53
--- /dev/null
+++ b/cds-ui/client/src/app/common/core/store/selectors/catalog.selectors.ts
@@ -0,0 +1,31 @@
+/*
+* ============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 { ICatalogState } from '../models/catalogState.model';
+
+const selectCatalogFromAppState = (state: IAppState) => state.catalog;
+
+export const selectCatalog = createSelector(
+ selectCatalogFromAppState,
+ (state: ICatalogState) => state.catalog
+); \ 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
index 052eb2c5b..c08edce1e 100644
--- 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
@@ -24,14 +24,17 @@ import { IBlueprintState } from '../models/blueprintState.model';
import { initialBlueprintState } from './blueprint.state';
import { IResourcesState } from '../models/resourcesState.model';
import { initialResourcesState } from './resources.state';
+import { ICatalogState } from '../models/catalogState.model';
+import { initialCatalogState } from './catalog.state';
export interface IAppState {
router? : RouterReducerState,
blueprint: IBlueprintState,
- resources: IResourcesState
+ resources: IResourcesState,
+ catalog: ICatalogState
}
-
export const initialAppState: IAppState = {
blueprint: initialBlueprintState,
- resources: initialResourcesState
+ resources: initialResourcesState,
+ catalog: initialCatalogState
} \ No newline at end of file
diff --git a/cds-ui/client/src/app/common/core/store/state/catalog.state.ts b/cds-ui/client/src/app/common/core/store/state/catalog.state.ts
new file mode 100644
index 000000000..a780269c5
--- /dev/null
+++ b/cds-ui/client/src/app/common/core/store/state/catalog.state.ts
@@ -0,0 +1,29 @@
+/*
+* ============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 { ICatalogState } from '../models/catalogState.model';
+import { ICatalog } from '../models/catalog.model';
+
+export const initialCatalogState : ICatalogState = {
+ catalog : {} as ICatalog,
+ isLoadSuccess: false,
+ isUpdateSuccess: false,
+ isSaveSuccess: false,
+} \ No newline at end of file
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
index f73f0e863..beff353ef 100644
--- 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
@@ -1,6 +1,8 @@
<!-- ============LICENSE_START==========================================
===================================================================
Copyright (C) 2018 IBM Intellectual Property. All rights reserved.
+
+Modifications Copyright (C) 2019 TechMahindra
===================================================================
Unless otherwise specified, all software contained herein is licensed
@@ -50,6 +52,7 @@ limitations under the License.
</ul>
</nav> -->
<a mat-list-item [routerLink]="['/resource-definition']">Resource Definition</a>
+ <a mat-list-item [routerLink]="['/controller-catalog']">Controller Catalog</a>
</mat-nav-list>
</mat-sidenav>