Skip to content

Commit

Permalink
Resolved merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Sep 26, 2019
2 parents 7f8f647 + b2c5fee commit 0f65f74
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
<div *ngIf="configuration">
<section *ngFor="let section of configuration.sections; let i = index;" class="mb-4">
<div class="config-group">
<div class="numbered-header d-flex justify-content-start bg-light align-items-center">
<h2 class="title h4 m-0 flex-grow-1">
<span *ngIf="numbered"
class="d-inline-block px-2 py-1 mb-0 h4 number border border-secondary bg-white rounded-lg">
<span *ngIf="i + 1 < 10">0</span>{{ i + 1 }}
</span>
<span class="text ml-2">{{ section.label | translate }}</span>
</h2>
<div class="actions px-2"
*ngIf="editable && configuration.dates.length === 1">
<button class="btn btn-link edit-link change-view" (click)="edit(section.id)">
<i class="fa fa-edit"></i>&nbsp;
<span translate="action.edit">Edit</span>
</button>
</div>
</div>
<div class="p-2">
<ng-container *ngIf="section && section.properties && section.properties.length">
<div class="d-flex border-bottom border-light border-2 py-2">
<strong [ngStyle]="{'width': width}" translate="label.option">Option</strong>
<strong *ngFor="let date of configuration.dates" [ngStyle]="{'width': width}">
<translate-i18n key="label.value" *ngIf="configuration.dates.length <= 1">Value</translate-i18n>
<span *ngIf="configuration.dates.length > 1">{{ date | date:DATE_FORMAT }}</span>
</strong>
</div>
<object-property
class="d-block"
[property]="section"
[columns]="configuration.dates.length"
(preview)="onPreview($event)">
</object-property>
</ng-container>
<ng-container *ngIf="!section || !section.properties || !section.properties.length">
<div class="alert">
No Changes
<div *ngIf="configuration" class="config-section-list">
<ng-container *ngFor="let section of configuration.sections; let i = index;">
<section class="mb-4 config-section-list-item" *ngIf="section && section.properties && section.properties.length">
<div class="config-group">
<div class="numbered-header d-flex justify-content-start bg-light align-items-center">
<h2 class="title h4 m-0 flex-grow-1">
<span *ngIf="numbered"
class="d-inline-block px-2 py-1 mb-0 h4 number border border-secondary bg-white rounded-lg">
<span *ngIf="i + 1 < 10">0</span>{{ i + 1 }}
</span>
<span class="text ml-2">{{ section.label | translate }}</span>
</h2>
<div class="actions px-2"
*ngIf="editable && configuration.dates.length === 1">
<button class="btn btn-link edit-link change-view" (click)="edit(section.id)">
<i class="fa fa-edit"></i>&nbsp;
<span translate="action.edit">Edit</span>
</button>
</div>
</ng-container>
</div>
<div class="p-2">
<ng-container *ngIf="section && section.properties && section.properties.length">
<div class="d-flex border-bottom border-light border-2 py-2">
<strong [ngStyle]="{'width': width}" translate="label.option">Option</strong>
<strong *ngFor="let date of configuration.dates" [ngStyle]="{'width': width}">
<translate-i18n key="label.value" *ngIf="configuration.dates.length <= 1">Value</translate-i18n>
<span *ngIf="configuration.dates.length > 1">{{ date | date:DATE_FORMAT }}</span>
</strong>
</div>
<object-property
class="d-block"
[property]="section"
[columns]="configuration.dates.length"
(preview)="onPreview($event)">
</object-property>
</ng-container>
</div>
</div>
</section>
</ng-container>
<ng-container *ngIf="zero">
<div class="alert alert-info" role="alert">
No changes
</div>
</section>
</ng-container>
</div>
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { Component, ChangeDetectionStrategy, Input, Output, EventEmitter } from '@angular/core';
import { Component, ChangeDetectionStrategy, Input, Output, EventEmitter, OnChanges } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { MetadataConfiguration } from '../model/metadata-configuration';
import { Metadata } from '../../domain/domain.type';
import { CONFIG_DATE_FORMAT } from '../configuration.values';

@Component({
selector: 'metadata-configuration',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './metadata-configuration.component.html',
styleUrls: ['./metadata-configuration.component.scss']
})
export class MetadataConfigurationComponent {
export class MetadataConfigurationComponent implements OnChanges {
@Input() configuration: MetadataConfiguration;
@Input() definition: any;
@Input() entity: Metadata;
Expand All @@ -19,13 +18,19 @@ export class MetadataConfigurationComponent {

@Output() preview: EventEmitter<any> = new EventEmitter();

zero = false;

DATE_FORMAT = CONFIG_DATE_FORMAT;

constructor(
private router: Router,
private activatedRoute: ActivatedRoute
) {}

ngOnChanges(): void {
this.zero = this.configuration.sections.some(s => !s.properties.length);
}

edit(id: string): void {
this.router.navigate(['../', 'edit', id], { relativeTo: this.activatedRoute.parent });
}
Expand Down
12 changes: 9 additions & 3 deletions ui/src/app/metadata/configuration/reducer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,16 @@ export const getComparisonLoading = createSelector(getCompareState, fromCompare.
export const getComparisonModels = createSelector(getCompareState, fromCompare.getVersionModels);
export const getComparisonModelsLoaded = createSelector(getCompareState, fromCompare.getVersionModelsLoaded);
export const getComparisonFilterId = createSelector(getCompareState, fromCompare.getFilterId);

export const getComparisonModelsFilteredFn = (models) => models.map((model) => ({
...model,
metadataFilters: getVersionModelFiltersFn(model, model.type)
}));

export const getComparisonModelsFiltered = createSelector(getComparisonModels, getComparisonModelsFilteredFn);

export const getComparisonConfigurations = createSelector(
getComparisonModels,
getComparisonModelsFiltered,
getConfigurationDefinition,
getConfigurationSchema,
getConfigurationSectionsFn
Expand Down Expand Up @@ -290,9 +298,7 @@ export const getComparisonSelectedFilters = createSelector(
// Version Restoration

export const getRestoreState = createSelector(getState, getRestoreStateFn);

export const getVersionState = createSelector(getState, getVersionStateFn);

export const getVersionLoading = createSelector(getVersionState, fromVersion.isVersionLoading);

export const getVersionModel = createSelector(getVersionState, fromVersion.getVersionModel);
Expand Down

0 comments on commit 0f65f74

Please sign in to comment.