From 1a0f16a5b28b4602d71a51f583da9da55d514e77 Mon Sep 17 00:00:00 2001 From: Arundathi Patil Date: Tue, 5 Mar 2019 16:10:24 +0530 Subject: Ngrx store changes Made model changes as file upload type is changed to .zip Issue-ID: CCSDK-1112 Change-Id: Idf206ee05fba99b0a6bafcc3867f16025a8486f4 Signed-off-by: Arundathi Patil --- .../src/app/common/core/store/actions/blueprint.action.ts | 10 +++++++++- .../src/app/common/core/store/models/blueprintState.model.ts | 9 +++++---- .../src/app/common/core/store/reducers/blueprint.reducer.ts | 6 ++++++ .../client/src/app/common/core/store/state/blueprint.state.ts | 2 ++ 4 files changed, 22 insertions(+), 5 deletions(-) (limited to 'cds-ui') 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 index 6a0ab8065..8dc5067e7 100644 --- 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 @@ -18,6 +18,7 @@ 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'; @@ -36,6 +37,8 @@ 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; @@ -52,6 +55,11 @@ export class LoadBlueprintFailure implements Action { 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) {} @@ -67,4 +75,4 @@ export class UpdateBlueprint implements Action { constructor(public payload: IBlueprint) {} } -export type Actions = LoadBlueprint | LoadBlueprintSuccess | LoadBlueprintFailure; \ No newline at end of file +export type Actions = LoadBlueprint | LoadBlueprintSuccess | LoadBlueprintFailure | SetBlueprintState; \ 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 index 556b33d19..5981f0136 100644 --- 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 @@ -18,7 +18,6 @@ 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'; @@ -26,7 +25,9 @@ import { IBlueprint } from './blueprint.model'; export interface IBlueprintState { blueprint: IBlueprint, - isLoadSuccess: boolean; - isUpdateSuccess: boolean; - isSaveSuccess: boolean; + 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/reducers/blueprint.reducer.ts b/cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts index edcf1c38a..b6c23ecf8 100644 --- 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 @@ -50,6 +50,12 @@ export function blueprintReducer(state: IBlueprintState = initialBlueprintState, return {...state, blueprint: action.payload } + case BlueprintActions.SET_BLUEPRINT_STATE : + return {...state, + blueprint: action.payload.blueprint, + files: action.payload.files, + filesData: action.payload.filesData + } default: return state; } 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 index 913072665..1899cb26e 100644 --- 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 @@ -25,6 +25,8 @@ import { IBlueprint } from '../models/blueprint.model'; export const initialBlueprintState : IBlueprintState = { blueprint : {} as IBlueprint, + files: [], + filesData: [], isLoadSuccess: false, isUpdateSuccess: false, isSaveSuccess: false, -- cgit 1.2.3-korg