Skip to content

Commit

Permalink
SHIBUI-1385 Fixed issue with wizard-summary
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Aug 20, 2019
1 parent 47dc848 commit e85b71c
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 26 deletions.
5 changes: 3 additions & 2 deletions ui/src/app/metadata/configuration/effect/restore.effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import {
getVersionModel,
getConfigurationModelId,
getConfigurationModelKind,
getConfigurationDefinition
getConfigurationDefinition,
getRestorationModel
} from '../reducer';
import { SetMetadata } from '../action/configuration.action';

Expand All @@ -39,7 +40,7 @@ export class RestoreEffects {
this.store.select(getConfigurationModelId),
this.store.select(getConfigurationModelKind),
this.store.select(getConfigurationModel),
this.store.select(getVersionModel)
this.store.select(getRestorationModel)
),
switchMap(([action, id, kind, current, version]) =>
this.historyService.updateVersion(id, kind, {
Expand Down
6 changes: 6 additions & 0 deletions ui/src/app/metadata/configuration/reducer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ export const getFormattedModel = createSelector(
(model, definition) => definition.formatter(model)
);

export const getRestorationModel = createSelector(
getVersionModel,
getRestorationChanges,
(model, changes) => model
);

// Mixed states

export const getConfigurationModelFn = (kind, version, provider, resolver) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,11 @@ export class WizardSummaryComponent implements OnChanges {

ngOnChanges(changes: SimpleChanges): void {
if (changes.summary && this.summary) {
const schemas = this.summary.schema;
const schema = this.summary.schema;
const model = this.summary.model;
const def = this.summary.definition;
const steps = def.steps;

const schema = Object.keys(schemas).reduce((coll, key) => ({
...merge(coll, schemas[key])
}), {} as any);

this.sections = steps
.filter(step => step.id !== 'summary')
.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class ProviderWizardComponent implements OnDestroy {

this.summary$ = combineLatest(
this.store.select(fromWizard.getWizardDefinition),
this.store.select(fromWizard.getSchema),
this.store.select(fromWizard.getSchemaObject),
this.store.select(fromProvider.getEntityChanges)
).pipe(
map(([ definition, schema, model ]) => ({ definition, schema, model }))
Expand Down
11 changes: 1 addition & 10 deletions ui/src/app/metadata/provider/effect/editor.effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import {
LoadSchemaSuccess,
LoadSchemaFail,
SetDefinition,
WizardActionTypes,
AddSchema
WizardActionTypes
} from '../../../wizard/action/wizard.action';
import { ResetChanges } from '../action/entity.action';

Expand All @@ -38,14 +37,6 @@ export class EditorEffects {
)
);

@Effect()
$loadSchemaSuccess = this.actions$.pipe(
ofType<LoadSchemaSuccess>(WizardActionTypes.LOAD_SCHEMA_SUCCESS),
map(action => action.payload),
withLatestFrom(this.store.select(fromWizard.getWizardIndex)),
map(([schema, id]) => new AddSchema({ id, schema }))
);

@Effect()
$resetChanges = this.actions$.pipe(
ofType<SetDefinition>(WizardActionTypes.SET_DEFINITION),
Expand Down
7 changes: 0 additions & 7 deletions ui/src/app/wizard/action/wizard.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ export class Previous implements Action {
constructor(public payload: string) { }
}

export class AddSchema implements Action {
readonly type = WizardActionTypes.ADD_SCHEMA;

constructor(public payload: { id: string, schema: any }) { }
}

export class ClearWizard implements Action {
readonly type = WizardActionTypes.CLEAR;
}
Expand Down Expand Up @@ -102,7 +96,6 @@ export type WizardActionUnion =
| Next
| Previous
| ClearWizard
| AddSchema
| LoadSchemaRequest
| LoadSchemaSuccess
| LoadSchemaFail
Expand Down
1 change: 0 additions & 1 deletion ui/src/app/wizard/reducer/wizard.reducer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as selectors from './wizard.reducer';
import {
WizardActionTypes,
ClearWizard,
AddSchema,
SetDisabled,
SetDefinition,
SetIndex,
Expand Down

0 comments on commit e85b71c

Please sign in to comment.