Fixes bug on External References undo finalize. (Issue #162)
This commit is contained in:
parent
47f939af81
commit
74ae77edbc
|
@ -22,6 +22,8 @@ export interface SingleAutoCompleteConfiguration {
|
|||
titleFn?: (item: any) => string;
|
||||
// Property formating for dropdown
|
||||
subtitleFn?: (item: any) => string;
|
||||
// Property formating for icon on chip
|
||||
iconFn?: (item: any) => string;
|
||||
//Extra data passed to query function
|
||||
extraData?: any;
|
||||
// Callback to intercept value assignment based on item selection
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<div class="row auto-complete">
|
||||
<mat-chip-list #chipList [disabled]="disabled" class="chip-list">
|
||||
<mat-chip *ngIf="value" [removable]="true" (removed)="chipRemove()">
|
||||
<mat-icon matChipRemove *ngIf="_iconFn(value)" class="ml-0 mr-1">{{_iconFn(value)}}</mat-icon>
|
||||
{{_displayFn(value)}}
|
||||
<mat-icon matChipRemove *ngIf="!disabled">cancel</mat-icon>
|
||||
</mat-chip>
|
||||
|
|
|
@ -137,6 +137,11 @@ export class SingleAutoCompleteComponent implements OnInit, MatFormFieldControl<
|
|||
return null;
|
||||
}
|
||||
|
||||
_iconFn(item: any): string {
|
||||
if (this.configuration.iconFn && item) { return this.configuration.iconFn(item); }
|
||||
return null;
|
||||
}
|
||||
|
||||
_requestDelay(): number {
|
||||
return this.configuration.requestDelay || this.requestDelay;
|
||||
}
|
||||
|
|
|
@ -12,27 +12,22 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="d-flex ml-auto p-2" *ngIf="datasetWizardModel && !isNew">
|
||||
<button mat-icon-button [matMenuTriggerFor]="actionsMenu" class="ml-auto more-icon"
|
||||
*ngIf="!publicMode" (click)="$event.stopImmediatePropagation();">
|
||||
<button mat-icon-button [matMenuTriggerFor]="actionsMenu" class="ml-auto more-icon" *ngIf="!publicMode" (click)="$event.stopImmediatePropagation();">
|
||||
<mat-icon class="more-horiz">more_horiz</mat-icon>
|
||||
</button>
|
||||
<mat-menu #actionsMenu="matMenu">
|
||||
<button mat-menu-item (click)="openDmpSearchDialogue()" class="menu-item">
|
||||
<mat-icon>file_copy</mat-icon>{{'DATASET-WIZARD.ACTIONS.COPY-DATASET' | translate}}
|
||||
</button>
|
||||
<button mat-menu-item *ngIf="!viewOnly && !isCopy"
|
||||
(click)="openConfirm(formGroup.get('label').value, formGroup.get('id').value)"
|
||||
class="menu-item">
|
||||
<button mat-menu-item *ngIf="!viewOnly && !isCopy" (click)="openConfirm(formGroup.get('label').value, formGroup.get('id').value)" class="menu-item">
|
||||
<mat-icon>delete</mat-icon>{{ 'DATASET-WIZARD.ACTIONS.DELETE' | translate }}
|
||||
</button>
|
||||
<button mat-menu-item (click)="advancedClicked()" class="menu-item">
|
||||
<mat-icon>save_alt</mat-icon>{{ 'DMP-LISTING.ACTIONS.ADV-EXP' | translate }}
|
||||
</button>
|
||||
<button mat-menu-item *ngIf="needsUpdate()" class="menu-item"
|
||||
(click)="openUpdateDatasetProfileDialogue();">{{ 'DATASET-WIZARD.ACTIONS.UPDATE-DATASET-PROFILE' | translate }}</button>
|
||||
<button mat-menu-item *ngIf="needsUpdate()" class="menu-item" (click)="openUpdateDatasetProfileDialogue();">{{ 'DATASET-WIZARD.ACTIONS.UPDATE-DATASET-PROFILE' | translate }}</button>
|
||||
</mat-menu>
|
||||
<button mat-raised-button color="primary" (click)="downloadPDF()"
|
||||
class="lightblue-btn ml-2 text-uppercase">
|
||||
<button mat-raised-button color="primary" (click)="downloadPDF()" class="lightblue-btn ml-2 text-uppercase">
|
||||
<mat-icon>save_alt</mat-icon> {{ 'DMP-LISTING.ACTIONS.EXPORT' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
|
@ -47,14 +42,11 @@
|
|||
</ng-template>
|
||||
<form *ngIf="formGroup" [formGroup]="formGroup" class="p-3">
|
||||
<mat-form-field class="col-md-6">
|
||||
<app-single-auto-complete [required]="true" [formControl]="formGroup.get('dmp')"
|
||||
placeholder="{{'DATASET-EDITOR.FIELDS.DMP' | translate}}"
|
||||
[configuration]="dmpAutoCompleteConfiguration">
|
||||
<app-single-auto-complete [required]="true" [formControl]="formGroup.get('dmp')" placeholder="{{'DATASET-EDITOR.FIELDS.DMP' | translate}}" [configuration]="dmpAutoCompleteConfiguration">
|
||||
</app-single-auto-complete>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col-md-6">
|
||||
<mat-select placeholder=" {{'DATASET-WIZARD.FIRST-STEP.PROFILE'| translate}}"
|
||||
[required]="true" formControlName="profile">
|
||||
<mat-select placeholder=" {{'DATASET-WIZARD.FIRST-STEP.PROFILE'| translate}}" [required]="true" formControlName="profile">
|
||||
<mat-option *ngFor="let profile of availableProfiles" [value]="profile.id">
|
||||
{{profile.label}}
|
||||
</mat-option>
|
||||
|
@ -71,8 +63,7 @@
|
|||
{{'DATASET-PROFILE-EDITOR.STEPS.PAGES.EXTERNAL-REFERENCES' | translate}}
|
||||
</ng-template>
|
||||
<form *ngIf="formGroup" [formGroup]="formGroup" class="p-3">
|
||||
<app-dataset-external-references-editor-component [formGroup]="formGroup"
|
||||
[viewOnly]="viewOnly"></app-dataset-external-references-editor-component>
|
||||
<app-dataset-external-references-editor-component [formGroup]="formGroup" [viewOnly]="viewOnly"></app-dataset-external-references-editor-component>
|
||||
</form>
|
||||
</mat-tab>
|
||||
<mat-tab [disabled]="isNew && (formGroup.get('profile').disabled || formGroup.get('profile').invalid)">
|
||||
|
@ -82,27 +73,21 @@
|
|||
{{'DATASET-PROFILE-EDITOR.STEPS.PAGES.DESCRIPTION' | translate}}
|
||||
</div>
|
||||
</ng-template>
|
||||
<app-dataset-description-form
|
||||
*ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition"
|
||||
[form]="this.formGroup.get('datasetProfileDefinition')"
|
||||
[visibilityRules]="datasetWizardModel.datasetProfileDefinition.rules"
|
||||
[datasetProfileId]="formGroup.get('profile').value">
|
||||
<app-dataset-description-form *ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition" [form]="this.formGroup.get('datasetProfileDefinition')" [visibilityRules]="datasetWizardModel.datasetProfileDefinition.rules" [datasetProfileId]="formGroup.get('profile').value">
|
||||
</app-dataset-description-form>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
|
||||
<div class="actions">
|
||||
<mat-icon *ngIf="hasNotReversableStatus()" color="accent" class="align-self-center mr-1">info_outlined</mat-icon>
|
||||
<div *ngIf="hasNotReversableStatus()" class="align-self-center mr-3">{{'DATASET-WIZARD.ACTIONS.INFO' | translate}}</div>
|
||||
<button mat-raised-button (click)="cancel()" type="button" class="cancelButton" color="primary">
|
||||
{{'DMP-EDITOR.ACTIONS.CANCEL' | translate}}
|
||||
</button>
|
||||
<button *ngIf="datasetWizardModel.status == 0 || isNew" mat-raised-button [disabled]="!isSemiFormValid(formGroup)" class="saveButton" color="primary" (click)="save();"
|
||||
type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</button>
|
||||
<button *ngIf="datasetWizardModel.status == 0 || isNew" mat-raised-button [disabled]="!formGroup.valid" class="finalizeButton" color="primary"
|
||||
(click)="saveFinalize();"
|
||||
type="button">{{ 'DATASET-WIZARD.ACTIONS.FINALIZE' | translate }}</button>
|
||||
<button *ngIf="datasetWizardModel.status == 0 || isNew" mat-raised-button [disabled]="!isSemiFormValid(formGroup)" class="saveButton" color="primary" (click)="save();" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</button>
|
||||
<button *ngIf="datasetWizardModel.status == 0 || isNew" mat-raised-button [disabled]="!formGroup.valid" class="finalizeButton" color="primary" (click)="saveFinalize();" type="button">{{ 'DATASET-WIZARD.ACTIONS.FINALIZE' | translate }}</button>
|
||||
<div class="fill-space"></div>
|
||||
<button *ngIf="hasReversableStatus" mat-raised-button class="reverseButton" color="primary" (click)="reverse();"
|
||||
type="button">{{ 'DATASET-WIZARD.ACTIONS.REVERSE' | translate }}</button>
|
||||
<button *ngIf="hasReversableStatus()" mat-raised-button class="reverseButton" color="primary" (click)="reverse()" type="button">{{ 'DATASET-WIZARD.ACTIONS.REVERSE' | translate }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
import {of as observableOf, Observable } from 'rxjs';
|
||||
|
||||
import {map, catchError, takeUntil } from 'rxjs/operators';
|
||||
import { of as observableOf, Observable } from 'rxjs';
|
||||
import { map, catchError, takeUntil } from 'rxjs/operators';
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormControl, FormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
@ -63,7 +61,6 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
profileUpdateId: string;
|
||||
downloadDocumentId: string;
|
||||
isLinear = false;
|
||||
hasReversableStatus: boolean = false;
|
||||
|
||||
constructor(
|
||||
private datasetWizardService: DatasetWizardService,
|
||||
|
@ -92,8 +89,9 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
this.dmpAutoCompleteConfiguration = {
|
||||
filterFn: this.searchDmp.bind(this),
|
||||
initialItems: (extraData) => this.searchDmp(''),
|
||||
displayFn: (item) => item['label'],
|
||||
titleFn: (item) => item['label']
|
||||
displayFn: (item) => (item['status'] ? this.language.instant('TYPES.DATASET-STATUS.FINALISED').toUpperCase() : this.language.instant('TYPES.DATASET-STATUS.DRAFT').toUpperCase()) + ': ' + item['label'],
|
||||
titleFn: (item) => item['label'],
|
||||
iconFn: (item) => item['status'] ? 'lock' : 'lock_open'
|
||||
};
|
||||
|
||||
const params = this.route.snapshot.params;
|
||||
|
@ -137,9 +135,6 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
this.registerFormListeners();
|
||||
// this.availableProfiles = this.datasetWizardModel.dmp.profiles;
|
||||
|
||||
if (this.formGroup.get('dmp').value.status == DmpStatus.Draft && this.formGroup.get('status').value == DatasetStatus.Finalized) {
|
||||
this.hasReversableStatus = true;
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-WIZARD.MESSAGES.DATAESET-NOT-FOUND'), SnackBarNotificationLevel.Error);
|
||||
|
@ -433,8 +428,16 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
this.submit();
|
||||
}
|
||||
|
||||
hasReversableStatus(): boolean {
|
||||
return (this.formGroup.get('dmp').value.status == DmpStatus.Draft && this.formGroup.get('status').value == DatasetStatus.Finalized);
|
||||
}
|
||||
|
||||
hasNotReversableStatus(): boolean {
|
||||
return (this.formGroup.get('dmp').value.status == DmpStatus.Finalized && this.formGroup.get('status').value == DatasetStatus.Finalized);
|
||||
}
|
||||
|
||||
reverse() {
|
||||
this.hasReversableStatus = false;
|
||||
this.viewOnly = false;
|
||||
this.datasetWizardModel.status = DatasetStatus.Draft;
|
||||
setTimeout(x => { this.formGroup = null; });
|
||||
setTimeout(x => {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<div class="row">
|
||||
<div class="col-12 d-flex flex-wrap">
|
||||
<mat-icon *ngIf="isDraft" matTooltip="{{'DMP-LISTING.TOOLTIP.DMP-STATUS.DRAFT' | translate}}" class="draft-icon">
|
||||
lock
|
||||
lock_open
|
||||
</mat-icon>
|
||||
<mat-icon *ngIf="isFinalized && !isPublished" matTooltip="{{'DMP-LISTING.TOOLTIP.DMP-STATUS.FINALIZED' | translate}}">
|
||||
lock
|
||||
|
|
|
@ -415,6 +415,7 @@
|
|||
"SAVE-AND-FINALISE": "Save and Finalize",
|
||||
"FINALIZE": "Finalize",
|
||||
"REVERSE": "Undo Finalization",
|
||||
"INFO": "Datasets of finalized DMPs can't revert to unfinalized",
|
||||
"DOWNLOAD-PDF": "Download PDF",
|
||||
"DOWNLOAD-XML": "Download XML",
|
||||
"DOWNLOAD-DOCX": "Download DOCX",
|
||||
|
|
|
@ -35,20 +35,34 @@ $app-blue-theme-primary-palette: (
|
|||
);
|
||||
|
||||
$app-blue-theme-accent-palette: (
|
||||
50: #fce4ec,
|
||||
100: #f8bbd0,
|
||||
200: #f48fb1,
|
||||
300: #f06292,
|
||||
400: #ec407a,
|
||||
500: #e91e63,
|
||||
600: #d81b60,
|
||||
700: #c2185b,
|
||||
800: #ad1457,
|
||||
900: #880e4f,
|
||||
A100: #ff80ab,
|
||||
A200: #ff4081,
|
||||
A400: #f50057,
|
||||
A700: #c51162,
|
||||
50 : #e0f6f3,
|
||||
100 : #b3e8e2,
|
||||
200 : #80d9cf,
|
||||
300 : #4dc9bc,
|
||||
400 : #26bead,
|
||||
500 : #00b29f,
|
||||
600 : #00ab97,
|
||||
700 : #00a28d,
|
||||
800 : #009983,
|
||||
900 : #008a72,
|
||||
A100 : #b6fff0,
|
||||
A200 : #83ffe6,
|
||||
A400 : #50ffdc,
|
||||
A700 : #36ffd7,
|
||||
// 50: #fce4ec,
|
||||
// 100: #f8bbd0,
|
||||
// 200: #f48fb1,
|
||||
// 300: #f06292,
|
||||
// 400: #ec407a,
|
||||
// 500: #e91e63,
|
||||
// 600: #d81b60,
|
||||
// 700: #c2185b,
|
||||
// 800: #ad1457,
|
||||
// 900: #880e4f,
|
||||
// A100: #ff80ab,
|
||||
// A200: #ff4081,
|
||||
// A400: #f50057,
|
||||
// A700: #c51162,
|
||||
contrast: (
|
||||
50: $black-87-opacity,
|
||||
100: $black-87-opacity,
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
|
||||
// Define a theme.
|
||||
$custom-theme-primary: mat-palette($app-blue-theme-primary-palette, 900);
|
||||
$custom-theme-accent: mat-palette($mat-pink, A200, A100, A400);
|
||||
$custom-theme-accent: mat-palette($app-blue-theme-accent-palette);
|
||||
// $custom-theme-accent: mat-palette($mat-pink, A200, A100, A400);
|
||||
$custom-theme-warn: mat-palette($mat-red);
|
||||
$custom-theme: mat-light-theme($custom-theme-primary, $custom-theme-accent, $custom-theme-warn);
|
||||
@include angular-material-theme($custom-theme);
|
||||
|
|
Loading…
Reference in New Issue