Skip to content

Commit

Permalink
SHIBUI-1407 comparison highlights
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Sep 6, 2019
1 parent 1600466 commit 3259685
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<div>
<div [ngClass]="{'bg-diff': property.differences}">
<ng-container *ngIf="property.items.type === 'object'">
<div class="py-2" role="term" [translate]="property.name">{{ property.name }}</div>
<div *ngFor="let item of range; let i = index;" class="py-2 bg-lighter border-top">
<div class="p-2" role="term" [translate]="property.name">{{ property.name }}</div>
<div *ngFor="let item of range; let i = index;" class="py-2 border-top" ngClass="{'bg-diff': !property.differences}">
<div *ngFor="let prop of getKeys(property.items); let n = index;" class="d-flex py-2">
<div [ngStyle]="{'width': width}">
<div [ngStyle]="{'width': width}" class="pl-4">
<span [translate]="property.items.properties[prop].title">{{ property.items.properties[prop].title }}</span>
</div>
<ng-container *ngFor="let version of property.value">
<div *ngIf="version && [i]"
<div *ngIf="version && version[i]"
[ngbPopover]="version[i][prop]"
triggers="mouseenter:mouseleave"
container="body"
Expand Down Expand Up @@ -36,7 +36,7 @@
</div>
<div *ngIf="property.widget && property.widget.dataUrl">
<div *ngFor="let attr of attributeList$ | async" class="d-flex justify-content-start border-bottom border-light">
<span class="py-2" role="term" [translate]="attr.label" [ngStyle]="{'width': width}">{{ attr.label }}</span>
<span class="p-2" role="term" [translate]="attr.label" [ngStyle]="{'width': width}">{{ attr.label }}</span>
<div *ngFor="let v of property.value" class="py-2" [ngStyle]="{'width': width}">
<span *ngIf="v && v.indexOf(attr.key) > -1" translate="value.true">
true
Expand All @@ -51,8 +51,8 @@
</ng-container>
</div>
<ng-template #listref>
<div class="d-flex align-items-center border-bottom border-light">
<span class="py-2" role="term" [translate]="property.name" [ngStyle]="{'width': width}">{{ property.name }}</span>
<div class="d-flex align-items-start border-bottom border-light">
<span class="p-2" role="term" [translate]="property.name" [ngStyle]="{'width': width}">{{ property.name }}</span>
<ng-container *ngFor="let v of property.value">
<p [ngStyle]="{'width': width}" class="text-secondary m-0" *ngIf="!v || !v.length">-</p>
<ul [ngStyle]="{'width': width}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<div *ngIf="property.name" class="d-flex border-bottom border-light py-2">
<div *ngIf="property.name"
class="d-flex border-bottom border-light p-2"
[ngClass]="{'bg-diff' : property.differences}">
<span class="d-block"
role="term"
[translate]="property.name"
Expand Down
6 changes: 6 additions & 0 deletions ui/src/app/metadata/configuration/reducer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ export const assignValueToProperties = (models, properties, definition: any): an
default:
return {
...prop,
differences: models.some((model, index, array) => {
if (!array) {
return false;
}
return JSON.stringify(model[prop.id]) !== JSON.stringify(array[0][prop.id]);
}),
value: models.map(model => {
return model[prop.id];
})
Expand Down
1 change: 1 addition & 0 deletions ui/src/app/metadata/domain/model/property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface Property {
value: any[];
items: Property;
properties: Property[];
differences?: boolean;
widget?: {
id: string;
data?: {key: string, label: string}[];
Expand Down

0 comments on commit 3259685

Please sign in to comment.