dmp blueprint frontend cleanup

This commit is contained in:
Diamantis Tziotzios 2023-10-25 18:15:41 +03:00
parent d1bac40f0f
commit 51cc5f4fd9
26 changed files with 74 additions and 474 deletions

View File

@ -1,4 +0,0 @@
export interface DmpAssociatedProfileModel {
id: String;
label: String;
}

View File

@ -1,7 +0,0 @@
export interface DmpBlueprintExternalAutoCompleteField {
url: string;
optionsRoot: string;
multiAutoComplete: boolean;
label: string;
value: string;
}

View File

@ -1,13 +0,0 @@
import { DmpBlueprintExtraFieldDataType } from '../../common/enum/dmp-blueprint-field-type';
import { DmpBlueprintType } from '../../common/enum/dmp-blueprint-type';
import { DmpBlueprintExternalAutoCompleteFieldDataEditorModel } from '../../../ui/admin/dmp-blueprint/editor/external-autocomplete/dmp-blueprint-external-autocomplete-field-editor.model';
export interface DmpBlueprintField {
id: string;
type: DmpBlueprintType;
dataType: DmpBlueprintExtraFieldDataType;
required: boolean;
label: string;
value: any;
externalAutocomplete?: DmpBlueprintExternalAutoCompleteFieldDataEditorModel;
}

View File

@ -1,5 +1,4 @@
import { DmpStatus } from "../../common/enum/dmp-status";
import { DmpAssociatedProfileModel } from '../dmp-blueprint/dmp-associated-profile';
export interface DmpListingModel {
id: string;
@ -18,7 +17,6 @@ export interface DmpListingModel {
groupId: string;
version: number;
datasets: any[];
associatedProfiles: DmpAssociatedProfileModel[];
users: any[];
public: boolean;
}

View File

@ -1,6 +1,5 @@
import { OrganizationModel } from "../organisation/organization";
import { UserInfoListingModel } from "../user/user-info-listing";
import { DmpAssociatedProfileModel } from "../dmp-blueprint/dmp-associated-profile";
import { ResearcherModel } from "../researcher/researcher";
import { GrantOverviewModel } from "../grant/grant-overview";
import { DatasetOverviewModel } from "../dataset/dataset-overview";
@ -18,7 +17,6 @@ export interface DmpOverviewModel {
groupId: string;
description: string;
grant: GrantOverviewModel;
associatedProfiles: DmpAssociatedProfileModel[];
users: UserInfoListingModel[];
organisations: OrganizationModel[];
datasets: DatasetOverviewModel[];

View File

@ -1,14 +1,10 @@
import { RecentActivityModel } from './recent-activity.model';
import { RecentDatasetModel } from './recent-dataset-activity.model';
import { DmpAssociatedProfileModel } from '../dmp-blueprint/dmp-associated-profile';
import { UserInfoListingModel } from '../user/user-info-listing';
import { DatasetUrlListing } from '../dataset/dataset-url-listing';
import { RecentActivityModel } from './recent-activity.model';
export class RecentDmpModel extends RecentActivityModel {
doi: String;
extraProperties: Map<String, any>;
datasets: DatasetUrlListing[];
associatedProfiles: DmpAssociatedProfileModel[];
organisations: String;
groupId: string;
}

View File

@ -12,11 +12,9 @@ import { CommonUiModule } from '@common/ui/common-ui.module';
import { NgxDropzoneModule } from "ngx-dropzone";
import { DmpBlueprintRoutingModule } from './dmp-blueprint.routing';
import { DmpBlueprintEditorComponent } from './editor/dmp-blueprint-editor.component';
import { DmpBlueprintExternalAutocompleteFieldEditorComponent } from './editor/external-autocomplete/dmp-blueprint-external-autocomplete-field-editor.component';
import { DialodConfirmationUploadDmpBlueprints } from './listing/criteria/dialog-confirmation-upload-blueprint/dialog-confirmation-upload-blueprints.component';
import { DmpBlueprintCriteriaComponent } from './listing/criteria/dmp-blueprint-criteria.component';
import { DmpBlueprintListingComponent } from './listing/dmp-blueprint-listing.component';
import { DmpBlueprintListingFiltersComponent } from "./listing/filters/dmp-blueprint-listing-filters.component";
import { ImportDmpBlueprintDialogComponent } from './listing/import-dmp-blueprint/import-dmp-blueprint.dialog.component';
@NgModule({
imports: [
@ -37,9 +35,7 @@ import { DmpBlueprintListingFiltersComponent } from "./listing/filters/dmp-bluep
DmpBlueprintEditorComponent,
DmpBlueprintListingComponent,
DmpBlueprintListingFiltersComponent,
DmpBlueprintCriteriaComponent,
DialodConfirmationUploadDmpBlueprints,
DmpBlueprintExternalAutocompleteFieldEditorComponent
ImportDmpBlueprintDialogComponent
]
})
export class DmpBlueprintModule { }

View File

@ -770,24 +770,4 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
FileSaver.saveAs(blob, filename);
});
}
// isExternalAutocomplete(formGroup: UntypedFormGroup) {
// if (formGroup.get('dataType').value == DmpBlueprintFieldDataType.ExternalAutocomplete) {
// this.addControl(formGroup);
// return true;
// } else {
// this.removeControl(formGroup);
// return false;
// }
// }
// addControl(formGroup: UntypedFormGroup) {
// if (formGroup.get('dataType').value == 3)
// formGroup.addControl('externalAutocomplete', new DmpBlueprintExternalAutoCompleteFieldDataEditorModel().buildForm());
// }
// removeControl(formGroup: UntypedFormGroup) {
// if (formGroup.get('dataType').value != 3)
// formGroup.removeControl('externalAutocomplete');
// }
}

View File

@ -1,22 +0,0 @@
<div class="container external-autocomplete">
<div class="row external-autocomplete-field" *ngIf="form.get('externalAutocomplete')">
<h5 style="font-weight: bold" class="col-auto">{{'DMP-BLUEPRINT-EDITOR.FIELDS.EXTERNAL-AUTOCOMPLETE.TITLE' | translate}}</h5>
<mat-checkbox class="col-auto" [formControl]="this.form.get('externalAutocomplete').get('multiAutoComplete')">
{{'DMP-BLUEPRINT-EDITOR.FIELDS.EXTERNAL-AUTOCOMPLETE.MULTIPLE-AUTOCOMPLETE' | translate}}
</mat-checkbox>
<mat-form-field class="col-md-12">
<input matInput placeholder="{{'DMP-BLUEPRINT-EDITOR.FIELDS.EXTERNAL-AUTOCOMPLETE.URL' | translate}}" [formControl]="this.form.get('externalAutocomplete').get('url')">
</mat-form-field>
<mat-form-field class="col-md-4">
<input matInput placeholder="{{'DMP-BLUEPRINT-EDITOR.FIELDS.EXTERNAL-AUTOCOMPLETE.OPTIONS-ROOT' | translate}}"
[formControl]="this.form.get('externalAutocomplete').get('optionsRoot')">
</mat-form-field>
<mat-form-field class="col-md-4">
<input matInput placeholder="{{'DMP-BLUEPRINT-EDITOR.FIELDS.EXTERNAL-AUTOCOMPLETE.LABEL' | translate}}" [formControl]="this.form.get('externalAutocomplete').get('label')">
</mat-form-field>
<mat-form-field class="col-md-4">
<input matInput placeholder="{{'DMP-BLUEPRINT-EDITOR.FIELDS.EXTERNAL-AUTOCOMPLETE.VALUE' | translate}}" [formControl]="this.form.get('externalAutocomplete').get('value')">
</mat-form-field>
</div>
</div>

View File

@ -1,13 +0,0 @@
.external-autocomplete {
margin-bottom: 10px;
.centered-row-item {
align-items: center;
display: flex;
}
}
.external-autocomplete-field {
margin-left: auto;
background: aliceblue;
}

View File

@ -1,17 +0,0 @@
import { Component, Input, OnInit } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
import { DmpBlueprintExternalAutoCompleteFieldDataEditorModel } from './dmp-blueprint-external-autocomplete-field-editor.model';
@Component({
selector: 'app-dmp-blueprint-external-autocomplete-field-editor-component',
styleUrls: ['./dmp-blueprint-external-autocomplete-field-editor.component.scss'],
templateUrl: './dmp-blueprint-external-autocomplete-field-editor.component.html'
})
export class DmpBlueprintExternalAutocompleteFieldEditorComponent implements OnInit {
@Input() form: UntypedFormGroup
private externalAutocomplete: DmpBlueprintExternalAutoCompleteFieldDataEditorModel;
ngOnInit() {
}
}

View File

@ -1,32 +0,0 @@
import { UntypedFormGroup, UntypedFormBuilder } from "@angular/forms";
import { DmpBlueprintExternalAutoCompleteField } from "../../../../../core/model/dmp-blueprint/dmp-blueprint-external-autocomplete";
export class DmpBlueprintExternalAutoCompleteFieldDataEditorModel {
public url: string;
public optionsRoot: string;
public multiAutoComplete: boolean = false;
public label: string;
public value: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = new UntypedFormBuilder().group({
url: [{ value: this.url, disabled: (disabled && !skipDisable.includes('DmpBlueprintExternalAutoCompleteFieldDataEditorModel.url')) }],
optionsRoot: [{ value: this.optionsRoot, disabled: (disabled && !skipDisable.includes('DmpBlueprintExternalAutoCompleteFieldDataEditorModel.optionsRoot')) }],
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('DmpBlueprintExternalAutoCompleteFieldDataEditorModel.multiAutoComplete')) }],
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('DmpBlueprintExternalAutoCompleteFieldDataEditorModel.label')) }],
value: [{ value: this.value, disabled: (disabled && !skipDisable.includes('DmpBlueprintExternalAutoCompleteFieldDataEditorModel.value')) }],
});
return formGroup;
}
fromModel(item: DmpBlueprintExternalAutoCompleteField): DmpBlueprintExternalAutoCompleteFieldDataEditorModel {
this.url = item.url;
this.optionsRoot = item.optionsRoot;
this.multiAutoComplete = item.multiAutoComplete;
this.label = item.label;
this.value = item.value;
return this;
}
}

View File

@ -1,23 +0,0 @@
<div class="row align-items-end">
<div class="col-auto">
<div class="d-lg-inline-block pr-2 text-muted">
<span>{{'CRITERIA.USERS.SHOW' | translate}}:</span>
</div>
<mat-form-field class="status-form-field">
<mat-select [(ngModel)]="criteria.status" (ngModelChange)="controlModified()" placeholder=" {{'CRITERIA.BLUEPRINT.STATUS' | translate}}">
<mat-option [value]="null">{{'BLUEPRINT-STATUS.NONE' | translate}}</mat-option>
<mat-option [value]="0">{{'BLUEPRINT-STATUS.DRAFT' | translate}}</mat-option>
<mat-option [value]="1">{{'BLUEPRINT-STATUS.FINALIZED' | translate}}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="col-auto ml-lg-auto">
<mat-form-field class="search-form-field">
<input matInput placeholder=" {{'CRITERIA.BLUEPRINT.LIKE'| translate}}" name="dmpBlueprintLike"
[(ngModel)]="criteria.like" (ngModelChange)="controlModified()">
<mat-icon matPrefix>search</mat-icon>
</mat-form-field>
</div>
</div>

View File

@ -1,17 +0,0 @@
.mat-form-field{
display: inline-block !important;
}
:host ::ng-deep .status-form-field .mat-form-field-wrapper {
background-color: white !important;
padding-bottom: 0 !important;
}
:host ::ng-deep .search-form-field .mat-form-field-wrapper {
background-color: white !important;
padding-bottom: 0 !important;
}
:host ::ng-deep .mat-form-field-appearance-outline .mat-form-field-infix {
padding: 0.3rem 0rem 0.6rem 0rem !important;
}

View File

@ -1,69 +0,0 @@
import { Component, Input, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { DmpBlueprintCriteria } from '@app/core/query/dmp/dmp-blueprint-criteria';
import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service';
import { BaseCriteriaComponent } from '@app/ui/misc/criteria/base-criteria.component';
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'app-dmp-blueprint-criteria-component',
templateUrl: './dmp-blueprint-criteria.component.html',
styleUrls: ['./dmp-blueprint-criteria.component.scss'],
})
export class DmpBlueprintCriteriaComponent extends BaseCriteriaComponent implements OnInit {
public criteria: DmpBlueprintCriteria = new DmpBlueprintCriteria();
constructor(
private dmpBlueprintService: DmpBlueprintService,
private dialog: MatDialog,
private language: TranslateService
) {
super(new ValidationErrorModel());
}
ngOnInit() {
super.ngOnInit();
if (this.criteria == null) { this.criteria = new DmpBlueprintCriteria(); }
}
setCriteria(criteria: DmpBlueprintCriteria): void {
this.criteria = criteria;
}
onCallbackError(error: any) {
this.setErrorModel(error.error);
}
controlModified(): void {
this.clearErrorModel();
if (this.refreshCallback != null &&
(this.criteria.like == null || this.criteria.like.length === 0 || this.criteria.like.length > 2)
) {
this.refreshCallback();
}
}
// openDialog(): void {
// const dialogRef = this.dialog.open(DialodConfirmationUploadDmpBlueprints, {
// restoreFocus: false,
// data: {
// message: this.language.instant('DMP-BLUEPRINT-LISTING.UPLOAD.UPLOAD-XML-FILE-TITLE'),
// confirmButton: this.language.instant('DMP-BLUEPRINT-LISTING.UPLOAD.UPLOAD-XML'),
// cancelButton: this.language.instant('DMP-BLUEPRINT-LISTING.UPLOAD.UPLOAD-XML-FILE-CANCEL'),
// name: '',
// file: FileList,
// sucsess: false
// }
// });
// dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(data => {
// if (data && data.sucsess && data.name != null && data.file != null) {
// this.dmpBlueprintService.uploadFile(data.file, data.name)
// .pipe(takeUntil(this._destroyed))
// .subscribe();
// }
// });
// }
}

View File

@ -8,27 +8,26 @@
</div>
<div class="col-auto">
<button mat-raised-button class="create-btn"
*ngIf="authService.hasPermission(authService.permissionEnum.EditDescriptionTemplateType)"
[routerLink]="['/dmp-blueprint/new']">
<button mat-raised-button class="import-btn" (click)="import()">
<span class="button-text">
{{'DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML' | translate}}
</span>
</button>
</div>
<div class="col-auto">
<button mat-raised-button class="create-btn" *ngIf="authService.hasPermission(authService.permissionEnum.EditDescriptionTemplateType)" [routerLink]="['/dmp-blueprint/new']">
<mat-icon>add</mat-icon>
{{'DMP-BLUEPRINT-LISTING.CREATE-DMP-BLUEPRINT' | translate}}
</button>
</div>
</div>
<app-hybrid-listing [rows]="gridRows" [columns]="gridColumns" [visibleColumns]="visibleColumns"
[count]="totalElements" [offset]="currentPageNumber" [limit]="lookup.page.size"
[defaultSort]="lookup.order?.items" [externalSorting]="true" (rowActivated)="onRowActivated($event)"
(pageLoad)="alterPage($event)" (columnSort)="onColumnSort($event)"
(columnsChanged)="onColumnsChanged($event)" [listItemTemplate]="listItemTemplate">
<app-hybrid-listing [rows]="gridRows" [columns]="gridColumns" [visibleColumns]="visibleColumns" [count]="totalElements" [offset]="currentPageNumber" [limit]="lookup.page.size" [defaultSort]="lookup.order?.items" [externalSorting]="true" (rowActivated)="onRowActivated($event)" (pageLoad)="alterPage($event)" (columnSort)="onColumnSort($event)" (columnsChanged)="onColumnsChanged($event)" [listItemTemplate]="listItemTemplate">
<app-dmp-blueprint-listing-filters hybrid-listing-filters [(filter)]="lookup"
(filterChange)="filterChanged($event)" />
<app-dmp-blueprint-listing-filters hybrid-listing-filters [(filter)]="lookup" (filterChange)="filterChanged($event)" />
<app-user-settings-picker [key]="userSettingsKey" [userPreference]="lookup"
(onSettingSelected)="changeSetting($event)" [autoSelectUserSettings]="autoSelectUserSettings"
user-preference-settings />
<app-user-settings-picker [key]="userSettingsKey" [userPreference]="lookup" (onSettingSelected)="changeSetting($event)" [autoSelectUserSettings]="autoSelectUserSettings" user-preference-settings />
<!-- <button mat-icon-button download-listing-report>
<mat-icon>download</mat-icon>
</button> -->
@ -43,15 +42,13 @@
<div class="d-flex align-items-center p-3 gap-1-rem">
<div class="row">
<ng-container *ngIf="isColumnSelected('label')">
<a class="buttonLinkClass" [routerLink]="'./' + item?.id" class="col-12"
(click)="$event.stopPropagation()">{{item?.label | nullifyValue}}</a>
<a class="buttonLinkClass" [routerLink]="'./' + item?.id" class="col-12" (click)="$event.stopPropagation()">{{item?.label | nullifyValue}}</a>
<br />
</ng-container>
<ng-container *ngIf="isColumnSelected('status')">
<div class="col-auto">
<div class="status-chip"
[ngClass]="{'status-chip-finalized': item.status === dmpBlueprintStatuses.Finalized, 'status-chip-draft' : item.status === dmpBlueprintStatuses.Draft}">
<div class="status-chip" [ngClass]="{'status-chip-finalized': item.status === dmpBlueprintStatuses.Finalized, 'status-chip-draft' : item.status === dmpBlueprintStatuses.Draft}">
{{enumUtils.toDescriptionTemplateTypeStatusString(item.status) | nullifyValue}}
</div>
</div>
@ -80,8 +77,7 @@
<ng-template #dmpBlueprintStatus let-row="row" let-item>
<div class="row">
<div class="col-auto status-chip"
[ngClass]="{'status-chip-finalized': row.status === dmpBlueprintStatuses.Finalized, 'status-chip-draft' : row.status === dmpBlueprintStatuses.Draft}">
<div class="col-auto status-chip" [ngClass]="{'status-chip-finalized': row.status === dmpBlueprintStatuses.Finalized, 'status-chip-draft' : row.status === dmpBlueprintStatuses.Draft}">
{{enumUtils.toDescriptionTemplateTypeStatusString(row.status) | nullifyValue}}
</div>
</div>

View File

@ -11,6 +11,7 @@ import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.servic
import { MatomoService } from '@app/core/services/matomo/matomo-service';
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
import { BaseListingComponent } from '@common/base/base-listing-component';
import { PipeService } from '@common/formatting/pipe.service';
@ -21,9 +22,11 @@ import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/
import { ColumnDefinition, ColumnsChangedEvent, HybridListingComponent, PageLoadEvent } from '@common/modules/hybrid-listing/hybrid-listing.component';
import { Guid } from '@common/types/guid';
import { TranslateService } from '@ngx-translate/core';
import * as FileSaver from 'file-saver';
import { Observable } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof';
import { ImportDmpBlueprintDialogComponent } from './import-dmp-blueprint/import-dmp-blueprint.dialog.component';
@Component({
@ -66,7 +69,8 @@ export class DmpBlueprintListingComponent extends BaseListingComponent<DmpBluepr
private pipeService: PipeService,
public enumUtils: EnumUtils,
private language: TranslateService,
private dialog: MatDialog
private dialog: MatDialog,
private fileUtils: FileUtils
) {
super(router, route, uiNotificationService, httpErrorHandlingService, queryParamsService);
// Lookup setup
@ -178,13 +182,40 @@ export class DmpBlueprintListingComponent extends BaseListingComponent<DmpBluepr
}
export(id: Guid): void {
// this.dmpBlueprintService.downloadXML(dmpBlueprintId)
// .pipe(takeUntil(this._destroyed))
// .subscribe(response => {
// const blob = new Blob([response.body], { type: 'application/xml' });
// const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
// FileSaver.saveAs(blob, filename);
// });
this.dmpBlueprintService.downloadXML(id)
.pipe(takeUntil(this._destroyed))
.subscribe(response => {
const blob = new Blob([response.body], { type: 'application/xml' });
const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
FileSaver.saveAs(blob, filename);
});
}
import(): void {
const dialogRef = this.dialog.open(ImportDmpBlueprintDialogComponent, {
restoreFocus: false,
data: {
message: this.language.instant('DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML-FILE-TITLE'),
confirmButton: this.language.instant('DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML'),
cancelButton: this.language.instant('DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML-FILE-CANCEL'),
name: '',
file: FileList,
sucsess: false
}
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(data => {
if (data && data.sucsess && data.name != null && data.file != null) {
this.dmpBlueprintService.uploadFile(data.file, data.name)
.pipe(takeUntil(this._destroyed))
.subscribe(_ => {
this.uiNotificationService.snackBarNotification(this.language.instant('DMP-BLUEPRINT-LISTING.MESSAGES.TEMPLATE-UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success);
this.ngOnInit();
},
error => {
this.uiNotificationService.snackBarNotification(error.message, SnackBarNotificationLevel.Error);
});
}
});
}
}
@ -277,9 +308,9 @@ export class DmpBlueprintListingComponent extends BaseListingComponent<DmpBluepr
// const dialogRef = this.dialog.open(DialodConfirmationUploadDmpBlueprints, {
// restoreFocus: false,
// data: {
// message: this.languageService.instant('DMP-BLUEPRINT-LISTING.UPLOAD.UPLOAD-XML-FILE-TITLE'),
// confirmButton: this.languageService.instant('DMP-BLUEPRINT-LISTING.UPLOAD.UPLOAD-XML'),
// cancelButton: this.languageService.instant('DMP-BLUEPRINT-LISTING.UPLOAD.UPLOAD-XML-FILE-CANCEL'),
// message: this.languageService.instant('DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML-FILE-TITLE'),
// confirmButton: this.languageService.instant('DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML'),
// cancelButton: this.languageService.instant('DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML-FILE-CANCEL'),
// name: '',
// file: FileList,
// sucsess: false

View File

@ -28,7 +28,7 @@
</div>
<div class="row">
<mat-form-field class="col-12">
<input matInput placeholder="{{'DMP-BLUEPRINT-LISTING.UPLOAD.UPLOAD-XML-NAME'| translate}}" name="datasetBlueprintName" [(ngModel)]="data.name">
<input matInput placeholder="{{'DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML-NAME'| translate}}" name="datasetBlueprintName" [(ngModel)]="data.name">
</mat-form-field>
<div class="col-auto">
<button mat-button type="button" class="cancel-btn" (click)="cancel()">{{ data.cancelButton }}</button>

View File

@ -1,39 +1,38 @@
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Inject, Component } from '@angular/core';
@Component({
selector: 'app-dialog-confirmation-upload',
templateUrl: './dialog-confirmation-upload-blueprints.component.html',
styleUrls: ['./dialog-confirmation-upload-blueprints.component.scss']
templateUrl: './import-dmp-blueprint.dialog.component.html',
styleUrls: ['./import-dmp-blueprint.dialog.component.scss']
})
export class DialodConfirmationUploadDmpBlueprints {
export class ImportDmpBlueprintDialogComponent {
sizeError = false;
selectFile =false;
selectFile = false;
maxFileSize: number = 1048576;
selectedFileName: string;
constructor(
public dialogRef: MatDialogRef<DialodConfirmationUploadDmpBlueprints>,
public dialogRef: MatDialogRef<ImportDmpBlueprintDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) { }
selectXML(event) {
let file: FileList = null;
if(event.target && event.target.files){
if (event.target && event.target.files) {
file = event.target.files;
}else if(event.addedFiles && event.addedFiles.length){
} else if (event.addedFiles && event.addedFiles.length) {
file = event.addedFiles;
}
if(!file) return;//no select closed with cancel . no file selected
if (!file) return;//no select closed with cancel . no file selected
const size: number = file[0].size; // Get file size.
this.sizeError = size > this.maxFileSize; // Checks if file size is valid.
const formdata: FormData = new FormData();
if (!this.sizeError) {
this.data.file = file;
this.selectFile=true;
this.selectFile = true;
this.selectedFileName = file[0].name;
}
this.data.name = file[0].name;
@ -50,12 +49,12 @@ export class DialodConfirmationUploadDmpBlueprints {
this.dialogRef.close(this.data);
}
hasBlueprint():boolean{
hasBlueprint(): boolean {
return (this.selectFile && !this.sizeError);
}
//remove selected file
onRemove(){
this.data.name="";
onRemove() {
this.data.name = "";
this.selectFile = false;
this.selectedFileName = "";
}

View File

@ -4,7 +4,6 @@ import { CardComponent } from '@app/ui/dashboard/card/card.component';
import { DashboardComponent } from '@app/ui/dashboard/dashboard.component';
import { DashboardRoutingModule } from '@app/ui/dashboard/dashboard.routing';
import { DatasetInfoCounterComponent } from '@app/ui/dashboard/dataset-info-counter/dataset-info-counter.component';
import { DmpInfoCounterComponent } from '@app/ui/dashboard/dmp-info-counter/dmp-info-counter.component';
import { DraftsComponent } from '@app/ui/dashboard/drafts/drafts.component';
import { InfoCounterComponent } from '@app/ui/dashboard/info-counter/info-counter.component';
import { QuickWizardCreateAdd } from '@app/ui/dashboard/quick-wizard-create-add/quick-wizard-create-add.component';
@ -41,7 +40,6 @@ import { FormattingModule } from '@app/core/formatting.module';
RecentVisitedActivityComponent,
RecentEditedActivityComponent,
DraftsComponent,
DmpInfoCounterComponent,
DatasetInfoCounterComponent,
RecentEditedDatasetActivityComponent,
RecentEditedDmpActivityComponent

View File

@ -1,71 +0,0 @@
.listing-item {
background-color: #ffffff;
}
.icon {
/* color: rgb(112, 173, 71); */
color: #08bd63;
/* color: #92d050; */
}
.gray-container {
letter-spacing: 5px;
color: #aaaaaa;
}
.container-header {
display: flex;
align-items: baseline;
margin-top: 0px;
padding-top: 10px;
text-transform: uppercase;
}
.container-header p {
letter-spacing: 5px;
color: #aaaaaa;
margin-bottom: 0px;
}
/* .container-header :hover {
color: #4687e6;
} */
.about-item {
display: flex;
flex-wrap: wrap;
}
.about-item .title {
margin: 2px 10px;
}
.about-item p {
margin-left: auto;
margin-bottom: 0px;
padding-top: 7px;
color: #aaaaaa;
}
.draft-icon {
color: #aaaaaa;
}
.more-horiz {
font-size: 28px;
color: #aaaaaa;
}
hr {
margin: 0.6em 0em;
}
.date {
display: flex;
}
.date p {
margin-left: auto;
margin-bottom: 0em;
color: #aaaaaa;
}

View File

@ -1,32 +0,0 @@
<div class="listing-item">
<div class="col" (click)="itemClicked()">
<div class="row">
<div class="col-12 gray-container container-header">
<p (click)="$event.stopImmediatePropagation(); grantClicked(dmp.grantId)">
{{dmp.grantAbbreviation}}</p>
</div>
</div>
<div class="row">
<div class="col-12 about-item">
<mat-icon class="icon">radio_button_checked</mat-icon>
<h4 class="title">{{dmp.label}}</h4>
</div>
</div>
<div class="row">
<div class="col-12">
<p class="mt-1 mb-2">{{dmp.description}}</p>
</div>
</div>
<div class="row">
<div class="col-12 about-item">
<div *ngFor="let profile of dmp.associatedProfiles" class="pt-1">
<div matTooltip="{{profile.label}}" class="chip ml-2 mr-2">{{profile.label}}</div>
</div>
</div>
</div>
<hr>
<div class="date">
<p>{{'DMP-BLUEPRINT-LISTING.COLUMNS.PUBLISHED' | translate}} {{dmp.creationTime | date: "shortDate"}}</p>
</div>
</div>
</div>

View File

@ -1,28 +0,0 @@
import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core';
import { Router } from '@angular/router';
import { DmpListingModel } from '../../../core/model/dmp/dmp-listing';
@Component({
selector: 'app-dmp-info-counter',
templateUrl: './dmp-info-counter.component.html',
styleUrls: ['./dmp-info-counter.component.css']
})
export class DmpInfoCounterComponent implements OnInit {
@Input() dmp: DmpListingModel;
@Output() onClick: EventEmitter<DmpListingModel> = new EventEmitter();
constructor(public router: Router) { }
ngOnInit() {
}
itemClicked() {
this.onClick.emit(this.dmp);
}
grantClicked(grantId: String) {
// this.router.navigate(['/datasets/publicEdit/' + grantId]);
}
}

View File

@ -11,7 +11,6 @@ import { DmpService } from "../../../../core/services/dmp/dmp.service";
import { Inject } from "@angular/core";
import { DmpModel } from "../../../../core/model/dmp/dmp";
import { TranslateService } from "@ngx-translate/core";
import { DmpAssociatedProfileModel } from '../../../../core/model/dmp-blueprint/dmp-associated-profile';
@Component({
selector: 'dataset-copy-dialogue-component',
@ -65,10 +64,6 @@ export class DatasetCopyDialogueComponent {
return this.dmpService.getPaged(dmpDataTableRequest, "profiles").pipe(map(x => x.data));
}
existsDatasetDescriptionTemplate(associatedProfiles: DmpAssociatedProfileModel[]): boolean {
return associatedProfiles.some((profile) => profile.id === this.data.datasetProfileId);
}
datasetProfileValidate() {
return this.dmpService.getSingle(this.data.formControl.value.id).pipe(map(result => result as DmpModel),
map(result => {

View File

@ -2,7 +2,6 @@ import { UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms
import { DmpBlueprintExtraFieldDataType } from '@app/core/common/enum/dmp-blueprint-field-type';
import { DmpBlueprintType } from '@app/core/common/enum/dmp-blueprint-type';
import { DmpStatus } from '@app/core/common/enum/dmp-status';
import { DmpBlueprintField } from '@app/core/model/dmp-blueprint/dmp-blueprint-field';
import { DmpModel } from '@app/core/model/dmp/dmp';
import { DmpDynamicField } from '@app/core/model/dmp/dmp-dynamic-field';
import { DmpDynamicFieldDependency } from '@app/core/model/dmp/dmp-dynamic-field-dependency';
@ -11,7 +10,6 @@ import { ResearcherModel } from '@app/core/model/researcher/researcher';
import { UserModel } from '@app/core/model/user/user';
import { UserInfoListingModel } from '@app/core/model/user/user-info-listing';
import { ValidJsonValidator } from '@app/library/auto-complete/auto-complete-custom-validator';
import { DmpBlueprintExternalAutoCompleteFieldDataEditorModel } from '@app/ui/admin/dmp-blueprint/editor/external-autocomplete/dmp-blueprint-external-autocomplete-field-editor.model';
import { FunderFormModel } from '@app/ui/dmp/editor/grant-tab/funder-form-model';
import { GrantTabModel } from '@app/ui/dmp/editor/grant-tab/grant-tab-model';
import { ProjectFormModel } from '@app/ui/dmp/editor/grant-tab/project-form-model';
@ -214,40 +212,3 @@ export class DmpDynamicFieldDependencyEditorModel {
});
}
}
export class DmpDefinitionFieldEditorModel implements DmpBlueprintField {
public id: string;
public type: DmpBlueprintType;
public dataType: DmpBlueprintExtraFieldDataType;
public required = false;
public label: string;
public value: any;
public externalAutocomplete?: DmpBlueprintExternalAutoCompleteFieldDataEditorModel;
fromModel(item: DmpBlueprintField): DmpDefinitionFieldEditorModel {
this.type = item.type;
this.dataType = item.dataType;
this.required = item.required;
this.label = item.label;
this.id = item.id;
this.value = item.value;
if (item.externalAutocomplete)
this.externalAutocomplete = new DmpBlueprintExternalAutoCompleteFieldDataEditorModel().fromModel(item.externalAutocomplete);
return this;
}
buildForm(): UntypedFormGroup {
const formGroup = new UntypedFormBuilder().group({
type: [this.type],
id: [this.id],
dataType: [this.dataType],
required: [this.required],
label: [this.label],
value: [this.value]
});
if (this.externalAutocomplete) {
formGroup.addControl('externalAutocomplete', this.externalAutocomplete.buildForm());
}
return formGroup;
}
}