Implemented Frontend Editor And Action Listing For Cloning Dataset Profiles (Ticket #50 - Cloning dataset profiles)

This commit is contained in:
Ioannis Kalyvas 2018-10-16 14:11:15 +03:00
parent 6128ede341
commit 01de2754e5
25 changed files with 239 additions and 263 deletions

View File

@ -1,6 +1,7 @@
package eu.eudat.controllers; package eu.eudat.controllers;
import eu.eudat.data.dao.criteria.RequestItem; import eu.eudat.data.dao.criteria.RequestItem;
import eu.eudat.logic.managers.AdminManager;
import eu.eudat.logic.managers.DatasetProfileManager; import eu.eudat.logic.managers.DatasetProfileManager;
import eu.eudat.logic.managers.UserManager; import eu.eudat.logic.managers.UserManager;
import eu.eudat.logic.security.claims.ClaimedAuthorities; import eu.eudat.logic.security.claims.ClaimedAuthorities;
@ -64,10 +65,11 @@ public class DatasetProfileController extends BaseController {
@Transactional @Transactional
@RequestMapping(method = RequestMethod.POST, value = {"/datasetprofile/clone/{id}"}, consumes = "application/json", produces = "application/json") @RequestMapping(method = RequestMethod.POST, value = {"/datasetprofile/clone/{id}"}, consumes = "application/json", produces = "application/json")
public ResponseEntity<ResponseItem<eu.eudat.data.entities.DatasetProfile>> clone(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN})Principal principal) { public ResponseEntity<ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>> clone(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN})Principal principal) {
//TODO
eu.eudat.data.entities.DatasetProfile profile = new DatasetProfileManager().clone(this.getApiContext(), id); eu.eudat.data.entities.DatasetProfile profile = new DatasetProfileManager().clone(this.getApiContext(), id);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.data.entities.DatasetProfile>().payload(profile)); eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
datasetprofile.setLabel(profile.getLabel());
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.models.data.admin.composite.DatasetProfile>().payload(datasetprofile));
} }
@RequestMapping(method = RequestMethod.POST, value = {"/search/autocomplete"}, consumes = "application/json", produces = "application/json") @RequestMapping(method = RequestMethod.POST, value = {"/search/autocomplete"}, consumes = "application/json", produces = "application/json")

View File

@ -37,7 +37,7 @@ public class DatasetProfileManager {
DatasetProfile profile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id)); DatasetProfile profile = apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
apiContext.getOperationsContext().getDatabaseRepository().detachEntity(profile); apiContext.getOperationsContext().getDatabaseRepository().detachEntity(profile);
profile.setId(null); profile.setId(null);
return apiContext.getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(profile); return profile;
} }
public static DataTableData<DatasetProfileListingModel> getPaged(ApiContext apiContext, DatasetProfileTableRequestItem datasetProfileTableRequestItem) throws Exception { public static DataTableData<DatasetProfileListingModel> getPaged(ApiContext apiContext, DatasetProfileTableRequestItem datasetProfileTableRequestItem) throws Exception {

View File

@ -47,7 +47,7 @@ const appRoutes: Routes = [
canActivate: [AuthGuard] canActivate: [AuthGuard]
}, },
{ {
path: 'form', path: 'dataset-profile',
loadChildren: './dataset-profile-form/dataset-profile.module#DatasetProfileModule', loadChildren: './dataset-profile-form/dataset-profile.module#DatasetProfileModule',
data: { data: {
breadcrumb: true breadcrumb: true
@ -81,13 +81,6 @@ const appRoutes: Routes = [
path: 'users', path: 'users',
loadChildren: './users/users.module#UsersModule' loadChildren: './users/users.module#UsersModule'
}, },
{
path: 'datasetsProfiles',
loadChildren: './datasets-admin-listing/dataset-admin.module#DatasetAdminModule',
data: {
breadcrumb: true
},
},
{ {
path: 'welcome', path: 'welcome',
component: WelcomepageComponent, component: WelcomepageComponent,

View File

@ -26,6 +26,9 @@ import { ComboboxComponent } from '../shared/componentsAdmin/combobox/combobox-c
import { SharedModule } from '../shared/shared.module'; import { SharedModule } from '../shared/shared.module';
import { DatasetProfilePreviewerComponent } from './previewer/dataset-profile-previewer.component'; import { DatasetProfilePreviewerComponent } from './previewer/dataset-profile-previewer.component';
import { DynamicFormModule } from '../form/dynamic-form.module'; import { DynamicFormModule } from '../form/dynamic-form.module';
import { DatasetProfileAdminListingComponent } from './datasets-admin-listing/dataset-profile-admin-listing.component';
import { TranslateService, TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
@NgModule({ @NgModule({
imports: [ imports: [
@ -36,7 +39,14 @@ import { DynamicFormModule } from '../form/dynamic-form.module';
RouterModule, RouterModule,
SharedModule, SharedModule,
DynamicFormModule, DynamicFormModule,
RouterModule.forChild(DatasetProfileRoutes) RouterModule.forChild(DatasetProfileRoutes),
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
}),
], ],
declarations: [ declarations: [
@ -44,6 +54,7 @@ import { DynamicFormModule } from '../form/dynamic-form.module';
//GroupFieldFormComponent, //GroupFieldFormComponent,
RuleFormComponent, RuleFormComponent,
SectionFormComponent, SectionFormComponent,
DatasetProfileAdminListingComponent,
PageFormComponent, PageFormComponent,
CompositeFieldFormComponent, CompositeFieldFormComponent,
FieldFormComponent, FieldFormComponent,
@ -65,6 +76,7 @@ import { DynamicFormModule } from '../form/dynamic-form.module';
SectionFormComponent, SectionFormComponent,
PageFormComponent, PageFormComponent,
CompositeFieldFormComponent, CompositeFieldFormComponent,
DatasetProfileAdminListingComponent,
FieldFormComponent, FieldFormComponent,
TextAreaComponent, TextAreaComponent,
CheckBoxComponent, CheckBoxComponent,
@ -83,4 +95,13 @@ import { DynamicFormModule } from '../form/dynamic-form.module';
}) })
export class DatasetProfileModule { } export class DatasetProfileModule {
constructor(private translate: TranslateService) {
translate.setDefaultLang('en');
translate.use('en');
}
}
export function HttpLoaderFactory(httpClient: HttpClient) {
return new TranslateHttpLoader(httpClient, 'assets/lang/', '.json');
}

View File

@ -1,5 +1,7 @@
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import { FormComponent } from './form/form.component'; import { FormComponent } from './form/form.component';
import { AuthGuard } from '../shared/guards/auth.guard';
import { DatasetProfileAdminListingComponent } from './datasets-admin-listing/dataset-profile-admin-listing.component';
export const DatasetProfileRoutes: Routes = [ export const DatasetProfileRoutes: Routes = [
{ {
@ -7,8 +9,12 @@ export const DatasetProfileRoutes: Routes = [
component: FormComponent component: FormComponent
}, },
{ {
path: '', path: 'clone/:cloneid',
component: FormComponent component: FormComponent
} },
{
path: '',
component: DatasetProfileAdminListingComponent,
},
]; ];

View File

@ -0,0 +1,59 @@
<div class="container-fluid">
<h3>{{titlePrefix}} {{'DATASET-PROFILE-LISTING.TITLE' | translate}}</h3>
<app-dataset-profile-criteria-component></app-dataset-profile-criteria-component>
<mat-card class="mat-card">
<mat-card-header>
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
</mat-card-header>
<mat-table [dataSource]="dataSource" matSort (matSortChange)="refresh()">
<!-- Column Definition: Name -->
<ng-container cdkColumnDef="label">
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'DATASET-PROFILE-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
</ng-container>
<!-- Column Definition: Description -->
<ng-container cdkColumnDef="description">
<mat-header-cell *matHeaderCellDef>{{'DATASET-PROFILE-LISTING.COLUMNS.DESCRIPTION' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.description}} </mat-cell>
</ng-container>
<!-- Column Definition: Created -->
<ng-container cdkColumnDef="created">
<mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DATASET-PROFILE-LISTING.COLUMNS.CREATED' |
translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell>
</ng-container>
<!-- Column Definition: Submission Time -->
<ng-container cdkColumnDef="actions">
<mat-header-cell *matHeaderCellDef>{{'DATASET-PROFILE-LISTING.COLUMNS.ACTIONS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row" (click)="$event.stopPropagation()">
<mat-menu #actionsMenu="matMenu">
<button mat-menu-item (click)="clone(row.id)">
<mat-icon>filter_none</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.CLONE' | translate}}
</button>
<!--<button *ngIf="row.status==1" mat-menu-item (click)="makeItPublic(row.id)"><mat-icon>people_outline</mat-icon>{{'DATASET-LISTING.ACTIONS.MAKE-IT-PUBLIC' | translate}}</button> -->
</mat-menu>
<button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_vert</mat-icon>
</button>
</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns" (click)="rowClick(row.id);"></mat-row>
<!-- (click)="rowClick(row.id)" -->
</mat-table>
<mat-paginator #paginator [length]="dataSource?.totalCount" [pageSizeOptions]="[10, 25, 100]">
</mat-paginator>
</mat-card>
<button mat-fab class="mat-fab-bottom-right" color="primary" [routerLink]="['/form'] ">
<mat-icon class="mat-24">add</mat-icon>
</button>
</div>

View File

@ -1,6 +1,3 @@
import { DataTableRequest } from '../models/data-table/DataTableRequest';
import { DatasetListingModel } from '../models/datasets/DatasetListingModel';
import { DatasetCriteria } from '../models/criteria/dataset/DatasetCriteria';
import { Component, ViewChild, OnInit, AfterViewInit } from '@angular/core'; import { Component, ViewChild, OnInit, AfterViewInit } from '@angular/core';
import { MatPaginator, MatSort, MatSnackBar } from '@angular/material'; import { MatPaginator, MatSort, MatSnackBar } from '@angular/material';
import { Router, Params, ActivatedRoute } from '@angular/router'; import { Router, Params, ActivatedRoute } from '@angular/router';
@ -9,10 +6,13 @@ import { DataSource } from '@angular/cdk/table';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { PageEvent } from '@angular/material'; import { PageEvent } from '@angular/material';
import { DataManagementPlanService } from '../services/data-management-plan/data-management-plan.service'; import { DatasetProfileAdmin } from '../../services/datasetProfileAdmin/datasetProfileAfmin.service';
import { DataManagementPlanModel } from '../models/data-managemnt-plans/DataManagementPlanModel'; import { DataManagementPlanService } from '../../services/data-management-plan/data-management-plan.service';
import { DatasetCriteriaComponent } from '../shared/components/criteria/datasets/datasets-criteria.component'; import { DatasetProfileCriteriaComponent } from '../../shared/components/criteria/dataset-profile/dataset-profile.component';
import { DatasetProfileAdmin } from '../services/datasetProfileAdmin/datasetProfileAfmin.service'; import { DataManagementPlanModel } from '../../models/data-managemnt-plans/DataManagementPlanModel';
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
import { DatasetProfileCriteria } from '../../models/criteria/dataset-profile/DatasetProfileCriteria';
@Component({ @Component({
@ -25,11 +25,11 @@ export class DatasetProfileAdminListingComponent implements OnInit {
@ViewChild(MatPaginator) _paginator: MatPaginator; @ViewChild(MatPaginator) _paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort; @ViewChild(MatSort) sort: MatSort;
@ViewChild(DatasetCriteriaComponent) criteria: DatasetCriteriaComponent; @ViewChild(DatasetProfileCriteriaComponent) criteria: DatasetProfileCriteriaComponent;
dataSource: DatasetDataSource | null; dataSource: DatasetDataSource | null;
displayedColumns: String[] = ['label', 'dmp', 'profile', 'dataRepositories', 'registries', 'services', 'description', 'created', 'actions']; displayedColumns: String[] = ['label', 'description', 'created', 'actions'];
pageEvent: PageEvent; pageEvent: PageEvent;
titlePrefix: String; titlePrefix: String;
dmpId: String; dmpId: String;
@ -73,17 +73,19 @@ export class DatasetProfileAdminListingComponent implements OnInit {
} }
rowClick(rowId: String) { rowClick(rowId: String) {
this.router.navigate(['form/' + rowId]); this.router.navigate(['dataset-profile/' + rowId]);
} }
getDefaultCriteria(dmpId: String): DatasetCriteria { getDefaultCriteria(dmpId: String): DatasetProfileCriteria {
const defaultCriteria = new DatasetCriteria(); const defaultCriteria = new DatasetProfileCriteria();
if (dmpId != null) {
defaultCriteria.dmpIds.push(dmpId);
}
return defaultCriteria; return defaultCriteria;
} }
clone(id: string) {
this.router.navigate(['dataset-profile/clone/' + id]);
}
// makeItPublic(id: String) { // makeItPublic(id: String) {
// debugger; // debugger;
// this.datasetService.makeDatasetPublic(id).subscribe(); // this.datasetService.makeDatasetPublic(id).subscribe();
@ -102,7 +104,7 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
private _sort: MatSort, private _sort: MatSort,
private _languageService: TranslateService, private _languageService: TranslateService,
private _snackBar: MatSnackBar, private _snackBar: MatSnackBar,
private _criteria: DatasetCriteriaComponent private _criteria: DatasetProfileCriteriaComponent
) { ) {
super(); super();
@ -114,7 +116,6 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
//this._sort.matSortChange //this._sort.matSortChange
]; ];
return Observable.merge(...displayDataChanges) return Observable.merge(...displayDataChanges)
.startWith(null) .startWith(null)
.switchMap(() => { .switchMap(() => {
@ -124,7 +125,7 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
const startIndex = this._paginator.pageIndex * this._paginator.pageSize; const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
let fields: Array<string> = new Array(); let fields: Array<string> = new Array();
if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; } if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; }
const request = new DataTableRequest<DatasetCriteria>(startIndex, this._paginator.pageSize, { fields: fields }); const request = new DataTableRequest<DatasetProfileCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
request.criteria = this._criteria.criteria; request.criteria = this._criteria.criteria;
return this._service.getPaged(request); return this._service.getPaged(request);
}) })

View File

@ -1,23 +1,10 @@
<div class="container"> <div class="container" [formGroup]='form'>
<!-- <mat-card> <mat-form-field class="full-width">
<form *ngIf="form" novalidate [formGroup]="form" (ngSubmit)="onSubmit()"> <input matInput formControlName="label" placeholder="{{'FORM.LABEL' | translate}}" required>
<div class="row"> <mat-error *ngIf="form.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
<div class="form-group col-md-12"> </mat-form-field>
<mat-form-field class="full-width">
<input matInput formControlName="label" placeholder="Label">
</mat-form-field>
</div>
</div>
<button mat-raised-button color="primary" type="submit" [disabled]="!form.valid">Save</button>
</form>
</mat-card> -->
<mat-horizontal-stepper [linear]="true" #stepper> <mat-horizontal-stepper [linear]="true" #stepper>
<mat-step> <mat-step>
<div class="panel-group"> <div class="panel-group">
<mat-expansion-panel *ngFor="let page of dataModel.pages; let i=index;" #panel> <mat-expansion-panel *ngFor="let page of dataModel.pages; let i=index;" #panel>
<mat-expansion-panel-header> <mat-expansion-panel-header>
@ -36,7 +23,6 @@
</div> </div>
</mat-expansion-panel> </mat-expansion-panel>
</div> </div>
<div style="margin-top:20px; padding-left: 15px;" class="row"> <div style="margin-top:20px; padding-left: 15px;" class="row">
<button mat-button (click)="addPage()" style="cursor: pointer"> <button mat-button (click)="addPage()" style="cursor: pointer">
Add Page + Add Page +
@ -44,7 +30,6 @@
</div> </div>
</mat-step> </mat-step>
<mat-step> <mat-step>
<div> <div>
<mat-expansion-panel *ngFor="let section of dataModel.sections; let i=index;" #panel> <mat-expansion-panel *ngFor="let section of dataModel.sections; let i=index;" #panel>
<mat-expansion-panel-header> <mat-expansion-panel-header>
@ -63,9 +48,6 @@
</div> </div>
</mat-expansion-panel> </mat-expansion-panel>
</div> </div>
<div style="margin-top:20px; padding-left: 15px;" class="row"> <div style="margin-top:20px; padding-left: 15px;" class="row">
<button mat-button (click)="addSection()" style="cursor: pointer"> <button mat-button (click)="addSection()" style="cursor: pointer">
Add Section + Add Section +
@ -74,6 +56,5 @@
</mat-step> </mat-step>
</mat-horizontal-stepper> </mat-horizontal-stepper>
<button mat-button (click)="preview()">Preview</button> <button mat-button (click)="preview()">Preview</button>
<button mat-raised-button color="primary" type="button" (click)='onSubmit()' [disabled]="!form.valid">Save</button> <button mat-raised-button color="primary" type="button" (click)='onSubmit()' [disabled]="form.valid">Save</button>
</div> </div>

View File

@ -23,6 +23,7 @@ export class FormComponent implements OnInit {
dataModel: DatasetProfileModelAdmin; dataModel: DatasetProfileModelAdmin;
form: FormGroup; form: FormGroup;
private profileID: string; private profileID: string;
private cloneId: string;
constructor( constructor(
public datasetprofileAdmin: DatasetProfileAdmin, public datasetprofileAdmin: DatasetProfileAdmin,
@ -32,6 +33,7 @@ export class FormComponent implements OnInit {
public dialog: MatDialog, public dialog: MatDialog,
) { ) {
this.profileID = route.snapshot.params['id']; this.profileID = route.snapshot.params['id'];
this.cloneId = route.snapshot.params['cloneid'];
} }
ngOnInit() { ngOnInit() {
@ -43,6 +45,11 @@ export class FormComponent implements OnInit {
this.dataModel = JsonSerializer.fromJSONObject(data, DatasetProfileModelAdmin); this.dataModel = JsonSerializer.fromJSONObject(data, DatasetProfileModelAdmin);
this.form = this.dataModel.buildForm(); this.form = this.dataModel.buildForm();
}); });
} else if (this.cloneId) {
this.datasetprofileAdmin.clone(this.cloneId).subscribe((data) => {
this.dataModel = JsonSerializer.fromJSONObject(data, DatasetProfileModelAdmin);
this.form = this.dataModel.buildForm();
});
} else { } else {
this.addSection(); this.addSection();
this.addPage(); this.addPage();

View File

@ -29,7 +29,7 @@ export class DatasetProfilePreviewerComponent implements OnInit {
this.datasetProfileAdminService.preview(this.data['model']).subscribe(x => { this.datasetProfileAdminService.preview(this.data['model']).subscribe(x => {
this.datasetWizardModel = new DatasetWizardModel(); this.datasetWizardModel = new DatasetWizardModel();
this.datasetWizardModel.datasetProfileDefinition = JsonSerializer.fromJSONObject(x, DatasetProfileDefinitionModel); this.datasetWizardModel.datasetProfileDefinition = JsonSerializer.fromJSONObject(x, DatasetProfileDefinitionModel);
this.formGroup = this.datasetWizardModel.buildForm(); this.formGroup = <FormGroup>this.datasetWizardModel.buildForm().get('datasetProfileDefinition');
}); });
} }

View File

@ -1,54 +0,0 @@
import { RouterModule } from '@angular/router';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { DatasetService } from '../services/dataset/dataset.service';
import { DynamicFormModule } from '../form/dynamic-form.module';
import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
import { DatasetAdminRoutes } from './dataset-admin.routes';
import { CommonModule } from '@angular/common';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { SharedModule } from '../shared/shared.module';
import { DatasetProfileAdminListingComponent } from './dataset-profile-admin-listing.component';
@NgModule({
imports: [
CommonModule,
FormsModule,
HttpClientModule,
SharedModule,
RouterModule.forChild(DatasetAdminRoutes),
ReactiveFormsModule,
DynamicFormModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
}),
],
declarations: [
DatasetProfileAdminListingComponent,
],
exports: [
DatasetProfileAdminListingComponent,
RouterModule
],
providers: [
DatasetService
]
})
export class DatasetAdminModule {
constructor(private translate: TranslateService) {
translate.setDefaultLang('en');
translate.use('en');
}
}
export function HttpLoaderFactory(httpClient: HttpClient) {
return new TranslateHttpLoader(httpClient, 'assets/lang/', '.json');
}

View File

@ -1,7 +0,0 @@
import { RouterModule, Routes } from '@angular/router';
import { AuthGuard } from '../shared/guards/auth.guard';
import { DatasetProfileAdminListingComponent } from './dataset-profile-admin-listing.component';
export const DatasetAdminRoutes: Routes = [
{ path: '', component: DatasetProfileAdminListingComponent, canActivate: [AuthGuard] },
];

View File

@ -1,94 +0,0 @@
<div class="container-fluid">
<h3>{{titlePrefix}} {{'DATASET-LISTING.TITLE' | translate}}</h3>
<app-datasets-criteria-component></app-datasets-criteria-component>
<mat-card class="mat-card">
<mat-card-header>
<mat-progress-bar *ngIf="dataSource?.isLoadingResults" mode="query"></mat-progress-bar>
</mat-card-header>
<mat-table [dataSource]="dataSource" matSort (matSortChange)="refresh()">
<!-- Column Definition: Name -->
<ng-container cdkColumnDef="label">
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'DATASET-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
</ng-container>
<!-- Column Definition: Dmp -->
<ng-container cdkColumnDef="dmp">
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|dmp:label">{{'DATASET-LISTING.COLUMNS.DMP' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.dmp}} </mat-cell>
</ng-container>
<!-- Column Definition: Profile -->
<ng-container cdkColumnDef="profile">
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|profile:label">{{'DATASET-LISTING.COLUMNS.PROFILE' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.profile}} </mat-cell>
</ng-container>
<!-- Column Definition: DataRepositories -->
<ng-container cdkColumnDef="dataRepositories">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.DATAREPOSITORIES' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.dataRepositories}} </mat-cell>
</ng-container>
<!-- Column Definition: DataRepositories -->
<ng-container cdkColumnDef="registries">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.REGISTRIES' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.registries}} </mat-cell>
</ng-container>
<!-- Column Definition: DataRepositories -->
<ng-container cdkColumnDef="services">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.SERVICES' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.services}} </mat-cell>
</ng-container>
<!-- Column Definition: Status -->
<!-- <ng-container cdkColumnDef="status">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.STATUS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.status}}
</mat-cell>
</ng-container> -->
<!-- Column Definition: Description -->
<ng-container cdkColumnDef="description">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.DESCRIPTION' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.description}} </mat-cell>
</ng-container>
<!-- Column Definition: Created -->
<ng-container cdkColumnDef="created">
<mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DATASET-LISTING.COLUMNS.CREATED' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell>
</ng-container>
<!-- Column Definition: Submission Time -->
<ng-container cdkColumnDef="actions">
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.ACTIONS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">
<mat-menu #actionsMenu="matMenu">
<button mat-menu-item (click)="rowClick(row.id)"><mat-icon>mode_edit</mat-icon>{{'DATASET-LISTING.ACTIONS.EDIT' | translate}}</button>
<!-- <button *ngIf="row.status==1" mat-menu-item (click)="rowClick(row.id)"><mat-icon>visibility</mat-icon>{{'DATASET-LISTING.ACTIONS.VIEW' | translate}}</button>
<button *ngIf="row.status==1" mat-menu-item (click)="makeItPublic(row.id)"><mat-icon>people_outline</mat-icon>{{'DATASET-LISTING.ACTIONS.MAKE-IT-PUBLIC' | translate}}</button> -->
</mat-menu>
<button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_vert</mat-icon>
</button>
</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
<!-- (click)="rowClick(row.id)" -->
</mat-table>
<mat-paginator #paginator [length]="dataSource?.totalCount" [pageSizeOptions]="[10, 25, 100]">
</mat-paginator>
</mat-card>
<button mat-fab class="mat-fab-bottom-right" color="primary" [routerLink]="['/form'] ">
<mat-icon class="mat-24">add</mat-icon>
</button>
</div>

View File

@ -13,7 +13,6 @@ import { DataManagementPlanModel, DataManagementPlanStatus } from '../../models/
import { ExternalSourcesService } from '../../services/external-sources/external-sources.service'; import { ExternalSourcesService } from '../../services/external-sources/external-sources.service';
import { ExternalSourcesItemModel } from '../../models/external-sources/ExternalSourcesItemModel'; import { ExternalSourcesItemModel } from '../../models/external-sources/ExternalSourcesItemModel';
import { RequestItem } from '../../models/criteria/RequestItem'; import { RequestItem } from '../../models/criteria/RequestItem';
import { DatasetProfileCriteria } from '../../models/criteria/dataset/DatasetProfileCriteria';
import { DataManagementPlanCriteriaComponent } from '../../shared/components/criteria/data-management-plan/dmp-criteria.component'; import { DataManagementPlanCriteriaComponent } from '../../shared/components/criteria/data-management-plan/dmp-criteria.component';
import { DatasetProfileModel } from '../../models/datasets/DatasetProfileModel'; import { DatasetProfileModel } from '../../models/datasets/DatasetProfileModel';
import { ProjectCriteria } from '../../models/criteria/project/ProjectCriteria'; import { ProjectCriteria } from '../../models/criteria/project/ProjectCriteria';
@ -36,6 +35,7 @@ import { MultipleAutoCompleteConfiguration } from '../../shared/components/autoc
import * as FileSaver from 'file-saver'; import * as FileSaver from 'file-saver';
import { DMPFinaliseDialogComponent } from './dmp-finalise-dialog/dmp-finalise-dialog.component'; import { DMPFinaliseDialogComponent } from './dmp-finalise-dialog/dmp-finalise-dialog.component';
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel'; import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
import { DatasetProfileCriteria } from '../../models/criteria/dataset-profile/DatasetProfileCriteria';
@Component({ @Component({
selector: 'app-dmp-editor-component', selector: 'app-dmp-editor-component',

View File

@ -1,5 +1,4 @@
import { DatasetProfileModel } from '../../../models/datasets/DatasetProfileModel'; import { DatasetProfileModel } from '../../../models/datasets/DatasetProfileModel';
import { DatasetProfileCriteria } from '../../../models/criteria/dataset/DatasetProfileCriteria';
import { BaseErrorModel } from '../../../models/error/BaseErrorModel'; import { BaseErrorModel } from '../../../models/error/BaseErrorModel';
import { SnackBarNotificationComponent } from '../../../shared/components/notificaiton/snack-bar-notification.component'; import { SnackBarNotificationComponent } from '../../../shared/components/notificaiton/snack-bar-notification.component';
import { JsonSerializer } from '../../../utilities/JsonSerializer'; import { JsonSerializer } from '../../../utilities/JsonSerializer';
@ -22,6 +21,7 @@ import { BaseCriteria } from '../../../models/criteria/BaseCriteria';
import { SingleAutoCompleteConfiguration } from '../../../shared/components/autocompletes/single/single-auto-complete-configuration'; import { SingleAutoCompleteConfiguration } from '../../../shared/components/autocompletes/single/single-auto-complete-configuration';
import { LanguageResolverService } from '../../../services/language-resolver/language-resolver.service'; import { LanguageResolverService } from '../../../services/language-resolver/language-resolver.service';
import { MultipleAutoCompleteConfiguration } from '../../../shared/components/autocompletes/multiple/multiple-auto-complete-configuration'; import { MultipleAutoCompleteConfiguration } from '../../../shared/components/autocompletes/multiple/multiple-auto-complete-configuration';
import { DatasetProfileCriteria } from '../../../models/criteria/dataset-profile/DatasetProfileCriteria';
@Component({ @Component({

View File

@ -1,43 +1,43 @@
<div class="panel-group" style="margin-top:10px;"> <div class="panel-group" style="margin-top:10px;">
<mat-accordion> <mat-accordion>
<mat-expansion-panel expanded=true> <mat-expansion-panel expanded=true>
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title> <mat-panel-title>
{{path}} {{section.title}} {{path}} {{section.title}}
</mat-panel-title> </mat-panel-title>
<mat-panel-description> <mat-panel-description>
<h3 *ngIf="section.description">{{section.description}}</h3> <h3 *ngIf="section.description">{{section.description}}</h3>
<!-- <h4 *ngIf="section.extendedDescription">{{section.extendedDescription}}</h4> --> <!-- <h4 *ngIf="section.extendedDescription">{{section.extendedDescription}}</h4> -->
</mat-panel-description> </mat-panel-description>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<div *ngFor="let compositeField of section.compositeFields; let i = index; trackBy: trackByFn"> <div *ngFor="let compositeField of section.compositeFields; let i = index; trackBy: trackByFn">
<div *ngIf="isElementVisible(compositeField)"> <div *ngIf="isElementVisible(compositeField)">
<div *ngIf="(compositeField?.multiplicity?.max - 1) > (compositeField?.multiplicityItems?.length)"> <div *ngIf="(compositeField?.multiplicity?.max - 1) > (compositeField?.multiplicityItems?.length)">
<a (click)="addMultipleField(i)" style="cursor: pointer"> <a (click)="addMultipleField(i)" style="cursor: pointer">
Add one more fieldset + Add one more fieldset +
</a> </a>
</div> </div>
<app-df-composite-field [compositeField]="compositeField" [path]="path" [pathName]="pathName+'.compositeFields.'+i"></app-df-composite-field> <app-df-composite-field [compositeField]="compositeField" [path]="path" [pathName]="pathName+'.compositeFields.'+i"></app-df-composite-field>
<div *ngIf="compositeField"> <div *ngIf="compositeField">
<div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn"> <div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn">
<app-df-composite-field [compositeField]="multipleCompositeField" [pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j"></app-df-composite-field> <app-df-composite-field [compositeField]="multipleCompositeField" [pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j"></app-df-composite-field>
</div> </div>
<div *ngIf="compositeField.hasCommentField" [formGroup]="form.get('compositeFields').get(''+i)"> <div *ngIf="compositeField.hasCommentField" [formGroup]="form.get('compositeFields').get(''+i)">
<mat-form-field> <mat-form-field>
<input matInput formControlName="commentFieldValue" placeholder="comment"> <input matInput formControlName="commentFieldValue" placeholder="comment">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div *ngIf="section?.sections"> <div *ngIf="section?.sections">
<div *ngFor="let itemsection of section.sections; let j = index;"> <div *ngFor="let itemsection of section.sections; let j = index;">
<app-df-section [section]="itemsection" [path]="path+'.'+(j+1)" [pathName]="pathName+'.sections.'+j"></app-df-section> <app-df-section [section]="itemsection" [path]="path+'.'+(j+1)" [pathName]="pathName+'.sections.'+j"></app-df-section>
</div> </div>
</div> </div>
</mat-expansion-panel> </mat-expansion-panel>
</mat-accordion> </mat-accordion>
</div> </div>

View File

@ -46,7 +46,8 @@ export class DynamicFormComponent implements OnInit, AfterViewInit {
// @Input() datasetId: string; // @Input() datasetId: string;
constructor(private router: Router, constructor(
private router: Router,
private _location: Location, private _location: Location,
private route: ActivatedRoute, private route: ActivatedRoute,
private visibilityRulesService: VisibilityRulesService, private visibilityRulesService: VisibilityRulesService,

View File

@ -1,5 +0,0 @@
import { BaseCriteria } from '../BaseCriteria';
export class DatasetProfileCriteria extends BaseCriteria {
}

View File

@ -10,6 +10,7 @@ import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria';
import { DatasetProfileModelAdmin } from '../../models/datasetProfileAdmin/DatasetProfileModelAdmin'; import { DatasetProfileModelAdmin } from '../../models/datasetProfileAdmin/DatasetProfileModelAdmin';
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel'; import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
import { DatasetProfileCriteria } from '../../models/criteria/dataset-profile/DatasetProfileCriteria';
@Injectable() @Injectable()
@ -38,7 +39,7 @@ export class DatasetProfileAdmin {
return this.http.get<DatasetProfileModelAdmin>(this.actionUrl + 'get/' + datasetProfileID, { headers: this.headers }); return this.http.get<DatasetProfileModelAdmin>(this.actionUrl + 'get/' + datasetProfileID, { headers: this.headers });
} }
getPaged(dataTableRequest: DataTableRequest<DatasetCriteria>): Observable<DataTableData<DatasetListingModel>> { getPaged(dataTableRequest: DataTableRequest<DatasetProfileCriteria>): Observable<DataTableData<DatasetListingModel>> {
return this.http.post<DataTableData<DatasetListingModel>>(this.actionUrl + 'datasetprofiles/getPaged', dataTableRequest, { headers: this.headers }); return this.http.post<DataTableData<DatasetListingModel>>(this.actionUrl + 'datasetprofiles/getPaged', dataTableRequest, { headers: this.headers });
} }
@ -46,4 +47,7 @@ export class DatasetProfileAdmin {
return this.http.post<DatasetProfileModelAdmin>(this.actionUrl + 'preview', data, { headers: this.headers }); return this.http.post<DatasetProfileModelAdmin>(this.actionUrl + 'preview', data, { headers: this.headers });
} }
clone(id: string): Observable<DatasetProfileModelAdmin> {
return this.http.post<DatasetProfileModelAdmin>(HostConfiguration.Server + 'datasetprofile/clone/' + id, {}, { headers: this.headers });
}
} }

View File

@ -0,0 +1,13 @@
<div class="dmp-criteria">
<mat-card class="mat-card">
<div class="row">
<div class="col-md-6">
<mat-form-field>
<input matInput placeholder=" {{'CRITERIA.DATASET-PROFILE.LIKE'| translate}}" name="datasetProfileLike"
[(ngModel)]="criteria.like" (ngModelChange)="controlModified()">
<mat-error *ngIf="baseErrorModel?.like">{{baseErrorModel['Criteria.like']}}</mat-error>
</mat-form-field>
</div>
</div>
</mat-card>
</div>

View File

@ -0,0 +1,45 @@
import { TranslateService } from '@ngx-translate/core';
import { Component, OnInit, Input } from '@angular/core';
import { BaseCriteriaComponent } from '../base/base-criteria.component';
import { DatasetProfileCriteria } from '../../../../models/criteria/dataset-profile/DatasetProfileCriteria';
import { FormBuilder } from '@angular/forms';
@Component({
selector: 'app-dataset-profile-criteria-component',
templateUrl: './dataset-profile.component.html',
styleUrls: ['./dataset-profile.component.scss'],
})
export class DatasetProfileCriteriaComponent extends BaseCriteriaComponent implements OnInit {
public criteria: DatasetProfileCriteria = new DatasetProfileCriteria();
constructor(
public language: TranslateService,
public formBuilder: FormBuilder
) {
super(new DatasetProfileCriteria());
}
ngOnInit() {
super.ngOnInit();
if (this.criteria == null) { this.criteria = new DatasetProfileCriteria(); }
}
setCriteria(criteria: DatasetProfileCriteria): 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();
}
}
}

View File

@ -12,7 +12,7 @@
<a *ngIf="isAdmin()" mat-button class="navbar-button" routerLink="/users">{{'NAV-BAR.USERS' | translate}}</a> <a *ngIf="isAdmin()" mat-button class="navbar-button" routerLink="/users">{{'NAV-BAR.USERS' | translate}}</a>
<a *ngIf="isAdmin()" mat-button class="navbar-button" routerLink="/dmp-profiles">{{'NAV-BAR.DMP-PROFILES' | <a *ngIf="isAdmin()" mat-button class="navbar-button" routerLink="/dmp-profiles">{{'NAV-BAR.DMP-PROFILES' |
translate}}</a> translate}}</a>
<a *ngIf="isAdmin()" mat-button class="navbar-button" routerLink="/datasetsProfiles">{{'NAV-BAR.DATASETS-ADMIN' <a *ngIf="isAdmin()" mat-button class="navbar-button" routerLink="/dataset-profile">{{'NAV-BAR.DATASETS-ADMIN'
| translate}}</a> | translate}}</a>
</div> </div>

View File

@ -30,6 +30,7 @@ import { CultureService } from '../utilities/culture/culture-service';
import { MAT_DATE_LOCALE } from '@angular/material'; import { MAT_DATE_LOCALE } from '@angular/material';
import { FacetSearchComponent } from './components/facets/facet-search.component'; import { FacetSearchComponent } from './components/facets/facet-search.component';
import { FacetSearchSectionComponent } from './components/facets/facet-search-component/facet-search-section.component'; import { FacetSearchSectionComponent } from './components/facets/facet-search-component/facet-search-section.component';
import { DatasetProfileCriteriaComponent } from './components/criteria/dataset-profile/dataset-profile.component';
@NgModule({ @NgModule({
imports: [ imports: [
@ -49,6 +50,7 @@ import { FacetSearchSectionComponent } from './components/facets/facet-search-co
DatasetCriteriaComponent, DatasetCriteriaComponent,
DataManagementPlanCriteriaComponent, DataManagementPlanCriteriaComponent,
DataManagementPlanProfileCriteriaComponent, DataManagementPlanProfileCriteriaComponent,
DatasetProfileCriteriaComponent,
FigurecardComponent, FigurecardComponent,
BaseCriteriaComponent, BaseCriteriaComponent,
FileUploaderComponent, FileUploaderComponent,
@ -75,6 +77,7 @@ import { FacetSearchSectionComponent } from './components/facets/facet-search-co
DatasetCriteriaComponent, DatasetCriteriaComponent,
DataManagementPlanProfileCriteriaComponent, DataManagementPlanProfileCriteriaComponent,
DataManagementPlanCriteriaComponent, DataManagementPlanCriteriaComponent,
DatasetProfileCriteriaComponent,
FigurecardComponent, FigurecardComponent,
BaseCriteriaComponent, BaseCriteriaComponent,
FileUploaderComponent, FileUploaderComponent,