From d48e8a984afaa58cdc5402d0a5d50b0e4b487597 Mon Sep 17 00:00:00 2001 From: apapachristou Date: Fri, 18 Sep 2020 14:14:48 +0300 Subject: [PATCH] Create new Dataset - using pop up --- .../app/ui/dashboard/dashboard.component.html | 8 +- .../app/ui/dashboard/dashboard.component.ts | 50 +++++++++- .../recent-edited-activity.component.html | 2 +- .../recent-edited-dmp-activity.component.html | 2 +- .../listing/dataset-listing.component.html | 4 +- .../listing/dataset-listing.component.ts | 38 +++++++- dmp-frontend/src/app/ui/dmp/dmp.module.ts | 3 + .../datasets-tab/datasets-tab.component.ts | 2 +- .../ui/dmp/listing/dmp-listing.component.ts | 9 +- .../dmp-listing-item.component.html | 2 +- .../dmp/overview/dmp-overview.component.html | 8 +- .../dmp/overview/dmp-overview.component.scss | 18 ++-- .../ui/dmp/overview/dmp-overview.component.ts | 41 +++++++- .../start-new-dataset-dialog.component.html | 29 ++++++ .../start-new-dataset-dialog.component.scss | 96 +++++++++++++++++++ .../start-new-dataset-dialog.component.ts | 82 ++++++++++++++++ dmp-frontend/src/assets/i18n/de.json | 3 +- dmp-frontend/src/assets/i18n/en.json | 2 + dmp-frontend/src/assets/i18n/es.json | 1 + dmp-frontend/src/assets/i18n/gr.json | 1 + dmp-frontend/src/assets/i18n/tr.json | 1 + 21 files changed, 370 insertions(+), 32 deletions(-) create mode 100644 dmp-frontend/src/app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component.html create mode 100644 dmp-frontend/src/app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component.scss create mode 100644 dmp-frontend/src/app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component.ts diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.html b/dmp-frontend/src/app/ui/dashboard/dashboard.component.html index d12c5d194..0224cac3f 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.html +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.html @@ -25,9 +25,9 @@
0
{{'DASHBOARD.DATASET-DESCRIPTIONS' | translate}}
0
- {{'DASHBOARD.GRANTS' | translate}} + {{'DASHBOARD.GRANTS' | translate}}
0
- {{'DASHBOARD.RELATED-ORGANISATIONS' | translate}} + {{'DASHBOARD.RELATED-ORGANISATIONS' | translate}} @@ -41,7 +41,7 @@ {{'DASHBOARD.DATASET-DESCRIPTIONS' | translate}} {{'DASHBOARD.DMP-ABOUT-END' | translate}}

- +
{{'DASHBOARD.LATEST-ACTIVITY' | translate}}
@@ -62,7 +62,7 @@
{{'DASHBOARD.EMPTY-LIST' | translate}}
-
diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts b/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts index b750ea74f..85e81bc7e 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts @@ -27,6 +27,12 @@ import { DmpCriteria } from '@app/core/query/dmp/dmp-criteria'; import { DatasetCriteria } from '@app/core/query/dataset/dataset-criteria'; import { MatDialog } from '@angular/material'; import { StartNewDmpDialogComponent } from '../dmp/start-new-dmp-dialogue/start-new-dmp-dialog.component'; +import { StartNewDatasetDialogComponent } from '../dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component'; +import { DatasetWizardEditorModel } from '../dataset/dataset-wizard/dataset-wizard-editor.model'; +import { DatasetWizardService } from '@app/core/services/dataset-wizard/dataset-wizard.service'; +import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; +import { TranslateService } from '@ngx-translate/core'; +import { DatasetWizardModel } from '@app/core/model/dataset/dataset-wizard'; @Component({ @@ -67,12 +73,14 @@ export class DashboardComponent extends BaseComponent implements OnInit, IBreadC private grantService: GrantService, private dmpService: DmpService, private datasetService: DatasetService, + private datasetWizardService: DatasetWizardService, private dashboardService: DashboardService, private searchBarService: SearchBarService, private authentication: AuthService, private userService: UserService, - private dialog: MatDialog - + private dialog: MatDialog, + private language: TranslateService, + private uiNotificationService: UiNotificationService ) { super(); // this.dashboardStatisticsData.totalDataManagementPlanCount = 0; @@ -234,6 +242,44 @@ export class DashboardComponent extends BaseComponent implements OnInit, IBreadC } } + addNewDataset() { + const dialogRef = this.dialog.open(StartNewDatasetDialogComponent, { + disableClose: false, + restoreFocus: false, + data: { + startNewDmp: false, + formGroup: new DatasetWizardEditorModel().buildForm() + } + }); + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { + if (result) { + if (result.startNewDmp) { + this.openNewDmpDialog(); + } else { + this.router.navigate(['/datasets', 'new', result.formGroup.get('dmp').value.id]); + // Save dataset direct but missing title and template + // this.datasetWizardService.createDataset(result.formGroup.getRawValue()) + // .pipe(takeUntil(this._destroyed)) + // .subscribe( + // data => { + // this.onCallbackSuccess(data); + // }, + // error => this.onCallbackError(error) + // ); + } + } + }); + } + + // onCallbackSuccess(datasetId: String): void { + // this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION'), SnackBarNotificationLevel.Success); + // this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'edit', datasetId]); }); + // } + + // onCallbackError(error: any) { + // this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Error); + // } + // viewAllPublicDmpsClicked() { // this.router.navigate(['/explore-plans']); // } diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html index 380ac2101..6e3d0c951 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html @@ -58,7 +58,7 @@
open_in_new{{'DMP-LISTING.ACTIONS.EXPORT' | translate}} - add{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}} + add{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}} group_add{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}} filter_none{{'DMP-LISTING.ACTIONS.CLONE' | translate}} more_horiz diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.html b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.html index 2527d5845..0da3dfb96 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.html +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.html @@ -52,7 +52,7 @@
open_in_new{{'DMP-LISTING.ACTIONS.EXPORT' | translate}} - add{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}} + add{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}} group_add{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}} filter_none{{'DMP-LISTING.ACTIONS.CLONE' | translate}} more_horiz diff --git a/dmp-frontend/src/app/ui/dataset/listing/dataset-listing.component.html b/dmp-frontend/src/app/ui/dataset/listing/dataset-listing.component.html index fad3c4a5a..73e335bf0 100644 --- a/dmp-frontend/src/app/ui/dataset/listing/dataset-listing.component.html +++ b/dmp-frontend/src/app/ui/dataset/listing/dataset-listing.component.html @@ -8,7 +8,7 @@

{{'DATASET-LISTING.TEXT-INFO' | translate}} {{'DATASET-LISTING.LINK-PUBLIC-DATASETS' | translate}} {{'DATASET-LISTING.TEXT-INFO-REST' | translate}}

{{'DATASET-LISTING.TEXT-INFO-PAR' | translate}}

-
@@ -17,7 +17,7 @@

{{(isPublic ? 'GENERAL.TITLES.EXPLORE' : 'GENERAL.TITLES.DATASETS') | translate}}

-
diff --git a/dmp-frontend/src/app/ui/dataset/listing/dataset-listing.component.ts b/dmp-frontend/src/app/ui/dataset/listing/dataset-listing.component.ts index e91b0095d..469ce6458 100644 --- a/dmp-frontend/src/app/ui/dataset/listing/dataset-listing.component.ts +++ b/dmp-frontend/src/app/ui/dataset/listing/dataset-listing.component.ts @@ -16,7 +16,7 @@ import { BaseComponent } from '@common/base/base.component'; import { TranslateService } from '@ngx-translate/core'; import { Observable, of as observableOf } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { ExternalTagEditorModel } from '../dataset-wizard/dataset-wizard-editor.model'; +import { ExternalTagEditorModel, DatasetWizardEditorModel } from '../dataset-wizard/dataset-wizard-editor.model'; import { AuthService } from '@app/core/services/auth/auth.service'; import { isNullOrUndefined } from 'util'; import { DatasetCriteriaDialogComponent } from './criteria/dataset-criteria-dialogue/dataset-criteria-dialog.component'; @@ -26,6 +26,8 @@ import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { GuidedTourService } from '@app/library/guided-tour/guided-tour.service'; import { GuidedTour, Orientation } from '@app/library/guided-tour/guided-tour.constants'; +import { StartNewDatasetDialogComponent } from '@app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component'; +import { StartNewDmpDialogComponent } from '@app/ui/dmp/start-new-dmp-dialogue/start-new-dmp-dialog.component'; @Component({ selector: 'app-dataset-listing-component', @@ -394,6 +396,40 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB this.guidedTourService.startTour(this.dashboardTour); } + openNewDmpDialog() { + if (this.dialog.openDialogs.length > 0) { + this.dialog.closeAll(); + } + else { + const dialogRef = this.dialog.open(StartNewDmpDialogComponent, { + disableClose: false, + data: { + isDialog: true + } + }); + } + } + + addNewDataset() { + const dialogRef = this.dialog.open(StartNewDatasetDialogComponent, { + disableClose: false, + restoreFocus: false, + data: { + startNewDmp: false, + formGroup: new DatasetWizardEditorModel().buildForm() + } + }); + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { + if (result) { + if (result.startNewDmp) { + this.openNewDmpDialog(); + } else { + this.router.navigate(['/datasets', 'new', result.formGroup.get('dmp').value.id]); + } + } + }); + } + // rowClicked(dataset: DatasetListingModel) { // this.router.navigate(['/datasets/edit/' + dataset.id]); // } diff --git a/dmp-frontend/src/app/ui/dmp/dmp.module.ts b/dmp-frontend/src/app/ui/dmp/dmp.module.ts index 187982142..a2c66f8e5 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp.module.ts +++ b/dmp-frontend/src/app/ui/dmp/dmp.module.ts @@ -43,6 +43,7 @@ import { DatasetEditorDetailsModule } from './editor/dataset-editor-details/data import { DatasetEditorDetailsComponent } from './editor/dataset-editor-details/dataset-editor-details.component'; import { DatasetDescriptionFormModule } from '../misc/dataset-description-form/dataset-description-form.module'; import { LicenseInfoComponent } from './editor/license-info/license-info.component'; +import { StartNewDatasetDialogComponent } from './start-new-dataset-dialogue/start-new-dataset-dialog.component'; @NgModule({ imports: [ @@ -87,6 +88,7 @@ import { LicenseInfoComponent } from './editor/license-info/license-info.compone AddCostComponent, CostListingComponent, StartNewDmpDialogComponent, + StartNewDatasetDialogComponent, MainInfoComponent, FundingInfoComponent, DatasetInfoComponent, @@ -103,6 +105,7 @@ import { LicenseInfoComponent } from './editor/license-info/license-info.compone AddOrganizationComponent, AddCostComponent, StartNewDmpDialogComponent, + StartNewDatasetDialogComponent, DatasetEditorDetailsComponent ] }) diff --git a/dmp-frontend/src/app/ui/dmp/editor/datasets-tab/datasets-tab.component.ts b/dmp-frontend/src/app/ui/dmp/editor/datasets-tab/datasets-tab.component.ts index 71954dfe6..ccb631948 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/datasets-tab/datasets-tab.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/datasets-tab/datasets-tab.component.ts @@ -36,7 +36,7 @@ export class DatasetsTabComponent implements OnInit { } addDataset(rowId: String) { - this.router.navigate(['/new/dataset/' + rowId]); + this.router.navigate(['/datasets/new/' + rowId]); } } diff --git a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts index 3fa5aac45..bcadc5d35 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts +++ b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts @@ -29,6 +29,9 @@ import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order import { GuidedTourService } from '@app/library/guided-tour/guided-tour.service'; import { GuidedTour, Orientation } from '@app/library/guided-tour/guided-tour.constants'; import { NgDialogAnimationService } from "ng-dialog-animation"; +import { StartNewDatasetDialogComponent } from '../start-new-dataset-dialogue/start-new-dataset-dialog.component'; +import { DatasetWizardEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model'; +import { StartNewDmpDialogComponent } from '../start-new-dmp-dialogue/start-new-dmp-dialog.component'; @Component({ selector: 'app-dmp-listing-component', @@ -290,9 +293,9 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread this.isVisible = false; } - addDataset(rowId: String) { - this.router.navigate(['/new/dataset/' + rowId]); - } + // addDataset(rowId: String) { + // this.router.navigate(['/datasets/new/' + rowId]); + // } showDatasets(rowId: String, rowLabel: String) { this.router.navigate(['/datasets/dmp/' + rowId, { dmpLabel: rowLabel }]); diff --git a/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.html b/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.html index 8ad60977a..ab560e044 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.html +++ b/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.html @@ -29,7 +29,7 @@
open_in_new{{'DMP-LISTING.ACTIONS.EXPORT' | translate}} - add{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}} + add{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}} group_add{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}} filter_none{{'DMP-LISTING.ACTIONS.CLONE' | translate}} more_horiz diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html index f510872ca..9758c6331 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html @@ -84,7 +84,7 @@
{{'DMP-OVERVIEW.DATASETS-USED' | translate}}
-
diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.scss b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.scss index b1ac1472d..c08278435 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.scss +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.scss @@ -56,14 +56,6 @@ font-weight: 700; } -.add-dataset-btn { - border: none; - font: Bold 0.875em Roboto; - // font: Bold 0.875em Open Sans; - color: #444444; - background-color: transparent; -} - .frame-btn { border: 1px solid #212121; color: black; @@ -173,6 +165,10 @@ margin-bottom: 1.875em; } +.dataset { + width: fit-content; +} + .dataset-btn-label { margin-right: 1em; overflow: hidden; @@ -283,13 +279,17 @@ .dmp-label, .dataset-btn, -.add-dataset-btn, .doi-panel, .researcher { display: flex; align-items: center; } +.add-dataset-btn { + border: 2px solid #212121; + border-radius: 30px; +} + .show-more-btn { display: flex; justify-content: center; diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts index 11dbdb653..d480a4e44 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts @@ -43,6 +43,9 @@ import { FunderFormModel } from '../editor/grant-tab/funder-form-model'; import { ProjectFormModel } from '../editor/grant-tab/project-form-model'; import { GrantTabModel } from '../editor/grant-tab/grant-tab-model'; import { ExtraPropertiesFormModel } from '../editor/general-tab/extra-properties-form.model'; +import { DatasetWizardEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model'; +import { StartNewDatasetDialogComponent } from '../start-new-dataset-dialogue/start-new-dataset-dialog.component'; +import { StartNewDmpDialogComponent } from '../start-new-dmp-dialogue/start-new-dmp-dialog.component'; @Component({ selector: 'app-dmp-overview', @@ -633,8 +636,42 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { }); } - addDataset(rowId: String) { - this.router.navigate(['/new/dataset/' + rowId]); + openNewDmpDialog() { + if (this.dialog.openDialogs.length > 0) { + this.dialog.closeAll(); + } + else { + const dialogRef = this.dialog.open(StartNewDmpDialogComponent, { + disableClose: false, + data: { + isDialog: true + } + }); + } + } + + // addDataset(rowId: String) { + // this.router.navigate(['/datasets/new/' + rowId]); + // } + + addNewDataset() { + const dialogRef = this.dialog.open(StartNewDatasetDialogComponent, { + disableClose: false, + restoreFocus: false, + data: { + startNewDmp: false, + formGroup: new DatasetWizardEditorModel().buildForm() + } + }); + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { + if (result) { + if (result.startNewDmp) { + this.openNewDmpDialog(); + } else { + this.router.navigate(['/datasets', 'new', result.formGroup.get('dmp').value.id]); + } + } + }); } createDoiLink(doi: string): string { diff --git a/dmp-frontend/src/app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component.html b/dmp-frontend/src/app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component.html new file mode 100644 index 000000000..8d2cf7362 --- /dev/null +++ b/dmp-frontend/src/app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component.html @@ -0,0 +1,29 @@ +
+
+ {{'DASHBOARD.SELECT-DMP' | translate}} + close +
+
+
+ + + +
+
+
+
+ Are those options not enough? Start new DMP +
+
+
+
+
+ +
+
+ + +
+
+
+
diff --git a/dmp-frontend/src/app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component.scss b/dmp-frontend/src/app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component.scss new file mode 100644 index 000000000..a6bbcd590 --- /dev/null +++ b/dmp-frontend/src/app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component.scss @@ -0,0 +1,96 @@ +::ng-deep .mat-dialog-container { + border-radius: 8px; +} + +.form-container { + width: 33rem; + min-height: 14rem; + padding: 0.28rem 0.34rem 0rem 0.625rem; +} + +.logo { + width: 8.44rem; +} + +.close-icon { + cursor: pointer; +} + +.content { + margin: 2.17rem 0rem 1.1875rem 0rem; +} + +.title, +.text { + font-size: 1.25rem; + font-weight: lighter; + color: #000000; + opacity: 0.8; +} + +.title { + text-align: left; + font-weight: 500; + font-size: 1.25rem; + letter-spacing: 0px; + color: #212121; + opacity: 1; +} + +.text { + margin-bottom: 2.9375rem; + line-height: 1.9rem; +} + +.cancel-btn { + background: #ffffff 0% 0% no-repeat padding-box; + border: 1px solid #b5b5b5; + border-radius: 30px; + width: 101px; + height: 43px; + color: #212121; + font-weight: 500; +} + +.next-btn { + background: #ffffff 0% 0% no-repeat padding-box; + border: 1px solid #129d99; + border-radius: 30px; + opacity: 1; + width: 101px; + height: 43px; + color: #129d99; + font-weight: 500; +} + +.disabled-btn { + border: 1px solid #b5b5b5; + border-radius: 30px; + opacity: 1; + width: 101px; + height: 43px; + color: #b5b5b5; + font-weight: 500; +} + +.actions { + display: flex; + flex-direction: row; +} + +.new-dmp { + text-align: left; + text-decoration: underline; + letter-spacing: 0px; + color: #008887; + cursor: pointer; +} + +::ng-deep .dmp-form .mat-form-field-appearance-outline .mat-form-field-outline { + background: #fafafa !important; +} + +::ng-deep .dmp-form .mat-form-field-appearance-outline .mat-form-field-infix { + font-size: 1rem; + padding: 0.6em 0 1em 0 !important; +} diff --git a/dmp-frontend/src/app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component.ts b/dmp-frontend/src/app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component.ts new file mode 100644 index 000000000..0d4d119d4 --- /dev/null +++ b/dmp-frontend/src/app/ui/dmp/start-new-dataset-dialogue/start-new-dataset-dialog.component.ts @@ -0,0 +1,82 @@ +import { Component, Inject } from '@angular/core'; +import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog'; +import { BaseComponent } from '@common/base/base.component'; +import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; +import { TranslateService } from '@ngx-translate/core'; +import { Observable } from 'rxjs'; +import { DmpListingModel } from '@app/core/model/dmp/dmp-listing'; +import { DataTableRequest } from '@app/core/model/data-table/data-table-request'; +import { DmpCriteria } from '@app/core/query/dmp/dmp-criteria'; +import { DmpStatus } from '@app/core/common/enum/dmp-status'; +import { map } from 'rxjs/operators'; +import { DmpService } from '@app/core/services/dmp/dmp.service'; +import { FormGroup } from '@angular/forms'; + +@Component({ + selector: 'app-start-new-dataset', + templateUrl: './start-new-dataset-dialog.component.html', + styleUrls: ['./start-new-dataset-dialog.component.scss'] +}) +export class StartNewDatasetDialogComponent extends BaseComponent { + + public isDialog: boolean = false; + public formGroup: FormGroup; + + dmpAutoCompleteConfiguration: SingleAutoCompleteConfiguration = { + filterFn: this.searchDmp.bind(this), + initialItems: (extraData) => this.searchDmp(''), + displayFn: (item) => this.getDatasetDisplay(item), + titleFn: (item) => item['label'], + subtitleFn: (item) => this.language.instant('DATASET-WIZARD.FIRST-STEP.SUB-TITLE') + new Date(item['creationTime']).toISOString() + }; + + constructor( + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: any, + public dialog: MatDialog, + private language: TranslateService, + private dmpService: DmpService + ) { + super(); + this.formGroup = data.formGroup; + } + + cancel() { + this.dialogRef.close(); + } + + send() { + this.dialogRef.close(this.data); + } + + close() { + this.dialogRef.close(false); + } + + next() { + this.dialogRef.close(this.data); + } + + startNewDmp() { + this.data.startNewDmp = true; + this.dialogRef.close(this.data); + } + + searchDmp(query: string): Observable { + const fields: Array = new Array(); + fields.push('-created'); + const dmpDataTableRequest: DataTableRequest = new DataTableRequest(0, null, { fields: fields }); + dmpDataTableRequest.criteria = new DmpCriteria(); + dmpDataTableRequest.criteria.like = query; + dmpDataTableRequest.criteria.status = DmpStatus.Draft; + return this.dmpService.getPaged(dmpDataTableRequest, "autocomplete").pipe(map(x => x.data)); + } + + getDatasetDisplay(item: any): string { + // if (!this.isPublic) { + // return (item['status'] ? this.language.instant('TYPES.DATASET-STATUS.FINALISED').toUpperCase() : this.language.instant('TYPES.DATASET-STATUS.DRAFT').toUpperCase()) + ': ' + item['label']; + // } + // else { return item['label']; } + return item['label'] ? item['label'] : null; + } +} diff --git a/dmp-frontend/src/assets/i18n/de.json b/dmp-frontend/src/assets/i18n/de.json index 121c14118..a962ea327 100644 --- a/dmp-frontend/src/assets/i18n/de.json +++ b/dmp-frontend/src/assets/i18n/de.json @@ -1146,7 +1146,8 @@ "SEARCH": "SUCHE...", "DATA-MANAGEMENT-PLANS": "DATENMANAGEMENTPLÄNE", "PERSONAL-USAGE": "Personal Usage", - "PUBLIC-USAGE": "Public Usage" + "PUBLIC-USAGE": "Public Usage", + "SELECT-DMP": "Select a DMP for your Dataset" }, "USER-DIALOG": { "USER-PROFILE": "Mein Profil", diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index 0a5981fb7..73e691a34 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -561,6 +561,7 @@ }, "COPY": "Copy", "CANCEL": "Cancel", + "NEXT": "Next", "ERROR-MESSAGE": "Does not contain this Dataset Description Template" } }, @@ -1309,6 +1310,7 @@ "LATEST-ACTIVITY": "Latest Activity", "DMP-ABOUT-BEG": "A DMP in Argos consists of key information about research, such as purpose, objectives and researchers involved, but also about documentation of research datasets, namely", "DMP-ABOUT-END": ", that highlight the steps followed and the means used across data management activities.", + "SELECT-DMP": "Select a DMP for your Dataset", "ACTIONS": { "ADD-DATASET-DESCRIPTION": "Add Dataset Description", "ADD-DATASET": "Add Dataset", diff --git a/dmp-frontend/src/assets/i18n/es.json b/dmp-frontend/src/assets/i18n/es.json index 51e262ecd..5fbec1181 100644 --- a/dmp-frontend/src/assets/i18n/es.json +++ b/dmp-frontend/src/assets/i18n/es.json @@ -1295,6 +1295,7 @@ "LATEST-ACTIVITY": "Última actividad", "DMP-ABOUT-BEG": "Un PGD en Argos consiste en la información clave sobre una investigación. Para este propósito se incluyen además de objetivos e investigaciones la documentación sobre los datasets de la investigación.", "DMP-ABOUT-END": ", esto resalta los pasos seguidos y los medios usados en las actividades de administración de datos.", + "SELECT-DMP": "Select a DMP for your Dataset", "ACTIONS": { "ADD-DATASET-DESCRIPTION": "Añadir la descripción del dataset", "ADD-DATASET": "Añadir un dataset", diff --git a/dmp-frontend/src/assets/i18n/gr.json b/dmp-frontend/src/assets/i18n/gr.json index 5330bdf24..a1a93a6ff 100644 --- a/dmp-frontend/src/assets/i18n/gr.json +++ b/dmp-frontend/src/assets/i18n/gr.json @@ -1284,6 +1284,7 @@ "ALL": "Όλα", "LATEST-ACTIVITY": "Latest Activity", "EMPTY-LIST": "Nothing here yet.", + "SELECT-DMP": "Select a DMP for your Dataset", "ACTIONS": { "ADD-DATASET-DESCRIPTION": "Προσθήκη Περιγραφή Dataset", "ADD-DATASET": "Add Dataset", diff --git a/dmp-frontend/src/assets/i18n/tr.json b/dmp-frontend/src/assets/i18n/tr.json index 3a70acbd8..3c6306a9b 100644 --- a/dmp-frontend/src/assets/i18n/tr.json +++ b/dmp-frontend/src/assets/i18n/tr.json @@ -1267,6 +1267,7 @@ "LATEST-ACTIVITY": "Son İşlemler", "DMP-ABOUT-BEG": "Argos'taki bir DMP, araştırma veri setlerinin dokümantasyonu, yani, takip edilen adımları ve araştırmayla ilgili amaç, hedefler ve araştırmacılar gibi önemli bilgilerden oluşur. Şöyle ki,", "DMP-ABOUT-END": ", veri yönetimi faaliyetlerinde izlenen adımları ve kullanılan araçları vurgulayan.", + "SELECT-DMP": "Select a DMP for your Dataset", "ACTIONS": { "ADD-DATASET-DESCRIPTION": "Veri Seti Tanımı Ekle", "ADD-DATASET": "Veri Seti Ekle",