diff --git a/ui/src/app/metadata/domain/component/wizard-summary.component.html b/ui/src/app/metadata/domain/component/wizard-summary.component.html
deleted file mode 100644
index 349f7cb74..000000000
--- a/ui/src/app/metadata/domain/component/wizard-summary.component.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ui/src/app/metadata/domain/component/wizard-summary.component.spec.ts b/ui/src/app/metadata/domain/component/wizard-summary.component.spec.ts
deleted file mode 100644
index 43712bd48..000000000
--- a/ui/src/app/metadata/domain/component/wizard-summary.component.spec.ts
+++ /dev/null
@@ -1,103 +0,0 @@
-import { Component, ViewChild } from '@angular/core';
-import { TestBed, async, ComponentFixture } from '@angular/core/testing';
-import { RouterTestingModule } from '@angular/router/testing';
-
-import { NgbDropdownModule, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap';
-
-import { WizardSummaryComponent } from './wizard-summary.component';
-import { SchemaFormModule, WidgetRegistry, DefaultWidgetRegistry } from 'ngx-schema-form';
-import { Wizard } from '../../../wizard/model';
-import { MetadataProvider } from '../../domain/model';
-import { SummaryPropertyComponent } from './summary-property.component';
-import { SCHEMA } from '../../../../testing/form-schema.stub';
-import { MockI18nModule } from '../../../../testing/i18n.stub';
-import { MetadataProviderWizard } from '../../provider/model';
-import { AttributesService } from '../service/attributes.service';
-import { MockAttributeService } from '../../../../testing/attributes.stub';
-
-@Component({
- template: `
-
- `
-})
-class TestHostComponent {
- @ViewChild(WizardSummaryComponent)
- public componentUnderTest: WizardSummaryComponent;
-
- private _summary;
-
- get summary(): { definition: Wizard, schema: { [id: string]: any }, model: any } {
- return this._summary;
- }
-
- set summary(summary: { definition: Wizard, schema: { [id: string]: any }, model: any }) {
- this._summary = summary;
- }
-}
-
-describe('Wizard Summary Component', () => {
-
- let fixture: ComponentFixture;
- let instance: TestHostComponent;
- let app: WizardSummaryComponent;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- imports: [
- NgbDropdownModule,
- NgbPopoverModule,
- RouterTestingModule,
- SchemaFormModule.forRoot(),
- MockI18nModule
- ],
- declarations: [
- WizardSummaryComponent,
- SummaryPropertyComponent,
- TestHostComponent
- ],
- providers: [
- { provide: WidgetRegistry, useClass: DefaultWidgetRegistry },
- { provide: AttributesService, useClass: MockAttributeService }
- ]
- }).compileComponents();
-
- fixture = TestBed.createComponent(TestHostComponent);
- instance = fixture.componentInstance;
- app = instance.componentUnderTest;
- fixture.detectChanges();
- }));
-
- it('should instantiate the component', async(() => {
- expect(app).toBeTruthy();
- }));
-
- describe('gotoPage function', () => {
- it('should emit an empty string if page is null', () => {
- spyOn(app.onPageSelect, 'emit');
- app.gotoPage();
- expect(app.onPageSelect.emit).toHaveBeenCalledWith('');
- });
-
- it('should emit the provided page', () => {
- spyOn(app.onPageSelect, 'emit');
- app.gotoPage('foo');
- expect(app.onPageSelect.emit).toHaveBeenCalledWith('foo');
- });
- });
-
- describe('ngOnChanges', () => {
- it('should set columns and sections if summary is provided', () => {
- instance.summary = {
- model: {
- name: 'foo',
- '@type': 'MetadataProvider'
- },
- schema: SCHEMA,
- definition: MetadataProviderWizard
- };
- fixture.detectChanges();
- expect(app.sections).toBeDefined();
- expect(app.columns).toBeDefined();
- });
- });
-});
diff --git a/ui/src/app/metadata/domain/component/wizard-summary.component.ts b/ui/src/app/metadata/domain/component/wizard-summary.component.ts
deleted file mode 100644
index 73a701491..000000000
--- a/ui/src/app/metadata/domain/component/wizard-summary.component.ts
+++ /dev/null
@@ -1,80 +0,0 @@
-import { Component, Input, SimpleChanges, OnChanges, Output, EventEmitter } from '@angular/core';
-
-import { Wizard, WizardStep } from '../../../wizard/model';
-import { MetadataProvider, MetadataResolver } from '../../domain/model';
-import { Property } from '../model/property';
-import { getSplitSchema } from '../../../wizard/reducer';
-import { getStepProperties } from '../utility/configuration';
-
-interface Section {
- id: string;
- index: number;
- label: string;
- pageNumber: number;
- properties: Property[];
-}
-
-@Component({
- selector: 'wizard-summary',
- templateUrl: './wizard-summary.component.html',
- styleUrls: []
-})
-
-export class WizardSummaryComponent implements OnChanges {
- @Input() summary: { definition: Wizard, schema: { [id: string]: any }, model: any };
-
- @Output() onPageSelect: EventEmitter = new EventEmitter();
-
- sections: Section[];
- columns: Array[];
- steps: WizardStep[];
-
- constructor() { }
-
- ngOnChanges(changes: SimpleChanges): void {
- if (changes.summary && this.summary) {
- const schema = 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, num: number) => {
- const { id, index, label } = step;
- const split = getSplitSchema(schema, step);
- const properties = getStepProperties(
- split,
- def.formatter(model),
- schema.definitions || {}
- );
- return ({
- id,
- pageNumber: num + 1,
- index,
- label,
- properties
- });
- }
- );
-
- 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/domain/domain.module.ts b/ui/src/app/metadata/domain/domain.module.ts
index 49e1fe685..b109734a6 100644
--- a/ui/src/app/metadata/domain/domain.module.ts
+++ b/ui/src/app/metadata/domain/domain.module.ts
@@ -22,10 +22,8 @@ import { UnsavedEntityComponent } from './component/unsaved-entity.dialog';
import { EditorNavComponent } from './component/editor-nav.component';
import { RouterModule } from '@angular/router';
import { SharedModule } from '../../shared/shared.module';
-import { WizardSummaryComponent } from './component/wizard-summary.component';
export const COMPONENTS = [
- WizardSummaryComponent,
PreviewDialogComponent,
UnsavedEntityComponent,
SummaryPropertyComponent,
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 366bb70d5..52d6f5e35 100644
--- a/ui/src/app/metadata/provider/container/provider-wizard.component.html
+++ b/ui/src/app/metadata/provider/container/provider-wizard.component.html
@@ -19,11 +19,12 @@
-
-
+
+
+
diff --git a/ui/src/app/metadata/provider/container/provider-wizard.component.spec.ts b/ui/src/app/metadata/provider/container/provider-wizard.component.spec.ts
index 5bba916d4..1dc620637 100644
--- a/ui/src/app/metadata/provider/container/provider-wizard.component.spec.ts
+++ b/ui/src/app/metadata/provider/container/provider-wizard.component.spec.ts
@@ -8,10 +8,10 @@ import { NgbDropdownModule, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'
import { ProviderWizardComponent } from './provider-wizard.component';
import * as fromRoot from '../reducer';
import { WizardModule } from '../../../wizard/wizard.module';
-import { WizardSummaryComponent } from '../../domain/component/wizard-summary.component';
import { SummaryPropertyComponent } from '../../domain/component/summary-property.component';
import * as fromWizard from '../../../wizard/reducer';
import { MockI18nModule } from '../../../../testing/i18n.stub';
+import { MetadataConfigurationComponentStub } from '../../../../testing/metadata-configuration.stub';
@Component({
template: `
@@ -46,7 +46,7 @@ describe('Provider Wizard Component', () => {
declarations: [
ProviderWizardComponent,
SummaryPropertyComponent,
- WizardSummaryComponent,
+ MetadataConfigurationComponentStub,
TestHostComponent
]
}).compileComponents();
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 e812527d5..c17ae03f2 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, combineLatest, Subject } from 'rxjs';
+import { Observable, Subject } from 'rxjs';
import { Store } from '@ngrx/store';
import * as fromProvider from '../reducer';
@@ -11,9 +11,9 @@ import { startWith, takeUntil } from 'rxjs/operators';
import { Wizard, WizardStep } from '../../../wizard/model';
import { MetadataProvider } from '../../domain/model';
import { ClearProvider } from '../action/entity.action';
-import { map } from 'rxjs/operators';
import { AddProviderRequest } from '../action/collection.action';
import { MetadataProviderWizard } from '../model';
+import { MetadataConfiguration } from '../../configuration/model/metadata-configuration';
@Component({
selector: 'provider-wizard',
@@ -33,7 +33,7 @@ export class ProviderWizardComponent implements OnDestroy {
nextStep: WizardStep;
previousStep: WizardStep;
- summary$: Observable<{ definition: Wizard, schema: { [id: string]: any }, model: any }>;
+ summary$: Observable = this.store.select(fromProvider.getProviderConfiguration);
provider: MetadataProvider;
@@ -61,14 +61,6 @@ export class ProviderWizardComponent implements OnDestroy {
this.store.dispatch(new SetDisabled(!valid));
});
- this.summary$ = combineLatest(
- this.store.select(fromWizard.getWizardDefinition),
- this.store.select(fromWizard.getParsedSchema),
- this.store.select(fromProvider.getEntityChanges)
- ).pipe(
- map(([ definition, schema, model ]) => ({ definition, schema, model }))
- );
-
this.changes$.pipe(takeUntil(this.ngUnsubscribe)).subscribe(c => this.provider = c);
this.store.dispatch(new SetDefinition(MetadataProviderWizard));
diff --git a/ui/src/app/metadata/provider/provider.module.ts b/ui/src/app/metadata/provider/provider.module.ts
index 99e033e74..a8580f23e 100644
--- a/ui/src/app/metadata/provider/provider.module.ts
+++ b/ui/src/app/metadata/provider/provider.module.ts
@@ -27,6 +27,7 @@ import { I18nModule } from '../../i18n/i18n.module';
import { DomainModule } from '../domain/domain.module';
import { MetadataProviderPageComponent } from './provider.component';
import { FilterModule } from '../filter/filter.module';
+import { MetadataConfigurationModule } from '../configuration/configuration.module';
@NgModule({
declarations: [
@@ -55,7 +56,8 @@ import { FilterModule } from '../filter/filter.module';
NgbModalModule,
I18nModule,
DomainModule,
- FilterModule
+ FilterModule,
+ MetadataConfigurationModule
],
exports: []
})
diff --git a/ui/src/app/metadata/provider/reducer/index.ts b/ui/src/app/metadata/provider/reducer/index.ts
index 8005d63e9..ce8a2813e 100644
--- a/ui/src/app/metadata/provider/reducer/index.ts
+++ b/ui/src/app/metadata/provider/reducer/index.ts
@@ -8,6 +8,7 @@ import * as utils from '../../domain/domain.util';
import * as fromWizard from '../../../wizard/reducer';
import { MetadataProvider } from '../../domain/model';
+import { getConfigurationSectionsFn } from '../../configuration/reducer/utilities';
export interface ProviderState {
editor: fromEditor.EditorState;
@@ -79,3 +80,12 @@ export const getOrderedProviders = createSelector(getAllProviders, getProviderOr
export const getOrderedProvidersInSearch = createSelector(getAllProviders, getProviderOrder, utils.mergeOrderFn);
export const getFilteredProviderXmlIds = createSelector(getProviderXmlIds, getSelectedProvider, getFilteredListFn('xmlId'));
+
+export const getProviderModelList = createSelector(getEntityChanges, (model) => [model]);
+
+export const getProviderConfiguration = createSelector(
+ getProviderModelList,
+ fromWizard.getWizardDefinition,
+ fromWizard.getProcessedSchema,
+ getConfigurationSectionsFn
+);