Fixed Formatting in files

This commit is contained in:
Ioannis Kalyvas 2018-10-05 18:00:54 +03:00
parent 6ace88ecda
commit 510384cdb7
321 changed files with 9244 additions and 9252 deletions

View File

@ -1,15 +1,15 @@
import { BaseHttpService } from "../utilities/cite-http-service-module/base-http.service";
import { HttpClient, HttpClientModule } from "@angular/common/http";
import { TranslateLoader } from "@ngx-translate/core";
import { TranslateModule } from "@ngx-translate/core";
import { SharedModule } from "../shared/shared.module";
import { FormsModule } from "@angular/forms";
import { CommonModule } from "@angular/common";
import { NgModule } from "@angular/core";
import { TranslateService } from "@ngx-translate/core";
import { TranslateHttpLoader } from "@ngx-translate/http-loader";
import { AboutRoutes } from "./about.routes";
import { AboutComponent } from "./components/about.component";
import { BaseHttpService } from '../utilities/cite-http-service-module/base-http.service';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { TranslateLoader } from '@ngx-translate/core';
import { TranslateModule } from '@ngx-translate/core';
import { SharedModule } from '../shared/shared.module';
import { FormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { AboutRoutes } from './about.routes';
import { AboutComponent } from './components/about.component';
@NgModule({
imports: [

View File

@ -1,5 +1,5 @@
import { AboutComponent } from "./components/about.component";
import { Routes, RouterModule } from "@angular/router";
import { AboutComponent } from './components/about.component';
import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [
{ path: '', component: AboutComponent },

View File

@ -1,6 +1,6 @@
import { Component, ViewEncapsulation, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { TranslateService } from "@ngx-translate/core";
import { Component, ViewEncapsulation, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'app-about',

View File

@ -31,7 +31,7 @@ const appRoutes: Routes = [
canActivate: [AuthGuard]
},
{
path: "dmps",
path: 'dmps',
loadChildren: './dmps/dmps.module#DataManagementPlanModule',
data: {
breadcrumb: true
@ -39,7 +39,7 @@ const appRoutes: Routes = [
canActivate: [AuthGuard]
},
{
path: "dmp-profiles",
path: 'dmp-profiles',
loadChildren: './dmp-profiles/dmp-profile.module#DataManagamentPlanProfileModule',
data: {
breadcrumb: true
@ -71,32 +71,32 @@ const appRoutes: Routes = [
pathMatch: 'full'
},
{
path: "unauthorized",
path: 'unauthorized',
loadChildren: './unauthorized/unauthorized.module#UnauthorizedModule',
data: {
breadcrumb: true
},
},
{
path: "users",
path: 'users',
loadChildren: './users/users.module#UsersModule'
},
{
path: "datasetsProfiles",
path: 'datasetsProfiles',
loadChildren: './datasets-admin-listing/dataset-admin.module#DatasetAdminModule',
data: {
breadcrumb: true
},
},
{
path: "welcome",
path: 'welcome',
component: WelcomepageComponent,
data: {
breadcrumb: false
},
},
{
path: "api/oauth/authorized/b2access",
path: 'api/oauth/authorized/b2access',
component: B2AccessLoginComponent,
data: {
},

View File

@ -2,21 +2,21 @@
<div class="container-fluid main-container">
<div class="row">
<help-content position="top"></help-content>
<app-help-content position="top"></app-help-content>
</div>
<div class="row">
<div class="col-md-2">
<help-content position="left"></help-content>
<app-help-content position="left"></app-help-content>
</div>
<div class="col-md-8">
<app-breadcrumb *ngIf="this.isAuthenticated() && (hasBreadCrumb | async)"></app-breadcrumb>
<router-outlet (activate)='onActivate($event)' (deactivate)='onDeactivate($event)'></router-outlet>
</div>
<div class="col-md-2">
<help-content position="right"></help-content>
<app-help-content position="right"></app-help-content>
</div>
</div>
<div class="row">
<help-content position="bottom"></help-content>
<app-help-content position="bottom"></app-help-content>
</div>
</div>

View File

@ -33,11 +33,11 @@ export class AppComponent implements OnInit {
private breadCrumbResolverService: BreadCrumbResolverService,
private cultureService: CultureService
) {
this.initializeServices()
this.initializeServices();
}
onActivate(event: any) {
this.breadCrumbResolverService.push(event)
this.breadCrumbResolverService.push(event);
}
onDeactivate(event: any) {
@ -50,7 +50,7 @@ export class AppComponent implements OnInit {
.map(() => this.route)
.map(route => route.firstChild)
.switchMap(route => route.data)
.map(data => data['breadcrumb'])
.map(data => data['breadcrumb']);
}
login() {
@ -63,7 +63,7 @@ export class AppComponent implements OnInit {
}
public isAuthenticated(): boolean {
return !(!this.authentication.current())
return !(!this.authentication.current());
}
goToDMPs() {

View File

@ -4,4 +4,4 @@ export const HostConfiguration = {
App: environment.App,
CacheLifeTimeMillis: 30000,
HelpServiceUrl: environment.HelpServiceUrl
}
};

View File

@ -57,8 +57,8 @@
</div>
</div>
<field-form *ngIf="!isComposite" [form]="form.get('fields').get(''+0)" [dataModel]="dataModel.fields[0]" [showMultiplicity]="false"
[indexPath]="indexPath + 'f' + 0"></field-form>
<app-field-form *ngIf="!isComposite" [form]="form.get('fields').get(''+0)" [dataModel]="dataModel.fields[0]" [showMultiplicity]="false"
[indexPath]="indexPath + 'f' + 0"></app-field-form>
<div *ngIf="isComposite">
<mat-expansion-panel *ngFor="let field of dataModel.fields let i=index;" #panel>
@ -71,7 +71,7 @@
</div>
</mat-expansion-panel-header>
<div id="{{indexPath + 'f' + i}}" *ngIf="panel.expanded">
<field-form [form]="form.get('fields').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'f' + i"></field-form>
<app-field-form [form]="form.get('fields').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'f' + i"></app-field-form>
</div>
</mat-expansion-panel>
</div>

View File

@ -1,37 +1,39 @@
import { Component, Input } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { FormArray, FormControl } from '@angular/forms';
import { FieldSet } from '../../models/datasetProfileAdmin/FieldSet';
import { Field } from '../../models/datasetProfileAdmin/Field';
@Component({
selector: 'compositefield-form',
selector: 'app-compositefield-form',
templateUrl: './compositefield-form.component.html',
styleUrls: ['./compositefield-form.component.scss']
})
export class CompositeFieldFormComponent {
export class CompositeFieldFormComponent implements OnInit {
@Input() form: FormGroup;
@Input() dataModel: FieldSet;
@Input() indexPath: string;
isComposite: boolean = false;
isMultiplicityEnabled: boolean = false;
isComposite = false;
isMultiplicityEnabled = false;
constructon() { }
ngOnInit() {
//this.addNewField();
if (this.form.get("multiplicity"))
if (this.form.get("multiplicity").value.min > 1 || this.form.get("multiplicity").value.max > 1)
if (this.form.get('multiplicity')) {
if (this.form.get('multiplicity').value.min > 1 || this.form.get('multiplicity').value.max > 1) {
this.isMultiplicityEnabled = true;
}
}
this.isComposite = this.dataModel.fields.length > 1;
}
onIsCompositeChange(isComposite: boolean) {
if (!isComposite && (<FormArray>this.form.get("fields")).length > 1) {
for (let i = 0; i < (<FormArray>this.form.get("fields")).length - 1; i++) {
(<FormArray>this.form.get("fields")).removeAt(1);
if (!isComposite && (<FormArray>this.form.get('fields')).length > 1) {
for (let i = 0; i < (<FormArray>this.form.get('fields')).length - 1; i++) {
(<FormArray>this.form.get('fields')).removeAt(1);
}
this.dataModel.fields.splice(1);
}
@ -39,19 +41,19 @@ export class CompositeFieldFormComponent {
onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) {
if (!isMultiplicityEnabled) {
(<FormControl>this.form.get('multiplicity').get("min")).setValue(0);
(<FormControl>this.form.get('multiplicity').get("max")).setValue(0);
(<FormControl>this.form.get('multiplicity').get('min')).setValue(0);
(<FormControl>this.form.get('multiplicity').get('max')).setValue(0);
}
}
addNewField() {
let field: Field = new Field();
const field: Field = new Field();
this.dataModel.fields.push(field);
(<FormArray>this.form.get("fields")).push(field.buildForm());
(<FormArray>this.form.get('fields')).push(field.buildForm());
}
DeleteField(index) {
this.dataModel.fields.splice(index, 1);
(<FormArray>this.form.get("fields")).removeAt(index);
(<FormArray>this.form.get('fields')).removeAt(index);
}
}

View File

@ -1,5 +1,5 @@
import { RouterModule, Routes } from '@angular/router';
import { FormComponent } from 'app/dataset-profile-form/form/form.component';
import { FormComponent } from './form/form.component';
export const DatasetProfileRoutes: Routes = [
{

View File

@ -64,22 +64,22 @@
<div fxLayout="row" fxLayoutAlign="start center" [ngSwitch]="form.get('viewStyle').get('renderStyle').value">
<div class="full-width" *ngSwitchCase="'combobox'">
<combobox-component [form]="form" [dataModel]="dataModel"></combobox-component>
<app-combobox-component [form]="form" [dataModel]="dataModel"></app-combobox-component>
</div>
<div class="full-width" *ngSwitchCase="'radiobox'">
<radiobox-component [form]="form" [dataModel]="dataModel"></radiobox-component>
<app-radiobox-component [form]="form" [dataModel]="dataModel"></app-radiobox-component>
</div>
<div class="full-width" *ngSwitchCase="'freetext'">
<freetext-component [form]="form" [dataModel]="dataModel"></freetext-component>
<app-freetext-component [form]="form" [dataModel]="dataModel"></app-freetext-component>
</div>
<div class="full-width" *ngSwitchCase="'textarea'">
<textarea-component [form]="form" [dataModel]="dataModel"></textarea-component>
<app-textarea-component [form]="form" [dataModel]="dataModel"></app-textarea-component>
</div>
<div class="full-width" *ngSwitchCase="'booleanDecision'">
<booleanDecision-component [form]="form" [dataModel]="dataModel"></booleanDecision-component>
<app-boolean-decision-component [form]="form" [dataModel]="dataModel"></app-boolean-decision-component>
</div>
<div class="full-width" *ngSwitchCase="'checkBox'">
<checkbox-component [form]="form" [dataModel]="dataModel"></checkbox-component>
<app-checkbox-component [form]="form" [dataModel]="dataModel"></app-checkbox-component>
</div>
</div>
<mat-checkbox *ngIf="showMultiplicity" [(ngModel)]="isFieldMultiplicityEnabled" (ngModelChange)="onIsFieldMultiplicityEnabledChange(isFieldMultiplicityEnabled)">Multiplicity</mat-checkbox>
@ -99,7 +99,7 @@
</button>
</div>
</mat-expansion-panel-header>
<rule-form *ngIf="panel.expanded" [form]="form.get('visible').get('rules').get(''+i)" [dataModel]="rule"></rule-form>
<app-rule-form *ngIf="panel.expanded" [form]="form.get('visible').get('rules').get(''+i)" [dataModel]="rule"></app-rule-form>
</mat-expansion-panel>

View File

@ -1,54 +1,56 @@

import { Component, Input } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup, FormControl, FormArray } from '@angular/forms';
import { ValidationTypes } from '../../models/common/ValidationTypes';
import { Field } from '../../models/datasetProfileAdmin/Field';
import { Rule } from '../../models/datasetProfileAdmin/Rule';
@Component({
selector: 'field-form',
selector: 'app-field-form',
templateUrl: './field-form.component.html',
styleUrls: ['./field-form.component.scss']
})
export class FieldFormComponent {
export class FieldFormComponent implements OnInit {
@Input() form: FormGroup;
@Input() dataModel: Field;
@Input() showMultiplicity: boolean = true;
@Input() showMultiplicity = true;
@Input() indexPath: string;
validationsOptions: Array<any>;
isFieldMultiplicityEnabled: boolean = false;
isFieldMultiplicityEnabled = false;
constructon() {
}
ngOnInit() {
if (this.form.get("multiplicity"))
if (this.form.get("multiplicity").value.min > 1 || this.form.get("multiplicity").value.max > 1)
if (this.form.get('multiplicity')) {
if (this.form.get('multiplicity').value.min > 1 || this.form.get('multiplicity').value.max > 1) {
this.isFieldMultiplicityEnabled = true;
this.validationsOptions = [{ key: 0, value: ValidationTypes[0] }, { key: 1, value: ValidationTypes[1] }]
}
}
this.validationsOptions = [{ key: 0, value: ValidationTypes[0] }, { key: 1, value: ValidationTypes[1] }];
// this.addNewRule();
}
onIsFieldMultiplicityEnabledChange(isFieldMultiplicityEnabled: boolean) {
if (!isFieldMultiplicityEnabled) {
(<FormControl>this.form.get('multiplicity').get("min")).setValue(0);
(<FormControl>this.form.get('multiplicity').get("max")).setValue(0);
(<FormControl>this.form.get('multiplicity').get('min')).setValue(0);
(<FormControl>this.form.get('multiplicity').get('max')).setValue(0);
}
}
addNewRule() {
let rule: Rule = new Rule();
const rule: Rule = new Rule();
this.dataModel.visible.rules.push(rule);
(<FormArray>this.form.get("visible").get("rules")).push(rule.buildForm());
(<FormArray>this.form.get('visible').get('rules')).push(rule.buildForm());
}
DeleteRule(index) {
this.dataModel.visible.rules.splice(index, 1);
(<FormArray>this.form.get("visible").get("rules")).removeAt(index);
(<FormArray>this.form.get('visible').get('rules')).removeAt(index);
}
onchangeCombo() {
if (this.form.get("data")) this.form.removeControl("data");
if (this.form.get('data')) { this.form.removeControl('data'); }
}
}

View File

@ -30,7 +30,7 @@
</mat-expansion-panel-header>
<div id="{{'p' + i}}" *ngIf="panel.expanded">
<div>
<page-form [form]="form.get('pages').at(i)" [dataModel]="page"></page-form>
<app-page-form [form]="form.get('pages').at(i)" [dataModel]="page"></app-page-form>
</div>
</div>
</mat-expansion-panel>
@ -56,7 +56,7 @@
</mat-expansion-panel-header>
<div id="{{'s' + i}}" *ngIf="panel.expanded">
<div>
<section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="'s' + i"></section-form>
<app-section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="'s' + i"></app-section-form>
</div>
</div>
</mat-expansion-panel>

View File

@ -4,23 +4,21 @@ import { DatasetProfileModelAdmin } from '../../models/datasetProfileAdmin/Datas
import { Page } from '../../models/datasetProfileAdmin/Page';
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormControl } from '@angular/forms';
import { SectionFormComponent } from '../section-form/section-form.component';
import { FormArray } from '@angular/forms';
import { Router, ActivatedRoute, ParamMap, Params } from '@angular/router';
import { PageFormComponent } from '../page-form/page-component'
import { Router, ActivatedRoute } from '@angular/router';
import { DatasetProfileAdmin } from '../../services/datasetProfileAdmin/datasetProfileAfmin.service';
import { Section } from '../../models/datasetProfileAdmin/Section';
import { MatDialog } from '@angular/material';
import { DatasetProfilePreviewerComponent } from '../previewer/dataset-profile-previewer.component';
@Component({
selector: 'form-comp',
selector: 'app-form-comp',
templateUrl: './form.component.html',
providers: [DatasetProfileAdmin, DatasetProfileService],
styleUrls: ['./form.component.scss']
})
export class FormComponent {
export class FormComponent implements OnInit {
dataModel: DatasetProfileModelAdmin;
form: FormGroup;
@ -45,8 +43,7 @@ export class FormComponent {
this.dataModel = JsonSerializer.fromJSONObject(data, DatasetProfileModelAdmin);
this.form = this.dataModel.buildForm();
});
}
else {
} else {
this.addSection();
this.addPage();
}
@ -54,31 +51,31 @@ export class FormComponent {
onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) {
if (!isMultiplicityEnabled) {
(<FormControl>this.form.get('multiplicity').get("min")).setValue(0);
(<FormControl>this.form.get('multiplicity').get("max")).setValue(0);
(<FormControl>this.form.get('multiplicity').get('min')).setValue(0);
(<FormControl>this.form.get('multiplicity').get('max')).setValue(0);
}
}
addSection() {
let section: Section = new Section();
const section: Section = new Section();
this.dataModel.sections.push(section);
(<FormArray>this.form.get("sections")).push(section.buildForm());
(<FormArray>this.form.get('sections')).push(section.buildForm());
}
addPage() {
let page: Page = new Page(this.dataModel.pages.length);
const page: Page = new Page(this.dataModel.pages.length);
this.dataModel.pages.push(page);
(<FormArray>this.form.get("pages")).push(page.buildForm());
(<FormArray>this.form.get('pages')).push(page.buildForm());
}
DeleteSection(index) {
this.dataModel.sections.splice(index, 1);
(<FormArray>this.form.get("sections")).removeAt(index)
(<FormArray>this.form.get('sections')).removeAt(index);
}
DeletePage(index) {
this.dataModel.pages.splice(index, 1);
(<FormArray>this.form.get("pages")).removeAt(index)
(<FormArray>this.form.get('pages')).removeAt(index);
}
createForm(data) {
@ -88,18 +85,21 @@ export class FormComponent {
return this.datasetprofileAdmin.updateForm(id, data);
}
onSubmit() {
let data = this.form.value;
const data = this.form.value;
if (this.profileID) this.updateForm(this.profileID, data).subscribe(() => {
this.router.navigate(['/datasetsProfiles'])
if (this.profileID) {
this.updateForm(this.profileID, data).subscribe(() => {
this.router.navigate(['/datasetsProfiles']);
});
else this.createForm(data).subscribe(() => {
this.router.navigate(['/datasetsProfiles'])
} else {
this.createForm(data).subscribe(() => {
this.router.navigate(['/datasetsProfiles']);
});
}
}
preview() {
let dialogRef = this.dialog.open(DatasetProfilePreviewerComponent, {
const dialogRef = this.dialog.open(DatasetProfilePreviewerComponent, {
height: '355px',
width: '700px',
data: {

View File

@ -1,10 +1,10 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { FormGroup } from '@angular/forms'
import { FormGroup } from '@angular/forms';
import { Page } from '../../models/datasetProfileAdmin/Page';
@Component({
selector: 'page-form',
selector: 'app-page-form',
templateUrl: './page-component.html',
styleUrls: ['./page-component.scss']
})

View File

@ -1,2 +1,2 @@
<dynamic-form *ngIf="formGroup" [form]="this.formGroup"
[dataModel]="datasetWizardModel"></dynamic-form>
<app-dynamic-form *ngIf="formGroup" [form]="this.formGroup"
[dataModel]="datasetWizardModel"></app-dynamic-form>

View File

@ -1,23 +1,23 @@
import { ViewEncapsulation, Component, Inject } from "@angular/core";
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
import { FormGroup } from "@angular/forms";
import { DatasetProfileDefinitionModel } from "../../models/DatasetProfileDefinitionModel";
import { JsonSerializer } from "../../utilities/JsonSerializer";
import { DatasetModel } from "../../models/datasets/DatasetModel";
import { DatasetWizardModel } from "../../models/datasets/DatasetWizardModel";
import { DatasetProfileService } from "../../services/dataset-profile.service";
import { DatasetProfileAdmin } from "../../services/datasetProfileAdmin/datasetProfileAfmin.service";
import { ViewEncapsulation, Component, Inject, OnInit } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { FormGroup } from '@angular/forms';
import { DatasetProfileDefinitionModel } from '../../models/DatasetProfileDefinitionModel';
import { JsonSerializer } from '../../utilities/JsonSerializer';
import { DatasetModel } from '../../models/datasets/DatasetModel';
import { DatasetWizardModel } from '../../models/datasets/DatasetWizardModel';
import { DatasetProfileService } from '../../services/dataset-profile.service';
import { DatasetProfileAdmin } from '../../services/datasetProfileAdmin/datasetProfileAfmin.service';
@Component({
selector: 'dataset-profile-previewer',
selector: 'app-dataset-profile-previewer',
templateUrl: './dataset-profile-previewer.component.html',
styleUrls: ['./dataset-profile-previewer.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class DatasetProfilePreviewerComponent {
formGroup: FormGroup
datasetWizardModel: DatasetWizardModel
export class DatasetProfilePreviewerComponent implements OnInit {
formGroup: FormGroup;
datasetWizardModel: DatasetWizardModel;
constructor(
private datasetProfileAdminService: DatasetProfileAdmin,
public dialogRef: MatDialogRef<DatasetProfilePreviewerComponent>,
@ -28,9 +28,9 @@ export class DatasetProfilePreviewerComponent {
this.datasetProfileAdminService.preview(this.data['model']).subscribe(x => {
this.datasetWizardModel = new DatasetWizardModel();
this.datasetWizardModel.datasetProfileDefinition = JsonSerializer.fromJSONObject(x, DatasetProfileDefinitionModel)
this.datasetWizardModel.datasetProfileDefinition = JsonSerializer.fromJSONObject(x, DatasetProfileDefinitionModel);
this.formGroup = this.datasetWizardModel.buildForm();
})
});
}
}

View File

@ -54,7 +54,7 @@
</div>
</mat-expansion-panel-header>
<div id="{{indexPath + 's' + i}}" *ngIf="panel.expanded">
<section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="indexPath + 's' + i"></section-form>
<app-section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="indexPath + 's' + i"></app-section-form>
</div>
</mat-expansion-panel>
</div>
@ -92,7 +92,7 @@
</div>
</mat-expansion-panel-header>
<compositefield-form *ngIf="panel.expanded" [form]="form.get('fieldSets').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'cf' + i"></compositefield-form>
<app-compositefield-form *ngIf="panel.expanded" [form]="form.get('fieldSets').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'cf' + i"></app-compositefield-form>
</mat-expansion-panel>
</div>

View File

@ -9,13 +9,13 @@ import { Page } from '../../models/datasetProfileAdmin/Page';
import { JsonSerializer } from '../../utilities/JsonSerializer';
@Component({
selector: 'section-form',
selector: 'app-section-form',
templateUrl: './section-form.component.html',
styleUrls: ['./section-form.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class SectionFormComponent {
export class SectionFormComponent implements OnInit {
@Input() form: FormGroup;
@Input() dataModel: Section;
@Input() indexPath: string;
@ -23,40 +23,42 @@ export class SectionFormComponent {
constructor() { }
ngOnInit() {
this.form.root.get("pages").valueChanges.subscribe(x =>
this.form.root.get('pages').valueChanges.subscribe(x =>
this.keepPageSelectionValid(x)
);
}
addField() {
let fieldSet: FieldSet = new FieldSet();
let field: Field = new Field();
const fieldSet: FieldSet = new FieldSet();
const field: Field = new Field();
fieldSet.fields.push(field);
if (this.dataModel.fieldSets)
if (this.dataModel.fieldSets) {
this.dataModel.fieldSets.push(fieldSet);
(<FormArray>this.form.get("fieldSets")).push(fieldSet.buildForm());
}
(<FormArray>this.form.get('fieldSets')).push(fieldSet.buildForm());
}
addSectioninSection() {
let section: Section = new Section();
const section: Section = new Section();
this.dataModel.sections.push(section);
(<FormArray>this.form.get("sections")).push(section.buildForm());
(<FormArray>this.form.get('sections')).push(section.buildForm());
}
DeleteSectionInSection(index) {
this.dataModel.sections.splice(index);
(<FormArray>this.form.get("sections")).removeAt(index);
(<FormArray>this.form.get('sections')).removeAt(index);
}
DeleteFieldSet(index) {
this.dataModel.fieldSets.splice(index, 1);
(<FormArray>this.form.get("fieldSets")).removeAt(index);
(<FormArray>this.form.get('fieldSets')).removeAt(index);
}
keepPageSelectionValid(pagesJson: Array<any>) {
let selectedPage = this.form.get("page").value as String;
let pages: Array<Page> = JsonSerializer.fromJSONArray(pagesJson, Page);
if (pages.find(elem => elem.id === selectedPage) === undefined)
this.form.get("page").reset();
const selectedPage = this.form.get('page').value as String;
const pages: Array<Page> = JsonSerializer.fromJSONArray(pagesJson, Page);
if (pages.find(elem => elem.id === selectedPage) === undefined) {
this.form.get('page').reset();
}
}
}

View File

@ -1,16 +1,16 @@
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 { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
import { Router, Params, ActivatedRoute } from "@angular/router";
import { TranslateService } from "@ngx-translate/core";
import { DataSource } from "@angular/cdk/table";
import { Component, ViewChild, OnInit, AfterViewInit } from '@angular/core';
import { MatPaginator, MatSort, MatSnackBar } from '@angular/material';
import { Router, Params, ActivatedRoute } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { DataSource } from '@angular/cdk/table';
import { Observable } from "rxjs/Observable";
import { Observable } from 'rxjs/Observable';
import { PageEvent } from '@angular/material';
import { DataManagementPlanService } from "../services/data-management-plan/data-management-plan.service";
import { DataManagementPlanModel } from "../models/data-managemnt-plans/DataManagementPlanModel";
import { DataManagementPlanService } from '../services/data-management-plan/data-management-plan.service';
import { DataManagementPlanModel } from '../models/data-managemnt-plans/DataManagementPlanModel';
import { DatasetCriteriaComponent } from '../shared/components/criteria/datasets/datasets-criteria.component';
import { DatasetProfileAdmin } from '../services/datasetProfileAdmin/datasetProfileAfmin.service';
@ -54,7 +54,7 @@ export class DatasetAdminListingComponent implements OnInit {
ngOnInit() {
this.route.params.subscribe((params: Params) => {
this.dmpId = params['dmpId'];
if (this.dmpId != null) this.setDmpTitle(this.dmpId);
if (this.dmpId != null) { this.setDmpTitle(this.dmpId); }
this.criteria.setCriteria(this.getDefaultCriteria(this.dmpId));
this.refresh();
this.criteria.setRefreshCallback(() => this.refresh());
@ -122,8 +122,8 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
this.isLoadingResults = true;
});
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
let fields: Array<string> = new Array()
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
let fields: Array<string> = new Array();
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 });
request.criteria = this._criteria.criteria;
return this._service.getPaged(request);

View File

@ -10,7 +10,7 @@ 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 { SharedModule } from '../shared/shared.module';
@NgModule({
imports: [
CommonModule,

View File

@ -1,17 +1,17 @@
import { OnInit, Component, ViewChild } from "@angular/core";
import { MatSort, MatPaginator, PageEvent, MatSnackBar } from "@angular/material";
import { DatasetCriteriaComponent } from "../../shared/components/criteria/datasets/datasets-criteria.component";
import { Observable } from "rxjs";
import { BreadcrumbItem } from "../../shared/components/breadcrumb/definition/breadcrumb-item";
import { DatasetService } from "../../services/dataset/dataset.service";
import { Router, ActivatedRoute, Params } from "@angular/router";
import { TranslateService } from "@ngx-translate/core";
import { DataManagementPlanService } from "../../services/data-management-plan/data-management-plan.service";
import { DatasetCriteria } from "../../models/criteria/dataset/DatasetCriteria";
import { DataSource } from "@angular/cdk/table";
import { DatasetListingModel } from "../../models/datasets/DatasetListingModel";
import { DataTableRequest } from "../../models/data-table/DataTableRequest";
import { FacetSearchCriteriaModel } from "../../models/facet-search/FacetSearchCriteriaModel";
import { OnInit, Component, ViewChild } from '@angular/core';
import { MatSort, MatPaginator, PageEvent, MatSnackBar } from '@angular/material';
import { DatasetCriteriaComponent } from '../../shared/components/criteria/datasets/datasets-criteria.component';
import { Observable } from 'rxjs';
import { BreadcrumbItem } from '../../shared/components/breadcrumb/definition/breadcrumb-item';
import { DatasetService } from '../../services/dataset/dataset.service';
import { Router, ActivatedRoute, Params } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { DataManagementPlanService } from '../../services/data-management-plan/data-management-plan.service';
import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria';
import { DataSource } from '@angular/cdk/table';
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
import { FacetSearchCriteriaModel } from '../../models/facet-search/FacetSearchCriteriaModel';
@Component({
@ -51,9 +51,10 @@ export class DatasetPublicListingComponent implements OnInit {
this.refresh();
this.criteria.setRefreshCallback(() => this.refresh());
if (this.dmpId != null) {
let dmp = await this.dataManagementPlanService.getSingle(this.dmpId).toPromise()
if (params['dmpLabel'] != undefined)
this.titlePrefix = "for " + params['dmpLabel'];
const dmp = await this.dataManagementPlanService.getSingle(this.dmpId).toPromise();
if (params['dmpLabel'] !== undefined) {
this.titlePrefix = 'for ' + params['dmpLabel'];
}
}
});
}
@ -117,8 +118,8 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
this.isLoadingResults = true;
});
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
let fields: Array<string> = new Array()
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
let fields: Array<string> = new Array();
if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; }
const request = new DataTableRequest<FacetSearchCriteriaModel>(startIndex, this._paginator.pageSize, { fields: fields });
request.criteria = this._criteria.criteria;
//if (this.dmpId) request.criteria.allVersions = true;

View File

@ -1,9 +1,9 @@
import { Component, ViewEncapsulation, OnInit, Inject } from "@angular/core";
import { FormGroup } from "@angular/forms";
import { DataRepositoryService } from "../../../services/datarepository/datarepository.service";
import { Router, ActivatedRoute } from "@angular/router";
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
import { DataRepositoryModel } from "../../../models/dataRepositories/DataRepositoryModel";
import { Component, ViewEncapsulation, OnInit, Inject } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { DataRepositoryService } from '../../../services/datarepository/datarepository.service';
import { Router, ActivatedRoute } from '@angular/router';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { DataRepositoryModel } from '../../../models/dataRepositories/DataRepositoryModel';
@Component({
selector: 'app-datarepository-referenced-model-helper',
@ -23,7 +23,7 @@ export class DataRepositoryReferencedModelHelperComponent implements OnInit {
) { }
ngOnInit(): void {
let datarepo = new DataRepositoryModel();
const datarepo = new DataRepositoryModel();
this.formGroup = datarepo.buildForm();
}

View File

@ -1,9 +1,9 @@
import { ExternalDatasetModel } from "../../../models/external-dataset/ExternalDatasetModel";
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
import { Inject, ViewEncapsulation, Component, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { ExternalDatasetService } from "../../../services/external-dataset/external-dataset.service";
import { FormGroup } from "@angular/forms";
import { ExternalDatasetModel } from '../../../models/external-dataset/ExternalDatasetModel';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { Inject, ViewEncapsulation, Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ExternalDatasetService } from '../../../services/external-dataset/external-dataset.service';
import { FormGroup } from '@angular/forms';
@Component({
selector: 'app-externaldataset-referenced-model-helper',
@ -23,7 +23,7 @@ export class ExternalDatasetReferencedModelHelperComponent implements OnInit {
) { }
ngOnInit(): void {
let externalDatasetModel = new ExternalDatasetModel();
const externalDatasetModel = new ExternalDatasetModel();
this.formGroup = externalDatasetModel.buildForm();
}

View File

@ -1,9 +1,9 @@
import { Component, ViewEncapsulation, OnInit, Inject } from "@angular/core";
import { FormGroup } from "@angular/forms";
import { ActivatedRoute, Router } from "@angular/router";
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
import { RegisterModel } from "../../../models/registers/RegisterModel";
import { RegistryService } from "../../../services/registries/registry.service";
import { Component, ViewEncapsulation, OnInit, Inject } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { RegisterModel } from '../../../models/registers/RegisterModel';
import { RegistryService } from '../../../services/registries/registry.service';
@Component({
selector: 'app-registry-referenced-model-helper',
@ -23,7 +23,7 @@ export class RegistryReferencedModelHelperComponent implements OnInit {
) { }
ngOnInit(): void {
let registryModel = new RegisterModel();
const registryModel = new RegisterModel();
this.formGroup = registryModel.buildForm();
}

View File

@ -1,9 +1,9 @@
import { ViewEncapsulation, Component, OnInit, Inject } from "@angular/core";
import { FormGroup } from "@angular/forms";
import { ActivatedRoute, Router } from "@angular/router";
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
import { ServiceModel } from "../../../models/services/ServiceModel";
import { ServicesDataService } from "../../../services/services/services-data.service";
import { ViewEncapsulation, Component, OnInit, Inject } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { ServiceModel } from '../../../models/services/ServiceModel';
import { ServicesDataService } from '../../../services/services/services-data.service';
@Component({
selector: 'app-services-referenced-model-helper',
@ -23,7 +23,7 @@ export class ServicesReferencedModelHelperComponent implements OnInit {
) { }
ngOnInit(): void {
let serviceModel = new ServiceModel();
const serviceModel = new ServiceModel();
this.formGroup = serviceModel.buildForm();
}

View File

@ -225,8 +225,8 @@
</mat-step>
<mat-step>
<ng-template matStepLabel>{{'DATASET-WIZARD.THIRD-STEP.TITLE' | translate}}</ng-template>
<dynamic-form class="full-width" *ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition" [form]="this.formGroup.get('datasetProfileDefinition')"
[dataModel]="datasetWizardModel"></dynamic-form>
<app-dynamic-form class="full-width" *ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition" [form]="this.formGroup.get('datasetProfileDefinition')"
[dataModel]="datasetWizardModel"></app-dynamic-form>
<div class="navigation-buttons-container">
<button style="margin-top:10px;" matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK'
| translate}}</button>

View File

@ -15,10 +15,10 @@ import { ExternalSourcesService } from '../../services/external-sources/external
import { DatasetWizardService } from '../../services/dataset-wizard/dataset-wizard.service';
import { TranslateService } from '@ngx-translate/core';
import { ActivatedRoute, Router, Params } from '@angular/router';
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation, TemplateRef, ChangeDetectionStrategy } from "@angular/core";
import { FormGroup, Validators, FormBuilder, FormArray } from "@angular/forms";
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation, TemplateRef, ChangeDetectionStrategy } from '@angular/core';
import { FormGroup, Validators, FormBuilder, FormArray } from '@angular/forms';
import * as FileSaver from 'file-saver';
import { MatPaginator, MatSort, MatSnackBar, MatStepper, MatDialog } from "@angular/material";
import { MatPaginator, MatSort, MatSnackBar, MatStepper, MatDialog } from '@angular/material';
import { ExternalDatasetCriteria } from '../../models/criteria/external-dataset/ExternalDatasetCriteria';
import { ExternalDatasetModel } from '../../models/external-dataset/ExternalDatasetModel';
import { RegistryCriteria } from '../../models/criteria/registry/RegistryCriteria';
@ -48,25 +48,11 @@ import { ServicesReferencedModelHelperComponent } from '../dataset-referenced-mo
styleUrls: ['./dataset-wizard.component.scss'],
encapsulation: ViewEncapsulation.None,
})
export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
export class DatasetWizardComponent implements OnInit, AfterViewInit, IBreadCrumbComponent {
breadCrumbs: Observable<BreadcrumbItem[]>;
viewOnly = false;
@ViewChild('stepper') stepper: MatStepper;
//autocomplete Display Functions;
externalDatasetDisplayFunc = (item) => item ? item.label : null;
registriesDisplayFunc = (item) => item ? item.label : null;
dataRepositoryDisplayFunc = (item) => item ? item.name : null;
servicesDisplayFunc = (item) => item ? item.label : null;
tagsDisplayFunc = (item) => item ? item.name : null;
//autocomplete Display Functions;
externalDatasetDisplaySubtitleFunc = (item) => item ? item.tag : null;
registriesDisplaySubtitleFunc = (item) => item ? item.tag : null;
dataRepositoryDisplaySubtitleFunc = (item) => item ? item.tag : null;
servicesDisplaySubtitleFunc = (item) => item ? item.tag : null;
tagsDisplaySubtitleFunc = (item) => item ? item.tag : null;
//autocomplete Configurations;
externalDatasetAutoCompleteConfiguration: AutoCompleteConfiguration;
registriesAutoCompleteConfiguration: AutoCompleteConfiguration;
@ -83,7 +69,22 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
datasetProfileDefinitionModel: DatasetProfileDefinitionModel;
availableProfiles: DatasetProfileModel[] = [];
itemId: string
itemId: string;
isLinear = false;
firstStepFormGroup: FormGroup;
secondFormGroup: FormGroup;
externalDatasetDisplayFunc = (item) => item ? item.label : null;
registriesDisplayFunc = (item) => item ? item.label : null;
dataRepositoryDisplayFunc = (item) => item ? item.name : null;
servicesDisplayFunc = (item) => item ? item.label : null;
tagsDisplayFunc = (item) => item ? item.name : null;
externalDatasetDisplaySubtitleFunc = (item) => item ? item.tag : null;
registriesDisplaySubtitleFunc = (item) => item ? item.tag : null;
dataRepositoryDisplaySubtitleFunc = (item) => item ? item.tag : null;
servicesDisplaySubtitleFunc = (item) => item ? item.tag : null;
tagsDisplaySubtitleFunc = (item) => item ? item.tag : null;
constructor(
private datasetWizardService: DatasetWizardService,
private formBuilder: FormBuilder,
@ -100,54 +101,49 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
}
isLinear = false;
firstStepFormGroup: FormGroup;
secondFormGroup: FormGroup;
ngOnInit() {
this.route
.data
.subscribe(v => this.viewOnly = v["public"]);
.subscribe(v => this.viewOnly = v['public']);
let dmpRequestItem: RequestItem<DataManagementPlanCriteria> = new RequestItem();
const dmpRequestItem: RequestItem<DataManagementPlanCriteria> = new RequestItem();
dmpRequestItem.criteria = new DataManagementPlanCriteria();
let externalDatasetRequestItem: RequestItem<ExternalDatasetCriteria> = new RequestItem();
const externalDatasetRequestItem: RequestItem<ExternalDatasetCriteria> = new RequestItem();
externalDatasetRequestItem.criteria = new ExternalDatasetCriteria();
this.externalDatasetAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetSExternalDatasetservice.bind(this.externalSourcesService), externalDatasetRequestItem)
this.externalDatasetAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetSExternalDatasetservice.bind(this.externalSourcesService), externalDatasetRequestItem);
let registriesRequestItem: RequestItem<RegistryCriteria> = new RequestItem();
const registriesRequestItem: RequestItem<RegistryCriteria> = new RequestItem();
registriesRequestItem.criteria = new RegistryCriteria();
this.registriesAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetRegistry.bind(this.externalSourcesService), registriesRequestItem)
this.registriesAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetRegistry.bind(this.externalSourcesService), registriesRequestItem);
let dataRepositoriesRequestItem: RequestItem<DataRepositoryCriteria> = new RequestItem();
const dataRepositoriesRequestItem: RequestItem<DataRepositoryCriteria> = new RequestItem();
dataRepositoriesRequestItem.criteria = new DataRepositoryCriteria();
this.dataRepositoriesAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetRepository.bind(this.externalSourcesService), dataRepositoriesRequestItem)
this.dataRepositoriesAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetRepository.bind(this.externalSourcesService), dataRepositoriesRequestItem);
let servicesRequestItem: RequestItem<ServicesCriteria> = new RequestItem();
const servicesRequestItem: RequestItem<ServicesCriteria> = new RequestItem();
servicesRequestItem.criteria = new ServicesCriteria();
this.servicesAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetService.bind(this.externalSourcesService), servicesRequestItem)
this.servicesAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetService.bind(this.externalSourcesService), servicesRequestItem);
let tagsRequestItem: RequestItem<TagsCriteria> = new RequestItem();
const tagsRequestItem: RequestItem<TagsCriteria> = new RequestItem();
tagsRequestItem.criteria = new TagsCriteria();
this.tagsAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetTags.bind(this.externalSourcesService), tagsRequestItem)
this.tagsAutoCompleteConfiguration = new AutoCompleteConfiguration(this.externalSourcesService.searchDatasetTags.bind(this.externalSourcesService), tagsRequestItem);
this.externalSourcesConfigurationService.getExternalSourcesConfiguration().subscribe(result => {
this.externalSourcesConfiguration = result;
this.externalSourcesConfiguration.dataRepositories.push({ key: '', label: "All" })
this.externalSourcesConfiguration.externalDatasets.push({ key: '', label: "All" })
this.externalSourcesConfiguration.registries.push({ key: '', label: "All" })
this.externalSourcesConfiguration.services.push({ key: '', label: "All" })
this.externalSourcesConfiguration.tags.push({ key: '', label: "All" })
})
this.externalSourcesConfiguration.dataRepositories.push({ key: '', label: 'All' });
this.externalSourcesConfiguration.externalDatasets.push({ key: '', label: 'All' });
this.externalSourcesConfiguration.registries.push({ key: '', label: 'All' });
this.externalSourcesConfiguration.services.push({ key: '', label: 'All' });
this.externalSourcesConfiguration.tags.push({ key: '', label: 'All' });
});
this.dmpAutoCompleteConfiguration = {
filterFn: this.searchDmp.bind(this),
items: this.searchDmp(''),
displayFn: (item) => item["label"],
titleFn: (item) => item["label"],
displayFn: (item) => item['label'],
titleFn: (item) => item['label'],
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
loadDataOnStart: true
};
@ -163,27 +159,27 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
this.breadCrumbs = Observable.of([
{
parentComponentName: null,
label: "Datasets",
url: "/datasets",
label: 'Datasets',
url: '/datasets',
notFoundResolver: [
{
parentComponentName: null,
label: this.datasetWizardModel.dmp.project.label,
url: "/projects/edit/" + this.datasetWizardModel.dmp.project.id
url: '/projects/edit/' + this.datasetWizardModel.dmp.project.id
},
{
parentComponentName: null,
label: this.datasetWizardModel.dmp.label,
url: "/dmps/edit/" + this.datasetWizardModel.dmp.id,
url: '/dmps/edit/' + this.datasetWizardModel.dmp.id,
},
]
}])
}]);
this.formGroup = this.datasetWizardModel.buildForm();
if (this.datasetWizardModel.status == 1) {
this.formGroup.disable()
if (this.datasetWizardModel.status === 1) {
this.formGroup.disable();
this.viewOnly = true;
}
if (this.viewOnly) this.formGroup.disable();
if (this.viewOnly) { this.formGroup.disable(); }
this.loadDatasetProfiles();
});
} else if (dmpId != null) {
@ -194,8 +190,8 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
setTimeout(() => {
this.datasetWizardModel.dmp = data;
this.formGroup = this.datasetWizardModel.buildForm();
if (this.datasetWizardModel.status == 1) {
this.formGroup.disable()
if (this.datasetWizardModel.status === 1) {
this.formGroup.disable();
this.viewOnly = true;
}
this.loadDatasetProfiles();
@ -203,61 +199,63 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
this.breadCrumbs = Observable.of([
{
parentComponentName: null,
label: "Datasets",
url: "/datasets",
label: 'Datasets',
url: '/datasets',
notFoundResolver: [
{
parentComponentName: null,
label: this.datasetWizardModel.dmp.project.label,
url: "/projects/edit/" + this.datasetWizardModel.dmp.project.id
url: '/projects/edit/' + this.datasetWizardModel.dmp.project.id
},
{
parentComponentName: null,
label: this.datasetWizardModel.dmp.label,
url: "/dmps/edit/" + this.datasetWizardModel.dmp.id,
url: '/dmps/edit/' + this.datasetWizardModel.dmp.id,
}]
}])
}]);
});
});
} else {
this.datasetWizardModel = new DatasetWizardModel();
this.formGroup = this.datasetWizardModel.buildForm()
if (this.datasetWizardModel.status == 1) {
this.formGroup.disable()
this.formGroup = this.datasetWizardModel.buildForm();
if (this.datasetWizardModel.status === 1) {
this.formGroup.disable();
this.viewOnly = true;
}
if (this.viewOnly) this.formGroup.disable();
if (this.viewOnly) { this.formGroup.disable(); }
this.formGroup.get('dmp').valueChanges.subscribe(x => {
this.loadDatasetProfiles();
})
});
}
});
}
ngAfterViewInit() {
this.route.params.subscribe((params: Params) => {
let itemId = params['id'];
if (itemId != null) this.stepper.selectedIndex = 2;
})
const itemId = params['id'];
if (itemId != null) { this.stepper.selectedIndex = 2; }
});
}
searchDmp(query: string): Observable<DataManagementPlanListingModel[]> {
let dmpRequestItem: RequestItem<DataManagementPlanCriteria> = new RequestItem();
const dmpRequestItem: RequestItem<DataManagementPlanCriteria> = new RequestItem();
dmpRequestItem.criteria = new DataManagementPlanCriteria();
dmpRequestItem.criteria.like = query;
return this.dataManagementPlanService.get(dmpRequestItem);
}
loadDatasetProfiles() {
let datasetProfileRequestItem: RequestItem<DatasetProfileCriteria> = new RequestItem();
const datasetProfileRequestItem: RequestItem<DatasetProfileCriteria> = new RequestItem();
datasetProfileRequestItem.criteria = new DatasetProfileCriteria();
datasetProfileRequestItem.criteria.id = this.formGroup.get("dmp").value.id;
if (datasetProfileRequestItem.criteria.id) this.datasetWizardService.getAvailableProfiles(datasetProfileRequestItem).subscribe(items => {
datasetProfileRequestItem.criteria.id = this.formGroup.get('dmp').value.id;
if (datasetProfileRequestItem.criteria.id) {
this.datasetWizardService.getAvailableProfiles(datasetProfileRequestItem).subscribe(items => {
this.availableProfiles = JsonSerializer.fromJSONArray(items, DatasetProfileModel);
});
}
}
public cancel(): void {
//this.router.navigate(['/dataManagementPlans']);
@ -265,11 +263,11 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
getDefinition() {
if (this.isNew) {
this.datasetWizardService.getDefinition(this.formGroup.get("profile").get("id").value).subscribe(item => {
this.datasetWizardService.getDefinition(this.formGroup.get('profile').get('id').value).subscribe(item => {
this.datasetWizardModel.datasetProfileDefinition = JsonSerializer.fromJSONObject(item, DatasetProfileDefinitionModel);
this.datasetProfileDefinitionModel = this.datasetWizardModel.datasetProfileDefinition;
this.formGroup.addControl("datasetProfileDefinition", this.datasetProfileDefinitionModel.buildForm())
})
this.formGroup.addControl('datasetProfileDefinition', this.datasetProfileDefinitionModel.buildForm());
});
}
}
@ -290,8 +288,8 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
result => {
this.datasetWizardModel = JsonSerializer.fromJSONObject(result, DatasetWizardModel);
}
)
this.onCallbackSuccess()
);
this.onCallbackSuccess();
},
error => this.onCallbackError(error)
);
@ -299,20 +297,20 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
submit() {
this.datasetWizardService.createDataset(this.formGroup.value).subscribe(data => {
this.router.navigateByUrl("/datasets/dmp/" + this.formGroup.get("dmp").value.id);
this.router.navigateByUrl('/datasets/dmp/' + this.formGroup.get('dmp').value.id);
});
}
save() {
if (!this.isFormValid()) { return; }
this.formGroup.get("status").setValue("0");
this.formGroup.get('status').setValue('0');
this.submit();
}
saveFinalize() {
if (!this.isFormValid()) { return; }
this.formGroup.get("status").setValue("1");
this.formGroup.get('status').setValue('1');
this.submit();
}
@ -320,7 +318,7 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
data: { message: this.isNew ? 'GENERAL.SNACK-BAR.SUCCESSFUL-CREATION' : 'GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE', language: this.language },
duration: 3000,
})
});
}
onCallbackError(error: any) {
@ -330,25 +328,25 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
public setErrorModel(errorModel: BaseErrorModel) {
Object.keys(errorModel).forEach(item => {
(<any>this.datasetWizardModel.errorModel)[item] = (<any>errorModel)[item];
})
});
}
downloadPDF(): void {
this.datasetWizardService.downloadPDF(this.itemId).subscribe(response => {
const blob = new Blob([response.body], { type: 'application/pdf' })
const blob = new Blob([response.body], { type: 'application/pdf' });
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
FileSaver.saveAs(blob, filename)
})
FileSaver.saveAs(blob, filename);
});
}
downloadXML(): void {
this.datasetWizardService.downloadXML(this.itemId).subscribe(response => {
const blob = new Blob([response.body], { type: 'application/xml' })
const blob = new Blob([response.body], { type: 'application/xml' });
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
FileSaver.saveAs(blob, filename)
})
FileSaver.saveAs(blob, filename);
});
}
getFilenameFromContentDispositionHeader(header: string): string {
@ -370,41 +368,41 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
}
public redirectToProject() {
this.router.navigate(["projects/edit/" + this.datasetWizardModel.dmp.project.id])
this.router.navigate(['projects/edit/' + this.datasetWizardModel.dmp.project.id]);
}
public redirectToDmp() {
this.router.navigate(["dmps/edit/" + this.datasetWizardModel.dmp.id])
this.router.navigate(['dmps/edit/' + this.datasetWizardModel.dmp.id]);
}
externalDatasetsOnItemChange(event) {
let externalDatasetModel = new ExternalDatasetModel(event.id, event.abbreviation, event.label, event.reference);
(<FormArray>this.formGroup.get("externalDatasets")).push(externalDatasetModel.buildForm());
const externalDatasetModel = new ExternalDatasetModel(event.id, event.abbreviation, event.label, event.reference);
(<FormArray>this.formGroup.get('externalDatasets')).push(externalDatasetModel.buildForm());
}
registriesOnItemChange(event) {
let registryModel = new RegisterModel(event.abbreviation, event.definition, event.id, event.label, event.reference, event.uri);
(<FormArray>this.formGroup.get("registries")).push(registryModel.buildForm());
const registryModel = new RegisterModel(event.abbreviation, event.definition, event.id, event.label, event.reference, event.uri);
(<FormArray>this.formGroup.get('registries')).push(registryModel.buildForm());
}
servicesOnItemChange(event) {
let serviceModel = new ServiceModel(event.abbreviation, event.definition, event.id, event.label, event.reference, event.uri);
(<FormArray>this.formGroup.get("services")).push(serviceModel.buildForm());
const serviceModel = new ServiceModel(event.abbreviation, event.definition, event.id, event.label, event.reference, event.uri);
(<FormArray>this.formGroup.get('services')).push(serviceModel.buildForm());
}
tagsOnItemChange(event) {
let serviceModel = new TagModel(event.id, event.name);
(<FormArray>this.formGroup.get("tags")).push(serviceModel.buildForm());
const serviceModel = new TagModel(event.id, event.name);
(<FormArray>this.formGroup.get('tags')).push(serviceModel.buildForm());
}
dataRepositoriesOnItemChange(event) {
let dataRepositoryModel = new DataRepositoryModel(event.id, event.name, event.abbreviation, event.uri, event.pid);
(<FormArray>this.formGroup.get("dataRepositories")).push(dataRepositoryModel.buildForm());
const dataRepositoryModel = new DataRepositoryModel(event.id, event.name, event.abbreviation, event.uri, event.pid);
(<FormArray>this.formGroup.get('dataRepositories')).push(dataRepositoryModel.buildForm());
}
addDataRepository() {
let dialogRef = this.dialog.open(DataRepositoryReferencedModelHelperComponent, {
const dialogRef = this.dialog.open(DataRepositoryReferencedModelHelperComponent, {
height: '255px',
width: '700px',
data: {
@ -412,14 +410,14 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
}
});
dialogRef.afterClosed().subscribe(result => {
if (!result) return
let dataRepositoryModel = new DataRepositoryModel(result.id, result.label, result.pid, result.uri, result.reference);
(<FormArray>this.formGroup.get("dataRepositories")).push(dataRepositoryModel.buildForm());
if (!result) { return; }
const dataRepositoryModel = new DataRepositoryModel(result.id, result.label, result.pid, result.uri, result.reference);
(<FormArray>this.formGroup.get('dataRepositories')).push(dataRepositoryModel.buildForm());
});
}
addRegistry() {
let dialogRef = this.dialog.open(RegistryReferencedModelHelperComponent, {
const dialogRef = this.dialog.open(RegistryReferencedModelHelperComponent, {
height: '255px',
width: '700px',
data: {
@ -427,14 +425,14 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
}
});
dialogRef.afterClosed().subscribe(result => {
if (!result) return
let registryModel = new RegisterModel(result.abbreviation, result.definition, result.id, result.label, result.reference, result.uri);
(<FormArray>this.formGroup.get("registries")).push(registryModel.buildForm());
if (!result) { return; }
const registryModel = new RegisterModel(result.abbreviation, result.definition, result.id, result.label, result.reference, result.uri);
(<FormArray>this.formGroup.get('registries')).push(registryModel.buildForm());
});
}
addExternalDataset() {
let dialogRef = this.dialog.open(ExternalDatasetReferencedModelHelperComponent, {
const dialogRef = this.dialog.open(ExternalDatasetReferencedModelHelperComponent, {
height: '255px',
width: '700px',
data: {
@ -442,14 +440,14 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
}
});
dialogRef.afterClosed().subscribe(result => {
if (!result) return
let externalDatasetModel = new ExternalDatasetModel(result.id, result.abbreviation, result.label, result.reference);
(<FormArray>this.formGroup.get("externalDatasets")).push(externalDatasetModel.buildForm());
if (!result) { return; }
const externalDatasetModel = new ExternalDatasetModel(result.id, result.abbreviation, result.label, result.reference);
(<FormArray>this.formGroup.get('externalDatasets')).push(externalDatasetModel.buildForm());
});
}
addService() {
let dialogRef = this.dialog.open(ServicesReferencedModelHelperComponent, {
const dialogRef = this.dialog.open(ServicesReferencedModelHelperComponent, {
height: '255px',
width: '700px',
data: {
@ -457,9 +455,9 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
}
});
dialogRef.afterClosed().subscribe(result => {
if (!result) return
let serviceModel = new ServiceModel(result.id, result.abbreviation, result.definition, result.uri, result.label, result.reference);
(<FormArray>this.formGroup.get("services")).push(serviceModel.buildForm());
if (!result) { return; }
const serviceModel = new ServiceModel(result.id, result.abbreviation, result.definition, result.uri, result.label, result.reference);
(<FormArray>this.formGroup.get('services')).push(serviceModel.buildForm());
});
}
}

View File

@ -12,7 +12,7 @@ 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 { SharedModule } from '../shared/shared.module';
import { BaseHttpService } from '../utilities/cite-http-service-module/base-http.service';
import { BaseHttpModule } from '../utilities/cite-http-service-module/cite-http.module';
import { MaterialModule } from '../shared/material/material.module';

View File

@ -6,7 +6,7 @@ import { DatasetPublicListingComponent } from './dataset-public/dataset-public-l
export const DatasetRoutes: Routes = [
{
path: "new/:dmpId",
path: 'new/:dmpId',
component: DatasetWizardComponent,
canActivate: [AuthGuard],
data: {
@ -14,7 +14,7 @@ export const DatasetRoutes: Routes = [
},
},
{
path: "edit/:id",
path: 'edit/:id',
component: DatasetWizardComponent,
canActivate: [AuthGuard],
data: {
@ -23,7 +23,7 @@ export const DatasetRoutes: Routes = [
},
},
{
path: "publicEdit/:id",
path: 'publicEdit/:id',
component: DatasetWizardComponent,
//canActivate: [AuthGuard],
data: {
@ -31,7 +31,7 @@ export const DatasetRoutes: Routes = [
}
},
{
path: "new",
path: 'new',
component: DatasetWizardComponent,
canActivate: [AuthGuard],
data: {
@ -52,7 +52,7 @@ export const DatasetRoutes: Routes = [
//canActivate: [AuthGuard],
},
{
path: "dmp/:dmpId",
path: 'dmp/:dmpId',
component: DatasetListingComponent,
//canActivate: [AuthGuard],
data: {

View File

@ -1,17 +1,17 @@
import { AfterViewInit, Component, Input, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
import { Router, ActivatedRoute, Params } from "@angular/router";
import { TranslateService } from "@ngx-translate/core";
import { DataSource } from "@angular/cdk/table";
import { Observable } from "rxjs/Observable";
import { JsonSerializer } from "../../utilities/JsonSerializer";
import { FormGroup } from "@angular/forms";
import { SnackBarNotificationComponent } from "../../shared/components/notificaiton/snack-bar-notification.component";
import { BaseErrorModel } from "../../models/error/BaseErrorModel";
import { DatasetService } from "../../services/dataset/dataset.service";
import { DatasetModel } from "../../models/datasets/DatasetModel";
import { ExternalSourcesService } from "../../services/external-sources/external-sources.service";
import { ExternalSourcesItemModel } from "../../models/external-sources/ExternalSourcesItemModel";
import { MatPaginator, MatSort, MatSnackBar } from '@angular/material';
import { Router, ActivatedRoute, Params } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { DataSource } from '@angular/cdk/table';
import { Observable } from 'rxjs/Observable';
import { JsonSerializer } from '../../utilities/JsonSerializer';
import { FormGroup } from '@angular/forms';
import { SnackBarNotificationComponent } from '../../shared/components/notificaiton/snack-bar-notification.component';
import { BaseErrorModel } from '../../models/error/BaseErrorModel';
import { DatasetService } from '../../services/dataset/dataset.service';
import { DatasetModel } from '../../models/datasets/DatasetModel';
import { ExternalSourcesService } from '../../services/external-sources/external-sources.service';
import { ExternalSourcesItemModel } from '../../models/external-sources/ExternalSourcesItemModel';

View File

@ -3,16 +3,16 @@ import { DataTableRequest } from '../../models/data-table/DataTableRequest';
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria';
import { DatasetService } from '../../services/dataset/dataset.service';
import { Component, ViewChild, OnInit, AfterViewInit } from "@angular/core";
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
import { Router, Params, ActivatedRoute } from "@angular/router";
import { TranslateService } from "@ngx-translate/core";
import { DataSource } from "@angular/cdk/table";
import { Component, ViewChild, OnInit, AfterViewInit } from '@angular/core';
import { MatPaginator, MatSort, MatSnackBar } from '@angular/material';
import { Router, Params, ActivatedRoute } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { DataSource } from '@angular/cdk/table';
import { Observable } from "rxjs/Observable";
import { Observable } from 'rxjs/Observable';
import { PageEvent } from '@angular/material';
import { DataManagementPlanService } from "../../services/data-management-plan/data-management-plan.service";
import { DataManagementPlanModel } from "../../models/data-managemnt-plans/DataManagementPlanModel";
import { DataManagementPlanService } from '../../services/data-management-plan/data-management-plan.service';
import { DataManagementPlanModel } from '../../models/data-managemnt-plans/DataManagementPlanModel';
import { DatasetCriteriaComponent } from '../../shared/components/criteria/datasets/datasets-criteria.component';
import { BreadcrumbItem } from '../../shared/components/breadcrumb/definition/breadcrumb-item';
import { IBreadCrumbComponent } from '../../shared/components/breadcrumb/definition/IBreadCrumbComponent';
@ -66,12 +66,13 @@ export class DatasetListingComponent implements OnInit, IBreadCrumbComponent {
this.refresh();
this.criteria.setRefreshCallback(() => this.refresh());
if (this.dmpId != null) {
let dmp = await this.dataManagementPlanService.getSingle(this.dmpId).toPromise()
this.breadCrumbs = Observable.of([{ parentComponentName: "DataManagementPlanEditorComponent", label: dmp.label, url: "dmps/edit/" + this.dmpId }])
if (params['dmpLabel'] != undefined)
this.titlePrefix = "for " + params['dmpLabel'];
const dmp = await this.dataManagementPlanService.getSingle(this.dmpId).toPromise();
this.breadCrumbs = Observable.of([{ parentComponentName: 'DataManagementPlanEditorComponent', label: dmp.label, url: 'dmps/edit/' + this.dmpId }]);
if (params['dmpLabel'] !== undefined) {
this.titlePrefix = 'for ' + params['dmpLabel'];
}
} else {
this.breadCrumbs = Observable.of([])
this.breadCrumbs = Observable.of([]);
}
});
}
@ -129,11 +130,11 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
this.isLoadingResults = true;
});
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
let fields: Array<string> = new Array()
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
let fields: Array<string> = new Array();
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 });
request.criteria = this._criteria.criteria;
if (this.dmpId) request.criteria.allVersions = true;
if (this.dmpId) { request.criteria.allVersions = true; }
return this._service.getPaged(request);
})
/*.catch((error: any) => {
@ -146,7 +147,7 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
return Observable.of(null);
})*/
.map(result => {
result.data = JsonSerializer.fromJSONArray(result.data, DatasetListingModel)
result.data = JsonSerializer.fromJSONArray(result.data, DatasetListingModel);
return result;
})
.map(result => {

View File

@ -1,5 +1,3 @@
<div class="dmp-profile-editor">
<form *ngIf="formGroup" (ngSubmit)="formSubmit()" [formGroup]="formGroup">
<mat-card>
@ -11,8 +9,8 @@
<mat-card-content>
<mat-form-field class="full-width">
<input matInput placeholder="{{'DMP-PROFILE-EDITOR.FIELDS.LABEL' | translate}}" type="text" name="label" formControlName="label"
required>
<input matInput placeholder="{{'DMP-PROFILE-EDITOR.FIELDS.LABEL' | translate}}" type="text" name="label"
formControlName="label" required>
<mat-error *ngIf="formGroup.get('label').errors?.backendError">{{baseErrorModel.label}}</mat-error>
<mat-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
@ -22,24 +20,29 @@
<mat-list-item *ngFor="let field of formGroup.controls.definition.controls.fields.controls;let i=index">
<div [formGroupName]="i">
<mat-form-field>
<input matInput placeholder="{{'DMP-PROFILE-EDITOR.FIELDS.LABEL' | translate}}" type="text" name="label" formControlName="label"
required>
<input matInput placeholder="{{'DMP-PROFILE-EDITOR.FIELDS.LABEL' | translate}}" type="text" name="label"
formControlName="label" required>
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('label').errors?.required">{{baseErrorModel.label}}</mat-error>
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('label').errors?.backendError">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('label').errors?.backendError">{{'GENERAL.VALIDATION.REQUIRED'
| translate}}</mat-error>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="{{'DMP-PROFILE-EDITOR.FIELDS.TYPE' | translate}}" formControlName="type">
<mat-option *ngFor="let fieldType of getDMPProfileFieldTypeValues()" [value]="fieldType">{{ getDMPProfileFieldTypeWithLanguage(fieldType) | translate}}</mat-option>
<mat-option *ngFor="let fieldType of getDMPProfileFieldTypeValues()" [value]="fieldType">{{
getDMPProfileFieldTypeWithLanguage(fieldType) | translate}}</mat-option>
</mat-select>
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('type').errors?.required">{{baseErrorModel.type}}</mat-error>
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('type').errors?.backendError">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('type').errors?.backendError">{{'GENERAL.VALIDATION.REQUIRED'
| translate}}</mat-error>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="{{'DMP-PROFILE-EDITOR.FIELDS.DATATYPE' | translate}}" formControlName="dataType">
<mat-option *ngFor="let fieldDataType of getDMPProfileFieldDataTypeValues()" [value]="fieldDataType">{{ getDMPProfileFieldDataTypeWithLanguage(fieldDataType) | translate}}</mat-option>
<mat-option *ngFor="let fieldDataType of getDMPProfileFieldDataTypeValues()" [value]="fieldDataType">{{
getDMPProfileFieldDataTypeWithLanguage(fieldDataType) | translate}}</mat-option>
</mat-select>
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('dataType').errors?.required">{{baseErrorModel.dataType}}</mat-error>
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('dataType').errors?.backendError">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
<mat-error *ngIf="formGroup.get('definition').get('fields').get(''+i).get('dataType').errors?.backendError">{{'GENERAL.VALIDATION.REQUIRED'
| translate}}</mat-error>
</mat-form-field>
<mat-checkbox formControlName="required">
{{'DMP-PROFILE-EDITOR.FIELDS.REQUIRED' | translate}}
@ -52,9 +55,11 @@
</mat-list>
</div>
<div layout="row" class="full-width text-right" align="end">
<button mat-raised-button color="primary" (click)="cancel()" type="button">{{'DMP-PROFILE-EDITOR.ACTIONS.CANCEL' | translate}}</button>
<button mat-raised-button color="primary" (click)="cancel()" type="button">{{'DMP-PROFILE-EDITOR.ACTIONS.CANCEL' |
translate}}</button>
<button mat-raised-button color="primary" type="submit">{{'DMP-PROFILE-EDITOR.ACTIONS.SAVE' | translate}}</button>
<button *ngIf="!isNew" mat-raised-button color="primary" type="button" (click)="delete()">{{'DMP-PROFILE-EDITOR.ACTIONS.DELETE' | translate}}</button>
<button *ngIf="!isNew" mat-raised-button color="primary" type="button" (click)="delete()">{{'DMP-PROFILE-EDITOR.ACTIONS.DELETE'
| translate}}</button>
</div>
</mat-card-content>

View File

@ -1,22 +1,22 @@
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation } from "@angular/core";
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
import { Router, ActivatedRoute, Params } from "@angular/router";
import { TranslateService } from "@ngx-translate/core";
import { DataSource } from "@angular/cdk/table";
import { Observable } from "rxjs/Observable";
import { DataManagementPlanService } from "../../services/data-management-plan/data-management-plan.service";
import { ProjectModel } from "../../models/projects/ProjectModel";
import { JsonSerializer } from "../../utilities/JsonSerializer";
import { FormGroup, AbstractControl, FormControl, FormArray } from "@angular/forms";
import { SnackBarNotificationComponent } from "../../shared/components/notificaiton/snack-bar-notification.component";
import { BaseErrorModel } from "../../models/error/BaseErrorModel";
import { TdDialogService } from "@covalent/core";
import { HostConfiguration } from "../../app.constants";
import { DataManagementPlanProfileService } from "../../services/data-management-plan-profile/datamanagement-profile.service";
import { DataManagementPlanProfileModel } from "../../models/data-management-plan-profile/DataManagementPlanProfileModel";
import { DMPProfileFieldDataType, DMPProfileType, DataManagementProfileField } from "../../models/data-management-plan-profile/DataManagementProfileField";
import { Utilities } from "../../utilities/utilities";
import { DataManagementPlanProfileListingModel } from "../../models/data-management-plan-profile/DataManagementPlanProfileListingModel";
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation } from '@angular/core';
import { MatPaginator, MatSort, MatSnackBar } from '@angular/material';
import { Router, ActivatedRoute, Params } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { DataSource } from '@angular/cdk/table';
import { Observable } from 'rxjs/Observable';
import { DataManagementPlanService } from '../../services/data-management-plan/data-management-plan.service';
import { ProjectModel } from '../../models/projects/ProjectModel';
import { JsonSerializer } from '../../utilities/JsonSerializer';
import { FormGroup, AbstractControl, FormControl, FormArray } from '@angular/forms';
import { SnackBarNotificationComponent } from '../../shared/components/notificaiton/snack-bar-notification.component';
import { BaseErrorModel } from '../../models/error/BaseErrorModel';
import { TdDialogService } from '@covalent/core';
import { HostConfiguration } from '../../app.constants';
import { DataManagementPlanProfileService } from '../../services/data-management-plan-profile/datamanagement-profile.service';
import { DataManagementPlanProfileModel } from '../../models/data-management-plan-profile/DataManagementPlanProfileModel';
import { DMPProfileFieldDataType, DMPProfileType, DataManagementProfileField } from '../../models/data-management-plan-profile/DataManagementProfileField';
import { Utilities } from '../../utilities/utilities';
import { DataManagementPlanProfileListingModel } from '../../models/data-management-plan-profile/DataManagementPlanProfileListingModel';
@ -24,7 +24,7 @@ import { DataManagementPlanProfileListingModel } from "../../models/data-managem
selector: 'app-dmp-profile-editor-component',
templateUrl: 'dmp-profile-editor.component.html',
styleUrls: ['./dmp-profile-editor.component.scss'],
providers: [DataManagementPlanProfileService],
providers: [DataManagementPlanProfileService, Utilities],
encapsulation: ViewEncapsulation.None
})
export class DataManagementPlanProfileEditorComponent implements AfterViewInit {
@ -89,7 +89,7 @@ export class DataManagementPlanProfileEditorComponent implements AfterViewInit {
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
data: { message: this.isNew ? 'GENERAL.SNACK-BAR.SUCCESSFUL-CREATION' : 'GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE', language: this.language },
duration: 3000,
})
});
this.router.navigate(['/dmp-profiles']);
}
@ -101,7 +101,7 @@ export class DataManagementPlanProfileEditorComponent implements AfterViewInit {
public setErrorModel(errorModel: BaseErrorModel) {
Object.keys(errorModel).forEach(item => {
(<any>this.dataManagementPlanProfileModel.errorModel)[item] = (<any>errorModel)[item];
})
});
}
public cancel(): void {
@ -116,33 +116,31 @@ export class DataManagementPlanProfileEditorComponent implements AfterViewInit {
Object.keys(formControl.controls).forEach(item => {
const control = formControl.get(item);
this.touchAllFormFields(control);
})
}
else if (formControl instanceof FormArray) {
});
} else if (formControl instanceof FormArray) {
formControl.controls.forEach(item => {
this.touchAllFormFields(item);
})
});
}
}
public validateAllFormFields(formControl: AbstractControl) {
if (formControl instanceof FormControl) {
formControl.updateValueAndValidity({ emitEvent: false })
formControl.updateValueAndValidity({ emitEvent: false });
} else if (formControl instanceof FormGroup) {
Object.keys(formControl.controls).forEach(item => {
const control = formControl.get(item);
this.validateAllFormFields(control);
})
}
else if (formControl instanceof FormArray) {
});
} else if (formControl instanceof FormArray) {
formControl.controls.forEach(item => {
this.validateAllFormFields(item);
})
});
}
}
addField() {
(<FormArray>this.formGroup.get("definition").get("fields")).push(new DataManagementProfileField().buildForm())
(<FormArray>this.formGroup.get('definition').get('fields')).push(new DataManagementProfileField().buildForm());
}
getDMPProfileFieldDataTypeValues(): Number[] {

View File

@ -1,14 +1,14 @@
import { Component, ViewChild, OnInit } from "@angular/core";
import { MatPaginator, MatSort, PageEvent, MatSnackBar } from "@angular/material";
import { DataManagementPlanProfileCriteriaComponent } from "../../shared/components/criteria/datamanagementplanprofile/dmp-profile-criteria.component";
import { ActivatedRoute, Router, Params } from "@angular/router";
import { TranslateService } from "@ngx-translate/core";
import { DataSource } from "@angular/cdk/table";
import { DataManagementPlanProfileCriteria } from "../../models/criteria/dmp-profile/DataManagementPlanProfileCriteria";
import { Observable } from "rxjs";
import { DataTableRequest } from "../../models/data-table/DataTableRequest";
import { DataManagementPlanProfileListingModel } from "../../models/data-management-plan-profile/DataManagementPlanProfileListingModel";
import { DataManagementPlanProfileService } from "../../services/data-management-plan-profile/datamanagement-profile.service";
import { Component, ViewChild, OnInit } from '@angular/core';
import { MatPaginator, MatSort, PageEvent, MatSnackBar } from '@angular/material';
import { DataManagementPlanProfileCriteriaComponent } from '../../shared/components/criteria/datamanagementplanprofile/dmp-profile-criteria.component';
import { ActivatedRoute, Router, Params } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { DataSource } from '@angular/cdk/table';
import { DataManagementPlanProfileCriteria } from '../../models/criteria/dmp-profile/DataManagementPlanProfileCriteria';
import { Observable } from 'rxjs';
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
import { DataManagementPlanProfileListingModel } from '../../models/data-management-plan-profile/DataManagementPlanProfileListingModel';
import { DataManagementPlanProfileService } from '../../services/data-management-plan-profile/datamanagement-profile.service';
@Component({
selector: 'app-dmp-profile-listing-component',
@ -105,8 +105,8 @@ export class DatasetDataSource extends DataSource<DataManagementPlanProfileListi
this.isLoadingResults = true;
});
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
let fields: Array<string> = new Array()
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
let fields: Array<string> = new Array();
if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; }
const request = new DataTableRequest<DataManagementPlanProfileCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
request.criteria = this._criteria.criteria;
return this._service.getPaged(request);

View File

@ -8,7 +8,7 @@ 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 { SharedModule } from '../shared/shared.module';
import { DataManagementPlanProfileRoutes } from './dmp-profile.routes';
import { DataManagementPlanProfileEditorComponent } from './dmp-profile-editor/dmp-profile-editor.component';
import { DataManagementPlanProfileListingComponent } from './dmp-profile-listing/dmp-profile-listing.component';

View File

@ -15,10 +15,10 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { CovalentDialogsModule } from '@covalent/core';
import { SharedModule } from '../shared/shared.module'
import { SharedModule } from '../shared/shared.module';
import { NgModule } from '@angular/core';
import { AvailableProfilesComponent } from '../shared/components/available-profiles/available-profiles.component';
import { DynamicDmpFieldResolver } from './editor/dynamic-field-resolver/dynamic-dmp-field-resolver.component';
import { DynamicDmpFieldResolverComponent } from './editor/dynamic-field-resolver/dynamic-dmp-field-resolver.component';
import { DynamicFieldsProjectComponent } from './editor/dynamic-fields-project/dynamic-fields-project.component';
import { DynamicFieldProjectComponent } from './editor/dynamic-fields-project/dynamic-field-project/dynamic-field-project.component';
import { BaseHttpModule } from '../utilities/cite-http-service-module/cite-http.module';
@ -62,7 +62,7 @@ import { FlexLayoutModule } from '@angular/flex-layout';
DatasetWizardListingComponent,
AddResearchersComponent,
AvailableProfilesComponent,
DynamicDmpFieldResolver,
DynamicDmpFieldResolverComponent,
DynamicFieldsProjectComponent,
DynamicFieldProjectComponent
],

View File

@ -58,7 +58,7 @@ export const DataManagementPlanRoutes: Routes = [
},
},
{
path: "invitation/:id",
path: 'invitation/:id',
component: InvitationAcceptedComponent,
data: {
breadcrumb: true

View File

@ -14,15 +14,19 @@
</div> -->
<div>
<button mat-button type="button" (click)="redirectToDatasets()">
<mat-icon>arrow_right_alt</mat-icon>{{'DMP-EDITOR.ACTIONS.GO-TO-DATASETS' | translate}}</button>
<mat-icon>arrow_right_alt</mat-icon>{{'DMP-EDITOR.ACTIONS.GO-TO-DATASETS' | translate}}
</button>
</div>
<mat-menu #actionsMenu="matMenu">
<button mat-menu-item (click)="newVersion(this.dataManagementPlan.id, this.dataManagementPlan.label)">
<mat-icon>queue</mat-icon>{{'DMP-LISTING.ACTIONS.NEW-VERSION' | translate}}</button>
<mat-icon>queue</mat-icon>{{'DMP-LISTING.ACTIONS.NEW-VERSION' | translate}}
</button>
<button mat-menu-item (click)="clone(this.dataManagementPlan.id)">
<mat-icon>filter_none</mat-icon>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</button>
<mat-icon>filter_none</mat-icon>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}
</button>
<button mat-menu-item (click)="viewVersions(this.dataManagementPlan.groupId, this.dataManagementPlan.label)">
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}</button>
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
</button>
</mat-menu>
<div>
<button mat-icon-button type="button" [matMenuTriggerFor]="actionsMenu">
@ -34,14 +38,15 @@
<mat-card-content>
<div class="row">
<mat-form-field class="col-md-12">
<input matInput placeholder="{{'DMP-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label" required>
<input matInput placeholder="{{'DMP-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label"
required>
<mat-error *ngIf="formGroup.get('label').errors?.backendError">{{baseErrorModel.label}}</mat-error>
<mat-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<mat-form-field class="col-md-12">
<textarea matInput class="description-area" placeholder="{{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}}" formControlName="description"
required></textarea>
<textarea matInput class="description-area" placeholder="{{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}}"
formControlName="description" required></textarea>
<mat-error *ngIf="formGroup.get('description').errors?.backendError">{{errorModel.description}}</mat-error>
<mat-error *ngIf="formGroup.get('description').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
@ -54,8 +59,8 @@
<!-- <app-dynamic-fields-project [formGroup]="formGroup"></app-dynamic-fields-project> -->
<div class="col-md-6">
<div class="row">
<app-multiple-auto-complete required='true' class="col-md-10" [reactiveFormControl]="formGroup.get('profiles')" placeholder="{{'DMP-EDITOR.FIELDS.PROFILES' | translate}}"
[configuration]="profilesAutoCompleteConfiguration">
<app-multiple-auto-complete required='true' class="col-md-10" [reactiveFormControl]="formGroup.get('profiles')"
placeholder="{{'DMP-EDITOR.FIELDS.PROFILES' | translate}}" [configuration]="profilesAutoCompleteConfiguration">
</app-multiple-auto-complete>
<div class="col-md-2">
<button mat-icon-button type="button" (click)="availableProfiles()">
@ -90,14 +95,16 @@
<h3 mat-subheader class="col-md-12">{{'DMP-EDITOR.FIELDS.PROFILE' | translate}}</h3>
<mat-form-field class="col-md-6">
<input type="text" placeholder="{{'DMP-EDITOR.FIELDS.PROFILE' | translate}}" [formControl]="textCtrl" matInput [matAutocomplete]="auto">
<input type="text" placeholder="{{'DMP-EDITOR.FIELDS.PROFILE' | translate}}" [formControl]="textCtrl" matInput
[matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete" [displayWith]="displayWith">
<mat-option *ngFor="let option of filteredOptions | async" [value]="option" (click)="selectOption(option)">
{{ option.label }}
</mat-option>
</mat-autocomplete>
</mat-form-field>
<app-dynamic-dmp-field-resolver class="col-md-12" *ngIf="dataManagementPlan.definition" [formGroup]="formGroup" [dataManagementPlanProfile]="dataManagementPlan.definition"></app-dynamic-dmp-field-resolver>
<app-dynamic-dmp-field-resolver class="col-md-12" *ngIf="dataManagementPlan.definition" [formGroup]="formGroup"
[dataManagementPlanProfile]="dataManagementPlan.definition"></app-dynamic-dmp-field-resolver>
<mat-form-field class="col-md-6">
<input matInput placeholder="Version" disabled [value]="formGroup.get('version').value== undefined ?0 :formGroup.get('version').value">
@ -115,10 +122,12 @@
<div class="col-md-12">
<div class="right-button">
<button mat-raised-button color="primary" (click)="cancel()" type="button">{{'DMP-EDITOR.ACTIONS.CANCEL' | translate}}</button>
<button mat-raised-button color="primary" (click)="cancel()" type="button">{{'DMP-EDITOR.ACTIONS.CANCEL' |
translate}}</button>
<!-- <button *ngIf="!isNew" mat-raised-button color="primary" (click)="invite()" type="button">{{'DMP-EDITOR.ACTIONS.INVITE' | translate}}</button> -->
<button mat-raised-button color="primary" type="submit">{{'DMP-EDITOR.ACTIONS.SAVE' | translate}}</button>
<button *ngIf="!isNew" mat-raised-button color="primary" type="button" (click)="openConfirm(formGroup.get('label').value, formGroup.get('id').value)">{{'DMP-EDITOR.ACTIONS.DELETE' | translate}}</button>
<button *ngIf="!isNew" mat-raised-button color="primary" type="button" (click)="openConfirm(formGroup.get('label').value, formGroup.get('id').value)">{{'DMP-EDITOR.ACTIONS.DELETE'
| translate}}</button>
</div>
</div>
</div>

View File

@ -1,38 +1,38 @@
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation } from "@angular/core";
import { MatPaginator, MatSort, MatSnackBar, MatDialog, MatChipList, MatChip } from "@angular/material";
import { Router, ActivatedRoute, Params } from "@angular/router";
import { TranslateService } from "@ngx-translate/core";
import { DataSource } from "@angular/cdk/table";
import { Observable } from "rxjs/Observable";
import { JsonSerializer } from "../../utilities/JsonSerializer";
import { FormGroup, FormControl } from "@angular/forms";
import { SnackBarNotificationComponent } from "../../shared/components/notificaiton/snack-bar-notification.component";
import { BaseErrorModel } from "../../models/error/BaseErrorModel";
import { DataManagementPlanService } from "../../services/data-management-plan/data-management-plan.service";
import { DataManagementPlanModel } from "../../models/data-managemnt-plans/DataManagementPlanModel";
import { ExternalSourcesService } from "../../services/external-sources/external-sources.service";
import { ExternalSourcesItemModel } from "../../models/external-sources/ExternalSourcesItemModel";
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 { DatasetProfileModel } from "../../models/datasets/DatasetProfileModel";
import { ProjectCriteria } from "../../models/criteria/project/ProjectCriteria";
import { ProjectService } from "../../services/project/project.service";
import { DmpUsersModel } from "../../models/dmpUsers/DmpUsersModel";
import { AddResearchersComponent } from "../../shared/components/add-researchers/add-researchers.component";
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation } from '@angular/core';
import { MatPaginator, MatSort, MatSnackBar, MatDialog, MatChipList, MatChip } from '@angular/material';
import { Router, ActivatedRoute, Params } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { DataSource } from '@angular/cdk/table';
import { Observable } from 'rxjs/Observable';
import { JsonSerializer } from '../../utilities/JsonSerializer';
import { FormGroup, FormControl } from '@angular/forms';
import { SnackBarNotificationComponent } from '../../shared/components/notificaiton/snack-bar-notification.component';
import { BaseErrorModel } from '../../models/error/BaseErrorModel';
import { DataManagementPlanService } from '../../services/data-management-plan/data-management-plan.service';
import { DataManagementPlanModel } from '../../models/data-managemnt-plans/DataManagementPlanModel';
import { ExternalSourcesService } from '../../services/external-sources/external-sources.service';
import { ExternalSourcesItemModel } from '../../models/external-sources/ExternalSourcesItemModel';
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 { DatasetProfileModel } from '../../models/datasets/DatasetProfileModel';
import { ProjectCriteria } from '../../models/criteria/project/ProjectCriteria';
import { ProjectService } from '../../services/project/project.service';
import { DmpUsersModel } from '../../models/dmpUsers/DmpUsersModel';
import { AddResearchersComponent } from '../../shared/components/add-researchers/add-researchers.component';
import { ViewContainerRef } from '@angular/core';
import { TdDialogService } from '@covalent/core';
import { AvailableProfilesComponent } from "../../shared/components/available-profiles/available-profiles.component";
import { BaseCriteria } from "../../models/criteria/BaseCriteria";
import { DataManagementPlanProfileService } from "../../services/data-management-plan-profile/datamanagement-profile.service";
import { DataManagementPlanProfileListingModel } from "../../models/data-management-plan-profile/DataManagementPlanProfileListingModel";
import { DataManagementPlanProfileCriteria } from "../../models/criteria/dmp-profile/DataManagementPlanProfileCriteria";
import { DataManagementPlanProfile } from "../../models/data-management-plan-profile/DataManagementPlanProfile";
import { LanguageResolverService } from "../../services/language-resolver/language-resolver.service";
import { IBreadCrumbComponent } from "../../shared/components/breadcrumb/definition/IBreadCrumbComponent";
import { BreadcrumbItem } from "../../shared/components/breadcrumb/definition/breadcrumb-item";
import { SingleAutoCompleteConfiguration } from "../../shared/components/autocompletes/single/single-auto-complete-configuration";
import { MultipleAutoCompleteConfiguration } from "../../shared/components/autocompletes/multiple/multiple-auto-complete-configuration";
import { AvailableProfilesComponent } from '../../shared/components/available-profiles/available-profiles.component';
import { BaseCriteria } from '../../models/criteria/BaseCriteria';
import { DataManagementPlanProfileService } from '../../services/data-management-plan-profile/datamanagement-profile.service';
import { DataManagementPlanProfileListingModel } from '../../models/data-management-plan-profile/DataManagementPlanProfileListingModel';
import { DataManagementPlanProfileCriteria } from '../../models/criteria/dmp-profile/DataManagementPlanProfileCriteria';
import { DataManagementPlanProfile } from '../../models/data-management-plan-profile/DataManagementPlanProfile';
import { LanguageResolverService } from '../../services/language-resolver/language-resolver.service';
import { IBreadCrumbComponent } from '../../shared/components/breadcrumb/definition/IBreadCrumbComponent';
import { BreadcrumbItem } from '../../shared/components/breadcrumb/definition/breadcrumb-item';
import { SingleAutoCompleteConfiguration } from '../../shared/components/autocompletes/single/single-auto-complete-configuration';
import { MultipleAutoCompleteConfiguration } from '../../shared/components/autocompletes/multiple/multiple-auto-complete-configuration';
@Component({
selector: 'app-dmp-editor-component',
@ -49,9 +49,9 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
dataManagementPlan: DataManagementPlanModel;
formGroup: FormGroup = null;
filteringOrganisationsAsync: boolean = false;
filteringResearchersAsync: boolean = false;
filteredProfilesAsync: boolean = false;
filteringOrganisationsAsync = false;
filteringResearchersAsync = false;
filteredProfilesAsync = false;
filteredOrganisations: ExternalSourcesItemModel[];
filteredResearchers: ExternalSourcesItemModel[];
filteredProfiles: DatasetProfileModel[];
@ -62,8 +62,8 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
researchersAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
createNewVersion;
associatedUsers: Array<DmpUsersModel>
filteredOptions: Observable<DataManagementPlanProfileListingModel>
associatedUsers: Array<DmpUsersModel>;
filteredOptions: Observable<DataManagementPlanProfileListingModel>;
constructor(
private dmpProfileService: DataManagementPlanProfileService,
@ -87,9 +87,9 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
this.route.params.subscribe((params: Params) => {
const itemId = params['id'];
let projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
projectRequestItem.criteria = new ProjectCriteria();
let organisationRequestItem: RequestItem<BaseCriteria> = new RequestItem();
const organisationRequestItem: RequestItem<BaseCriteria> = new RequestItem();
organisationRequestItem.criteria = new BaseCriteria();
//this.projectAutoCompleteConfiguration = new AutoCompleteConfiguration(this.projectService.getWithExternal.bind(this.projectService), projectRequestItem);
@ -97,34 +97,34 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
this.projectAutoCompleteConfiguration = {
filterFn: this.searchProject.bind(this),
items: this.searchProject(''),
displayFn: (item) => item["label"],
titleFn: (item) => item["label"],
displayFn: (item) => item['label'],
titleFn: (item) => item['label'],
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
loadDataOnStart: true
};
this.profilesAutoCompleteConfiguration = {
filterFn: this.filterProfiles.bind(this),
initialItems: (excludedItems: any[]) => this.filterProfiles('').map(result => result.filter(x => excludedItems.map(x => x.id).indexOf(x.id) == -1)),
displayFn: (item) => item["label"],
titleFn: (item) => item["label"],
initialItems: (excludedItems: any[]) => this.filterProfiles('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
displayFn: (item) => item['label'],
titleFn: (item) => item['label'],
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
loadDataOnStart: true
};
this.organisationsAutoCompleteConfiguration = {
filterFn: this.filterOrganisations.bind(this),
initialItems: (excludedItems: any[]) => this.filterOrganisations('').map(result => result.filter(x => excludedItems.map(x => x.id).indexOf(x.id) == -1)),
displayFn: (item) => item["name"],
titleFn: (item) => item["name"],
initialItems: (excludedItems: any[]) => this.filterOrganisations('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
displayFn: (item) => item['name'],
titleFn: (item) => item['name'],
loadDataOnStart: true
};
this.researchersAutoCompleteConfiguration = {
filterFn: this.filterResearchers.bind(this),
initialItems: (excludedItems: any[]) => this.filterResearchers('').map(result => result.filter(x => excludedItems.map(x => x.id).indexOf(x.id) == -1)),
displayFn: (item) => item["name"],
titleFn: (item) => item["name"],
initialItems: (excludedItems: any[]) => this.filterResearchers('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
displayFn: (item) => item['name'],
titleFn: (item) => item['name'],
loadDataOnStart: true
};
@ -134,34 +134,34 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
.subscribe(async data => {
this.dataManagementPlan = JsonSerializer.fromJSONObject(data, DataManagementPlanModel);
this.formGroup = this.dataManagementPlan.buildForm();
if (this.formGroup.get("profile") && this.formGroup.get("profile").value) {
this.textCtrl.patchValue(this.formGroup.get("profile").value);
if (this.formGroup.get('profile') && this.formGroup.get('profile').value) {
this.textCtrl.patchValue(this.formGroup.get('profile').value);
}
this.breadCrumbs = Observable.of([
{
parentComponentName: "DataManagementPlanListingComponent",
parentComponentName: 'DataManagementPlanListingComponent',
label: 'DMPs',
url: "dmps",
url: 'dmps',
notFoundResolver: [await this.projectService.getSingle(this.dataManagementPlan.project.id).map(x => ({ label: x.label, url: '/projects/edit/' + x.id }) as BreadcrumbItem).toPromise()]
}
]
)
);
this.associatedUsers = data.associatedUsers;
});
} else {
this.dataManagementPlan = new DataManagementPlanModel();
setTimeout(async () => {
this.formGroup = this.dataManagementPlan.buildForm();
if (this.formGroup.get("profile") && this.formGroup.get("profile").value) {
this.textCtrl.patchValue(this.formGroup.get("profile").value);
if (this.formGroup.get('profile') && this.formGroup.get('profile').value) {
this.textCtrl.patchValue(this.formGroup.get('profile').value);
}
this.breadCrumbs = Observable.of([
{
parentComponentName: "DataManagementPlanListingComponent",
parentComponentName: 'DataManagementPlanListingComponent',
label: 'DMPs',
url: "dmps",
url: 'dmps',
}
])
]);
});
}
@ -169,12 +169,12 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
this.route
.queryParams
.subscribe(params => {
this.createNewVersion = params["clone"];
this.createNewVersion = params['clone'];
});
}
searchProject(query: string) {
let projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
projectRequestItem.criteria = new ProjectCriteria();
projectRequestItem.criteria.like = query;
return this.projectService.getWithExternal(projectRequestItem);
@ -194,14 +194,14 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
this.dataManagementPlanService.createDataManagementPlan(this.formGroup.value).subscribe(
complete => this.onCallbackSuccess(),
error => this.onCallbackError(error)
)
);
}
onCallbackSuccess(): void {
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
data: { message: this.isNew ? 'GENERAL.SNACK-BAR.SUCCESSFUL-CREATION' : 'GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE', language: this.language },
duration: 3000,
})
});
this.router.navigate(['/dmps']);
}
@ -213,7 +213,7 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
public setErrorModel(errorModel: BaseErrorModel) {
Object.keys(errorModel).forEach(item => {
(<any>this.dataManagementPlan.errorModel)[item] = (<any>errorModel)[item];
})
});
}
public cancel(): void {
@ -229,7 +229,7 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
this.filteredOrganisations = undefined;
this.filteringOrganisationsAsync = true;
return this.externalSourcesService.searchDMPOrganizations(value)
return this.externalSourcesService.searchDMPOrganizations(value);
}
filterResearchers(value: string): Observable<ExternalSourcesItemModel[]> {
@ -237,7 +237,7 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
this.filteredResearchers = undefined;
this.filteringResearchersAsync = true;
return this.externalSourcesService.searchDMPResearchers({ criteria: { name: value, like: null } })
return this.externalSourcesService.searchDMPResearchers({ criteria: { name: value, like: null } });
}
filterProfiles(value: string): Observable<DatasetProfileModel[]> {
@ -246,14 +246,14 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
this.filteredProfilesAsync = true;
const request = new RequestItem<DatasetProfileCriteria>();
let criteria = new DatasetProfileCriteria();
const criteria = new DatasetProfileCriteria();
criteria.like = value;
request.criteria = criteria;
return this._service.searchDMPProfiles(request)
return this._service.searchDMPProfiles(request);
}
addResearcher(rowId: any, rowName: any) {
let dialogRef = this.dialog.open(AddResearchersComponent, {
const dialogRef = this.dialog.open(AddResearchersComponent, {
height: '255px',
width: '700px',
data: {
@ -265,11 +265,11 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
}
availableProfiles() {
let dialogRef = this.dialog.open(AvailableProfilesComponent, {
const dialogRef = this.dialog.open(AvailableProfilesComponent, {
height: '355px',
width: '700px',
data: {
profiles: this.formGroup.get("profiles")
profiles: this.formGroup.get('profiles')
}
});
@ -288,7 +288,7 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
}).afterClosed().subscribe((accept: boolean) => {
if (accept) {
this.dataManagementPlanService.delete(id).subscribe(() => {
this.router.navigate(['/dmps'])
this.router.navigate(['/dmps']);
});
} else {
// DO SOMETHING ELSE
@ -299,23 +299,23 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
selectOption(option: any) {
this.dataManagementPlan.definition = null;
this.formGroup.get("profile").patchValue(option, { emitEvent: false })
this.formGroup.get('profile').patchValue(option, { emitEvent: false });
this.dmpProfileService.getSingle(option.id).subscribe(result => {
this.dataManagementPlan.definition = result.definition;
})
});
}
displayWith(item: any) {
if (!item) return null;
return item["label"];
if (!item) { return null; }
return item['label'];
}
redirectToProject() {
this.router.navigate(["projects/edit/" + this.dataManagementPlan.project.id])
this.router.navigate(['projects/edit/' + this.dataManagementPlan.project.id]);
}
redirectToDatasets() {
this.router.navigate(["datasets/dmp/" + this.dataManagementPlan.id])
this.router.navigate(['datasets/dmp/' + this.dataManagementPlan.id]);
}
newVersion(id: String, label: String) {

View File

@ -1,8 +1,8 @@
import { Component, ViewEncapsulation, AfterViewInit, Input, OnInit, OnDestroy } from "@angular/core";
import { DataManagementPlanProfile } from "../../../models/data-management-plan-profile/DataManagementPlanProfile";
import { DMPProfileFieldDataType, DMPProfileType } from "../../../models/data-management-plan-profile/DataManagementProfileField";
import { FormGroup, FormBuilder, FormArray } from "@angular/forms";
import { LanguageResolverService } from "../../../services/language-resolver/language-resolver.service";
import { Component, ViewEncapsulation, AfterViewInit, Input, OnInit, OnDestroy } from '@angular/core';
import { DataManagementPlanProfile } from '../../../models/data-management-plan-profile/DataManagementPlanProfile';
import { DMPProfileFieldDataType, DMPProfileType } from '../../../models/data-management-plan-profile/DataManagementProfileField';
import { FormGroup, FormBuilder, FormArray } from '@angular/forms';
import { LanguageResolverService } from '../../../services/language-resolver/language-resolver.service';
@Component({
selector: 'app-dynamic-dmp-field-resolver',
@ -10,7 +10,7 @@ import { LanguageResolverService } from "../../../services/language-resolver/lan
styleUrls: ['./dynamic-dmp-field-resolver.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class DynamicDmpFieldResolver implements OnInit, OnDestroy {
export class DynamicDmpFieldResolverComponent implements OnInit, OnDestroy {
DMPProfileFieldDataType = DMPProfileFieldDataType;
@ -20,21 +20,21 @@ export class DynamicDmpFieldResolver implements OnInit, OnDestroy {
dataManagementPlanProfile: DataManagementPlanProfile;
@Input()
formGroup: FormGroup
formGroup: FormGroup;
ngOnInit(): void {
this.formGroup.addControl("properties", new FormBuilder().group([]));
(<FormGroup>this.formGroup.get("properties")).addControl("fields", new FormBuilder().array([]))
this.formGroup.addControl('properties', new FormBuilder().group([]));
(<FormGroup>this.formGroup.get('properties')).addControl('fields', new FormBuilder().array([]));
this.dataManagementPlanProfile.fields.forEach(item => {
(<FormArray>this.formGroup.get("properties").get("fields")).push(new FormBuilder().group({
(<FormArray>this.formGroup.get('properties').get('fields')).push(new FormBuilder().group({
id: [item.id],
value: [item.value]
}))
})
}));
});
}
ngOnDestroy(): void {
this.formGroup.removeControl("properties")
this.formGroup.removeControl('properties');
}
}

View File

@ -1,12 +1,12 @@
import { Component, ViewEncapsulation, OnInit, Input, ViewChild } from "@angular/core";
import { FormGroup } from "@angular/forms";
import { DataManagementPlanService } from "../../../../services/data-management-plan/data-management-plan.service";
import { RequestItem } from "../../../../models/criteria/RequestItem";
import { DynamicFieldProjectCriteria, DynamicFieldProjectCriteriaDependencies } from "../../../../models/dynamic-field-project/DynamicFieldProjectCriteria";
import { AutoCompleteComponent } from "../../../../shared/components/auto-complete/auto-complete.component";
import { DynamicFieldDependency } from "../../../../models/data-managemnt-plans/DynamicFieldDependency";
import { LanguageResolverService } from "../../../../services/language-resolver/language-resolver.service";
import { AutoCompleteConfiguration } from "../../../../shared/components/auto-complete/AutoCompleteConfiguration";
import { Component, ViewEncapsulation, OnInit, Input, ViewChild } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { DataManagementPlanService } from '../../../../services/data-management-plan/data-management-plan.service';
import { RequestItem } from '../../../../models/criteria/RequestItem';
import { DynamicFieldProjectCriteria, DynamicFieldProjectCriteriaDependencies } from '../../../../models/dynamic-field-project/DynamicFieldProjectCriteria';
import { AutoCompleteComponent } from '../../../../shared/components/auto-complete/auto-complete.component';
import { DynamicFieldDependency } from '../../../../models/data-managemnt-plans/DynamicFieldDependency';
import { LanguageResolverService } from '../../../../services/language-resolver/language-resolver.service';
import { AutoCompleteConfiguration } from '../../../../shared/components/auto-complete/AutoCompleteConfiguration';
@Component({
selector: 'app-dynamic-field-project',
@ -19,66 +19,66 @@ export class DynamicFieldProjectComponent implements OnInit {
constructor(private languageResolverService: LanguageResolverService, private dmpService: DataManagementPlanService) { }
@Input()
dependencies: Array<FormGroup>
dependencies: Array<FormGroup>;
@Input()
formGroup: FormGroup;
@ViewChild(AutoCompleteComponent)
autocomplete: AutoCompleteComponent
autocomplete: AutoCompleteComponent;
autoCompleteConfiguration: AutoCompleteConfiguration
autoCompleteConfiguration: AutoCompleteConfiguration;
ngOnInit(): void {
let requestItem = new RequestItem<DynamicFieldProjectCriteria>()
requestItem.criteria = { id: this.formGroup.get("id").value, dynamicFields: this.buildDependencies() }
const requestItem = new RequestItem<DynamicFieldProjectCriteria>();
requestItem.criteria = { id: this.formGroup.get('id').value, dynamicFields: this.buildDependencies() };
this.autoCompleteConfiguration = new AutoCompleteConfiguration(this.dmpService.getDynamicField.bind(this.dmpService), requestItem);
}
hasUnResolvedDependencies() {
if (this.dependencies == null || this.dependencies.length == 0) {
if (this.formGroup.get("value").disabled) {
if (this.dependencies == null || this.dependencies.length === 0) {
if (this.formGroup.get('value').disabled) {
this.updateConfiguration();
this.formGroup.get("value").enable({ onlySelf: true, emitEvent: false })
this.formGroup.get('value').enable({ onlySelf: true, emitEvent: false });
}
return false;
}
for (let i = 0; i < this.dependencies.length; i++) {
if (!this.dependencies[i].get("value").value) {
this.formGroup.get("value").disable({ onlySelf: true, emitEvent: false })
if (!this.dependencies[i].get('value').value) {
this.formGroup.get('value').disable({ onlySelf: true, emitEvent: false });
return true;
}
}
if (this.formGroup.get("value").disabled) {
if (this.formGroup.get('value').disabled) {
this.updateConfiguration();
this.formGroup.get("value").enable({ onlySelf: true, emitEvent: false })
this.formGroup.get('value').enable({ onlySelf: true, emitEvent: false });
}
return false;
}
updateConfiguration() {
let requestItem = new RequestItem<DynamicFieldProjectCriteria>()
requestItem.criteria = { id: this.formGroup.get("id").value, dynamicFields: this.buildDependencies() }
const requestItem = new RequestItem<DynamicFieldProjectCriteria>();
requestItem.criteria = { id: this.formGroup.get('id').value, dynamicFields: this.buildDependencies() };
this.autoCompleteConfiguration = new AutoCompleteConfiguration(this.dmpService.getDynamicField.bind(this.dmpService), requestItem);
this.autocomplete.inputData = this.autoCompleteConfiguration;
}
buildDependencies(): Array<DynamicFieldProjectCriteriaDependencies> {
if (!this.dependencies || this.dependencies.length == 0) return []
let dependencies = new Array<DynamicFieldProjectCriteriaDependencies>();
if (!this.dependencies || this.dependencies.length === 0) { return []; }
const dependencies = new Array<DynamicFieldProjectCriteriaDependencies>();
for (let i = 0; i < this.dependencies.length; i++) {
dependencies.push({ property: this.dependencies[i].get("id").value, value: this.assignFunction(this.dependencies[i].get("value").value) })
dependencies.push({ property: this.dependencies[i].get('id').value, value: this.assignFunction(this.dependencies[i].get('value').value) });
}
return dependencies;
}
displayFunction(item: any): any {
if (!item) return null;
return item["label"];
if (!item) { return null; }
return item['label'];
}
assignFunction(item: any): any {
if (!item) return null;
return item["id"];
if (!item) { return null; }
return item['id'];
}
}

View File

@ -1,6 +1,6 @@
import { Component, ViewEncapsulation, OnInit, OnDestroy, Input } from "@angular/core";
import { FormGroup, FormArray } from "@angular/forms";
import { DynamicFieldDependency } from "../../../models/data-managemnt-plans/DynamicFieldDependency";
import { Component, ViewEncapsulation, OnInit, OnDestroy, Input } from '@angular/core';
import { FormGroup, FormArray } from '@angular/forms';
import { DynamicFieldDependency } from '../../../models/data-managemnt-plans/DynamicFieldDependency';
@Component({
selector: 'app-dynamic-fields-project',
@ -17,16 +17,16 @@ export class DynamicFieldsProjectComponent implements OnInit {
}
findDependencies(id: number) {
let formGroupDependencies: Array<FormGroup> = new Array<FormGroup>();
let dynamicFieldDependency: DynamicFieldDependency[] = (<FormArray>this.formGroup.get("dynamicFields")).at(id).get("dependencies").value
const formGroupDependencies: Array<FormGroup> = new Array<FormGroup>();
const dynamicFieldDependency: DynamicFieldDependency[] = (<FormArray>this.formGroup.get('dynamicFields')).at(id).get('dependencies').value;
if (dynamicFieldDependency.length > 0) {
dynamicFieldDependency.forEach(item => {
let length = (<FormArray>this.formGroup.get("dynamicFields")).length;
const length = (<FormArray>this.formGroup.get('dynamicFields')).length;
for (let i = 0; i < length; i++) {
let formGroup = (<FormArray>this.formGroup.get("dynamicFields")).at(i);
if (formGroup.get("id").value === item.id) formGroupDependencies.push(<FormGroup>formGroup);
const formGroup = (<FormArray>this.formGroup.get('dynamicFields')).at(i);
if (formGroup.get('id').value === item.id) { formGroupDependencies.push(<FormGroup>formGroup); }
}
})
});
}
return formGroupDependencies;
}

View File

@ -6,12 +6,12 @@ import {
DataManagementPlanCriteriaComponent,
} from '../../shared/components/criteria/data-management-plan/dmp-criteria.component';
import { DataManagementPlanService } from '../../services/data-management-plan/data-management-plan.service';
import { Component, ViewChild, OnInit, AfterViewInit } from "@angular/core";
import { MatPaginator, MatSort, MatSnackBar, MatDialog } from "@angular/material";
import { Router, ActivatedRoute, ActivatedRouteSnapshot } from "@angular/router";
import { TranslateService } from "@ngx-translate/core";
import { DataSource } from "@angular/cdk/table";
import { Observable } from "rxjs/Observable";
import { Component, ViewChild, OnInit, AfterViewInit } from '@angular/core';
import { MatPaginator, MatSort, MatSnackBar, MatDialog } from '@angular/material';
import { Router, ActivatedRoute, ActivatedRouteSnapshot } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { DataSource } from '@angular/cdk/table';
import { Observable } from 'rxjs/Observable';
import { DataManagementPlanRoutes } from '../../dmps/dmps.routes';
import { DatasetRoutes } from '../../datasets/dataset.routes';
import { ProjectModel } from '../../models/projects/ProjectModel';
@ -55,39 +55,41 @@ export class DataManagementPlanListingComponent implements OnInit, IBreadCrumbCo
ngOnInit() {
this.route.params.subscribe(async params => {
let projectLabel;
if (params["projectId"]) {
this.projectId = params["projectId"];
if (params['projectId']) {
this.projectId = params['projectId'];
this.showProject = false;
let project = new ProjectModel();
const project = new ProjectModel();
project.id = this.projectId;
this.criteria.setCriteria({ like: null, projects: [project], groupIds: null, allVersions: false })
this.criteria.setCriteria({ like: null, projects: [project], groupIds: null, allVersions: false });
this.refresh();
projectLabel = this.route.snapshot.queryParams.projectLabel
this.breadCrumbs = Observable.of([{ parentComponentName: "ProjectEditorComponent", label: projectLabel, url: "/projects/edit/" + this.projectId }])
projectLabel = this.route.snapshot.queryParams.projectLabel;
this.breadCrumbs = Observable.of([{ parentComponentName: 'ProjectEditorComponent', label: projectLabel, url: '/projects/edit/' + this.projectId }]);
this.criteria.setRefreshCallback(() => this.refresh());
} else {
this.itemId = params['groupId'];
this.showProject = true;
let breadCrumbs = [];
const breadCrumbs = [];
if (this.itemId) {
let dmplabel = this.route.snapshot.queryParams.groupLabel
const dmplabel = this.route.snapshot.queryParams.groupLabel;
breadCrumbs.push(
{ parentComponentName: null, label: 'DMPs', url: "/dmps" },
)
{ parentComponentName: null, label: 'DMPs', url: '/dmps' },
);
}
//else breadCrumbs.push({ parentComponentName: null, label: 'DMPs', url: "/dmps" })
this.breadCrumbs = Observable.of(breadCrumbs)
this.breadCrumbs = Observable.of(breadCrumbs);
this.criteria.setCriteria(this.getDefaultCriteria());
this.refresh();
this.criteria.setRefreshCallback(() => this.refresh());
}
if (this.projectId != null)
if (projectLabel != undefined)
this.titlePrefix = "for " + projectLabel;
})
if (this.projectId != null) {
if (projectLabel !== undefined) {
this.titlePrefix = 'for ' + projectLabel;
}
}
});
}
@ -117,7 +119,7 @@ export class DataManagementPlanListingComponent implements OnInit, IBreadCrumbCo
}
openShareDialog(rowId: any, rowName: any) {
let dialogRef = this.dialog.open(InvitationComponent, {
const dialogRef = this.dialog.open(InvitationComponent, {
height: '200px',
width: '700px',
data: {
@ -156,8 +158,8 @@ export class DataManagementPlanDataSource extends DataSource<DataManagementPlanL
this.isLoadingResults = true;
});
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
let fields: Array<string> = new Array()
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
let fields: Array<string> = new Array();
if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; }
const request = new DataTableRequest<DataManagementPlanCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
request.criteria = this._criteria.formGroup.value;
if (this.itemId) {
@ -175,7 +177,7 @@ export class DataManagementPlanDataSource extends DataSource<DataManagementPlanL
return Observable.of(null);
})*/
.map(result => {
result.data = JsonSerializer.fromJSONArray(result.data, DataManagementPlanListingModel)
result.data = JsonSerializer.fromJSONArray(result.data, DataManagementPlanListingModel);
return result;
})
.map(result => {
@ -188,11 +190,11 @@ export class DataManagementPlanDataSource extends DataSource<DataManagementPlanL
if (!result) { return []; }
if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; }
return result.data.map(item => {
item["datasets"].map(dmp => {
dmp.url = "datasets/edit/" + dmp.url;
dmp.all = "datasets/dmp/" + item.id
item['datasets'].map(dmp => {
dmp.url = 'datasets/edit/' + dmp.url;
dmp.all = 'datasets/dmp/' + item.id;
return dmp;
})
});
return item;
});
});

View File

@ -26,10 +26,10 @@ export class DataManagementPlanWizardComponent implements OnInit, IBreadCrumbCom
private router: Router
) { }
public itemId: string
public itemId: string;
public dataManagementPlan: DataManagementPlanModel;
public formGroup: FormGroup
public isClone: boolean
public formGroup: FormGroup;
public isClone: boolean;
ngOnInit(): void {
@ -39,11 +39,10 @@ export class DataManagementPlanWizardComponent implements OnInit, IBreadCrumbCom
.subscribe(data => {
this.dataManagementPlan = JsonSerializer.fromJSONObject(data, DataManagementPlanModel);
this.isClone = this.route.snapshot.data.clone;
if (this.isClone == false) this.dataManagementPlan.version = this.dataManagementPlan.version + 1;
if (this.isClone === false) { this.dataManagementPlan.version = this.dataManagementPlan.version + 1; }
this.formGroup = this.dataManagementPlan.buildForm();
});
})
});
}
@ -65,7 +64,7 @@ export class DataManagementPlanWizardComponent implements OnInit, IBreadCrumbCom
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
data: { message: 'GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE', language: this.language },
duration: 3000,
})
});
this.router.navigate(['/dmps']);
}
@ -77,7 +76,7 @@ export class DataManagementPlanWizardComponent implements OnInit, IBreadCrumbCom
public setErrorModel(errorModel: BaseErrorModel) {
Object.keys(errorModel).forEach(item => {
// (<any>this.dataManagementPlan.errorModel)[item] = (<any>errorModel)[item];
})
});
}

View File

@ -3,15 +3,15 @@
<mat-card>
<mat-card-content>
<mat-form-field class="full-width">
<input matInput placeholder="{{'DMP-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label" required
[attr.disabled]="labelDisabled">
<input matInput placeholder="{{'DMP-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label"
required [attr.disabled]="labelDisabled">
<mat-error *ngIf="formGroup.get('label').errors?.backendError">{{baseErrorModel.label}}</mat-error>
<mat-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<mat-form-field class="full-width">
<textarea matInput class="description-area" placeholder="{{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}}" formControlName="description"
required></textarea>
<textarea matInput class="description-area" placeholder="{{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}}"
formControlName="description" required></textarea>
<mat-error *ngIf="formGroup.get('description').errors?.backendError">{{errorModel.description}}</mat-error>
<mat-error *ngIf="formGroup.get('description').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>

View File

@ -11,12 +11,12 @@ import { DataManagementPlanModel } from '../../../models/data-managemnt-plans/Da
import { ProjectService } from '../../../services/project/project.service';
import { ExternalSourcesService } from '../../../services/external-sources/external-sources.service';
import { DataManagementPlanService } from '../../../services/data-management-plan/data-management-plan.service';
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation, Input } from "@angular/core";
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
import { Router, ActivatedRoute, Params } from "@angular/router";
import { TranslateService } from "@ngx-translate/core";
import { DataSource } from "@angular/cdk/table";
import { Observable } from "rxjs/Observable";
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation, Input } from '@angular/core';
import { MatPaginator, MatSort, MatSnackBar } from '@angular/material';
import { Router, ActivatedRoute, Params } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { DataSource } from '@angular/cdk/table';
import { Observable } from 'rxjs/Observable';
import { FormGroup } from '@angular/forms';
import { BaseCriteria } from '../../../models/criteria/BaseCriteria';
import { SingleAutoCompleteConfiguration } from '../../../shared/components/autocompletes/single/single-auto-complete-configuration';
@ -36,9 +36,9 @@ export class DataManagementPlanWizardEditorComponent implements OnInit {
isNew = true;
@Input() formGroup: FormGroup = null;
filteringOrganisationsAsync: boolean = false;
filteringResearchersAsync: boolean = false;
filteredProfilesAsync: boolean = false;
filteringOrganisationsAsync = false;
filteringResearchersAsync = false;
filteredProfilesAsync = false;
filteredOrganisations: ExternalSourcesItemModel[];
filteredResearchers: ExternalSourcesItemModel[];
filteredProfiles: DatasetProfileModel[];
@ -48,8 +48,8 @@ export class DataManagementPlanWizardEditorComponent implements OnInit {
organisationsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
researchersAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
createNewVersion;
associatedUsers: Array<DmpUsersModel>
labelDisabled: boolean = false;
associatedUsers: Array<DmpUsersModel>;
labelDisabled = false;
constructor(
private dataManagementPlanService: DataManagementPlanService,
@ -67,55 +67,55 @@ export class DataManagementPlanWizardEditorComponent implements OnInit {
ngOnInit() {
let projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
projectRequestItem.criteria = new ProjectCriteria();
this.projectAutoCompleteConfiguration = {
filterFn: this.searchProject.bind(this.projectService),
items: this.searchProject(''),
displayFn: (item) => item["label"],
titleFn: (item) => item["label"],
displayFn: (item) => item['label'],
titleFn: (item) => item['label'],
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
loadDataOnStart: true
};
this.profilesAutoCompleteConfiguration = {
filterFn: this.filterProfiles.bind(this),
initialItems: (excludedItems: any[]) => this.filterProfiles('').map(result => result.filter(x => excludedItems.map(x => x.id).indexOf(x.id) == -1)),
displayFn: (item) => item["label"],
titleFn: (item) => item["label"],
initialItems: (excludedItems: any[]) => this.filterProfiles('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
displayFn: (item) => item['label'],
titleFn: (item) => item['label'],
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
loadDataOnStart: true
};
this.organisationsAutoCompleteConfiguration = {
filterFn: this.filterOrganisations.bind(this),
initialItems: (excludedItems: any[]) => this.filterOrganisations('').map(result => result.filter(x => excludedItems.map(x => x.id).indexOf(x.id) == -1)),
displayFn: (item) => item["name"],
titleFn: (item) => item["name"],
initialItems: (excludedItems: any[]) => this.filterOrganisations('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
displayFn: (item) => item['name'],
titleFn: (item) => item['name'],
loadDataOnStart: true
};
this.researchersAutoCompleteConfiguration = {
filterFn: this.filterResearchers.bind(this),
initialItems: (excludedItems: any[]) => this.filterResearchers('').map(result => result.filter(x => excludedItems.map(x => x.id).indexOf(x.id) == -1)),
displayFn: (item) => item["name"],
titleFn: (item) => item["name"],
initialItems: (excludedItems: any[]) => this.filterResearchers('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
displayFn: (item) => item['name'],
titleFn: (item) => item['name'],
loadDataOnStart: true
};
let organisationRequestItem: RequestItem<BaseCriteria> = new RequestItem();
const organisationRequestItem: RequestItem<BaseCriteria> = new RequestItem();
organisationRequestItem.criteria = new BaseCriteria();
this.route.data.subscribe(value => {
if (value.clone == false && this.formGroup.get("label").value) {
if (value.clone === false && this.formGroup.get('label').value) {
this.labelDisabled = true;
}
this.formGroup.controls["version"].disable();
})
this.formGroup.controls['version'].disable();
});
}
searchProject(query: string) {
let projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
projectRequestItem.criteria = new ProjectCriteria();
projectRequestItem.criteria.like = query;
return this.projectService.getWithExternal(projectRequestItem);
@ -142,7 +142,7 @@ export class DataManagementPlanWizardEditorComponent implements OnInit {
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
data: { message: this.isNew ? 'GENERAL.SNACK-BAR.SUCCESSFUL-CREATION' : 'GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE', language: this.language },
duration: 3000,
})
});
this.router.navigate(['/dmps']);
}
@ -154,7 +154,7 @@ export class DataManagementPlanWizardEditorComponent implements OnInit {
public setErrorModel(errorModel: BaseErrorModel) {
Object.keys(errorModel).forEach(item => {
// (<any>this.dataManagementPlan.errorModel)[item] = (<any>errorModel)[item];
})
});
}
public cancel(): void {
@ -166,7 +166,7 @@ export class DataManagementPlanWizardEditorComponent implements OnInit {
this.filteredOrganisations = undefined;
this.filteringOrganisationsAsync = true;
return this.externalSourcesService.searchDMPOrganizations(value)
return this.externalSourcesService.searchDMPOrganizations(value);
}
filterResearchers(value: string): Observable<ExternalSourcesItemModel[]> {
@ -174,7 +174,7 @@ export class DataManagementPlanWizardEditorComponent implements OnInit {
this.filteredResearchers = undefined;
this.filteringResearchersAsync = true;
return this.externalSourcesService.searchDMPResearchers({ criteria: { name: value, like: null } })
return this.externalSourcesService.searchDMPResearchers({ criteria: { name: value, like: null } });
}
filterProfiles(value: string): Observable<DatasetProfileModel[]> {
@ -183,10 +183,10 @@ export class DataManagementPlanWizardEditorComponent implements OnInit {
this.filteredProfilesAsync = true;
const request = new RequestItem<DatasetProfileCriteria>();
let criteria = new DatasetProfileCriteria();
const criteria = new DatasetProfileCriteria();
criteria.like = value;
request.criteria = criteria;
return this._service.searchDMPProfiles(request)
return this._service.searchDMPProfiles(request);
}
}

View File

@ -7,13 +7,13 @@ import { DataManagementPlanModel } from '../../../models/data-managemnt-plans/Da
import { DatasetCriteriaComponent } from '../../../shared/components/criteria/datasets/datasets-criteria.component';
import { DataManagementPlanService } from '../../../services/data-management-plan/data-management-plan.service';
import { DatasetService } from '../../../services/dataset/dataset.service';
import { Component, ViewChild, OnInit, AfterViewInit, Input } from "@angular/core";
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
import { Router, Params, ActivatedRoute } from "@angular/router";
import { TranslateService } from "@ngx-translate/core";
import { DataSource } from "@angular/cdk/table";
import { FormGroup, FormBuilder, FormControl, FormArray } from "@angular/forms"
import { Observable } from "rxjs/Observable";
import { Component, ViewChild, OnInit, AfterViewInit, Input } from '@angular/core';
import { MatPaginator, MatSort, MatSnackBar } from '@angular/material';
import { Router, Params, ActivatedRoute } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { DataSource } from '@angular/cdk/table';
import { FormGroup, FormBuilder, FormControl, FormArray } from '@angular/forms';
import { Observable } from 'rxjs/Observable';
import { PageEvent } from '@angular/material';
import { SelectionModel } from '@angular/cdk/collections';
@ -31,10 +31,10 @@ export class DatasetWizardListingComponent implements OnInit {
titlePrefix: String;
datasets: DatasetListingModel[] = []
datasets: DatasetListingModel[] = [];
@Input() dmpId: String;
@Input() formGroup: FormGroup
@Input() formGroup: FormGroup;
selection = new SelectionModel<Element>(true, []);
statuses = [
@ -56,24 +56,26 @@ export class DatasetWizardListingComponent implements OnInit {
ngOnInit() {
this.route.params.subscribe((params: Params) => {
if (this.dmpId != null)
if (params['dmpLabel'] != undefined)
this.titlePrefix = "for " + params['dmpLabel'];
if (this.dmpId != null) {
if (params['dmpLabel'] !== undefined) {
this.titlePrefix = 'for ' + params['dmpLabel'];
}
}
});
let request: DataTableRequest<DatasetCriteria> = new DataTableRequest<DatasetCriteria>(null, null, null);
const request: DataTableRequest<DatasetCriteria> = new DataTableRequest<DatasetCriteria>(null, null, null);
request.criteria = new DatasetCriteria();
request.criteria.dmpIds = [this.dmpId];
this.datasetService.getPaged(request).subscribe(items => {
this.datasets = JsonSerializer.fromJSONArray(items.data, DatasetListingModel)
})
this.formGroup.addControl("datasets", new FormBuilder().array(new Array<FormControl>()))
this.datasets = JsonSerializer.fromJSONArray(items.data, DatasetListingModel);
});
this.formGroup.addControl('datasets', new FormBuilder().array(new Array<FormControl>()));
}
selectionChanged(event, selectedItems) {
this.formGroup.removeControl("datasets");
this.formGroup.addControl("datasets", new FormBuilder().array(new Array<FormControl>()))
this.formGroup.removeControl('datasets');
this.formGroup.addControl('datasets', new FormBuilder().array(new Array<FormControl>()));
selectedItems.selectedOptions.selected.forEach(element => {
(<FormArray>this.formGroup.get("datasets")).push(new FormBuilder().group({ id: element.value }))
(<FormArray>this.formGroup.get('datasets')).push(new FormBuilder().group({ id: element.value }));
});
}

View File

@ -11,7 +11,7 @@ declare var $: any;
@Component({
selector: 'df-autocomplete',
selector: 'app-df-autocomplete',
templateUrl: './autocomplete-remote.component.html',
styleUrls: ['./autocomplete-remote.component.css'],
encapsulation: ViewEncapsulation.None,
@ -20,14 +20,14 @@ export class AutocompleteRemoteComponent implements OnInit/* , ControlValueAcces
@Input() field: Field;
@Input() disabled = false
@Input() disabled = false;
@Input() form: FormGroup;
public autoCompleteConfiguration: AutoCompleteConfiguration;
public loading: boolean;
public datasetId;
public values: any[] = new Array();
public typeaheadMS: number = 1400;
public typeaheadMS = 1400;
constructor(private datasetProfileService: DatasetProfileService, route: ActivatedRoute) {
this.datasetId = route.snapshot.params['id'];
@ -35,7 +35,7 @@ export class AutocompleteRemoteComponent implements OnInit/* , ControlValueAcces
ngOnInit() {
let autocompleteRequestItem: RequestItem<AutocompleteLookupItem> = new RequestItem();
const autocompleteRequestItem: RequestItem<AutocompleteLookupItem> = new RequestItem();
autocompleteRequestItem.criteria = new AutocompleteLookupItem();
autocompleteRequestItem.criteria.fieldID = this.field.id;
autocompleteRequestItem.criteria.profileID = this.datasetId;
@ -44,19 +44,18 @@ export class AutocompleteRemoteComponent implements OnInit/* , ControlValueAcces
}
displayWith(item: any) {
if (!item) return null;
if (typeof item === 'string') item = this.transform(item);
return item["label"];
if (!item) { return null; }
if (typeof item === 'string') { item = this.transform(item); }
return item['label'];
}
assign(item: any) {
if (!item) return null;
if (!item) { return null; }
return this.transform(item);
}
transform(item: any) {
if (typeof item === 'string') return JSON.parse(item)
else return JSON.stringify(item);
if (typeof item === 'string') { return JSON.parse(item); } else { return JSON.stringify(item); }
}
}

View File

@ -3,7 +3,7 @@ import { Field } from '../../../models/Field';
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
@Component({
selector: 'df-booleanDecision',
selector: 'app-df-boolean-decision',
templateUrl: './dynamic-field-boolean-decision.component.html',
styleUrls: [
'./dynamic-field-boolean-decision.component.css'

View File

@ -3,7 +3,7 @@ import { FormGroup } from '@angular/forms';
import { Component, Input, ViewEncapsulation, OnInit } from '@angular/core';
@Component({
selector: 'df-checkbox',
selector: 'app-df-checkbox',
templateUrl: './dynamic-field-checkbox.html',
styleUrls: [
'./dynamic-field-checkbox.css'

View File

@ -3,7 +3,7 @@ import { Field } from '../../../models/Field';
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
@Component({
selector: 'df-dropdown',
selector: 'app-df-dropdown',
templateUrl: './dynamic-field-dropdown.html',
styleUrls: [
'./dynamic-field-dropdown.css'

View File

@ -4,7 +4,7 @@ import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
@Component({
selector: 'df-radiobox',
selector: 'app-df-radiobox',
templateUrl: './dynamic-field-radiobox.component.html',
styleUrls: [
'./dynamic-field-radiobox.component.css'

View File

@ -19,16 +19,16 @@
<div *ngSwitchCase="'combobox'">
<!--TODO-->
<div *ngIf="this.field.data.type === 'autocomplete'">
<df-autocomplete [form]="form" [field]="field"></df-autocomplete>
<app-df-autocomplete [form]="form" [field]="field"></app-df-autocomplete>
</div>
<div *ngIf="this.field.data.type === 'wordlist'">
<df-dropdown [form]="form" [field]="field"></df-dropdown>
<app-df-dropdown [form]="form" [field]="field"></app-df-dropdown>
</div>
</div>
<div *ngSwitchCase="'checkBox'" class="checkbox">
<df-checkbox [form]="form" [field]="field"></df-checkbox>
<app-df-checkbox [form]="form" [field]="field"></app-df-checkbox>
</div>
<div *ngSwitchCase="'textarea'">
@ -44,11 +44,11 @@
</div>
<div *ngSwitchCase="'booleanDecision'">
<df-booleanDecision [form]="form" [field]="field"></df-booleanDecision>
<app-df-boolean-decision [form]="form" [field]="field"></app-df-boolean-decision>
</div>
<div *ngSwitchCase="'radiobox'">
<df-radiobox [form]="form" [field]="field"></df-radiobox>
<app-df-radiobox [form]="form" [field]="field"></app-df-radiobox>
</div>
<div *ngSwitchCase="'label'"> </div>

View File

@ -1,5 +1,5 @@
import { Field } from '../../models/Field';
import { Component, Input, OnInit, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';
import { Component, Input, OnInit, ViewEncapsulation, ChangeDetectionStrategy, OnChanges, OnDestroy } from '@angular/core';
import { FormGroup, ValidatorFn, AbstractControl, Validators } from '@angular/forms';
import { ActivatedRoute } from '@angular/router';
import { VisibilityRulesService } from '../../utilities/visibility-rules/visibility-rules.service';
@ -7,7 +7,7 @@ import { Subscription } from 'rxjs';
@Component({
selector: 'df-field',
selector: 'app-df-field',
templateUrl: './dynamic-form-field.component.html',
// styles: ['.checkBoxLabelCustom {font-weight: 700;}']
styleUrls: [
@ -16,25 +16,23 @@ import { Subscription } from 'rxjs';
encapsulation: ViewEncapsulation.None
})
export class DynamicFormFieldComponent implements OnInit {
export class DynamicFormFieldComponent implements OnInit, OnChanges, OnDestroy {
@Input() field: Field;
form: FormGroup;
@Input() pathName: string;
@Input() path: string;
change: Subscription;
trackByFn = (index, item) => item ? item["id"] : null
trackByFn = (index, item) => item ? item['id'] : null;
constructor(private route: ActivatedRoute, public visibilityRulesService: VisibilityRulesService) {
}
ngOnInit() {
if (this.field) {
this.form = this.visibilityRulesService.getFormGroup(this.field.id)
if (!this.form) debugger;
if (!this.form.get('value')) debugger;
this.form = this.visibilityRulesService.getFormGroup(this.field.id);
this.change = this.form.get('value').valueChanges.subscribe(item => {
this.visibilityRulesService.updateValueAndVisibility(this.field.id)
})
this.visibilityRulesService.updateValueAndVisibility(this.field.id);
});
}
}
@ -45,22 +43,22 @@ export class DynamicFormFieldComponent implements OnInit {
ngOnDestroy(): void {
//Called once, before the instance is destroyed.
//Add 'implements OnDestroy' to the class.
if(this.change) this.change.unsubscribe()
if (this.change) { this.change.unsubscribe(); }
}
clearInput() {
}
get isValid() {
return this.form.get("value").valid;
return this.form.get('value').valid;
}
get isValidRequired() {
return this.form.get("value").hasError("required");
return this.form.get('value').hasError('required');
}
get isValidPattern() {
return this.form.get("value").hasError("pattern");
return this.form.get('value').hasError('pattern');
}
get isValidCustom() {
return this.form.get("value").hasError("forbiddenName");
return this.form.get('value').hasError('forbiddenName');
}
}

View File

@ -7,7 +7,7 @@
<h5 *ngIf="compositeField.extendedDescription" class="fieldset-extended-desc">
<i>{{compositeField.extendedDescription}}</i>
</h5>
<df-field *ngIf="compositeField.fields.length == 1" [field]="compositeField.fields[0]" [pathName]="pathName+'.fields.'+0"></df-field>
<app-df-field *ngIf="compositeField.fields.length == 1" [field]="compositeField.fields[0]" [pathName]="pathName+'.fields.'+0"></app-df-field>
</div>
</div>
@ -28,10 +28,10 @@
</div>
</div>
<df-field [field]="field" [pathName]="pathName+'.fields.'+i"></df-field>
<app-df-field [field]="field" [pathName]="pathName+'.fields.'+i"></app-df-field>
<div *ngIf="field">
<div *ngFor="let multipleField of field.multiplicityItems; let j = index; trackBy: trackByFn">
<df-field [field]="multipleField" [pathName]="pathName+'.fields.'+i+'.multiplicityItems.'+j"></df-field>
<app-df-field [field]="multipleField" [pathName]="pathName+'.fields.'+i+'.multiplicityItems.'+j"></app-df-field>
</div>
</div>
</div>

View File

@ -4,7 +4,7 @@ import { FormGroup, FormArray } from '@angular/forms';
import { Component, Input, OnInit, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';
import { Field } from '../../models/Field';
@Component({
selector: 'df-composite-field',
selector: 'app-df-composite-field',
templateUrl: './dynamic-form-composite-field.html',
styleUrls: [
'./dynamic-form-composite-field.css'
@ -13,25 +13,25 @@ import { Field } from '../../models/Field';
})
export class DynamicFormCompositeFieldComponent implements OnInit {
@Input() compositeField: CompositeField
@Input() compositeField: CompositeField;
form: FormGroup;
@Input() pathName: string;
@Input() path: string;
trackByFn = (index, item) => item ? item["id"] : null
trackByFn = (index, item) => item ? item['id'] : null;
constructor(private visibilityRulesService: VisibilityRulesService) {
}
ngOnInit() {
if (this.compositeField) {
this.form = this.visibilityRulesService.getFormGroup(this.compositeField.id)
this.form = this.visibilityRulesService.getFormGroup(this.compositeField.id);
}
}
addMultipleField(fieldIndex: number) {
let field: Field = this.compositeField.fields[fieldIndex].cloneForMultiplicity(fieldIndex, "");
const field: Field = this.compositeField.fields[fieldIndex].cloneForMultiplicity(fieldIndex, '');
this.compositeField.fields[fieldIndex].multiplicityItems.push(field);
(<FormArray>(this.form.get("fields").get('' + fieldIndex).get('multiplicityItems'))).push(field.buildForm());
(<FormArray>(this.form.get('fields').get('' + fieldIndex).get('multiplicityItems'))).push(field.buildForm());
}
}

View File

@ -9,10 +9,10 @@
</a>
</div>
</div>
<df-composite-field [compositeField]="compositeField" [path]="path" [pathName]="pathName+'.compositeFields.'+i"></df-composite-field>
<app-df-composite-field [compositeField]="compositeField" [path]="path" [pathName]="pathName+'.compositeFields.'+i"></app-df-composite-field>
<div *ngIf="compositeField">
<div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn">
<df-composite-field [compositeField]="multipleCompositeField" [pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j"></df-composite-field>
<app-df-composite-field [compositeField]="multipleCompositeField" [pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j"></app-df-composite-field>
</div>
</div>
</div>

View File

@ -8,32 +8,32 @@ import { CompositeField } from '../../models/CompositeField';
@Component({
selector: 'df-group',
selector: 'app-df-group',
templateUrl: './dynamic-form-group.component.html',
styleUrls: ['./dynamic-form-group.component.css'],
encapsulation: ViewEncapsulation.None,
})
export class DynamicFormGroupComponent implements OnInit {
@Input() group: FieldGroup
@Input() group: FieldGroup;
form: FormGroup;
@Input() pathName: string;
@Input() path: string;
trackByFn = (index, item) => item ? item["id"] : null
trackByFn = (index, item) => item ? item['id'] : null;
constructor(public visibilityRulesService: VisibilityRulesService) {
}
ngOnInit() {
if (this.group) {
this.form = this.visibilityRulesService.getFormGroup(this.group.id)
this.form = this.visibilityRulesService.getFormGroup(this.group.id);
}
}
addMultipleField(fieldsetIndex: number) {
let compositeField: CompositeField = this.group.compositeFields[fieldsetIndex].cloneForMultiplicity(fieldsetIndex);
const compositeField: CompositeField = this.group.compositeFields[fieldsetIndex].cloneForMultiplicity(fieldsetIndex);
this.group.compositeFields[fieldsetIndex].multiplicityItems.push(compositeField);
(<FormArray>(this.form.get("compositeFields").get('' + fieldsetIndex).get('multiplicityItems'))).push(compositeField.buildForm());
(<FormArray>(this.form.get('compositeFields').get('' + fieldsetIndex).get('multiplicityItems'))).push(compositeField.buildForm());
}
addFieldSet() {

View File

@ -18,10 +18,10 @@
Add one more fieldset +
</a>
</div>
<df-composite-field [compositeField]="compositeField" [path]="path" [pathName]="pathName+'.compositeFields.'+i"></df-composite-field>
<app-df-composite-field [compositeField]="compositeField" [path]="path" [pathName]="pathName+'.compositeFields.'+i"></app-df-composite-field>
<div *ngIf="compositeField">
<div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn">
<df-composite-field [compositeField]="multipleCompositeField" [pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j"></df-composite-field>
<app-df-composite-field [compositeField]="multipleCompositeField" [pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j"></app-df-composite-field>
</div>
<div *ngIf="compositeField.hasCommentField" [formGroup]="form.get('compositeFields').get(''+i)">
<mat-form-field>
@ -35,7 +35,7 @@
<div *ngIf="section?.sections">
<div *ngFor="let itemsection of section.sections; let j = index;">
<df-section [section]="itemsection" [path]="path+'.'+(j+1)" [pathName]="pathName+'.sections.'+j"></df-section>
<app-df-section [section]="itemsection" [path]="path+'.'+(j+1)" [pathName]="pathName+'.sections.'+j"></app-df-section>
</div>
</div>
</mat-expansion-panel>

View File

@ -1,49 +1,50 @@
import { VisibilityRulesService } from '../../utilities/visibility-rules/visibility-rules.service';
import { FormGroup, Form, FormArray } from '@angular/forms';
import { Component, Input, OnInit, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';
import { Component, Input, OnInit, ViewEncapsulation, ChangeDetectionStrategy, AfterViewInit } from '@angular/core';
import { CompositeField } from '../../models/CompositeField';
import { Section } from '../../models/Section';
@Component({
selector: 'df-section',
selector: 'app-df-section',
templateUrl: './dynamic-form-section.html',
styleUrls: [
'./dynamic-form-section.css'
],
encapsulation: ViewEncapsulation.None,
})
export class DynamicFormSectionComponent implements OnInit {
export class DynamicFormSectionComponent implements OnInit, AfterViewInit {
@Input() section: Section
@Input() section: Section;
form: FormGroup;
@Input() pathName: string;
@Input() path: string;
trackByFn = (index, item) => item ? item["id"] : null
trackByFn = (index, item) => item ? item['id'] : null;
constructor(public visibilityRulesService: VisibilityRulesService) { }
ngOnInit() {
if (this.section) {
this.form = this.visibilityRulesService.getFormGroup(this.section.id)
this.form = this.visibilityRulesService.getFormGroup(this.section.id);
}
}
ngAfterViewInit() {
this.visibilityRulesService.triggerVisibilityEvaluation()
this.visibilityRulesService.triggerVisibilityEvaluation();
}
addMultipleField(fieldsetIndex: number) {
let compositeField: CompositeField = this.section.compositeFields[fieldsetIndex].cloneForMultiplicity(fieldsetIndex);
const compositeField: CompositeField = this.section.compositeFields[fieldsetIndex].cloneForMultiplicity(fieldsetIndex);
this.section.compositeFields[fieldsetIndex].multiplicityItems.push(compositeField);
(<FormArray>(this.form.get("compositeFields").get('' + fieldsetIndex).get('multiplicityItems'))).push(compositeField.buildForm());
(<FormArray>(this.form.get('compositeFields').get('' + fieldsetIndex).get('multiplicityItems'))).push(compositeField.buildForm());
}
isElementVisible(fieldSet: CompositeField): boolean {
if (!fieldSet) return false;
for (var i = 0; i < fieldSet.fields.length; i++) {
if (fieldSet.fields[i])
if (!fieldSet) { return false; }
for (let i = 0; i < fieldSet.fields.length; i++) {
if (fieldSet.fields[i]) {
return true;
}
}
return false;
}
}

View File

@ -28,7 +28,7 @@ import { SharedModule } from '../shared/shared.module';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { NgModule } from "@angular/core";
import { NgModule } from '@angular/core';
import { DatasetProfileAdmin } from '../services/datasetProfileAdmin/datasetProfileAfmin.service';
import { DatasetProfileService } from '../services/dataset-profile.service';
import { DatasetWizardService } from '../services/dataset-wizard/dataset-wizard.service';

View File

@ -14,7 +14,7 @@
<div>
<div class="alignment-center">
<!-- <ngb-pagination *ngIf="pages" [collectionSize]="pages.length*10" [page]="currentPageIndex" (pageChange)="changePageIndex($event)" aria-label="Default pagination"></ngb-pagination> -->
<progress-bar *ngIf="form" [formGroup]="form"></progress-bar>
<app-progress-bar *ngIf="form" [formGroup]="form"></app-progress-bar>
</div>
</div>
@ -26,7 +26,7 @@
<mat-step [stepControl]="section">
<ng-template matStepLabel>{{page.title}}</ng-template>
<div *ngIf="stepper.selectedIndex == z">
<df-section [section]="section" [path]="z+1" [pathName]="'pages.'+z+'.sections.'+i"></df-section>
<app-df-section [section]="section" [path]="z+1" [pathName]="'pages.'+z+'.sections.'+i"></app-df-section>
</div>
</mat-step>
</div>

View File

@ -17,7 +17,7 @@ import { MatSidenavModule } from '@angular/material/sidenav';
declare function simple_notifier(type: string, title: string, message: string): any;
@Component({
selector: 'dynamic-form',
selector: 'app-dynamic-form',
templateUrl: './dynamic-form.component.html',
styleUrls: [
'./dynamic-form.component.scss'
@ -28,24 +28,24 @@ declare function simple_notifier(type: string, title: string, message: string):
})
export class DynamicFormComponent implements OnInit, AfterViewInit {
pathName: string;
pages: Array<number>;
activeStepperIndex = 1;
visibleSidebar = false;
datasetProfileDefinitionModel: DatasetProfileDefinitionModel;
private progressbar = false;
private currentPageIndex = 0;
private fragment: string;
@Input() dataModel: DatasetWizardModel = new DatasetWizardModel();
@Input() path: string;
@Input() form: FormGroup;
id: string;
trackByFn = (index, item) => item ? item["id"] : null
pageTrackByFn = (index, item) => item["id"]
trackByFn = (index, item) => item ? item['id'] : null;
pageTrackByFn = (index, item) => item['id'];
// @Input() datasetId: string;
pathName: string;
pages: Array<number>;
activeStepperIndex: number = 1;
visibleSidebar: boolean = false;
datasetProfileDefinitionModel: DatasetProfileDefinitionModel
private progressbar: boolean = false;
private currentPageIndex: number = 0;
private fragment: string;
constructor(private router: Router,
private _location: Location,
private route: ActivatedRoute,
@ -63,27 +63,28 @@ export class DynamicFormComponent implements OnInit, AfterViewInit {
ngOnInit() {
let rules: Rule[] = JsonSerializer.fromJSONArray(this.dataModel.datasetProfileDefinition.rules, Rule);
const rules: Rule[] = JsonSerializer.fromJSONArray(this.dataModel.datasetProfileDefinition.rules, Rule);
this.visibilityRulesService.formGroup = this.form;
this.visibilityRulesService.buildVisibilityRules(rules)
this.datasetProfileDefinitionModel = this.dataModel.datasetProfileDefinition
this.visibilityRulesService.setModel(this.datasetProfileDefinitionModel)
this.visibilityRulesService.buildVisibilityRules(rules);
this.datasetProfileDefinitionModel = this.dataModel.datasetProfileDefinition;
this.visibilityRulesService.setModel(this.datasetProfileDefinitionModel);
this.createPagination();
this.progressbar = true;
this.route.fragment.subscribe((fragment: string) => {
var self = this;
setTimeout(function () { self.scrollTo(fragment) });
const self = this;
setTimeout(function () { self.scrollTo(fragment); });
});
this.route.queryParams.subscribe((params) => {
if (params && "page" in params)
this.changeCurrentPage(params["page"]);
if (params && 'page' in params) {
this.changeCurrentPage(params['page']);
}
});
}
ngAfterViewInit() {
this.visibilityRulesService.triggerVisibilityEvaluation()
this.visibilityRulesService.triggerVisibilityEvaluation();
}
@ -102,7 +103,7 @@ export class DynamicFormComponent implements OnInit, AfterViewInit {
// }
shouldDisplaySection(section: Section): Boolean {
return (section.page) == this.currentPageIndex;
return (section.page) === this.currentPageIndex;
}
createPagination() {
@ -114,25 +115,25 @@ export class DynamicFormComponent implements OnInit, AfterViewInit {
}
changePageIndex(index: any) {
this.router.navigate([this.route.snapshot.url[0] + "/" + this.route.snapshot.url[1]], { queryParams: { page: this.pages[index - 1] } });
this.router.navigate([this.route.snapshot.url[0] + '/' + this.route.snapshot.url[1]], { queryParams: { page: this.pages[index - 1] } });
}
scrollTo(sectionID: string) {
if (!sectionID) return;
var element = document.querySelector('#' + sectionID);
if (!element) return;
if (!sectionID) { return; }
const element = document.querySelector('#' + sectionID);
if (!element) { return; }
element.scrollIntoView();
this.visibleSidebar = true;
var scrollElement = document.querySelector('.scrollableContent');
const scrollElement = document.querySelector('.scrollableContent');
//scrollElement.scrollTop = topElement.offsetTop;
}
changeCurrentPage(pageString: string) {
if (!pageString) return;
var page = parseInt(pageString);
if (isNaN(page)) return;
var pageIndex = this.pages.indexOf(page);
if (pageIndex === -1) return;
if (!pageString) { return; }
const page = parseInt(pageString);
if (isNaN(page)) { return; }
const pageIndex = this.pages.indexOf(page);
if (pageIndex === -1) { return; }
this.currentPageIndex = page;
}
}

View File

@ -1,4 +1,4 @@
import { Injectable } from '@angular/core'
import { Injectable } from '@angular/core';
@Injectable()
export class PaginationService {
@ -13,6 +13,6 @@ export class PaginationService {
}
public isElementVisible(elementPage: number): boolean {
return elementPage == this.currentPageIndex ; //TODO
return elementPage === this.currentPageIndex; //TODO
}
}

View File

@ -2,23 +2,23 @@
import { ViewEncapsulation } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup, FormControl, FormArray } from '@angular/forms'
import { FormGroup, FormControl, FormArray } from '@angular/forms';
@Component({
selector: 'progress-bar',
selector: 'app-progress-bar',
templateUrl: './progress-bar.component.html',
styles: ['.alwaysVisible .ui-progressbar-label { display:block!important; }'],
encapsulation: ViewEncapsulation.None
})
export class ProgressBarComponent implements OnInit {
@Input() formGroup: FormGroup
@Input("progressValueAccuracy") public accuracy: number = 1;
@Input() formGroup: FormGroup;
@Input() public progressValueAccuracy = 1;
determinateProgressValue: number;
constructor(private visibilityRulesService: VisibilityRulesService) { }
public value: number = 0;
public value = 0;
ngOnInit() {
this.calculateValueForProgressbar()
this.calculateValueForProgressbar();
this.formGroup
.valueChanges
.subscribe(control => {
@ -27,24 +27,22 @@ export class ProgressBarComponent implements OnInit {
}
calculateValueForProgressbar() {
var progressSoFar = this.countFormControlsWithValue(this.formGroup);
var total = this.getFormControlDepthLength(this.formGroup);
var perc = (progressSoFar / total) * 100;
this.value = Number.parseFloat(perc.toPrecision(this.accuracy));
const progressSoFar = this.countFormControlsWithValue(this.formGroup);
const total = this.getFormControlDepthLength(this.formGroup);
const perc = (progressSoFar / total) * 100;
this.value = Number.parseFloat(perc.toPrecision(this.progressValueAccuracy));
}
countFormControlsWithValue(form: FormGroup): number {
let value = 0;
Object.keys(form.controls).forEach(key => {
let control = form.controls[key]
if (control instanceof FormGroup) value += this.countFormControlsWithValue(control);
else if (control instanceof FormArray) {
let formArray = (<FormArray>control);
const control = form.controls[key];
if (control instanceof FormGroup) { value += this.countFormControlsWithValue(control); } else if (control instanceof FormArray) {
const formArray = (<FormArray>control);
for (let i = 0; i < formArray.length; i++) {
value += this.countFormControlsWithValue(<FormGroup>formArray.get("" + i))
value += this.countFormControlsWithValue(<FormGroup>formArray.get('' + i));
}
}
else if (key === "value" && control.value != null && control.value != "") value++;
} else if (key === 'value' && control.value != null && control.value !== '') { value++; }
});
return value;
}
@ -52,10 +50,9 @@ export class ProgressBarComponent implements OnInit {
getFormControlDepthLength(form: FormGroup): number {
let value = 0;
Object.keys(form.controls).forEach(key => {
let control = form.controls[key];
if (control instanceof FormGroup) { value += this.getFormControlDepthLength(control); }
else if (control instanceof FormArray) {
let formArray = (<FormArray>control);
const control = form.controls[key];
if (control instanceof FormGroup) { value += this.getFormControlDepthLength(control); } else if (control instanceof FormArray) {
const formArray = (<FormArray>control);
for (let i = 0; i < formArray.length; i++) {
//if (<FormGroup>formArray.get("" + i).value && this.visibilityRulesService.isElementVisible(null, formArray.get("" + i).value.id))
//value += this.getFormControlDepthLength(<FormGroup>formArray.get("" + i))

View File

@ -5,6 +5,6 @@ export class BaseTableOfContent {
scrollToId(elementId, page: number) {
//this.paginationService.setCurrentIndex(page-1);
this.router.navigate([this.route.snapshot.url[0] + "/" + this.route.snapshot.url[1]], { fragment: elementId, queryParams: { page: page } });
this.router.navigate([this.route.snapshot.url[0] + '/' + this.route.snapshot.url[1]], { fragment: elementId, queryParams: { page: page } });
}
}

View File

@ -4,11 +4,11 @@ import { CompositeField } from '../../../models/CompositeField';
import { Field } from '../../../models/Field';
import { Section } from '../../../models/Section';
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router'
import { Router, ActivatedRoute } from '@angular/router';
@Component({
selector: 'table-of-contents-field',
selector: 'app-table-of-contents-field',
templateUrl: './table-of-content-field.component.html',
providers: []
})
@ -18,6 +18,6 @@ export class TableOfContentsFieldComponent extends BaseTableOfContent {
@Input() public path: string;
@Input() public page: number;
constructor(public router: Router, public route: ActivatedRoute, private visibilityRulesService: VisibilityRulesService) {
super(router, route)
super(router, route);
}
}

View File

@ -4,13 +4,13 @@ import { CompositeField } from '../../../models/CompositeField';
import { FieldGroup } from '../../../models/FieldGroup';
import { Section } from '../../../models/Section';
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router'
import { Router, ActivatedRoute } from '@angular/router';
//import * as $ from '../../../../node_modules/jquery/dist/jquery'
@Component({
selector: 'table-of-contents-fieldset',
selector: 'app-table-of-contents-fieldset',
templateUrl: './table-of-content-fieldset.component.html',
providers: []
})
@ -21,6 +21,6 @@ export class TableOfContentsFieldSetComponent extends BaseTableOfContent {
@Input() public path: string;
@Input() public page: number;
constructor(public router: Router, public route: ActivatedRoute, private visibilityRulesService: VisibilityRulesService) {
super(router, route)
super(router, route);
}
}

View File

@ -3,12 +3,12 @@ import { BaseTableOfContent } from '../base-table-of-content.component';
import { FieldGroup } from '../../../models/FieldGroup';
import { Section } from '../../../models/Section';
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router'
import { Router, ActivatedRoute } from '@angular/router';
//import * as $ from '../../../../node_modules/jquery/dist/jquery'
@Component({
selector: 'table-of-contents-group',
selector: 'app-table-of-contents-group',
templateUrl: './table-of-content-group.component.html',
providers: []
})
@ -23,7 +23,7 @@ export class TableOfContentsGroupComponent extends BaseTableOfContent {
*/
constructor(public router: Router, public route: ActivatedRoute, private visibilityRulesService: VisibilityRulesService) {
super(router, route)
super(router, route);
}

View File

@ -5,6 +5,6 @@
<!-- All contents in the first page -->
<ul>
<li *ngFor="let sectionModel of model.sections let i = index">
<table-of-contents-section [page]='page' [model]="sectionModel" [index]="i" [path]="path+'.'+(i+1)"> </table-of-contents-section>
<app-table-of-contents-section [page]='page' [model]="sectionModel" [index]="i" [path]="path+'.'+(i+1)"> </app-table-of-contents-section>
</li>
</ul>

View File

@ -8,7 +8,7 @@ import { ActivatedRouteSnapshot, Router, ActivatedRoute } from '@angular/router'
@Component({
selector: 'table-of-contents-section',
selector: 'app-table-of-contents-section',
templateUrl: './table-of-content-section.component.html',
providers: []
})
@ -19,7 +19,7 @@ export class TableOfContentsSectionComponent extends BaseTableOfContent implemen
@Input() public path: string;
@Input() public page: number;
constructor(public router: Router, public route: ActivatedRoute, private visibilityRulesService: VisibilityRulesService) {
super(router, route)
super(router, route);
}
ngOnInit() {

View File

@ -2,6 +2,6 @@
<ul>
<li *ngFor="let section of model['sections'] let i = index">
<!-- && field.label for sections without field label as data summery -->
<table-of-contents-section [page]='section.page' [model]="section" [index]="i+1" [path]="i+1"> </table-of-contents-section>
<app-table-of-contents-section [page]='section.page' [model]="section" [index]="i+1" [path]="i+1"> </app-table-of-contents-section>
</li>
</ul>

View File

@ -6,7 +6,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
//import * as scroll from '../../../assets/jquery.scrollTo.min.js';
@Component({
selector: 'table-of-content',
selector: 'app-table-of-content',
templateUrl: './table-of-contents.component.html',
styleUrls: ['./toc.component.css'],
providers: []
@ -15,7 +15,7 @@ export class TableOfContentsComponent implements OnInit {
@Input()
public model: DatasetProfileDefinitionModel;
public path: string = "";
public path = '';
/* @Output()
setPage:EventEmitter<number> = new EventEmitter<number>();

View File

@ -16,7 +16,7 @@ import { SearchBarItem } from '../models/dashboard/SearchBarItem';
import { SearchBarType } from '../shared/components/search-bar/types/search-bar-type';
@Component({
selector: 'homepage',
selector: 'app-homepage',
templateUrl: './homepage.component.html',
styleUrls: ['./homepage.component.scss'],
providers: [ProjectService, UserReferenceService]
@ -32,7 +32,7 @@ export class HomepageComponent implements OnInit {
projectAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
public searchControl = new FormControl();
filteredOptions: Observable<SearchBarItem[]>;
RecentActivityTypes = RecentActivityTypes
RecentActivityTypes = RecentActivityTypes;
public search = false;
constructor(
@ -54,17 +54,17 @@ export class HomepageComponent implements OnInit {
if (this.isAuthenticated()) {
this.userReferenceService.getRecentActivity().subscribe(response => {
this.datasetActivities = response["recentDatasetActivities"];
this.dmpActivities = response["recentDmpActivities"];
this.projectActivities = response["recentProjectActivities"];
})
this.datasetActivities = response['recentDatasetActivities'];
this.dmpActivities = response['recentDmpActivities'];
this.projectActivities = response['recentProjectActivities'];
});
}
this.projectAutoCompleteConfiguration = {
filterFn: this.searchProject.bind(this),
items: this.searchProject(''),
displayFn: (item) => item["label"],
titleFn: (item) => item["label"],
displayFn: (item) => item['label'],
titleFn: (item) => item['label'],
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
loadDataOnStart: true
};
@ -73,25 +73,25 @@ export class HomepageComponent implements OnInit {
this.dashBoardService.getStatistics().subscribe(results => {
//let data = results['payload'];
this.dashboardStatisticsData = JsonSerializer.fromJSONObject(results, DashboardStatisticsModel);
})
});
} else {
this.dashBoardService.getStatisticsSpecificuser().subscribe(results => {
this.dashboardStatisticsData = JsonSerializer.fromJSONObject(results, DashboardStatisticsModel);
})
});
}
this.filteredOptions = this.searchControl.valueChanges.flatMap(x => {
return this.dashBoardService.searchUserItems(x);
})
});
}
public isAuthenticated(): boolean {
return !(!this.authentication.current())
return !(!this.authentication.current());
}
searchProject(query: string) {
let projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
projectRequestItem.criteria = new ProjectCriteria();
projectRequestItem.criteria.like = query;
return this.projectService.getWithExternal(projectRequestItem);
@ -100,26 +100,26 @@ export class HomepageComponent implements OnInit {
redirect(id: string, type: RecentActivityTypes) {
switch (type) {
case RecentActivityTypes.PROJECT: {
this.router.navigate(["projects/edit/" + id]);
this.router.navigate(['projects/edit/' + id]);
return;
}
case RecentActivityTypes.DATASET: {
this.router.navigate(["datasets/edit/" + id]);
this.router.navigate(['datasets/edit/' + id]);
return;
}
case RecentActivityTypes.DMP: {
this.router.navigate(["dmps/edit/" + id]);
this.router.navigate(['dmps/edit/' + id]);
return;
}
default: throw new Error("Unsupported Activity Type ")
default: throw new Error('Unsupported Activity Type ');
}
}
onOptionSelected(event: any) {
let selectedSearchBarItem = event.option.value;
if (selectedSearchBarItem.type == SearchBarType.DATASET) this.router.navigate(["datasets/edit/" + selectedSearchBarItem.id])
if (selectedSearchBarItem.type == SearchBarType.PROJECT) this.router.navigate(["projects/edit/" + selectedSearchBarItem.id])
if (selectedSearchBarItem.type == SearchBarType.DATAMANAGEMENTPLAN) this.router.navigate(["dmps/edit/" + selectedSearchBarItem.id])
const selectedSearchBarItem = event.option.value;
if (selectedSearchBarItem.type === SearchBarType.DATASET) { this.router.navigate(['datasets/edit/' + selectedSearchBarItem.id]); }
if (selectedSearchBarItem.type === SearchBarType.PROJECT) { this.router.navigate(['projects/edit/' + selectedSearchBarItem.id]); }
if (selectedSearchBarItem.type === SearchBarType.DATAMANAGEMENTPLAN) { this.router.navigate(['dmps/edit/' + selectedSearchBarItem.id]); }
}
}

View File

@ -2,17 +2,17 @@ import { FormGroup } from '@angular/forms';
import { JsonSerializer } from '../utilities/JsonSerializer';
import { Serializable } from './interfaces/Serializable';
import { BaseModel } from './BaseModel';
import { Field } from './Field'
import { Field } from './Field';
import { Multiplicity } from './Multiplicity';
export class CompositeField extends BaseModel implements Serializable<CompositeField> {
public fields: Array<Field> = new Array<Field>();
public ordinal: number
public id: string
public ordinal: number;
public id: string;
public multiplicity: Multiplicity;
public multiplicityItems: Array<CompositeField> = new Array<CompositeField>();
public title: string
public description: string
public extendedDescription: string
public title: string;
public description: string;
public extendedDescription: string;
public hasCommentField: boolean;
public commentFieldValue: string;
@ -29,12 +29,12 @@ export class CompositeField extends BaseModel implements Serializable<CompositeF
this.multiplicity = JsonSerializer.fromJSONObject(item.multiplicity, Multiplicity);
//this.multiplicity = new Multiplicity();
//this.multiplicity.max = 2;
if(item.multiplicityItems)this.multiplicityItems = JsonSerializer.fromJSONArray(item.multiplicityItems, CompositeField);
if (item.multiplicityItems) {this.multiplicityItems = JsonSerializer.fromJSONArray(item.multiplicityItems, CompositeField); }
return this;
}
buildForm(): FormGroup {
let formGroup = this.formBuilder.group({
const formGroup = this.formBuilder.group({
id: this.id,
ordinal: this.ordinal,
title: this.title,
@ -44,28 +44,28 @@ export class CompositeField extends BaseModel implements Serializable<CompositeF
commentFieldValue: this.commentFieldValue
});
let fieldsFormArray = new Array<FormGroup>();
const fieldsFormArray = new Array<FormGroup>();
this.fields.forEach(item => {
let form: FormGroup = item.buildForm();
fieldsFormArray.push(form)
})
const form: FormGroup = item.buildForm();
fieldsFormArray.push(form);
});
formGroup.addControl('fields', this.formBuilder.array(fieldsFormArray));
let multiplicityItemsFormArray = new Array<FormGroup>();
const multiplicityItemsFormArray = new Array<FormGroup>();
this.multiplicityItems.forEach(item => {
let form: FormGroup = item.buildForm();
multiplicityItemsFormArray.push(form)
})
const form: FormGroup = item.buildForm();
multiplicityItemsFormArray.push(form);
});
formGroup.addControl('multiplicityItems', this.formBuilder.array(multiplicityItemsFormArray));
return formGroup;
}
cloneForMultiplicity(index: number): CompositeField {
let newItem: CompositeField = new CompositeField();
const newItem: CompositeField = new CompositeField();
newItem.id = 'multiple_' + this.id + '_' + index;
this.fields.forEach(field => {
newItem.fields.push(field.cloneForMultiplicity(this.fields.indexOf(field), newItem.id + "_"));
newItem.fields.push(field.cloneForMultiplicity(this.fields.indexOf(field), newItem.id + '_'));
});
newItem.ordinal = this.ordinal;

View File

@ -1,5 +1,5 @@
import { DataField } from './DataField';
import { FormGroup } from '@angular/forms'
import { FormGroup } from '@angular/forms';
import { ListingItem } from '../common/ListingItem';
import { JsonSerializer } from '../../utilities/JsonSerializer';
@ -11,13 +11,13 @@ export class AutocompleteData extends DataField<AutocompleteData>{
public autoCompleteOptions: ListingItem = new ListingItem();
buildForm(): FormGroup {
let formGroup = this.formBuilder.group({
const formGroup = this.formBuilder.group({
label: [this.label],
type: [this.type],
url: [this.url],
optionsRoot: [this.optionsRoot]
})
formGroup.addControl("autoCompleteOptions", this.autoCompleteOptions.buildForm());
});
formGroup.addControl('autoCompleteOptions', this.autoCompleteOptions.buildForm());
return formGroup;
}

View File

@ -3,14 +3,14 @@ import { FormGroup } from '@angular/forms';
export class BooleanDecisionData extends DataField<BooleanDecisionData> {
buildForm(): FormGroup {
let formGroup = this.formBuilder.group({
const formGroup = this.formBuilder.group({
label: this.label
});
return formGroup;
}
fromJSONObject(item: any): BooleanDecisionData {
this.label = item.label
this.label = item.label;
return this;
}
}

View File

@ -3,14 +3,14 @@ import { FormGroup } from '@angular/forms';
export class CheckBoxData extends DataField<CheckBoxData> {
buildForm(): FormGroup {
let formGroup = this.formBuilder.group({
const formGroup = this.formBuilder.group({
label: this.label
});
return formGroup;
}
fromJSONObject(item: any): CheckBoxData {
this.label = item.label
this.label = item.label;
return this;
}
}

View File

@ -1,16 +1,16 @@
import { BaseModel } from '../BaseModel';
import { FormGenerator } from '../interfaces/FormGenerator';
import { Serializable } from '../interfaces/Serializable';
import { FormGroup } from '@angular/forms'
import { FormGroup } from '@angular/forms';
export abstract class DataField<T> extends BaseModel implements Serializable<T>, FormGenerator<FormGroup> {
public label: string;
buildForm(): FormGroup {
throw new Error("Build Form Is not not correctly overriden");
throw new Error('Build Form Is not not correctly overriden');
}
fromJSONObject(item: any): T {
throw new Error("From Json Object is not correctly overriden")
throw new Error('From Json Object is not correctly overriden');
}
}

View File

@ -3,14 +3,14 @@ import { FormGroup } from '@angular/forms';
export class FreeTextData extends DataField<FreeTextData> {
buildForm(): FormGroup {
let formGroup = this.formBuilder.group({
const formGroup = this.formBuilder.group({
label: this.label
});
return formGroup;
}
fromJSONObject(item: any): FreeTextData {
this.label = item.label
this.label = item.label;
return this;
}
}

View File

@ -1,21 +1,21 @@
import { JsonSerializer } from '../../utilities/JsonSerializer';
import { DataField } from './DataField';
import { ListingItem } from '../common/ListingItem';
import { FormGroup } from '@angular/forms'
import { FormGroup } from '@angular/forms';
export class RadioBoxData extends DataField<RadioBoxData> {
public options: Array<ListingItem>;
buildForm(): FormGroup {
let formGroup = this.formBuilder.group({
const formGroup = this.formBuilder.group({
label: [this.label]
});
let optionsFormArray = new Array<FormGroup>();
const optionsFormArray = new Array<FormGroup>();
if (this.options) {
this.options.forEach(item => {
let form: FormGroup = item.buildForm();
optionsFormArray.push(form)
})
const form: FormGroup = item.buildForm();
optionsFormArray.push(form);
});
}
formGroup.addControl('options', this.formBuilder.array(optionsFormArray));
return formGroup;
@ -23,7 +23,7 @@ export class RadioBoxData extends DataField<RadioBoxData>{
fromJSONObject(item: any): RadioBoxData {
this.options = JsonSerializer.fromJSONArray(item.options, ListingItem);
this.label = item.label
this.label = item.label;
return this;
}
}

View File

@ -3,14 +3,14 @@ import { FormGroup } from '@angular/forms';
export class TextArea extends DataField<TextArea> {
buildForm(): FormGroup {
let formGroup = this.formBuilder.group({
const formGroup = this.formBuilder.group({
label: this.label
});
return formGroup;
}
fromJSONObject(item: any): TextArea {
this.label = item.label
this.label = item.label;
return this;
}
}

View File

@ -1,22 +1,22 @@
import { JsonSerializer } from '../../utilities/JsonSerializer';
import { ListingItem } from '../common/ListingItem';
import { DataField } from './DataField';
import { FormGroup } from '@angular/forms'
import { FormGroup } from '@angular/forms';
export class WordListData extends DataField<WordListData> {
public type: string;
public options: Array<ListingItem>;
buildForm(): FormGroup {
let formGroup = this.formBuilder.group({
const formGroup = this.formBuilder.group({
type: [this.type],
label: [this.label]
});
let optionsFormArray = new Array<FormGroup>();
const optionsFormArray = new Array<FormGroup>();
if (this.options) {
this.options.forEach(item => {
let form: FormGroup = item.buildForm();
optionsFormArray.push(form)
})
const form: FormGroup = item.buildForm();
optionsFormArray.push(form);
});
}
formGroup.addControl('options', this.formBuilder.array(optionsFormArray));

View File

@ -7,7 +7,7 @@ import { Section } from './Section';
import { Serializable } from './interfaces/Serializable';
import { Page } from '../models/Page';
export class DatasetProfileDefinitionModel extends BaseModel implements Serializable<DatasetProfileDefinitionModel>, FormGenerator<FormGroup> {
public status: number
public status: number;
public pages: Array<Page>;
public rules: Rule[];
//public sections:Array<Section>
@ -20,8 +20,8 @@ export class DatasetProfileDefinitionModel extends BaseModel implements Serializ
}
buildForm(): FormGroup {
let formGroup: FormGroup = new FormBuilder().group({});
let pagesFormArray = new Array<FormGroup>();
const formGroup: FormGroup = new FormBuilder().group({});
const pagesFormArray = new Array<FormGroup>();
// let sectionsFormArray = new Array<FormGroup>();
// this.pages.forEach (page => {
// page.sections.forEach(item => {
@ -30,9 +30,9 @@ export class DatasetProfileDefinitionModel extends BaseModel implements Serializ
// })
// })
this.pages.forEach(item => {
let form: FormGroup = item.buildForm();
pagesFormArray.push(form)
})
const form: FormGroup = item.buildForm();
pagesFormArray.push(form);
});
formGroup.addControl('pages', this.formBuilder.array(pagesFormArray));
return formGroup;
}

View File

@ -14,7 +14,7 @@ export class DefaultValue extends BaseModel implements Serializable<DefaultValue
}
buildForm(): FormGroup {
let formGroup = this.formBuilder.group({
const formGroup = this.formBuilder.group({
type: [this.type],
value: [this.value]

View File

@ -39,11 +39,11 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
this.defaultValue = JsonSerializer.fromJSONObject(item.defaultValue, DefaultValue);
this.value = this.defaultValue.value && !item.value ? this.defaultValue.value : item.value;
//this.multiplicity = new Multiplicity();
if (this.viewStyle.renderStyle === "checkBox") {
if (this.viewStyle.renderStyle === 'checkBox') {
this.value = this.value === 'true';
}
//this.multiplicity.max = 2;
if (item.multiplicityItems) this.multiplicityItems = JsonSerializer.fromJSONArray(item.multiplicityItems, Field);
if (item.multiplicityItems) { this.multiplicityItems = JsonSerializer.fromJSONArray(item.multiplicityItems, Field); }
this.data = item.data;
return this;
}
@ -52,16 +52,17 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
buildForm(): FormGroup {
if (this.validations)
if (this.validations) {
this.validations.forEach(validation => {
if (validation == ValidationTypes.Required) this.validationRequired = true;
if (validation === ValidationTypes.Required) { this.validationRequired = true; }
});
}
let formGroup = this.formBuilder.group({
const formGroup = this.formBuilder.group({
id: [this.id],
data: [this.data],
/* title: [this.title], */
value: [this.value, this.validationRequired == true ? Validators.required : null]/* ,
value: [this.value, this.validationRequired === true ? Validators.required : null]/* ,
description: [this.description],
extendedDescription:[this.extendedDescription],
viewStyle: [this.viewStyle],
@ -70,18 +71,18 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
data:[this.data] */
});
let multiplicityItemsFormArray = new Array<FormGroup>();
const multiplicityItemsFormArray = new Array<FormGroup>();
this.multiplicityItems.forEach(item => {
let form: FormGroup = item.buildForm();
multiplicityItemsFormArray.push(form)
})
const form: FormGroup = item.buildForm();
multiplicityItemsFormArray.push(form);
});
formGroup.addControl('multiplicityItems', this.formBuilder.array(multiplicityItemsFormArray));
return formGroup;
}
cloneForMultiplicity(index: number, idPath: string): Field {
let newItem: Field = new Field();
const newItem: Field = new Field();
newItem.id = idPath ? idPath + index : 'multiple_' + this.id + '_' + index;
newItem.title = this.title;

View File

@ -32,7 +32,7 @@ export class FieldGroup extends BaseModel implements Serializable<FieldGroup>, F
}
buildForm(): FormGroup {
let formGroup: FormGroup = this.formBuilder.group({
const formGroup: FormGroup = this.formBuilder.group({
/* id: [this.id],
title: [this.title],
value: [this.value],
@ -41,12 +41,12 @@ export class FieldGroup extends BaseModel implements Serializable<FieldGroup>, F
defaultVisibility: [this.defaultVisibility],
page: [this.page] */
});
let compositeFieldsFormArray = new Array<FormGroup>();
const compositeFieldsFormArray = new Array<FormGroup>();
if (this.compositeFields) {
this.compositeFields.forEach(item => {
let form: FormGroup = item.buildForm();
compositeFieldsFormArray.push(form)
})
const form: FormGroup = item.buildForm();
compositeFieldsFormArray.push(form);
});
}
formGroup.addControl('compositeFields', this.formBuilder.array(compositeFieldsFormArray));

View File

@ -13,7 +13,7 @@ export class Multiplicity extends BaseModel implements Serializable<Multiplicity
}
buildForm(): FormGroup {
let formGroup = this.formBuilder.group({
const formGroup = this.formBuilder.group({
min: [this.min],
max: [this.max]

View File

@ -1,4 +1,4 @@
import { Section } from "../models/Section";
import { Section } from '../models/Section';
import { BaseModel } from './BaseModel';
import { FormGenerator } from './interfaces/FormGenerator';
import { Serializable } from './interfaces/Serializable';
@ -18,12 +18,12 @@ export class Page extends BaseModel implements Serializable<Page> {
}
buildForm(): FormGroup {
let formGroup: FormGroup = new FormBuilder().group({});
let sectionsFormArray = new Array<FormGroup>();
const formGroup: FormGroup = new FormBuilder().group({});
const sectionsFormArray = new Array<FormGroup>();
this.sections.forEach(item => {
let form: FormGroup = item.buildForm();
sectionsFormArray.push(form)
})
const form: FormGroup = item.buildForm();
sectionsFormArray.push(form);
});
formGroup.addControl('sections', this.formBuilder.array(sectionsFormArray));
return formGroup;
}

View File

@ -12,8 +12,8 @@ export class Section extends BaseModel implements Serializable<Section>, FormGen
public defaultVisibility: boolean;
public page: number;
public ordinal: number;
public id: string
public title: string
public id: string;
public title: string;
public description: string;
public compositeFields: Array<CompositeField> = new Array<CompositeField>();
@ -31,27 +31,27 @@ export class Section extends BaseModel implements Serializable<Section>, FormGen
}
buildForm(): FormGroup {
let formGroup: FormGroup = new FormBuilder().group({});
let sectionsFormArray = new Array<FormGroup>();
const formGroup: FormGroup = new FormBuilder().group({});
const sectionsFormArray = new Array<FormGroup>();
if (this.sections) {
this.sections.forEach(item => {
let form: FormGroup = item.buildForm();
sectionsFormArray.push(form)
})
const form: FormGroup = item.buildForm();
sectionsFormArray.push(form);
});
}
let fieldGroupsFormArray = new Array<FormGroup>();
const fieldGroupsFormArray = new Array<FormGroup>();
// if (this.fieldGroups) {
// this.fieldGroups.forEach(item => {
// let form: FormGroup = item.buildForm();
// fieldGroupsFormArray.push(form)
// })
// }
let compositeFieldsFormArray = new Array<FormGroup>();
const compositeFieldsFormArray = new Array<FormGroup>();
if (this.compositeFields) {
this.compositeFields.forEach(item => {
let form: FormGroup = item.buildForm();
compositeFieldsFormArray.push(form)
})
const form: FormGroup = item.buildForm();
compositeFieldsFormArray.push(form);
});
}
formGroup.addControl('compositeFields', this.formBuilder.array(compositeFieldsFormArray));
formGroup.addControl('sections', this.formBuilder.array(sectionsFormArray));

View File

@ -1,4 +1,4 @@
import { BaseCriteria } from "../criteria/BaseCriteria";
import { BaseCriteria } from '../criteria/BaseCriteria';
export class AutocompleteLookupItem extends BaseCriteria {
public profileID: String;

View File

@ -1,6 +1,6 @@
import { FormGenerator } from '../interfaces/FormGenerator';
import { Serializable } from '../interfaces/Serializable';
import { FormGroup, FormBuilder } from '@angular/forms'
import { FormGroup, FormBuilder } from '@angular/forms';
export class ListingItem implements Serializable<ListingItem>, FormGenerator<FormGroup> {
public label: string;
public value: string;
@ -15,6 +15,6 @@ export class ListingItem implements Serializable<ListingItem>, FormGenerator<For
return new FormBuilder().group({
label: [this.label],
value: [this.value]
})
});
}
}

View File

@ -1,5 +1,5 @@
import { FormGenerator } from "../../utilities/forms/FormGenerator";
import { BaseCriteriaErrorModel } from "./BaseCriteriaErrorModel";
import { FormGenerator } from '../../utilities/forms/FormGenerator';
import { BaseCriteriaErrorModel } from './BaseCriteriaErrorModel';
export class BaseCriteria {
public like: string;

View File

@ -1,5 +1,5 @@
import { FormGenerator } from "../../utilities/forms/FormGenerator";
import { BaseCriteriaErrorModel } from "./BaseCriteriaErrorModel";
import { FormGenerator } from '../../utilities/forms/FormGenerator';
import { BaseCriteriaErrorModel } from './BaseCriteriaErrorModel';
export class RequestItem<T> {
public criteria: T;

View File

@ -1,8 +1,8 @@
import { BaseCriteria } from "../BaseCriteria";
import { ProjectModel } from "../../projects/ProjectModel";
import { BaseCriteria } from '../BaseCriteria';
import { ProjectModel } from '../../projects/ProjectModel';
export class DataManagementPlanCriteria extends BaseCriteria {
public projects: ProjectModel[] = [];
public groupIds: string[]
public allVersions: boolean
public groupIds: string[];
public allVersions: boolean;
}

View File

@ -1,4 +1,4 @@
import { BaseCriteriaErrorModel } from "../BaseCriteriaErrorModel";
import { BaseCriteriaErrorModel } from '../BaseCriteriaErrorModel';
export class DataManagementPlanCriteriaErrorModel extends BaseCriteriaErrorModel {

View File

@ -1,5 +1,5 @@
import { BaseCriteria } from "../BaseCriteria";
import { ExternalSourcesItemModel } from "../../external-sources/ExternalSourcesItemModel";
import { BaseCriteria } from '../BaseCriteria';
import { ExternalSourcesItemModel } from '../../external-sources/ExternalSourcesItemModel';
export class DatasetCriteria extends BaseCriteria {
public status: Number;

View File

@ -1,4 +1,4 @@
import { BaseCriteriaErrorModel } from "../BaseCriteriaErrorModel";
import { BaseCriteriaErrorModel } from '../BaseCriteriaErrorModel';
export class DatasetCriteriaErrorModel extends BaseCriteriaErrorModel {
public status: Number;

View File

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

Some files were not shown because too many files have changed in this diff Show More