Skip to content

Commit

Permalink
Merged in bugfix/SHIBUI-1754 (pull request #467)
Browse files Browse the repository at this point in the history
Bugfix/SHIBUI-1754
  • Loading branch information
rmathis committed Apr 9, 2021
2 parents 8f6d323 + 748fd14 commit 8b66807
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 49 deletions.
1 change: 1 addition & 0 deletions backend/src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ message.protocol-support-required=Protocol Support Enumeration is required if an
message.conflict=Conflict
message.data-version-contention=Data Version Contention
message.contention-new-version=A newer version of this metadata source has been saved. Below are a list of changes. You can use your changes or their changes.
message.contention-error=There was a problem saving due to a mismatched version.
message.organization-feedback=These three fields must all be entered if any single field has a value.
message.valid-email=Must be a valid Email Address
message.valid-url=Must be a valid URL
Expand Down
33 changes: 19 additions & 14 deletions ui/src/app/contention/component/contention-dialog.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
<h4 class="modal-title"><translate-i18n key="message.data-version-contention">Data Version Contention</translate-i18n></h4>
</div>
<div class="modal-body">
<div class="d-flex w-100 justify-content-between">
<div class="d-flex w-100 justify-content-start">
<i class="fa fa-fw fa-exclamation-triangle fa-3x text-warning"></i>
<p class="ml-2">
<translate-i18n key="message.contention-new-version">A newer version of this metadata source has been saved. Below are a list of changes. You can use your changes or their changes.</translate-i18n></p>
<p class="ml-2" *ngIf="theirs.length > 0">
<translate-i18n key="message.contention-new-version">A newer version of this metadata source has been saved. Below are a list of changes. You can use your changes or their changes.</translate-i18n>
</p>
<p class="ml-2" *ngIf="theirs.length < 1">
<translate-i18n key="message.contention-error">There was a problem saving due to a mismatched version.</translate-i18n>
</p>
</div>
<div class="row">
<div class="row" *ngIf="theirs.length > 0">
<div class="col col-6">
<div class="card">
<div class="card-header bg-info text-white">
Expand All @@ -31,16 +35,17 @@ <h4 class="modal-title"><translate-i18n key="message.data-version-contention">Da
</div>
</div>
</div>
<div class="modal-footer">
<div class="modal-footer" *ngIf="theirs.length < 1">
<button

class="btn btn-info"
(click)="activeModal.close(resolutionObj)"
[disabled]="!resolutionObj"><translate-i18n key="action.use-mine">Use My Changes</translate-i18n></button>
<button

class="btn btn-danger"
(click)="activeModal.dismiss(rejectionObj)"
[disabled]="!rejectionObj"><translate-i18n key="action.use-theirs">Use Their Changes</translate-i18n></button>
class="btn btn-secondary"
(click)="activeModal.dismiss(rejectionObj)"><translate-i18n key="action.cancel">Cancel</translate-i18n></button>
</div>
<div class="modal-footer" *ngIf="theirs.length > 0">
<button class="btn btn-info" (click)="activeModal.close(resolutionObj)" [disabled]="!resolutionObj">
<translate-i18n key="action.use-mine">Use My Changes</translate-i18n>
</button>
<button class="btn btn-danger" (click)="activeModal.dismiss(rejectionObj)" [disabled]="!rejectionObj">
<translate-i18n key="action.use-theirs">Use Their Changes</translate-i18n>
</button>
</div>
</div>
6 changes: 0 additions & 6 deletions ui/src/app/contention/effect/contention.effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ export class ContentionEffects {
switchMap(contention => {
const resolutionAction = of(new ResolveContentionAction({ value: contention.resolutionObject, handlers: contention.handlers }));
const rejectionAction = of(new CancelContentionAction({ value: contention.rejectionObject, handlers: contention.handlers }));
if (contention.ourChanges.length < 1) {
return rejectionAction;
}
if (contention.theirChanges.length < 1) {
return resolutionAction;
}
return this.modal
.open(ContentionDialogComponent, DEFAULT_MODAL_OPTIONS, { contention })
.pipe(
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/metadata/provider/effect/collection.effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ import { MetadataProviderService } from '../../domain/service/provider.service';
import * as fromProvider from '../reducer';
import * as fromRoot from '../../../app.reducer';
import { array_move } from '../../../shared/util';
import { ClearProvider, ResetChanges } from '../action/entity.action';
import { ClearProvider } from '../action/entity.action';
import { ShowContentionAction } from '../../../contention/action/contention.action';
import { ContentionService } from '../../../contention/service/contention.service';
import { MetadataProvider } from '../../domain/model';
import { AddNotification } from '../../../notification/action/notification.action';
import { Notification, NotificationType } from '../../../notification/model/notification';
import { WizardActionTypes, SetDisabled } from '../../../wizard/action/wizard.action';
import { SetDisabled } from '../../../wizard/action/wizard.action';
import { I18nService } from '../../../i18n/service/i18n.service';
import * as fromI18n from '../../../i18n/reducer';
import { ClearEditor } from '../action/editor.action';
Expand Down
13 changes: 8 additions & 5 deletions ui/src/app/metadata/provider/effect/editor.effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import { Injectable } from '@angular/core';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { SchemaService } from '../../../schema-form/service/schema.service';

import {
EditorActionTypes
} from '../action/editor.action';
import { map, switchMap, catchError, withLatestFrom, debounceTime } from 'rxjs/operators';
import { map, switchMap, catchError, debounceTime } from 'rxjs/operators';
import { of } from 'rxjs';
import {
LoadSchemaRequest,
Expand All @@ -18,6 +15,7 @@ import { ResetChanges } from '../action/entity.action';

import * as fromWizard from '../../../wizard/reducer';
import { Store } from '@ngrx/store';
import { CancelContentionAction, ContentionActionTypes } from '../../../contention/action/contention.action';

@Injectable()
export class EditorEffects {
Expand All @@ -43,9 +41,14 @@ export class EditorEffects {
map(() => new ResetChanges())
);

@Effect()
$resetChangesOnContentionFail = this.actions$.pipe(
ofType<CancelContentionAction>(ContentionActionTypes.CANCEL_CONTENTION),
map(() => new ResetChanges())
);

constructor(
private schemaService: SchemaService,
private store: Store<fromWizard.WizardState>,
private actions$: Actions
) { }
} /* istanbul ignore next */
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Component, OnDestroy } from '@angular/core';
import { Router, ActivatedRoute, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { Router, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { Observable, of, Subject } from 'rxjs';
import { skipWhile, map, combineLatest, filter, takeUntil } from 'rxjs/operators';
import { map, filter } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import * as fromWizard from '../../../wizard/reducer';
import * as fromResolver from '../reducer';
import { ClearWizard, SetIndex, LoadSchemaRequest } from '../../../wizard/action/wizard.action';
import { LoadSchemaRequest } from '../../../wizard/action/wizard.action';
import { MetadataResolver } from '../../domain/model';
import { Clear } from '../action/entity.action';
import { Wizard } from '../../../wizard/model';
Expand Down Expand Up @@ -41,7 +41,6 @@ export class ResolverEditComponent implements OnDestroy, CanComponentDeactivate
constructor(
private store: Store<fromResolver.ResolverState>,
private router: Router,
private route: ActivatedRoute,
private modalService: NgbModal,
private diffService: DifferentialService
) {
Expand Down
11 changes: 9 additions & 2 deletions ui/src/app/metadata/resolver/effect/entity.effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import {
Clear,
Cancel,
UpdateChangesRequest,
UpdateChangesSuccess
UpdateChangesSuccess,
UpdateSaving
} from '../action/entity.action';
import * as provider from '../action/collection.action';

import { ShowContentionAction } from '../../../contention/action/contention.action';
import { CancelContentionAction, ContentionActionTypes, ShowContentionAction } from '../../../contention/action/contention.action';

import { ResolverCollectionActionTypes } from '../action/collection.action';
import { ResolverService } from '../../domain/service/resolver.service';
Expand Down Expand Up @@ -69,6 +70,12 @@ export class EntityEffects {
})
);

@Effect()
$resetChangesOnContentionFail = this.actions$.pipe(
ofType<CancelContentionAction>(ContentionActionTypes.CANCEL_CONTENTION),
map(() => new UpdateSaving(false))
);

constructor(
private store: Store<fromRoot.State>,
private service: ResolverService,
Expand Down
5 changes: 3 additions & 2 deletions ui/src/app/schema-form/widget/array/array.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
</ng-container>
<ng-container *ngSwitchCase="'object'">
<div #acc>
<div class="d-flex justify-content-between" (click)="acc.isHidden = !acc.isHidden">
<div class="d-flex justify-content-between align-items-center" >
<span>
<i class="fa fa-fw" [ngClass]="{'fa-chevron-right': acc.isHidden, 'fa-chevron-down': !acc.isHidden}"></i>
<button class="btn btn-text" (click)="acc.isHidden = !acc.isHidden"><i class="fa fa-fw" [ngClass]="{'fa-chevron-right': acc.isHidden, 'fa-chevron-down': !acc.isHidden}"></i></button>

&nbsp;
<translate-i18n key="label.new-of-type" [params]="{ type: (itemProperty.schema.title | translate) }"></translate-i18n>
<ng-container *ngIf="itemProperty.schema.properties.makeDefault">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
<span *ngIf="schema.description" class="sr-only"><translate-i18n [key]="schema.description">{{ schema.description }}</translate-i18n></span>
<div class="d-flex">
<ng-container *ngFor="let option of schema.oneOf; let i=index;">
<div class="custom-control custom-radio custom-control-inline">
<div class="form-check mr-3">
<input
disableValidation="true"
class="custom-control-input"
class="form-check-input"
[id]="formProperty._canonicalPath + '.' + option.enum[0]"
[formControl]="control"
[name]="name"
[value]="option.enum[0]"
type="radio"
[attr.disabled]="schema.readOnly">
[attr.disabled]="schema.readOnly"
disableValidation="true">
<label
class="custom-control-label"
class="form-check-label"
[for]="formProperty._canonicalPath + '.' + option.enum[0]">
<translate-i18n [key]="option.description">{{ option.description }}</translate-i18n></label>
</div>
Expand Down
6 changes: 3 additions & 3 deletions ui/src/app/schema-form/widget/check/checkbox.component.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<div class="widget form-group">
<ng-container *ngIf="schema.type !== 'array'">
<div class="d-flex justify-content-start">
<div class="custom-control custom-checkbox custom-control-inline custom-control-reverse"
<div class="form-check control-reverse"
[id]="formProperty._canonicalPath + '.parent'">
<input [formControl]="control"
class="custom-control-input"
class="form-check-input"
[attr.name]="name"
[indeterminate]="control.value !== false && control.value !== true ? true :null"
type="checkbox"
[attr.disabled]="schema.readOnly?true:null"
[id]="formProperty._canonicalPath"
[disableValidation]="true">
<label [attr.for]="formProperty._canonicalPath" class="custom-control-label">
<label [attr.for]="formProperty._canonicalPath" class="form-check-label">
<translate-i18n [key]="schema.title">{{ schema.title }}</translate-i18n>
</label>
</div>
Expand Down
10 changes: 4 additions & 6 deletions ui/src/app/schema-form/widget/radio/radio.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
<translate-i18n [key]="schema.description">{{schema.description}}</translate-i18n>
</span>
<ng-container *ngFor="let option of schema.oneOf; let i = index;">
<div class="custom-control custom-radio custom-control-inline" [ngClass]="schema.widget.class">
<input class="custom-control-input"
[formControl]="control"
<div class="form-check" [ngClass]="schema.widget.class">
<input class="form-check-input"
type="radio"
[attr.name]="name"
[name]="name"
[id]="formProperty._canonicalPath + '.' + i"
[value]="option.enum[0]"
[attr.disabled]="schema.readOnly"
disableValidation="true">
<label class="custom-control-label" [for]="formProperty._canonicalPath + '.' + i">
<label class="form-check-label" [for]="formProperty._canonicalPath + '.' + i">
<translate-i18n [key]="option.description">{{option.description}}</translate-i18n>
</label>
</div>
Expand Down

0 comments on commit 8b66807

Please sign in to comment.