-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
265 additions
and
137 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
ui/src/app/metadata/provider/component/provider-wizard-summary.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div class="row"> | ||
<div class="col-xl-6 col-xs-12" *ngFor="let sections of columns"> | ||
<section class="px-3" *ngFor="let section of sections; let i = index;"> | ||
<button (click)="gotoPage(section.id)" class="tag tag-success tag-sm my-4 text-left" [attr.aria-label]="section.label" role="button"> | ||
<span class="index">{{ section.index }}</span> | ||
<ng-container>{{ section.label }}</ng-container> | ||
</button> | ||
<ng-container *ngFor="let prop of section.properties"> | ||
<summary-property [property]="prop"></summary-property> | ||
</ng-container> | ||
</section> | ||
</div> | ||
</div> |
83 changes: 83 additions & 0 deletions
83
ui/src/app/metadata/provider/component/provider-wizard-summary.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<MetadataProvider>, schema: { [id: string]: any }, model: any }; | ||
|
||
@Output() onPageSelect: EventEmitter<string> = new EventEmitter(); | ||
|
||
sections: Section[]; | ||
columns: Array<Section>[]; | ||
|
||
constructor( | ||
private store: Store<fromProvider.ProviderState> | ||
) {} | ||
|
||
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); | ||
} | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
ui/src/app/metadata/provider/component/summary-property.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<div role="listitem" class="mb-3" *ngIf="property"> | ||
<ng-container [ngSwitch]="property.type"> | ||
<ng-container *ngSwitchDefault> | ||
<ng-container *ngIf="property.name"> | ||
<strong class="text-primary d-block" role="term">{{ property.name }}</strong> | ||
<span class="d-block" role="definition">{{ property.value || '-' }}</span> | ||
</ng-container> | ||
</ng-container> | ||
<ng-container *ngSwitchCase="'object'"> | ||
<ng-container *ngIf="property.name"> | ||
<span class="text-primary d-block" role="term">{{ property.name }}</span> | ||
</ng-container> | ||
<ng-container *ngIf="property.properties"> | ||
<summary-property *ngFor="let prop of property.properties" [property]="prop"></summary-property> | ||
</ng-container> | ||
</ng-container> | ||
</ng-container> | ||
</div> |
13 changes: 13 additions & 0 deletions
13
ui/src/app/metadata/provider/component/summary-property.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
21 changes: 0 additions & 21 deletions
21
ui/src/app/metadata/provider/container/provider-wizard-summary.component.ts
This file was deleted.
Oops, something went wrong.
13 changes: 9 additions & 4 deletions
13
ui/src/app/metadata/provider/container/provider-wizard.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
<div class="container-fluid p-3" role="main"> | ||
<wizard (onNext)="next()" (onPrevious)="previous()" (onSave)="save()"></wizard> | ||
<wizard | ||
(onNext)="next()" | ||
(onPrevious)="previous()" | ||
(onSave)="save()"></wizard> | ||
<hr /> | ||
<div class="row"> | ||
<div class="col col-xl-6 col-lg-9 col-xs-12"> | ||
<router-outlet></router-outlet> | ||
</div> | ||
<!--<div class="col col-xl-6 col-lg-9 col-xs-12"> | ||
<code class="bg-light border rounded p-4 d-block"><pre>{{ changes$ | async | json }}</pre></code> | ||
</div>--> | ||
</div> | ||
<provider-wizard-summary | ||
[summary]="summary$ | async" | ||
(onPageSelect)="gotoPage($event)" | ||
*ngIf="currentPage === 'summary'"> | ||
</provider-wizard-summary> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.