diff --git a/ui/src/app/metadata/provider/component/provider-wizard-summary.component.html b/ui/src/app/metadata/provider/component/provider-wizard-summary.component.html
new file mode 100644
index 000000000..a60ef4c1e
--- /dev/null
+++ b/ui/src/app/metadata/provider/component/provider-wizard-summary.component.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/ui/src/app/metadata/provider/component/provider-wizard-summary.component.ts b/ui/src/app/metadata/provider/component/provider-wizard-summary.component.ts
new file mode 100644
index 000000000..ad4d6fc68
--- /dev/null
+++ b/ui/src/app/metadata/provider/component/provider-wizard-summary.component.ts
@@ -0,0 +1,83 @@
+import { Component, Input, SimpleChanges, OnChanges, Output, EventEmitter } from '@angular/core';
+import { Store } from '@ngrx/store';
+
+import * as fromProvider from '../reducer';
+import { Wizard, WizardStep } from '../../../wizard/model';
+import { MetadataProvider } from '../../domain/model';
+import { Property } from '../model/property';
+
+interface Section {
+ id: string;
+ index: number;
+ label: string;
+ properties: Property[];
+}
+
+function getStepProperties(schema: any, model: any): Property[] {
+ if (!schema || !schema.properties) { return []; }
+ return Object.keys(schema.properties).map(property => ({
+ name: schema.properties[property].title,
+ value: (model && model.hasOwnProperty(property)) ? model[property] : null,
+ type: schema.properties[property].type,
+ properties: schema.properties ? getStepProperties(
+ schema.properties[property],
+ (model && model.hasOwnProperty(property)) ? model[property] : null
+ ) : []
+ }));
+}
+
+@Component({
+ selector: 'provider-wizard-summary',
+ templateUrl: './provider-wizard-summary.component.html',
+ styleUrls: []
+})
+
+export class ProviderWizardSummaryComponent implements OnChanges {
+ @Input() summary: { definition: Wizard, schema: { [id: string]: any }, model: any };
+
+ @Output() onPageSelect: EventEmitter = new EventEmitter();
+
+ sections: Section[];
+ columns: Array[];
+
+ constructor(
+ private store: Store
+ ) {}
+
+ ngOnChanges(changes: SimpleChanges): void {
+ if (changes.summary && this.summary) {
+ const schemas = this.summary.schema;
+ const model = this.summary.model;
+ const def = this.summary.definition;
+ const steps = def.steps;
+
+ this.sections = steps
+ .filter(step => step.id !== 'summary')
+ .map(
+ (step: WizardStep) => ({
+ id: step.id,
+ index: step.index,
+ label: step.label,
+ properties: getStepProperties(schemas[step.id], def.translate ? def.translate.formatter(model) : model)
+ })
+ );
+
+ this.columns = this.sections.reduce((resultArray, item, index) => {
+ const chunkIndex = Math.floor(index / Math.round(this.sections.length / 2));
+
+ if (!resultArray[chunkIndex]) {
+ resultArray[chunkIndex] = [];
+ }
+
+ resultArray[chunkIndex].push(item);
+
+ return resultArray;
+ }, []);
+ }
+ }
+
+ gotoPage(page: string = ''): void {
+ this.onPageSelect.emit(page);
+ }
+}
+
diff --git a/ui/src/app/metadata/provider/component/summary-property.component.html b/ui/src/app/metadata/provider/component/summary-property.component.html
new file mode 100644
index 000000000..8f4781e47
--- /dev/null
+++ b/ui/src/app/metadata/provider/component/summary-property.component.html
@@ -0,0 +1,18 @@
+
+
+
+
+ {{ property.name }}
+ {{ property.value || '-' }}
+
+
+
+
+ {{ property.name }}
+
+
+
+
+
+
+
diff --git a/ui/src/app/metadata/provider/component/summary-property.component.ts b/ui/src/app/metadata/provider/component/summary-property.component.ts
new file mode 100644
index 000000000..6dbd0c716
--- /dev/null
+++ b/ui/src/app/metadata/provider/component/summary-property.component.ts
@@ -0,0 +1,13 @@
+import { Component, Input } from '@angular/core';
+import { Property } from '../model/property';
+
+@Component({
+ selector: 'summary-property',
+ templateUrl: './summary-property.component.html',
+ styleUrls: []
+})
+
+export class SummaryPropertyComponent {
+ @Input() property: Property;
+}
+
diff --git a/ui/src/app/metadata/provider/container/provider-wizard-step.component.ts b/ui/src/app/metadata/provider/container/provider-wizard-step.component.ts
index 81f57c1eb..962445d30 100644
--- a/ui/src/app/metadata/provider/container/provider-wizard-step.component.ts
+++ b/ui/src/app/metadata/provider/container/provider-wizard-step.component.ts
@@ -6,9 +6,8 @@ import { Store } from '@ngrx/store';
import * as fromProvider from '../reducer';
import * as fromWizard from '../../../wizard/reducer';
-import { SetDisabled, SetDefinition } from '../../../wizard/action/wizard.action';
-import { LoadSchemaRequest, UpdateStatus } from '../action/editor.action';
-import { startWith } from 'rxjs/operators';
+import { SetDefinition } from '../../../wizard/action/wizard.action';
+import { UpdateStatus } from '../action/editor.action';
import { Wizard } from '../../../wizard/model';
import { MetadataProvider } from '../../domain/model';
import { MetadataProviderTypes, MetadataProviderWizard } from '../model';
@@ -36,45 +35,26 @@ export class ProviderWizardStepComponent implements OnDestroy {
constructor(
private store: Store
) {
- this.store
- .select(fromWizard.getCurrentWizardSchema)
- .subscribe(s => {
- this.store.dispatch(new LoadSchemaRequest(s));
- });
-
this.schema$ = this.store.select(fromProvider.getSchema);
- this.valid$ = this.store.select(fromProvider.getEditorIsValid);
this.definition$ = this.store.select(fromWizard.getWizardDefinition);
this.changes$ = this.store.select(fromProvider.getEntityChanges);
- this.valid$
- .pipe(startWith(false))
- .subscribe((valid) => {
- this.store.dispatch(new SetDisabled(!valid));
- });
-
this.model$ = this.schema$.pipe(
withLatestFrom(
this.store.select(fromWizard.getModel),
this.changes$,
this.definition$
),
- map(([schema, model, changes, definition]) => {
- return ({
- model: {
- ...model,
- ...changes
- },
- definition
- });
- }),
- map(({ model, definition }) => {
- return definition.translate ? definition.translate.formatter(model) : model;
- })
+ map(([schema, model, changes, definition]) => ({
+ model: {
+ ...model,
+ ...changes
+ },
+ definition
+ })),
+ map(({ model, definition }) => definition.translate ? definition.translate.formatter(model) : model)
);
- this.schema$.subscribe(s => this.schema = s);
-
this.changeEmitted$.pipe(
withLatestFrom(this.schema$, this.definition$),
map(([changes, schema, definition]) => {
diff --git a/ui/src/app/metadata/provider/container/provider-wizard-summary.component.html b/ui/src/app/metadata/provider/container/provider-wizard-summary.component.html
deleted file mode 100644
index e69de29bb..000000000
diff --git a/ui/src/app/metadata/provider/container/provider-wizard-summary.component.ts b/ui/src/app/metadata/provider/container/provider-wizard-summary.component.ts
deleted file mode 100644
index d16ee2498..000000000
--- a/ui/src/app/metadata/provider/container/provider-wizard-summary.component.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { Component } from '@angular/core';
-import { Store } from '@ngrx/store';
-
-import * as fromProvider from '../reducer';
-
-@Component({
- selector: 'provider-wizard-summary',
- templateUrl: './provider-wizard-summary.component.html',
- styleUrls: []
-})
-
-export class ProviderWizardSummaryComponent {
- constructor(
- private store: Store
- ) {}
-
- save(): void {
- console.log('Save!');
- }
-}
-
diff --git a/ui/src/app/metadata/provider/container/provider-wizard.component.html b/ui/src/app/metadata/provider/container/provider-wizard.component.html
index 2193c7e1d..196081a1f 100644
--- a/ui/src/app/metadata/provider/container/provider-wizard.component.html
+++ b/ui/src/app/metadata/provider/container/provider-wizard.component.html
@@ -1,12 +1,17 @@
diff --git a/ui/src/app/metadata/provider/container/provider-wizard.component.ts b/ui/src/app/metadata/provider/container/provider-wizard.component.ts
index 248efe68b..a9383bd64 100644
--- a/ui/src/app/metadata/provider/container/provider-wizard.component.ts
+++ b/ui/src/app/metadata/provider/container/provider-wizard.component.ts
@@ -1,5 +1,5 @@
import { Component, OnDestroy } from '@angular/core';
-import { Observable } from 'rxjs';
+import { Observable, combineLatest } from 'rxjs';
import { Store } from '@ngrx/store';
import * as fromProvider from '../reducer';
@@ -10,6 +10,8 @@ import { startWith } from 'rxjs/operators';
import { Wizard, WizardStep } from '../../../wizard/model';
import { MetadataProvider } from '../../domain/model';
import { ClearProvider } from '../action/entity.action';
+import { Router, ActivatedRoute } from '@angular/router';
+import { map } from 'rxjs/operators';
@Component({
@@ -19,9 +21,6 @@ import { ClearProvider } from '../action/entity.action';
})
export class ProviderWizardComponent implements OnDestroy {
-
- schema$: Observable;
- schema: any;
definition$: Observable>;
changes$: Observable;
model$: Observable;
@@ -31,8 +30,12 @@ export class ProviderWizardComponent implements OnDestroy {
nextStep: WizardStep;
previousStep: WizardStep;
+ summary$: Observable<{ definition: Wizard, schema: { [id: string]: any }, model: any }>;
+
constructor(
- private store: Store
+ private store: Store,
+ private router: Router,
+ private route: ActivatedRoute
) {
this.store
.select(fromWizard.getCurrentWizardSchema)
@@ -41,8 +44,10 @@ export class ProviderWizardComponent implements OnDestroy {
});
this.valid$ = this.store.select(fromProvider.getEditorIsValid);
this.changes$ = this.store.select(fromProvider.getEntityChanges);
+
this.store.select(fromWizard.getNext).subscribe(n => this.nextStep = n);
this.store.select(fromWizard.getPrevious).subscribe(p => this.previousStep = p);
+ this.store.select(fromWizard.getWizardIndex).subscribe(i => this.currentPage = i);
this.valid$
.pipe(startWith(false))
@@ -50,8 +55,13 @@ export class ProviderWizardComponent implements OnDestroy {
this.store.dispatch(new SetDisabled(!valid));
});
- this.schema$.subscribe(s => this.schema = s);
-
+ this.summary$ = combineLatest(
+ this.store.select(fromWizard.getWizardDefinition),
+ this.store.select(fromWizard.getSchemaCollection),
+ this.store.select(fromProvider.getEntityChanges)
+ ).pipe(
+ map(([ definition, schema, model ]) => ({ definition, schema, model }))
+ );
}
ngOnDestroy() {
@@ -73,5 +83,9 @@ export class ProviderWizardComponent implements OnDestroy {
save(): void {
console.log('Save!');
}
+
+ gotoPage(page: string): void {
+ this.store.dispatch(new SetIndex(page));
+ }
}
diff --git a/ui/src/app/metadata/provider/container/provider.component.ts b/ui/src/app/metadata/provider/container/provider.component.ts
index c2955ca7a..afaf48a27 100644
--- a/ui/src/app/metadata/provider/container/provider.component.ts
+++ b/ui/src/app/metadata/provider/container/provider.component.ts
@@ -1,10 +1,5 @@
import { Component } from '@angular/core';
-import { FormGroup, Validators, FormBuilder } from '@angular/forms';
import { Store } from '@ngrx/store';
-import { ActivatedRoute } from '@angular/router';
-
-
-import { MetadataProviderTypes } from '../model';
import * as fromProvider from '../reducer';
import { SetDefinition, SetIndex } from '../../../wizard/action/wizard.action';
@@ -16,10 +11,7 @@ import { MetadataProviderWizard } from '../model';
styleUrls: []
})
export class ProviderComponent {
- types = MetadataProviderTypes;
-
constructor(
- private fb: FormBuilder,
private store: Store
) {
this.store.dispatch(new SetDefinition(MetadataProviderWizard));
diff --git a/ui/src/app/metadata/provider/effect/editor.effect.ts b/ui/src/app/metadata/provider/effect/editor.effect.ts
index 7fc04f3bc..bbf1bcc48 100644
--- a/ui/src/app/metadata/provider/effect/editor.effect.ts
+++ b/ui/src/app/metadata/provider/effect/editor.effect.ts
@@ -8,11 +8,14 @@ import {
LoadSchemaFail,
EditorActionTypes
} from '../action/editor.action';
-import { map, switchMap, catchError } from 'rxjs/operators';
+import { map, switchMap, catchError, withLatestFrom } from 'rxjs/operators';
import { of } from 'rxjs';
-import { SetDefinition, WizardActionTypes } from '../../../wizard/action/wizard.action';
+import { SetDefinition, WizardActionTypes, AddSchema } from '../../../wizard/action/wizard.action';
import { ResetChanges } from '../action/entity.action';
+import * as fromWizard from '../../../wizard/reducer';
+import { Store } from '@ngrx/store';
+
@Injectable()
export class EditorEffects {
@@ -30,6 +33,14 @@ export class EditorEffects {
)
);
+ @Effect()
+ $loadSchemaSuccess = this.actions$.pipe(
+ ofType(EditorActionTypes.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(WizardActionTypes.SET_DEFINITION),
@@ -38,6 +49,7 @@ export class EditorEffects {
constructor(
private schemaService: SchemaService,
+ private store: Store,
private actions$: Actions
) { }
} /* istanbul ignore next */
diff --git a/ui/src/app/metadata/provider/model/file-backed-http.provider.form.ts b/ui/src/app/metadata/provider/model/file-backed-http.provider.form.ts
index 9b31fa220..d4bfd143d 100644
--- a/ui/src/app/metadata/provider/model/file-backed-http.provider.form.ts
+++ b/ui/src/app/metadata/provider/model/file-backed-http.provider.form.ts
@@ -5,27 +5,27 @@ export const FileBackedHttpMetadataProviderWizard: Wizard ({
- ...changes,
- metadataFilters: [
- ...Object.keys(changes.metadataFilters || {}).reduce((collection, filterName) => ([
- ...collection,
- {
- ...changes.metadataFilters[filterName],
- '@type': filterName
- }
- ]), [])
- ]
- }),
- formatter: (changes) => ({
- ...changes,
- metadataFilters: {
- ...(changes.metadataFilters || []).reduce((collection, filter) => ({
- ...collection,
- [filter['@type']]: filter
- }), {})
- }
- })
+ parser: (changes) => changes.metadataFilters ? ({
+ ...changes,
+ metadataFilters: [
+ ...Object.keys(changes.metadataFilters).reduce((collection, filterName) => ([
+ ...collection,
+ {
+ ...changes.metadataFilters[filterName],
+ '@type': filterName
+ }
+ ]), [])
+ ]
+ }) : changes,
+ formatter: (changes) => changes.metadataFilters ? ({
+ ...changes,
+ metadataFilters: {
+ ...(changes.metadataFilters || []).reduce((collection, filter) => ({
+ ...collection,
+ [filter['@type']]: filter
+ }), {})
+ }
+ }) : changes
},
steps: [
{
@@ -50,6 +50,13 @@ export const FileBackedHttpMetadataProviderWizard: Wizard
-
\ No newline at end of file
diff --git a/ui/src/app/wizard/action/wizard.action.ts b/ui/src/app/wizard/action/wizard.action.ts
index 55bb9b404..ecb507cb4 100644
--- a/ui/src/app/wizard/action/wizard.action.ts
+++ b/ui/src/app/wizard/action/wizard.action.ts
@@ -7,6 +7,8 @@ export enum WizardActionTypes {
UPDATE_DEFINITION = '[Wizard] Update Definition',
SET_DISABLED = '[Wizard] Set Disabled',
+ ADD_SCHEMA = '[Wizard] Add Schema',
+
NEXT = '[Wizard] Next Page',
PREVIOUS = '[Wizard] Previous Page',
@@ -49,6 +51,12 @@ 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;
}
@@ -60,4 +68,5 @@ export type WizardActionUnion =
| SetDisabled
| Next
| Previous
- | ClearWizard;
+ | ClearWizard
+ | AddSchema;
diff --git a/ui/src/app/wizard/component/wizard.component.html b/ui/src/app/wizard/component/wizard.component.html
index e5921c6ac..a4ae2b75c 100644
--- a/ui/src/app/wizard/component/wizard.component.html
+++ b/ui/src/app/wizard/component/wizard.component.html
@@ -8,21 +8,26 @@
Back
- {{ (previous$ | async).index }}. {{ (previous$ | async).label }}
+ {{ (previous$ | async).index }}.
+ {{ (previous$ | async).label }}
- {{ (current$ | async).index }}
- {{ (current$ | async).index }}. {{ (current$ | async).label }}
+ {{ (current$ | async).index }}
+
+ {{ (current$ | async).index }}.
+
+ {{ (current$ | async).label }}
-
-
-
diff --git a/ui/src/app/wizard/component/wizard.component.ts b/ui/src/app/wizard/component/wizard.component.ts
index 5ab006519..da9cdafb0 100644
--- a/ui/src/app/wizard/component/wizard.component.ts
+++ b/ui/src/app/wizard/component/wizard.component.ts
@@ -13,6 +13,7 @@ import { Observable } from 'rxjs';
export class WizardComponent implements OnChanges {
@Output() onNext = new EventEmitter();
@Output() onPrevious = new EventEmitter();
+ @Output() onLast = new EventEmitter();
@Output() onSave = new EventEmitter();
currentPage: any = {};
diff --git a/ui/src/app/wizard/reducer/index.ts b/ui/src/app/wizard/reducer/index.ts
index bde6660fb..bbf53caf4 100644
--- a/ui/src/app/wizard/reducer/index.ts
+++ b/ui/src/app/wizard/reducer/index.ts
@@ -22,6 +22,7 @@ export const getState = createSelector(getWizardState, getWizardStateFn);
export const getWizardIndex = createSelector(getState, fromWizard.getIndex);
export const getWizardIsDisabled = createSelector(getState, fromWizard.getDisabled);
export const getWizardDefinition = createSelector(getState, fromWizard.getDefinition);
+export const getSchemaCollection = createSelector(getState, fromWizard.getCollection);
export const getSchema = (index: string, wizard: Wizard) => {
const step = wizard.steps.find(s => s.id === index);
@@ -63,4 +64,3 @@ export const getCurrent = createSelector(getWizardIndex, getWizardDefinition, ge
export const getNext = createSelector(getWizardIndex, getWizardDefinition, getNextFn);
export const getLast = createSelector(getWizardIndex, getWizardDefinition, getLastFn);
export const getModel = createSelector(getCurrent, getModelFn);
-
diff --git a/ui/src/app/wizard/reducer/wizard.reducer.ts b/ui/src/app/wizard/reducer/wizard.reducer.ts
index de40f86a3..9ecae96ce 100644
--- a/ui/src/app/wizard/reducer/wizard.reducer.ts
+++ b/ui/src/app/wizard/reducer/wizard.reducer.ts
@@ -5,16 +5,27 @@ export interface State {
index: string;
disabled: boolean;
definition: Wizard;
+ schemaCollection: { [id: string]: any };
}
export const initialState: State = {
index: null,
disabled: false,
- definition: null
+ definition: null,
+ schemaCollection: {}
};
export function reducer(state = initialState, action: WizardActionUnion): State {
switch (action.type) {
+ case WizardActionTypes.ADD_SCHEMA: {
+ return {
+ ...state,
+ schemaCollection: {
+ ...state.schemaCollection,
+ [action.payload.id]: action.payload.schema
+ }
+ };
+ }
case WizardActionTypes.SET_DISABLED: {
return {
...state,
@@ -56,3 +67,4 @@ export function reducer(state = initialState, action: WizardActionUnion): State
export const getIndex = (state: State) => state.index;
export const getDisabled = (state: State) => state.disabled;
export const getDefinition = (state: State) => state.definition;
+export const getCollection = (state: State) => state.schemaCollection;
diff --git a/ui/src/assets/schema/provider/metadata-provider-summary.schema.json b/ui/src/assets/schema/provider/metadata-provider-summary.schema.json
new file mode 100644
index 000000000..b3cc3b73c
--- /dev/null
+++ b/ui/src/assets/schema/provider/metadata-provider-summary.schema.json
@@ -0,0 +1,11 @@
+{
+ "type": "object",
+ "properties": {
+ "enabled": {
+ "title": "Enable Metadata Provider",
+ "description": "Enable Metadata Provider",
+ "type": "boolean",
+ "default": true
+ }
+ }
+}
\ No newline at end of file