-
-
{{ property.name }}
-
—
-
+
+
{{ property.name }}
+
+ -
+ 0">
+ - 1}">
+ 0 && isUrl(item)">
+
+
+ {{ item }}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ui/src/app/metadata/configuration/component/configuration-property.component.html b/ui/src/app/metadata/configuration/component/array-property.component.scss
similarity index 100%
rename from ui/src/app/metadata/configuration/component/configuration-property.component.html
rename to ui/src/app/metadata/configuration/component/array-property.component.scss
diff --git a/ui/src/app/metadata/configuration/component/array-property.component.spec.ts b/ui/src/app/metadata/configuration/component/array-property.component.spec.ts
index 453d9d484..614738b06 100644
--- a/ui/src/app/metadata/configuration/component/array-property.component.spec.ts
+++ b/ui/src/app/metadata/configuration/component/array-property.component.spec.ts
@@ -21,12 +21,12 @@ class TestHostComponent {
@ViewChild(ArrayPropertyComponent)
public componentUnderTest: ArrayPropertyComponent;
- property: Property = getStepProperty(SCHEMA.properties.list, {
+ property: Property = getStepProperty(SCHEMA.properties.list, [{
name: 'foo',
type: 'baz',
description: 'foo bar baz',
list: []
- }, SCHEMA.definitions);
+ }], SCHEMA.definitions);
setProperty(property: Property): void {
this.property = property;
diff --git a/ui/src/app/metadata/configuration/component/array-property.component.ts b/ui/src/app/metadata/configuration/component/array-property.component.ts
index ff9cd0ac4..a17ad01da 100644
--- a/ui/src/app/metadata/configuration/component/array-property.component.ts
+++ b/ui/src/app/metadata/configuration/component/array-property.component.ts
@@ -1,24 +1,38 @@
-import { Component, Input } from '@angular/core';
+import { Component, Input, OnChanges, Output, EventEmitter } from '@angular/core';
import { Property } from '../../domain/model/property';
import { Observable, of } from 'rxjs';
import { AttributesService } from '../../domain/service/attributes.service';
import { ConfigurationPropertyComponent } from './configuration-property.component';
+import UriValidator from '../../../shared/validation/uri.validator';
@Component({
selector: 'array-property',
templateUrl: './array-property.component.html',
- styleUrls: []
+ styleUrls: ['./array-property.component.scss']
})
-export class ArrayPropertyComponent extends ConfigurationPropertyComponent {
+export class ArrayPropertyComponent extends ConfigurationPropertyComponent implements OnChanges {
@Input() property: Property;
+ @Output() preview: EventEmitter
= new EventEmitter();
+
+ range = [];
+
constructor(
private attrService: AttributesService
) {
super();
}
+ ngOnChanges(): void {
+ const keys = this.property.value.reduce((val, version) => version ? version.length > val ? version.length : val : val, 0);
+ this.range = [...Array(keys).keys()];
+ }
+
+ isUrl(str: string): boolean {
+ return UriValidator.isUri(str);
+ }
+
get attributeList$(): Observable<{ key: string, label: string }[]> {
if (this.property.widget && this.property.widget.hasOwnProperty('data')) {
return of(this.property.widget.data);
diff --git a/ui/src/app/metadata/configuration/component/configuration-property.component.spec.ts b/ui/src/app/metadata/configuration/component/configuration-property.component.spec.ts
index 5ef0452e0..aa7fd9478 100644
--- a/ui/src/app/metadata/configuration/component/configuration-property.component.spec.ts
+++ b/ui/src/app/metadata/configuration/component/configuration-property.component.spec.ts
@@ -62,7 +62,8 @@ describe('Configuration Property Component', () => {
describe('getItemType method', () => {
it('should return the item`s type', () => {
- expect(app.getItemType({ widget: { id: 'string' } } as Property)).toBe('string');
+ expect(app.getItemType({items: { widget: { id: 'string' } } } as Property)).toBe('string');
+ expect(app.getItemType({items: {}} as Property)).toBe('default');
expect(app.getItemType({} as Property)).toBe('default');
});
});
diff --git a/ui/src/app/metadata/configuration/component/configuration-property.component.ts b/ui/src/app/metadata/configuration/component/configuration-property.component.ts
index bcdd45711..5418bde30 100644
--- a/ui/src/app/metadata/configuration/component/configuration-property.component.ts
+++ b/ui/src/app/metadata/configuration/component/configuration-property.component.ts
@@ -3,12 +3,12 @@ import { Property } from '../../domain/model/property';
@Component({
selector: 'configuration-property',
- template: `{{ property | json }}`,
- styleUrls: []
+ template: `{{ property | json }}`
})
export class ConfigurationPropertyComponent {
@Input() property: Property;
+ @Input() columns = 1;
constructor() { }
@@ -16,8 +16,14 @@ export class ConfigurationPropertyComponent {
return Object.keys(schema.properties);
}
- getItemType(items: Property): string {
- return items.widget ? items.widget.id : 'default';
+ getItemType(property: Property): string {
+ const items = property.items;
+ const def = 'default';
+ return items ? items.widget ? items.widget.id : def : def;
+ }
+
+ get width(): string {
+ return `${ Math.floor(100 / (this.columns + 1)) }%`;
}
}
diff --git a/ui/src/app/metadata/configuration/component/filter-configuration-list-item.component.html b/ui/src/app/metadata/configuration/component/filter-configuration-list-item.component.html
new file mode 100644
index 000000000..b8df62a11
--- /dev/null
+++ b/ui/src/app/metadata/configuration/component/filter-configuration-list-item.component.html
@@ -0,0 +1,47 @@
+
+
{{ index + 1 }}
+
+
+
+
+
+
{{ filter['@type'] }}
+
+ Enabled
+ Disabled
+
+
+
+
+
+
+
+
+ Edit
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ui/src/app/metadata/configuration/component/filter-configuration-list-item.component.ts b/ui/src/app/metadata/configuration/component/filter-configuration-list-item.component.ts
new file mode 100644
index 000000000..ede42a55a
--- /dev/null
+++ b/ui/src/app/metadata/configuration/component/filter-configuration-list-item.component.ts
@@ -0,0 +1,52 @@
+import { Component, Input, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
+import { Store } from '@ngrx/store';
+import { MetadataFilter } from '../../domain/model';
+import { MetadataConfigurationService } from '../service/configuration.service';
+import { MetadataConfiguration } from '../model/metadata-configuration';
+import { PreviewEntity } from '../../domain/action/entity.action';
+import { Metadata } from '../../domain/domain.type';
+import * as fromRoot from '../../../app.reducer';
+
+@Component({
+ selector: 'filter-configuration-list-item',
+ templateUrl: './filter-configuration-list-item.component.html'
+})
+export class FilterConfigurationListItemComponent implements OnChanges {
+ @Input() filter: MetadataFilter;
+ @Input() index: number;
+ @Input() isFirst: boolean;
+ @Input() isLast: boolean;
+
+ @Output() onUpdateOrderUp: EventEmitter = new EventEmitter();
+ @Output() onUpdateOrderDown: EventEmitter = new EventEmitter();
+ @Output() onRemove: EventEmitter = new EventEmitter();
+
+ open = false;
+ configuration: MetadataConfiguration;
+ definition: any;
+
+ constructor(
+ private configService: MetadataConfigurationService,
+ private store: Store
+ ) {}
+
+ onPreview($event: { data: any, parent: Metadata }): void {
+ this.store.dispatch(new PreviewEntity({
+ id: $event.data,
+ entity: this.definition.getEntity($event.parent)
+ }));
+ }
+
+ ngOnChanges(changes: SimpleChanges): void {
+ if (changes.filter) {
+ this.definition = this.configService.getDefinition(this.filter['@type']);
+ this.configService.loadSchema(this.definition.schema).subscribe(schema => {
+ this.configuration = this.configService.getMetadataConfiguration(
+ this.filter,
+ this.definition,
+ schema
+ );
+ });
+ }
+ }
+}
diff --git a/ui/src/app/metadata/configuration/component/filter-configuration-list.component.html b/ui/src/app/metadata/configuration/component/filter-configuration-list.component.html
new file mode 100644
index 000000000..c49a7738c
--- /dev/null
+++ b/ui/src/app/metadata/configuration/component/filter-configuration-list.component.html
@@ -0,0 +1,17 @@
+
+
+
No Filters
+
No filters have been added to this Metadata Provider
+
\ No newline at end of file
diff --git a/ui/src/app/metadata/configuration/component/filter-configuration-list.component.ts b/ui/src/app/metadata/configuration/component/filter-configuration-list.component.ts
new file mode 100644
index 000000000..5208a7f4c
--- /dev/null
+++ b/ui/src/app/metadata/configuration/component/filter-configuration-list.component.ts
@@ -0,0 +1,8 @@
+import { Component } from '@angular/core';
+import { FilterListComponent } from '../../filter/component/filter-list.component';
+
+@Component({
+ selector: 'filter-configuration-list',
+ templateUrl: './filter-configuration-list.component.html'
+})
+export class FilterConfigurationListComponent extends FilterListComponent { }
diff --git a/ui/src/app/metadata/configuration/component/filter-target-property.component.html b/ui/src/app/metadata/configuration/component/filter-target-property.component.html
new file mode 100644
index 000000000..f8bfbb5c8
--- /dev/null
+++ b/ui/src/app/metadata/configuration/component/filter-target-property.component.html
@@ -0,0 +1,9 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ui/src/app/metadata/configuration/component/filter-target-property.component.spec.ts b/ui/src/app/metadata/configuration/component/filter-target-property.component.spec.ts
new file mode 100644
index 000000000..98c08d4c4
--- /dev/null
+++ b/ui/src/app/metadata/configuration/component/filter-target-property.component.spec.ts
@@ -0,0 +1,66 @@
+import { Component, ViewChild } from '@angular/core';
+import { TestBed, async, ComponentFixture } from '@angular/core/testing';
+import { RouterTestingModule } from '@angular/router/testing';
+
+import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap';
+import { Property } from '../../domain/model/property';
+import { MockI18nModule } from '../../../../testing/i18n.stub';
+import { SCHEMA } from '../../../../testing/form-schema.stub';
+import { getStepProperty } from '../../domain/utility/configuration';
+import { FilterTargetPropertyComponent } from './filter-target-property.component';
+import { PrimitivePropertyComponent } from './primitive-property.component';
+import { ArrayPropertyComponentStub, PrimitivePropertyComponentStub } from '../../../../testing/property-component.stub';
+import { AttributesService } from '../../domain/service/attributes.service';
+import { of } from 'rxjs';
+
+@Component({
+ template: `
+
+ `
+})
+class TestHostComponent {
+ @ViewChild(FilterTargetPropertyComponent)
+ public componentUnderTest: FilterTargetPropertyComponent;
+
+ property: Property = getStepProperty(SCHEMA.properties.formatFilterTarget, {
+ formatFilterTargetType: 'ENTITY_ID',
+ value: [
+ 'foo',
+ 'bar',
+ 'baz'
+ ]
+ }, SCHEMA.definitions);
+}
+
+describe('Filter Target Property Component', () => {
+
+ let fixture: ComponentFixture;
+ let instance: TestHostComponent;
+ let app: FilterTargetPropertyComponent;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ imports: [
+ NgbPopoverModule,
+ MockI18nModule,
+ RouterTestingModule
+ ],
+ declarations: [
+ FilterTargetPropertyComponent,
+ PrimitivePropertyComponentStub,
+ ArrayPropertyComponentStub,
+ TestHostComponent
+ ],
+ providers: []
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(TestHostComponent);
+ instance = fixture.componentInstance;
+ app = instance.componentUnderTest;
+ fixture.detectChanges();
+ }));
+
+ it('should accept a property input', async(() => {
+ expect(app).toBeTruthy();
+ }));
+});
diff --git a/ui/src/app/metadata/configuration/component/filter-target-property.component.ts b/ui/src/app/metadata/configuration/component/filter-target-property.component.ts
new file mode 100644
index 000000000..6b7ebf216
--- /dev/null
+++ b/ui/src/app/metadata/configuration/component/filter-target-property.component.ts
@@ -0,0 +1,26 @@
+import { Component, Input, Output, EventEmitter } from '@angular/core';
+import { Property } from '../../domain/model/property';
+import { ConfigurationPropertyComponent } from './configuration-property.component';
+
+@Component({
+ selector: 'filter-target-property',
+ templateUrl: './filter-target-property.component.html',
+ styleUrls: []
+})
+export class FilterTargetPropertyComponent extends ConfigurationPropertyComponent {
+ @Input() parent: Property;
+
+ @Output() preview: EventEmitter = new EventEmitter();
+
+ constructor() {
+ super();
+ }
+
+ onPreview(data: any) {
+ this.preview.emit({
+ parent: this.parent,
+ data
+ });
+ }
+}
+
diff --git a/ui/src/app/metadata/configuration/component/history-list.component.html b/ui/src/app/metadata/configuration/component/history-list.component.html
index 2983c151c..82a275060 100644
--- a/ui/src/app/metadata/configuration/component/history-list.component.html
+++ b/ui/src/app/metadata/configuration/component/history-list.component.html
@@ -21,9 +21,9 @@
- Current (v{{ i + 1 }}) |
- 0">v{{ i + 1 }} |
- {{ version.date | date }} |
+ Current (v{{ history.length - i }}) |
+ 0">v{{ history.length - (i) }} |
+ {{ version.date | date:'medium' }} |
{{ version.creator }} |
|