Merge branch 'ui-redesign' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot into ui-redesign
This commit is contained in:
commit
097c862ab6
|
@ -5,7 +5,7 @@
|
|||
<app-sidebar></app-sidebar>
|
||||
</mat-sidenav>
|
||||
<mat-sidenav-content class="sidenav-content">
|
||||
<div>
|
||||
<div id="main-page">
|
||||
<router-outlet (activate)='onActivate($event)' (deactivate)='onDeactivate($event)'></router-outlet>
|
||||
</div>
|
||||
</mat-sidenav-content>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<div *ngFor="let activity of datasetDrafts">
|
||||
<div class="dataset-card">
|
||||
<div>
|
||||
<!-- <div [routerLink]="['../datasets/overview/' + activity.id]"> -->
|
||||
<div [routerLink]="['../datasets/overview/' + activity.id]" class="pointer">
|
||||
<div class="d-flex flex-direction-row">
|
||||
<div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div>
|
||||
<div class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{activity.modified | date:"longDate"}}</div>
|
||||
|
|
|
@ -70,8 +70,7 @@
|
|||
</div>
|
||||
<div *ngIf="activity && activity.type === recentActivityTypeEnum.Dataset.valueOf()">
|
||||
<div class="dataset-card">
|
||||
<div>
|
||||
<!-- <div [routerLink]="['../datasets/overview/' + activity.id]"> -->
|
||||
<div [routerLink]="['../datasets/overview/' + activity.id]" class="pointer">
|
||||
<div class="d-flex flex-direction-row">
|
||||
<div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div>
|
||||
<div class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{activity.modified | date:"longDate"}}</div>
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
<div *ngIf="datasetActivities != null">
|
||||
<div *ngFor="let activity of datasetActivities">
|
||||
<div class="dataset-card">
|
||||
<div>
|
||||
<!-- <div [routerLink]="['../datasets/overview/' + activity.id]"> -->
|
||||
<div [routerLink]="['../datasets/overview/' + activity.id]" class="pointer">
|
||||
<div class="d-flex flex-direction-row">
|
||||
<div class="col-auto dataset-label">{{'DATASET-LISTING.DATASET-DESCRIPTION' | translate}}</div>
|
||||
<div class="col-auto ml-auto edited-date">{{'DATASET-LISTING.STATES.EDITED' | translate}}: {{activity.modified | date:"longDate"}}</div>
|
||||
|
|
|
@ -247,12 +247,10 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
|
|||
}
|
||||
|
||||
removeTag(tag: any) {
|
||||
console.log((<FormArray>this.formGroup.get('tags')).value);
|
||||
(<FormArray>this.formGroup.get('tags')).removeAt(((<FormArray>this.formGroup.get('tags')).value as any[]).indexOf(tag));
|
||||
}
|
||||
|
||||
addTag(ev: MatChipInputEvent) {
|
||||
console.log((<FormArray>this.formGroup.get('tags')).value);
|
||||
if (ev.value !== '' && isNullOrUndefined(((<FormArray>this.formGroup.get('tags')).value as ExternalTagEditorModel[]).find(tag => tag.name === ev.value))) {
|
||||
(<FormArray>this.formGroup.get('tags')).push(new ExternalTagEditorModel('', ev.value).buildForm());
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<a class="col-auto d-flex pointer" (click)="onClose()"><span class="ml-auto pt-3 material-icons clear-icon">clear</span></a>
|
||||
<app-dmp-criteria-component [showGrant]="data.showGrant" [isPublic]="data.isPublic" class="col-auto"></app-dmp-criteria-component>
|
||||
<app-dmp-criteria-component [showGrant]="data.showGrant" [isPublic]="data.isPublic" [criteriaFormGroup]="data.formGroup" (filtersChanged)="onFiltersChanged($event)" class="col-auto"></app-dmp-criteria-component>
|
||||
|
|
|
@ -1,17 +1,27 @@
|
|||
import { Inject, Component } from '@angular/core';
|
||||
import { Inject, Component, ViewChild, OnInit, Output, EventEmitter } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
|
||||
import { DmpCriteriaComponent } from './dmp-criteria.component';
|
||||
import { DmpCriteria } from '@app/core/query/dmp/dmp-criteria';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'dmp-criteria-dialog-component',
|
||||
templateUrl: './dmp-criteria-dialog.component.html',
|
||||
})
|
||||
|
||||
export class DmpCriteriaDialogComponent {
|
||||
export class DmpCriteriaDialogComponent implements OnInit {
|
||||
|
||||
@ViewChild(DmpCriteriaComponent, { static: true }) criteria: DmpCriteriaComponent;
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<DmpCriteriaDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: { showGrant: boolean, isPublic: boolean }
|
||||
) { }
|
||||
@Inject(MAT_DIALOG_DATA) public data: { showGrant: boolean, isPublic: boolean, criteria: DmpCriteria, formGroup: FormGroup, updateDataFn: Function }
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.criteria.setCriteria(this.data.criteria);
|
||||
}
|
||||
|
||||
onNoClick(): void {
|
||||
this.dialogRef.close();
|
||||
|
@ -21,4 +31,8 @@ export class DmpCriteriaDialogComponent {
|
|||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
onFiltersChanged(event) {
|
||||
this.data.updateDataFn(this.criteria);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,20 +3,20 @@
|
|||
<h6 class="filters-title">{{'CRITERIA.FILTERS'| translate}}</h6>
|
||||
<div class="row" style="justify-content: center;">
|
||||
<!-- Search Filter-->
|
||||
<mat-form-field class="col-11 search">
|
||||
<!-- <mat-form-field class="col-11 search">
|
||||
<input matInput placeholder="{{'CRITERIA.DMP.LIKE'| translate}}" name="likeCriteria"
|
||||
[formControl]="formGroup.get('like')">
|
||||
<mat-error *ngIf="formGroup.get('like').hasError('backendError')">
|
||||
{{formGroup.get('like').getError('backendError').message}}</mat-error>
|
||||
<mat-icon matSuffix class="style-icon">search</mat-icon>
|
||||
</mat-form-field>
|
||||
</mat-form-field> -->
|
||||
<!-- End of Search Filter -->
|
||||
|
||||
<!-- Visibility Filter-->
|
||||
<div *ngIf="!isPublic" class="col-10 gray-container">
|
||||
<h6 class="category-title">{{ 'TYPES.DMP-VISIBILITY.VISIBILITY' | translate }}</h6>
|
||||
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('status')">
|
||||
<mat-list-item><mat-radio-button value="null" checked>{{ 'TYPES.DMP-VISIBILITY.ANY' | translate }}</mat-radio-button></mat-list-item>
|
||||
<mat-list-item><mat-radio-button value="null" [checked]="!formGroup.get('status').value">{{ 'TYPES.DMP-VISIBILITY.ANY' | translate }}</mat-radio-button></mat-list-item>
|
||||
<mat-list-item><mat-radio-button value="2">{{ 'TYPES.DMP-VISIBILITY.PUBLIC' | translate }}</mat-radio-button></mat-list-item>
|
||||
<mat-list-item><mat-radio-button value="1">{{ 'TYPES.DMP-VISIBILITY.FINALIZED' | translate }}</mat-radio-button></mat-list-item>
|
||||
<mat-list-item><mat-radio-button value="0">{{ 'TYPES.DMP-VISIBILITY.DRAFT' | translate }}</mat-radio-button></mat-list-item>
|
||||
|
@ -81,7 +81,7 @@
|
|||
<div *ngIf="isAuthenticated()" class="col-10 gray-container">
|
||||
<h6 class="category-title">{{ 'DATASET-PROFILE-LISTING.COLUMNS.ROLE' | translate }}</h6>
|
||||
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('role')">
|
||||
<mat-list-item><mat-radio-button value="null" checked>{{ 'TYPES.DATASET-ROLE.ANY' | translate }}</mat-radio-button></mat-list-item>
|
||||
<mat-list-item><mat-radio-button value="null" [checked]="!formGroup.get('role').value">{{ 'TYPES.DATASET-ROLE.ANY' | translate }}</mat-radio-button></mat-list-item>
|
||||
<mat-list-item><mat-radio-button value="0">{{ 'TYPES.DATASET-ROLE.OWNER' | translate }}</mat-radio-button></mat-list-item>
|
||||
<mat-list-item><mat-radio-button value="1">{{ 'TYPES.DATASET-ROLE.MEMBER' | translate }}</mat-radio-button></mat-list-item>
|
||||
</mat-radio-group>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormControl } from '@angular/forms';
|
||||
import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
|
||||
import { GrantListingModel } from '@app/core/model/grant/grant-listing';
|
||||
|
@ -34,6 +34,9 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
|
|||
|
||||
@Input() showGrant: boolean;
|
||||
@Input() isPublic: boolean;
|
||||
@Input() criteriaFormGroup: FormGroup;
|
||||
@Output() filtersChanged: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
filteringGrantsAsync = false;
|
||||
sizeError = false;
|
||||
maxFileSize: number = 1048576;
|
||||
|
@ -96,6 +99,15 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
|
|||
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
|
||||
// This if is just for passing label on chips of dialog
|
||||
if (this.formGroup && this.criteriaFormGroup) {
|
||||
this.formGroup.get('datasetTemplates').setValue(this.criteriaFormGroup.get('datasetTemplates').value);
|
||||
this.formGroup.get('grants').setValue(this.criteriaFormGroup.get('grants').value);
|
||||
this.formGroup.get('collaborators').setValue(this.criteriaFormGroup.get('collaborators').value);
|
||||
this.formGroup.get('organisations').setValue(this.criteriaFormGroup.get('organisations').value);
|
||||
}
|
||||
|
||||
this.formGroup.get('role').valueChanges
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(x => this.controlModified());
|
||||
|
@ -131,6 +143,7 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
|
|||
this.formGroup.get('collaborators').patchValue(criteria.collaborators);
|
||||
this.formGroup.get('datasetTemplates').patchValue(criteria.datasetTemplates);
|
||||
this.formGroup.get('grantStatus').patchValue(criteria.grantStatus);
|
||||
this.formGroup.get('organisations').patchValue(criteria.organisations);
|
||||
}
|
||||
|
||||
onCallbackError(error: any) {
|
||||
|
@ -139,6 +152,7 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
|
|||
|
||||
controlModified(): void {
|
||||
this.clearErrorModel();
|
||||
this.filtersChanged.emit();
|
||||
if (this.refreshCallback != null &&
|
||||
(this.formGroup.get('like').value == null || this.formGroup.get('like').value.length === 0 || this.formGroup.get('like').value.length > 2)
|
||||
) {
|
||||
|
|
|
@ -8,18 +8,24 @@
|
|||
<p class="mt-4 pt-2">{{'DMP-LISTING.TEXT-INFO-QUESTION' | translate}} <u>{{'DMP-LISTING.LINK-ZENODO' | translate}}</u> {{'DMP-LISTING.GET-IDEA' | translate}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="filter-btn"><button mat-raised-button><mat-icon class="mr-2" (click)="openFiltersDialog()">filter_alt</mat-icon></button></div>
|
||||
<div class="filter-btn" [style.right]="dialog.openDialogs.length > 0 ? '446px' : '0px'" [style.width]="hasScrollbar() ? '52px' : '37px'" (click)="openFiltersDialog()"><button mat-raised-button class="p-0">
|
||||
<mat-icon class="mr-4">filter_alt</mat-icon>
|
||||
</button></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="listing row pb-2">
|
||||
<div class="col-12 col-sm-12 col-md-3">
|
||||
<app-dmp-criteria-component [showGrant]="showGrant" [isPublic]="isPublic" class="col-auto"></app-dmp-criteria-component>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-9 pt-4">
|
||||
<!-- Search Filter-->
|
||||
<mat-form-field appearance="outline" class="search-form ml-auto col-auto" floatLabel="never">
|
||||
<mat-icon matSuffix>search</mat-icon>
|
||||
<input matInput placeholder="{{'CRITERIA.DMP.LIKE'| translate}}" name="likeCriteria" [formControl]="formGroup.get('like')">
|
||||
<mat-error *ngIf="formGroup.get('like').hasError('backendError')">{{formGroup.get('like').getError('backendError').message}}</mat-error>
|
||||
</mat-form-field>
|
||||
<!-- End of Search Filter -->
|
||||
<div class="col-md-12 col-sm-12 col-md-9">
|
||||
<div *ngFor="let item of listingItems; let i = index">
|
||||
<app-dmp-listing-item-component [showDivider]="i != (listingItems.length - 1)" [dmp]="item" [isPublic]="isPublic"></app-dmp-listing-item-component>
|
||||
</div>
|
||||
<div *ngIf="listingItems && listingItems.length > 0" class="d-flex justify-content-center">
|
||||
<div *ngIf="listingItems && listingItems.length > 0 && this.startIndex < this.totalCount - 1 && this.pageSize < this.totalCount - 1" class="d-flex justify-content-center">
|
||||
<button type="button" class="btn-load-more" (click)="loadMore()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -186,16 +186,32 @@
|
|||
}
|
||||
|
||||
.filter-btn {
|
||||
position: fixed;
|
||||
right: 0px;
|
||||
z-index: 100;
|
||||
position: fixed;
|
||||
right: 0px;
|
||||
z-index: 100;
|
||||
width: 37px;
|
||||
}
|
||||
|
||||
.filter-btn button {
|
||||
color: white;
|
||||
background-color: #23BCBA;
|
||||
width: 52px;
|
||||
height: 45px;
|
||||
color: white;
|
||||
background-color: #23bcba;
|
||||
width: 37px;
|
||||
height: 45px;
|
||||
}
|
||||
|
||||
.search-form {
|
||||
// font-size: 12px;
|
||||
text-align: left;
|
||||
width: 17.5rem;
|
||||
}
|
||||
|
||||
.search-form mat-icon {
|
||||
color: #129d99;
|
||||
}
|
||||
|
||||
::ng-deep .search-form .mat-form-field-wrapper {
|
||||
background-color: white !important;
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
|
||||
// .bot-paginator {
|
||||
|
|
|
@ -24,6 +24,7 @@ import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/serv
|
|||
import { isNullOrUndefined } from 'util';
|
||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||
import { DmpCriteriaDialogComponent } from './criteria/dmp-criteria-dialog.component';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -35,7 +36,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
|
||||
@ViewChild(MatPaginator, { static: true }) _paginator: MatPaginator;
|
||||
@ViewChild(MatSort, { static: false }) sort: MatSort;
|
||||
@ViewChild(DmpCriteriaComponent, { static: true }) criteria: DmpCriteriaComponent;
|
||||
// @ViewChild(DmpCriteriaComponent, { static: true }) criteria: DmpCriteriaComponent;
|
||||
|
||||
breadCrumbs: Observable<BreadcrumbItem[]> = observableOf([{ parentComponentName: null, label: 'DMPs', url: "/plans" }]);
|
||||
itemId: string;
|
||||
|
@ -52,11 +53,17 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
startIndex: number = 0;
|
||||
pageSize: number = 5;
|
||||
|
||||
criteria: DmpCriteria;
|
||||
criteriaFormGroup: FormGroup;
|
||||
public formGroup = new FormBuilder().group({
|
||||
like: new FormControl()
|
||||
})
|
||||
|
||||
constructor(
|
||||
private dmpService: DmpService,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private dialog: MatDialog,
|
||||
public dialog: MatDialog,
|
||||
public enumUtils: EnumUtils,
|
||||
private language: TranslateService,
|
||||
private grantService: GrantService,
|
||||
|
@ -83,12 +90,14 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
// const grant: GrantListingModel = {
|
||||
// id: this.grantId
|
||||
// }
|
||||
this.criteria.setCriteria({ like: null, grants: [grant], groupIds: null, allVersions: false });
|
||||
// this.breadCrumbs = Observable.of([{ parentComponentName: 'GrantEditorComponent', label: grantLabel, url: '/grants/edit/' + this.grantId }]);
|
||||
grantLabel = this.route.snapshot.queryParams.grantLabel;
|
||||
|
||||
this.criteria = { like: null, grants: [grant], groupIds: null, allVersions: false }
|
||||
// this.criteria.setCriteria({ like: null, grants: [grant], groupIds: null, allVersions: false });
|
||||
|
||||
this.refresh();
|
||||
grantLabel = this.route.snapshot.queryParams.grantLabel;
|
||||
// this.breadCrumbs = Observable.of([{ parentComponentName: 'GrantEditorComponent', label: grantLabel, url: '/grants/edit/' + this.grantId }]);
|
||||
this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
||||
// this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
||||
})
|
||||
|
||||
} else if (params['groupId']) {
|
||||
|
@ -106,10 +115,12 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
}]
|
||||
);
|
||||
})
|
||||
this.criteria.setCriteria(this.getDefaultCriteria());
|
||||
this.groupLabel = this.route.snapshot.queryParams.groupLabel;
|
||||
|
||||
// this.criteria.setCriteria(this.getDefaultCriteria());
|
||||
this.criteria = this.getDefaultCriteria();
|
||||
this.refresh();
|
||||
this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
||||
// this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
||||
} else {
|
||||
this.itemId = params['groupId'];
|
||||
this.showGrant = true;
|
||||
|
@ -134,9 +145,10 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
}]
|
||||
);
|
||||
})
|
||||
this.criteria.setCriteria(this.getDefaultCriteria());
|
||||
// this.criteria.setCriteria(this.getDefaultCriteria());
|
||||
this.criteria = this.getDefaultCriteria();
|
||||
this.refresh();
|
||||
this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
||||
// this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
||||
}
|
||||
|
||||
if (this.grantId != null) {
|
||||
|
@ -146,9 +158,13 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
this.formGroup.get('like').valueChanges
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(x => this.controlModified());
|
||||
}
|
||||
|
||||
refresh(resetPages = false) {
|
||||
public refresh(resetPages = false) {
|
||||
// if (this._paginator.pageSize === undefined) this._paginator.pageSize = 10;
|
||||
// if (resetPages) this._paginator.pageIndex = 0;
|
||||
// const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
||||
|
@ -158,36 +174,10 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
fields.push('-modified');
|
||||
|
||||
const request = new DataTableRequest<DmpCriteria>(this.startIndex, this.pageSize, { fields: fields });
|
||||
let value = this.criteria.formGroup.value;
|
||||
request.criteria = {
|
||||
like: value.like,
|
||||
grants: value.grants,
|
||||
role: value.role
|
||||
}
|
||||
if (value.status == 2) {
|
||||
request.criteria.isPublic = true;
|
||||
} else {
|
||||
request.criteria.status = value.status;
|
||||
request.criteria.isPublic = false;
|
||||
}
|
||||
request.criteria.onlyPublic = this.isPublic;
|
||||
if (this.isPublic) {
|
||||
request.criteria.isPublic = true;
|
||||
}
|
||||
if (value.datasetTemplates)
|
||||
request.criteria.datasetTemplates = value.datasetTemplates.map(x => x.id);
|
||||
if (value.collaborators)
|
||||
request.criteria.collaborators = value.collaborators.map(x => x.id);
|
||||
if (value.organisations)
|
||||
request.criteria.organisations = value.organisations.map(x => x.id);
|
||||
if (this.itemId) {
|
||||
request.criteria.groupIds = [this.itemId];
|
||||
request.criteria.allVersions = true;
|
||||
}
|
||||
request.criteria.grantStatus = value.grantStatus;
|
||||
request.criteria = this.criteria;
|
||||
|
||||
this.dmpService.getPaged(request, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
if (!result) { return []; }
|
||||
// if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; }
|
||||
result.data.map(item => {
|
||||
item['datasets'].map(dmp => {
|
||||
dmp.url = 'datasets/edit/' + dmp.url;
|
||||
|
@ -197,6 +187,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
return item;
|
||||
});
|
||||
this.listingItems = result.data;
|
||||
this.totalCount = result.totalCount;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -204,37 +195,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
this.startIndex = this.startIndex + this.pageSize;
|
||||
const fields: Array<string> = ["-modified"];
|
||||
const request = new DataTableRequest<DmpCriteria>(this.startIndex, this.pageSize, { fields: fields });
|
||||
|
||||
// request.criteria = new DmpCriteria();
|
||||
// request.criteria.like = "";
|
||||
|
||||
let value = this.criteria.formGroup.value;
|
||||
request.criteria = {
|
||||
like: value.like,
|
||||
grants: value.grants,
|
||||
role: value.role
|
||||
}
|
||||
if (value.status == 2) {
|
||||
request.criteria.isPublic = true;
|
||||
} else {
|
||||
request.criteria.status = value.status;
|
||||
request.criteria.isPublic = false;
|
||||
}
|
||||
request.criteria.onlyPublic = this.isPublic;
|
||||
if (this.isPublic) {
|
||||
request.criteria.isPublic = true;
|
||||
}
|
||||
if (value.datasetTemplates)
|
||||
request.criteria.datasetTemplates = value.datasetTemplates.map(x => x.id);
|
||||
if (value.collaborators)
|
||||
request.criteria.collaborators = value.collaborators.map(x => x.id);
|
||||
if (value.organisations)
|
||||
request.criteria.organisations = value.organisations.map(x => x.id);
|
||||
if (this.itemId) {
|
||||
request.criteria.groupIds = [this.itemId];
|
||||
request.criteria.allVersions = true;
|
||||
}
|
||||
request.criteria.grantStatus = value.grantStatus;
|
||||
request.criteria = this.criteria;
|
||||
|
||||
this.dmpService.getPaged(request, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
if (!result) { return []; }
|
||||
|
@ -254,6 +215,17 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
this.refresh();
|
||||
}
|
||||
|
||||
controlModified(): void {
|
||||
// this.clearErrorModel();
|
||||
// if (this.refreshCallback != null &&
|
||||
// (this.formGroup.get('like').value == null || this.formGroup.get('like').value.length === 0 || this.formGroup.get('like').value.length > 2)
|
||||
// ) {
|
||||
// setTimeout(() => this.refreshCallback(true));
|
||||
// }
|
||||
this.criteria.like = this.formGroup.get("like").value;
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
// rowClicked(dmp: DmpListingModel) {
|
||||
// this.router.navigate(['/plans/overview/' + dmp.id]);
|
||||
// }
|
||||
|
@ -281,8 +253,6 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
|
||||
openShareDialog(rowId: any, rowName: any) {
|
||||
const dialogRef = this.dialog.open(DmpInvitationDialogComponent, {
|
||||
// height: '250px',
|
||||
// width: '700px',
|
||||
data: {
|
||||
dmpId: rowId,
|
||||
dmpName: rowName
|
||||
|
@ -324,7 +294,11 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
restoreFocus: false,
|
||||
data: {
|
||||
showGrant: this.showGrant,
|
||||
isPublic: this.isPublic
|
||||
isPublic: this.isPublic,
|
||||
criteria: this.criteria,
|
||||
formGroup: this.criteriaFormGroup,
|
||||
// criteria: this.grantId ? this.criteria : this.getDefaultCriteria(),
|
||||
updateDataFn: this.updateDataFn.bind(this)
|
||||
},
|
||||
position: { right: '0px;' }
|
||||
});
|
||||
|
@ -332,6 +306,46 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
dialogRef.afterClosed().subscribe(result => {
|
||||
});
|
||||
}
|
||||
|
||||
updateDataFn(criteria: DmpCriteriaComponent): void {
|
||||
this.criteriaFormGroup = criteria.formGroup;
|
||||
this.toDmpCriteria(criteria);
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
toDmpCriteria(criteria: DmpCriteriaComponent): void {
|
||||
let formGroup = criteria.formGroup;
|
||||
this.criteria = {
|
||||
like: formGroup.get('like').value,
|
||||
grants: formGroup.get('grants').value,
|
||||
role: formGroup.get('role').value
|
||||
}
|
||||
this.criteria.status = formGroup.get('status').value;
|
||||
if (formGroup.get('status').value == 2) {
|
||||
this.criteria.isPublic = true;
|
||||
} else {
|
||||
this.criteria.isPublic = false;
|
||||
}
|
||||
this.criteria.onlyPublic = this.isPublic;
|
||||
if (this.isPublic) {
|
||||
this.criteria.isPublic = true;
|
||||
}
|
||||
if (formGroup.get('datasetTemplates').value)
|
||||
this.criteria.datasetTemplates = formGroup.get('datasetTemplates').value.map(x => x.id);
|
||||
if (formGroup.get('collaborators').value)
|
||||
this.criteria.collaborators = formGroup.get('collaborators').value.map(x => x.id);
|
||||
if (formGroup.get('organisations').value)
|
||||
this.criteria.organisations = formGroup.get('organisations').value.map(x => x.id);
|
||||
if (this.itemId) {
|
||||
this.criteria.groupIds = [this.itemId];
|
||||
this.criteria.allVersions = true;
|
||||
}
|
||||
this.criteria.grantStatus = formGroup.get('grantStatus').value;
|
||||
}
|
||||
|
||||
hasScrollbar(): boolean {
|
||||
return document.getElementById("main-page").scrollHeight > document.documentElement.clientHeight
|
||||
}
|
||||
}
|
||||
|
||||
// export class DmpDataSource extends DataSource<DmpListingModel> {
|
||||
|
|
|
@ -575,7 +575,6 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
copyDoi(doi) {
|
||||
console.log(doi.nativeElement.innerHTML);
|
||||
let domElement = doi.nativeElement as HTMLInputElement;
|
||||
domElement.select();
|
||||
document.execCommand('copy');
|
||||
|
|
|
@ -29,7 +29,6 @@ export class Oauth2DialogComponent extends BaseComponent implements OnInit{
|
|||
}
|
||||
|
||||
private loadUrl(url: string ) {
|
||||
console.log(url);
|
||||
window.location.href = url;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue