diff --git a/ui/src/app/metadata/configuration/component/metadata-configuration.component.scss b/ui/src/app/metadata/configuration/component/metadata-configuration.component.scss new file mode 100644 index 000000000..82e7a5f37 --- /dev/null +++ b/ui/src/app/metadata/configuration/component/metadata-configuration.component.scss @@ -0,0 +1,20 @@ +@import '../../../../theme/_palette'; + +:host /deep/ { + .bg-diff { + background: #FEE8E9; + position: relative; + border-color: #CCC !important; + &::before { + $size: 24px; + content: "\f06a"; + font-family: 'FontAwesome'; + text-align: center; + width: $size; + height: $size; + position: absolute; + left: -$size; + top: 0.5rem; + } + } +} diff --git a/ui/src/app/metadata/configuration/component/metadata-configuration.component.ts b/ui/src/app/metadata/configuration/component/metadata-configuration.component.ts index 280c362a6..1b04ba636 100644 --- a/ui/src/app/metadata/configuration/component/metadata-configuration.component.ts +++ b/ui/src/app/metadata/configuration/component/metadata-configuration.component.ts @@ -8,7 +8,7 @@ import { CONFIG_DATE_FORMAT } from '../configuration.values'; selector: 'metadata-configuration', changeDetection: ChangeDetectionStrategy.OnPush, templateUrl: './metadata-configuration.component.html', - styleUrls: [] + styleUrls: ['./metadata-configuration.component.scss'] }) export class MetadataConfigurationComponent { @Input() configuration: MetadataConfiguration; diff --git a/ui/src/app/metadata/configuration/component/property/array-property.component.html b/ui/src/app/metadata/configuration/component/property/array-property.component.html index e16eb8e65..380e0105b 100644 --- a/ui/src/app/metadata/configuration/component/property/array-property.component.html +++ b/ui/src/app/metadata/configuration/component/property/array-property.component.html @@ -1,58 +1,74 @@ -
- -
{{ property.name }}
-
-
-
- {{ property.items.properties[prop].title }} -
- -
- {{ version[i][prop] }} -
-
- - -
-
+
+
{{ property.name }}
+
+
+
+ {{ property.items.properties[prop].title }}
+ +
+ {{ version[i][prop] }} +
+
+ - +
+
- - - - + +
+ {{ version[i][prop] }} +
+
+ - +
- +
+
+ + + + + + + + +
- - -
- -
-
-
- {{ attr.label }} -
- - true - - - false - -
+
+
+
+ {{ attr.label }} +
+ + true + + + false +
- +
-
+
-
- {{ property.name }} +
+ {{ property.name }}

-

    { expect(app).toBeTruthy(); })); + describe('isDifferent method', () => { + it('should return true if the value is different between any of the lists', () => { + expect(app.isDifferent('foo', [['foo', 'bar', 'baz'], ['bar', 'baz']])).toBe(true); + expect(app.isDifferent('bar', [['bar'], null])).toBe(true); + }); + + it('should return false if the list of values is the same', () => { + expect(app.isDifferent('foo', [['foo', 'baz'], ['foo', 'bar']])).toBe(false); + }); + }); + describe('attributeList$ getter', () => { it('should return an empty list when no data or dataUrl is set', () => { app.attributeList$.subscribe((list) => { diff --git a/ui/src/app/metadata/configuration/component/property/array-property.component.ts b/ui/src/app/metadata/configuration/component/property/array-property.component.ts index 2c4de49bd..7a042fa46 100644 --- a/ui/src/app/metadata/configuration/component/property/array-property.component.ts +++ b/ui/src/app/metadata/configuration/component/property/array-property.component.ts @@ -33,6 +33,12 @@ export class ArrayPropertyComponent extends ConfigurationPropertyComponent imple return UriValidator.isUri(str); } + isDifferent(key: string, model: any): boolean { + return model + .map((value) => value ? value.indexOf(key) > -1 : false) + .reduce((current, val) => current !== val ? true : false, false); + } + 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/property/primitive-property.component.html b/ui/src/app/metadata/configuration/component/property/primitive-property.component.html index 4d93c07cc..6abfa315d 100644 --- a/ui/src/app/metadata/configuration/component/property/primitive-property.component.html +++ b/ui/src/app/metadata/configuration/component/property/primitive-property.component.html @@ -1,4 +1,6 @@ -
    +
    { + if (!array) { + return false; + } + return JSON.stringify(model[prop.id]) !== JSON.stringify(array[0][prop.id]); + }), value: models.map(model => { return model[prop.id]; }) diff --git a/ui/src/app/metadata/domain/model/property.ts b/ui/src/app/metadata/domain/model/property.ts index 4768de9e4..dba90e82e 100644 --- a/ui/src/app/metadata/domain/model/property.ts +++ b/ui/src/app/metadata/domain/model/property.ts @@ -5,6 +5,7 @@ export interface Property { value: any[]; items: Property; properties: Property[]; + differences?: boolean; widget?: { id: string; data?: {key: string, label: string}[];