Adds button to change Dataset Status, if DMP is Draft
This commit is contained in:
parent
349dffb137
commit
758c72ed2e
|
@ -101,6 +101,8 @@
|
||||||
(click)="saveFinalize();"
|
(click)="saveFinalize();"
|
||||||
type="button">{{ 'DATASET-WIZARD.ACTIONS.FINALIZE' | translate }}</button>
|
type="button">{{ 'DATASET-WIZARD.ACTIONS.FINALIZE' | translate }}</button>
|
||||||
<div class="fill-space"></div>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
.description-action-row {
|
.description-action-row {
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
}
|
}
|
||||||
.deleteButton {
|
.deleteButton, .reverseButton {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
margin-right: 15px;
|
margin-right: 15px;
|
||||||
|
|
|
@ -29,6 +29,7 @@ import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCru
|
||||||
import { DatasetDescriptionFormEditorModel } from '../../misc/dataset-description-form/dataset-description-form.model';
|
import { DatasetDescriptionFormEditorModel } from '../../misc/dataset-description-form/dataset-description-form.model';
|
||||||
import { DatasetCopyDialogueComponent } from './dataset-copy-dialogue/dataset-copy-dialogue.component';
|
import { DatasetCopyDialogueComponent } from './dataset-copy-dialogue/dataset-copy-dialogue.component';
|
||||||
import { DatasetWizardEditorModel } from './dataset-wizard-editor.model';
|
import { DatasetWizardEditorModel } from './dataset-wizard-editor.model';
|
||||||
|
import { DmpStatus } from '../../../core/common/enum/dmp-status';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dataset-wizard-component',
|
selector: 'app-dataset-wizard-component',
|
||||||
|
@ -58,6 +59,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
profileUpdateId: string;
|
profileUpdateId: string;
|
||||||
downloadDocumentId: string;
|
downloadDocumentId: string;
|
||||||
isLinear = false;
|
isLinear = false;
|
||||||
|
hasReversableStatus: boolean = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private datasetWizardService: DatasetWizardService,
|
private datasetWizardService: DatasetWizardService,
|
||||||
|
@ -83,31 +85,6 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
const dmpRequestItem: RequestItem<DmpCriteria> = new RequestItem();
|
const dmpRequestItem: RequestItem<DmpCriteria> = new RequestItem();
|
||||||
dmpRequestItem.criteria = new DmpCriteria();
|
dmpRequestItem.criteria = new DmpCriteria();
|
||||||
|
|
||||||
// const externalDatasetRequestItem: RequestItem<ExternalDatasetCriteria> = new RequestItem();
|
|
||||||
// externalDatasetRequestItem.criteria = new ExternalDatasetCriteria();
|
|
||||||
// this.externalDatasetAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetSExternalDatasetservice.bind(this.externalSourcesService),
|
|
||||||
// externalDatasetRequestItem, new BehaviorSubject(false));
|
|
||||||
|
|
||||||
// const registriesRequestItem: RequestItem<RegistryCriteria> = new RequestItem();
|
|
||||||
// registriesRequestItem.criteria = new RegistryCriteria();
|
|
||||||
// this.registriesAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetRegistry.bind(this.externalSourcesService),
|
|
||||||
// registriesRequestItem, new BehaviorSubject(false));
|
|
||||||
|
|
||||||
// const dataRepositoriesRequestItem: RequestItem<DataRepositoryCriteria> = new RequestItem();
|
|
||||||
// dataRepositoriesRequestItem.criteria = new DataRepositoryCriteria();
|
|
||||||
// this.dataRepositoriesAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetRepository.bind(this.externalSourcesService),
|
|
||||||
// dataRepositoriesRequestItem, new BehaviorSubject(false));
|
|
||||||
|
|
||||||
// const servicesRequestItem: RequestItem<ServiceCriteria> = new RequestItem();
|
|
||||||
// servicesRequestItem.criteria = new ServiceCriteria();
|
|
||||||
// this.servicesAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetService.bind(this.externalSourcesService),
|
|
||||||
// servicesRequestItem, new BehaviorSubject(false));
|
|
||||||
|
|
||||||
// const tagsRequestItem: RequestItem<TagCriteria> = new RequestItem();
|
|
||||||
// tagsRequestItem.criteria = new TagCriteria();
|
|
||||||
// this.tagsAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetTags.bind(this.externalSourcesService),
|
|
||||||
// tagsRequestItem, new BehaviorSubject(false));
|
|
||||||
|
|
||||||
this.dmpAutoCompleteConfiguration = {
|
this.dmpAutoCompleteConfiguration = {
|
||||||
filterFn: this.searchDmp.bind(this),
|
filterFn: this.searchDmp.bind(this),
|
||||||
initialItems: (extraData) => this.searchDmp(''),
|
initialItems: (extraData) => this.searchDmp(''),
|
||||||
|
@ -138,11 +115,6 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
label: this.datasetWizardModel.label,
|
label: this.datasetWizardModel.label,
|
||||||
url: '/datasets/edit/' + this.datasetWizardModel.id,
|
url: '/datasets/edit/' + this.datasetWizardModel.id,
|
||||||
notFoundResolver: [
|
notFoundResolver: [
|
||||||
// {
|
|
||||||
// parentComponentName: null,
|
|
||||||
// label: this.datasetWizardModel.dmp.label,
|
|
||||||
// url: '/plans/overview/' + this.datasetWizardModel.dmp.id
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
parentComponentName: null,
|
parentComponentName: null,
|
||||||
label: this.language.instant('NAV-BAR.MY-DATASET-DESCRIPTIONS').toUpperCase(),
|
label: this.language.instant('NAV-BAR.MY-DATASET-DESCRIPTIONS').toUpperCase(),
|
||||||
|
@ -158,16 +130,11 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
}
|
}
|
||||||
// if (this.viewOnly) { this.formGroup.disable(); } // For future use, to make Dataset edit like DMP.
|
// if (this.viewOnly) { this.formGroup.disable(); } // For future use, to make Dataset edit like DMP.
|
||||||
this.loadDatasetProfiles();
|
this.loadDatasetProfiles();
|
||||||
this.formGroup.get('dmp').valueChanges
|
this.registerFormListeners();
|
||||||
.pipe(takeUntil(this._destroyed))
|
|
||||||
.subscribe(() => {
|
if (this.formGroup.get('dmp').value.status == DmpStatus.Draft && this.formGroup.get('status').value == DatasetStatus.Finalized) {
|
||||||
this.dmpValueChanged(this.formGroup.get('dmp').value);
|
this.hasReversableStatus = true;
|
||||||
});
|
}
|
||||||
this.formGroup.get('profile').valueChanges
|
|
||||||
.pipe(takeUntil(this._destroyed))
|
|
||||||
.subscribe(x => {
|
|
||||||
this.datasetProfileValueChanged(x);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
} else if (dmpId != null) {
|
} else if (dmpId != null) {
|
||||||
this.isNew = true;
|
this.isNew = true;
|
||||||
|
@ -179,21 +146,10 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
this.datasetWizardModel.dmp = data;
|
this.datasetWizardModel.dmp = data;
|
||||||
this.formGroup = this.datasetWizardModel.buildForm();
|
this.formGroup = this.datasetWizardModel.buildForm();
|
||||||
this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft;
|
this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft;
|
||||||
if (this.datasetWizardModel.status === DatasetStatus.Finalized) {
|
|
||||||
this.formGroup.disable();
|
|
||||||
this.viewOnly = true;
|
|
||||||
}
|
|
||||||
this.loadDatasetProfiles();
|
this.loadDatasetProfiles();
|
||||||
this.formGroup.get('dmp').valueChanges
|
this.registerFormListeners();
|
||||||
.pipe(takeUntil(this._destroyed))
|
|
||||||
.subscribe(() => {
|
|
||||||
this.dmpValueChanged(this.formGroup.get('dmp').value);
|
|
||||||
});
|
|
||||||
this.formGroup.get('profile').valueChanges
|
|
||||||
.pipe(takeUntil(this._destroyed))
|
|
||||||
.subscribe(x => {
|
|
||||||
this.datasetProfileValueChanged(x);
|
|
||||||
});
|
|
||||||
this.breadCrumbs = Observable.of([
|
this.breadCrumbs = Observable.of([
|
||||||
{
|
{
|
||||||
parentComponentName: null,
|
parentComponentName: null,
|
||||||
|
@ -327,16 +283,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
this.viewOnly = true;
|
this.viewOnly = true;
|
||||||
}
|
}
|
||||||
//if (this.viewOnly) { this.formGroup.disable(); } // For future use, to make Dataset edit like DMP.
|
//if (this.viewOnly) { this.formGroup.disable(); } // For future use, to make Dataset edit like DMP.
|
||||||
this.formGroup.get('dmp').valueChanges
|
this.registerFormListeners();
|
||||||
.pipe(takeUntil(this._destroyed))
|
|
||||||
.subscribe(x => {
|
|
||||||
this.dmpValueChanged(x);
|
|
||||||
});
|
|
||||||
this.formGroup.get('profile').valueChanges
|
|
||||||
.pipe(takeUntil(this._destroyed))
|
|
||||||
.subscribe(x => {
|
|
||||||
this.datasetProfileValueChanged(x);
|
|
||||||
});
|
|
||||||
this.dmpValueChanged(null);
|
this.dmpValueChanged(null);
|
||||||
this.breadCrumbs = Observable.of([
|
this.breadCrumbs = Observable.of([
|
||||||
{
|
{
|
||||||
|
@ -354,6 +301,19 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
registerFormListeners() {
|
||||||
|
this.formGroup.get('dmp').valueChanges
|
||||||
|
.pipe(takeUntil(this._destroyed))
|
||||||
|
.subscribe(x => {
|
||||||
|
this.dmpValueChanged(x);
|
||||||
|
});
|
||||||
|
this.formGroup.get('profile').valueChanges
|
||||||
|
.pipe(takeUntil(this._destroyed))
|
||||||
|
.subscribe(x => {
|
||||||
|
this.datasetProfileValueChanged(x);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
dmpValueChanged(dmp: DmpListingModel) {
|
dmpValueChanged(dmp: DmpListingModel) {
|
||||||
if (dmp) {
|
if (dmp) {
|
||||||
this.formGroup.get('profile').enable();
|
this.formGroup.get('profile').enable();
|
||||||
|
@ -446,13 +406,21 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
//if (!this.isFormValid()) { return; }
|
|
||||||
this.formGroup.get('status').setValue(DatasetStatus.Draft);
|
|
||||||
this.submit();
|
this.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reverse() {
|
||||||
|
this.hasReversableStatus = false;
|
||||||
|
this.datasetWizardModel.status = DatasetStatus.Draft;
|
||||||
|
setTimeout(x => { this.formGroup = null; });
|
||||||
|
setTimeout(x => {
|
||||||
|
this.formGroup = this.datasetWizardModel.buildForm();
|
||||||
|
this.registerFormListeners();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
saveFinalize() {
|
saveFinalize() {
|
||||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||||
data: {
|
data: {
|
||||||
|
@ -599,9 +567,9 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
maxWidth: '300px',
|
maxWidth: '300px',
|
||||||
data: {
|
data: {
|
||||||
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'),
|
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'),
|
||||||
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
|
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.DELETE'),
|
||||||
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
|
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
|
||||||
isDeleteConfirmation: false
|
isDeleteConfirmation: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||||
|
|
|
@ -324,6 +324,7 @@
|
||||||
"SAVE": "Save",
|
"SAVE": "Save",
|
||||||
"SAVE-AND-FINALISE": "Save and Finalize",
|
"SAVE-AND-FINALISE": "Save and Finalize",
|
||||||
"FINALIZE": "Finalize",
|
"FINALIZE": "Finalize",
|
||||||
|
"REVERSE": "Undo Finalization",
|
||||||
"DOWNLOAD-PDF": "Download PDF",
|
"DOWNLOAD-PDF": "Download PDF",
|
||||||
"DOWNLOAD-XML": "Download XML",
|
"DOWNLOAD-XML": "Download XML",
|
||||||
"DOWNLOAD-DOCX": "Download DOCX",
|
"DOWNLOAD-DOCX": "Download DOCX",
|
||||||
|
|
Loading…
Reference in New Issue