Create new Dataset - using pop up

This commit is contained in:
apapachristou 2020-09-18 14:14:48 +03:00
parent 5944dfc005
commit d48e8a984a
21 changed files with 370 additions and 32 deletions

View File

@ -25,9 +25,9 @@
<div class="counter-zero">0</div>
<a [routerLink]="['/datasets']" class="link">{{'DASHBOARD.DATASET-DESCRIPTIONS' | translate}}</a>
<div class="counter-zero">0</div>
<a href="#" class="link-disabled">{{'DASHBOARD.GRANTS' | translate}}</a>
<a class="link-disabled">{{'DASHBOARD.GRANTS' | translate}}</a>
<div class="counter-zero">0</div>
<a href="#" class="link-disabled">{{'DASHBOARD.RELATED-ORGANISATIONS' | translate}}</a>
<a class="link-disabled">{{'DASHBOARD.RELATED-ORGANISATIONS' | translate}}</a>
</div>
</div>
</div>
@ -41,7 +41,7 @@
<b>{{'DASHBOARD.DATASET-DESCRIPTIONS' | translate}}</b>
{{'DASHBOARD.DMP-ABOUT-END' | translate}}</p>
<div class="d-flex pt-4 pb-4 mt-3 mb-3">
<button mat-raised-button type="button" class="col-auto align-self-center yellow-btn" [routerLink]="['/new/dataset/']">{{'DASHBOARD.ACTIONS.ADD-DATASET-DESCRIPTION' | translate}}</button>
<button mat-raised-button type="button" class="col-auto align-self-center yellow-btn" (click)="addNewDataset()">{{'DASHBOARD.ACTIONS.ADD-DATASET-DESCRIPTION' | translate}}</button>
</div>
</div>
<div class="latest-activity-title">{{'DASHBOARD.LATEST-ACTIVITY' | translate}}</div>
@ -62,7 +62,7 @@
<app-recent-edited-dataset-activity (totalCountDatasets)="onCountDatasets($event)"></app-recent-edited-dataset-activity>
<div *ngIf="totalDatasets === 0" class="empty-list">{{'DASHBOARD.EMPTY-LIST' | translate}}</div>
<div *ngIf="totalDatasets === 0" class="col-auto d-flex justify-content-center">
<button mat-raised-button class="add-dataset" [routerLink]="['/new/dataset/']">
<button mat-raised-button class="add-dataset" (click)="addNewDataset()">
<mat-icon>add</mat-icon> {{'DASHBOARD.ACTIONS.ADD-DATASET' | translate}}
</button>
</div>

View File

@ -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']);
// }

View File

@ -58,7 +58,7 @@
</a>
<div class="dmp-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isDraftDmp(activity)" [routerLink]="['/new/dataset/' + activity.id]" target="_blank"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isDraftDmp(activity)" [routerLink]="['/datasets/new/' + activity.id]" target="_blank"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isUserOwner(activity)" (click)="openShareDialog(activity.id, activity.title)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isAuthenticated()" (click)="cloneOrNewVersionClicked(activity, false)"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>
<a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>

View File

@ -52,7 +52,7 @@
</a>
<div class="dmp-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isDraftDmp(activity)" [routerLink]="['/new/dataset/' + activity.id]" target="_blank"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isDraftDmp(activity)" [routerLink]="['/datasets/new/' + activity.id]" target="_blank"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isUserOwner(activity)" (click)="openShareDialog(activity.id, activity.label)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isAuthenticated()" (click)="cloneOrNewVersionClicked(activity, false)"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>
<a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>

View File

@ -8,7 +8,7 @@
<p>{{'DATASET-LISTING.TEXT-INFO' | translate}} <u class="pointer" [routerLink]="['/explore']">{{'DATASET-LISTING.LINK-PUBLIC-DATASETS' | translate}}</u> {{'DATASET-LISTING.TEXT-INFO-REST' | translate}}</p>
<p class="mt-4 pt-2">{{'DATASET-LISTING.TEXT-INFO-PAR' | translate}}
<div class="col pl-0 pt-3">
<button mat-raised-button class="add-dataset align-self-center yellow-btn" [routerLink]="['/new/dataset/']">
<button mat-raised-button class="add-dataset align-self-center yellow-btn" (click)="addNewDataset()">
{{'DASHBOARD.ACTIONS.ADD-DATASET' | translate}}
</button>
</div>
@ -17,7 +17,7 @@
<p *ngIf="listingItems && listingItems.length > 0" class="col-auto header-title">{{(isPublic ? 'GENERAL.TITLES.EXPLORE' : 'GENERAL.TITLES.DATASETS') | translate}}</p>
<div *ngIf="listingItems && listingItems.length > 0 && !isPublic" class="ml-auto">
<div class="col-auto">
<button mat-raised-button class="add-dataset align-self-center yellow-btn" [routerLink]="['/new/dataset/']">
<button mat-raised-button class="add-dataset align-self-center yellow-btn" (click)="addNewDataset()">
{{'DASHBOARD.ACTIONS.ADD-DATASET' | translate}}
</button>
</div>

View File

@ -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]);
// }

View File

@ -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
]
})

View File

@ -36,7 +36,7 @@ export class DatasetsTabComponent implements OnInit {
}
addDataset(rowId: String) {
this.router.navigate(['/new/dataset/' + rowId]);
this.router.navigate(['/datasets/new/' + rowId]);
}
}

View File

@ -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 }]);

View File

@ -29,7 +29,7 @@
</a>
<div class="dmp-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isDraftDmp(dmp)" [routerLink]="['/new/dataset/' + dmp.id]" target="_blank"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isDraftDmp(dmp)" [routerLink]="['/datasets/new/' + dmp.id]" target="_blank"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isUserOwner(dmp)" (click)="openShareDialog(dmp.id, dmp.label)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" *ngIf="isAuthenticated()" (click)="cloneOrNewVersionClicked(dmp, false)"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>
<a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>

View File

@ -84,7 +84,7 @@
<div class="row header">{{'DMP-OVERVIEW.DATASETS-USED' | translate}}</div>
<div class="d-flex flex-column">
<div *ngFor="let dataset of dmp.datasets">
<a class="row" [routerLink]="['/datasets/overview/' + dataset.id]" target="_blank">
<a class="row dataset" [routerLink]="['/datasets/overview/' + dataset.id]" target="_blank">
<button mat-raised-button class="mb-2 mr-2 pl-0 pr-0">
<div matTooltip="{{ dataset.label }}" class="col-auto dataset-btn">
<div class="dataset-btn-label">{{ dataset.label }}</div>
@ -97,11 +97,11 @@
<span class="material-icons">horizontal_rule</span>
</div>
</div>
<div class="row mt-2 add-dataset-txt">
<a class="add-dataset-btn" *ngIf="isDraftDmp(dmp)" [routerLink]="['/new/dataset/' + dmp.id]" target="_blank">
<div class="row mt-2">
<button mat-raised-button class="add-dataset-btn" *ngIf="isDraftDmp(dmp)" (click)="addNewDataset()">
<mat-icon>add</mat-icon>
{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}
</a>
</button>
</div>
</div>
<div class="col-md-4 col-lg-4 p-0">

View File

@ -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;

View File

@ -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 {

View File

@ -0,0 +1,29 @@
<div class="form-container">
<div mat-dialog-title class="row d-flex justify-content-between m-0">
<span class="title">{{'DASHBOARD.SELECT-DMP' | translate}}</span>
<mat-icon class="close-icon" (click)="close()">close</mat-icon>
</div>
<div class="row content">
<div class="col dmp-form p-0">
<mat-form-field>
<app-single-auto-complete [required]="true" [formControl]="formGroup.get('dmp')" placeholder="{{'DATASET-EDITOR.FIELDS.SELECT-DMP' | translate}}" [configuration]="dmpAutoCompleteConfiguration"></app-single-auto-complete>
</mat-form-field>
</div>
</div>
<div class="row">
<div class="col-auto pb-4">
<span>Are those options not enough?</span>&nbsp;<span class="new-dmp" (click)="startNewDmp()">Start new DMP</span>
</div>
</div>
<div class="row">
<div class="col actions">
<div class="col-auto ml-auto">
<button mat-button type="button" class="cancel-btn" (click)="cancel()">{{ 'DATASET-WIZARD.DIALOGUE.CANCEL' | translate }}</button>
</div>
<div class="col-auto pl-0">
<button mat-button *ngIf="formGroup.get('dmp').value" type="button" class="next-btn" (click)="next()">{{ 'DATASET-WIZARD.DIALOGUE.NEXT' | translate }}</button>
<button mat-button *ngIf="!formGroup.get('dmp').value" type="button" class="disabled-btn">{{ 'DATASET-WIZARD.DIALOGUE.NEXT' | translate }}</button>
</div>
</div>
</div>
</div>

View File

@ -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;
}

View File

@ -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<StartNewDatasetDialogComponent>,
@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<DmpListingModel[]> {
const fields: Array<string> = new Array<string>();
fields.push('-created');
const dmpDataTableRequest: DataTableRequest<DmpCriteria> = 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;
}
}

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",