Merge branch 'Development' of https://gitlab.eudat.eu/dmp/OpenAIRE-EUDAT-DMP-service-pilot into Development
This commit is contained in:
commit
af99c1f418
|
@ -20,6 +20,8 @@ public class DatasetPublicTableRequest extends TableQuery<DatasetPublicCriteria,
|
||||||
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("dmp").get("version"),
|
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("dmp").get("version"),
|
||||||
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("dmp").get("groupId"), nestedRoot.get("dmp").get("groupId")),
|
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("dmp").get("groupId"), nestedRoot.get("dmp").get("groupId")),
|
||||||
Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), String.class)));
|
Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), String.class)));
|
||||||
|
if (this.getCriteria().getLike() != null && !this.getCriteria().getLike().isEmpty())
|
||||||
|
query.where((builder, root) -> builder.like(root.get("label"), "%" + this.getCriteria().getLike() + "%"));
|
||||||
if (this.getCriteria().projects != null && !this.getCriteria().projects.isEmpty())
|
if (this.getCriteria().projects != null && !this.getCriteria().projects.isEmpty())
|
||||||
query.where(((builder, root) -> root.get("dmp").get("project").get("id").in(this.getCriteria().projects)));
|
query.where(((builder, root) -> root.get("dmp").get("project").get("id").in(this.getCriteria().projects)));
|
||||||
if (this.getCriteria().projectStatus != null) query
|
if (this.getCriteria().projectStatus != null) query
|
||||||
|
|
|
@ -80,8 +80,7 @@ public class DatasetManager {
|
||||||
public DataTableData<DatasetListingModel> getPaged(ApiContext apiContext, DatasetPublicTableRequest datasetTableRequest, Principal principal) throws Exception {
|
public DataTableData<DatasetListingModel> getPaged(ApiContext apiContext, DatasetPublicTableRequest datasetTableRequest, Principal principal) throws Exception {
|
||||||
datasetTableRequest.setQuery(apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetListingModel.class)));
|
datasetTableRequest.setQuery(apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetListingModel.class)));
|
||||||
QueryableList<eu.eudat.data.entities.Dataset> pagedItems = PaginationManager.applyPaging(datasetTableRequest.applyCriteria(), datasetTableRequest);
|
QueryableList<eu.eudat.data.entities.Dataset> pagedItems = PaginationManager.applyPaging(datasetTableRequest.applyCriteria(), datasetTableRequest);
|
||||||
DataTableData<DatasetListingModel> dataTable = new DataTableData<DatasetListingModel>();
|
DataTableData<DatasetListingModel> dataTable = new DataTableData<>();
|
||||||
|
|
||||||
|
|
||||||
CompletableFuture<List<DatasetListingModel>> itemsFuture = pagedItems.
|
CompletableFuture<List<DatasetListingModel>> itemsFuture = pagedItems.
|
||||||
selectAsync(item -> new DatasetListingModel().fromDataModel(item)).whenComplete((resultList, throwable) -> {
|
selectAsync(item -> new DatasetListingModel().fromDataModel(item)).whenComplete((resultList, throwable) -> {
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
#eu.eudat.logic.security.portmapping.https = 7444
|
#eu.eudat.logic.security.portmapping.https = 7444
|
||||||
########################/Security########################################
|
########################/Security########################################
|
||||||
server.port=8080
|
server.port=8080
|
||||||
server.tomcat.max-threads = 1000
|
server.tomcat.max-threads = 20
|
||||||
|
server.tomcat.max-connections = 10000
|
||||||
logging.file=/logs/spring-boot-logging.log
|
logging.file=/logs/spring-boot-logging.log
|
||||||
##########################Persistence##########################################
|
##########################Persistence##########################################
|
||||||
database.driver-class-name=org.postgresql.Driver
|
database.driver-class-name=org.postgresql.Driver
|
||||||
|
|
|
@ -3,8 +3,8 @@ root = true
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
indent_style = space
|
indent_style = tab
|
||||||
indent_size = 2
|
indent_size = 4
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ FROM johnpapa/angular-cli as angular
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json /app/
|
COPY package.json /app/
|
||||||
RUN npm cache clear --force && npm install
|
RUN npm cache clear --force && npm install
|
||||||
|
|
||||||
COPY ./ /app/
|
COPY ./ /app/
|
||||||
ARG env=dev
|
ARG env=dev
|
||||||
ARG aot=--no-aot
|
ARG aot=--no-aot
|
||||||
|
|
|
@ -9,4 +9,8 @@ server {
|
||||||
location /material/ {
|
location /material/ {
|
||||||
alias /usr/share/nginx/static/;
|
alias /usr/share/nginx/static/;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /.well-known/ {
|
||||||
|
alias /usr/share/nginx/wwwcert/;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
import { BaseHttpService } from "../utilities/cite-http-service-module/base-http.service";
|
import { BaseHttpService } from '../utilities/cite-http-service-module/base-http.service';
|
||||||
import { HttpClient, HttpClientModule } from "@angular/common/http";
|
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||||
import { TranslateLoader } from "@ngx-translate/core";
|
import { TranslateLoader } from '@ngx-translate/core';
|
||||||
import { TranslateModule } from "@ngx-translate/core";
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { SharedModule } from "../shared/shared.module";
|
import { SharedModule } from '../shared/shared.module';
|
||||||
import { FormsModule } from "@angular/forms";
|
import { FormsModule } from '@angular/forms';
|
||||||
import { CommonModule } from "@angular/common";
|
import { CommonModule } from '@angular/common';
|
||||||
import { NgModule } from "@angular/core";
|
import { NgModule } from '@angular/core';
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { TranslateHttpLoader } from "@ngx-translate/http-loader";
|
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
||||||
import { AboutRoutes } from "./about.routes";
|
import { AboutRoutes } from './about.routes';
|
||||||
import { AboutComponent } from "./components/about.component";
|
import { AboutComponent } from './components/about.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { AboutComponent } from "./components/about.component";
|
import { AboutComponent } from './components/about.component';
|
||||||
import { Routes, RouterModule } from "@angular/router";
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: '', component: AboutComponent },
|
{ path: '', component: AboutComponent },
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Component, ViewEncapsulation, OnInit } from "@angular/core";
|
import { Component, ViewEncapsulation, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from "@angular/router";
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-about',
|
selector: 'app-about',
|
||||||
|
|
|
@ -31,7 +31,7 @@ const appRoutes: Routes = [
|
||||||
canActivate: [AuthGuard]
|
canActivate: [AuthGuard]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "dmps",
|
path: 'dmps',
|
||||||
loadChildren: './dmps/dmps.module#DataManagementPlanModule',
|
loadChildren: './dmps/dmps.module#DataManagementPlanModule',
|
||||||
data: {
|
data: {
|
||||||
breadcrumb: true
|
breadcrumb: true
|
||||||
|
@ -39,7 +39,7 @@ const appRoutes: Routes = [
|
||||||
canActivate: [AuthGuard]
|
canActivate: [AuthGuard]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "dmp-profiles",
|
path: 'dmp-profiles',
|
||||||
loadChildren: './dmp-profiles/dmp-profile.module#DataManagamentPlanProfileModule',
|
loadChildren: './dmp-profiles/dmp-profile.module#DataManagamentPlanProfileModule',
|
||||||
data: {
|
data: {
|
||||||
breadcrumb: true
|
breadcrumb: true
|
||||||
|
@ -71,32 +71,32 @@ const appRoutes: Routes = [
|
||||||
pathMatch: 'full'
|
pathMatch: 'full'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "unauthorized",
|
path: 'unauthorized',
|
||||||
loadChildren: './unauthorized/unauthorized.module#UnauthorizedModule',
|
loadChildren: './unauthorized/unauthorized.module#UnauthorizedModule',
|
||||||
data: {
|
data: {
|
||||||
breadcrumb: true
|
breadcrumb: true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "users",
|
path: 'users',
|
||||||
loadChildren: './users/users.module#UsersModule'
|
loadChildren: './users/users.module#UsersModule'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "datasetsProfiles",
|
path: 'datasetsProfiles',
|
||||||
loadChildren: './datasets-admin-listing/dataset-admin.module#DatasetAdminModule',
|
loadChildren: './datasets-admin-listing/dataset-admin.module#DatasetAdminModule',
|
||||||
data: {
|
data: {
|
||||||
breadcrumb: true
|
breadcrumb: true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "welcome",
|
path: 'welcome',
|
||||||
component: WelcomepageComponent,
|
component: WelcomepageComponent,
|
||||||
data: {
|
data: {
|
||||||
breadcrumb: false
|
breadcrumb: false
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "api/oauth/authorized/b2access",
|
path: 'api/oauth/authorized/b2access',
|
||||||
component: B2AccessLoginComponent,
|
component: B2AccessLoginComponent,
|
||||||
data: {
|
data: {
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,21 +2,21 @@
|
||||||
|
|
||||||
<div class="container-fluid main-container">
|
<div class="container-fluid main-container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<help-content position="top"></help-content>
|
<app-help-content position="top"></app-help-content>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<help-content position="left"></help-content>
|
<app-help-content position="left"></app-help-content>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<app-breadcrumb *ngIf="this.isAuthenticated() && (hasBreadCrumb | async)"></app-breadcrumb>
|
<app-breadcrumb *ngIf="this.isAuthenticated() && (hasBreadCrumb | async)"></app-breadcrumb>
|
||||||
<router-outlet (activate)='onActivate($event)' (deactivate)='onDeactivate($event)'></router-outlet>
|
<router-outlet (activate)='onActivate($event)' (deactivate)='onDeactivate($event)'></router-outlet>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<help-content position="right"></help-content>
|
<app-help-content position="right"></app-help-content>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<help-content position="bottom"></help-content>
|
<app-help-content position="bottom"></app-help-content>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -33,11 +33,11 @@ export class AppComponent implements OnInit {
|
||||||
private breadCrumbResolverService: BreadCrumbResolverService,
|
private breadCrumbResolverService: BreadCrumbResolverService,
|
||||||
private cultureService: CultureService
|
private cultureService: CultureService
|
||||||
) {
|
) {
|
||||||
this.initializeServices()
|
this.initializeServices();
|
||||||
}
|
}
|
||||||
|
|
||||||
onActivate(event: any) {
|
onActivate(event: any) {
|
||||||
this.breadCrumbResolverService.push(event)
|
this.breadCrumbResolverService.push(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
onDeactivate(event: any) {
|
onDeactivate(event: any) {
|
||||||
|
@ -50,7 +50,7 @@ export class AppComponent implements OnInit {
|
||||||
.map(() => this.route)
|
.map(() => this.route)
|
||||||
.map(route => route.firstChild)
|
.map(route => route.firstChild)
|
||||||
.switchMap(route => route.data)
|
.switchMap(route => route.data)
|
||||||
.map(data => data['breadcrumb'])
|
.map(data => data['breadcrumb']);
|
||||||
}
|
}
|
||||||
|
|
||||||
login() {
|
login() {
|
||||||
|
@ -63,7 +63,7 @@ export class AppComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public isAuthenticated(): boolean {
|
public isAuthenticated(): boolean {
|
||||||
return !(!this.authentication.current())
|
return !(!this.authentication.current());
|
||||||
}
|
}
|
||||||
|
|
||||||
goToDMPs() {
|
goToDMPs() {
|
||||||
|
|
|
@ -4,4 +4,4 @@ export const HostConfiguration = {
|
||||||
App: environment.App,
|
App: environment.App,
|
||||||
CacheLifeTimeMillis: 30000,
|
CacheLifeTimeMillis: 30000,
|
||||||
HelpServiceUrl: environment.HelpServiceUrl
|
HelpServiceUrl: environment.HelpServiceUrl
|
||||||
}
|
};
|
||||||
|
|
|
@ -57,8 +57,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<field-form *ngIf="!isComposite" [form]="form.get('fields').get(''+0)" [dataModel]="dataModel.fields[0]" [showMultiplicity]="false"
|
<app-field-form *ngIf="!isComposite" [form]="form.get('fields').get(''+0)" [dataModel]="dataModel.fields[0]" [showMultiplicity]="false"
|
||||||
[indexPath]="indexPath + 'f' + 0"></field-form>
|
[indexPath]="indexPath + 'f' + 0"></app-field-form>
|
||||||
|
|
||||||
<div *ngIf="isComposite">
|
<div *ngIf="isComposite">
|
||||||
<mat-expansion-panel *ngFor="let field of dataModel.fields let i=index;" #panel>
|
<mat-expansion-panel *ngFor="let field of dataModel.fields let i=index;" #panel>
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
</div>
|
</div>
|
||||||
</mat-expansion-panel-header>
|
</mat-expansion-panel-header>
|
||||||
<div id="{{indexPath + 'f' + i}}" *ngIf="panel.expanded">
|
<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>
|
</div>
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,37 +1,39 @@
|
||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
import { FormArray, FormControl } from '@angular/forms';
|
import { FormArray, FormControl } from '@angular/forms';
|
||||||
import { FieldSet } from '../../models/datasetProfileAdmin/FieldSet';
|
import { FieldSet } from '../../models/datasetProfileAdmin/FieldSet';
|
||||||
import { Field } from '../../models/datasetProfileAdmin/Field';
|
import { Field } from '../../models/datasetProfileAdmin/Field';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'compositefield-form',
|
selector: 'app-compositefield-form',
|
||||||
templateUrl: './compositefield-form.component.html',
|
templateUrl: './compositefield-form.component.html',
|
||||||
styleUrls: ['./compositefield-form.component.scss']
|
styleUrls: ['./compositefield-form.component.scss']
|
||||||
})
|
})
|
||||||
|
|
||||||
export class CompositeFieldFormComponent {
|
export class CompositeFieldFormComponent implements OnInit {
|
||||||
@Input() form: FormGroup;
|
@Input() form: FormGroup;
|
||||||
@Input() dataModel: FieldSet;
|
@Input() dataModel: FieldSet;
|
||||||
@Input() indexPath: string;
|
@Input() indexPath: string;
|
||||||
|
|
||||||
isComposite: boolean = false;
|
isComposite = false;
|
||||||
isMultiplicityEnabled: boolean = false;
|
isMultiplicityEnabled = false;
|
||||||
|
|
||||||
constructon() { }
|
constructon() { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
//this.addNewField();
|
//this.addNewField();
|
||||||
if (this.form.get("multiplicity"))
|
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').value.min > 1 || this.form.get('multiplicity').value.max > 1) {
|
||||||
this.isMultiplicityEnabled = true;
|
this.isMultiplicityEnabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
this.isComposite = this.dataModel.fields.length > 1;
|
this.isComposite = this.dataModel.fields.length > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
onIsCompositeChange(isComposite: boolean) {
|
onIsCompositeChange(isComposite: boolean) {
|
||||||
if (!isComposite && (<FormArray>this.form.get("fields")).length > 1) {
|
if (!isComposite && (<FormArray>this.form.get('fields')).length > 1) {
|
||||||
for (let i = 0; i < (<FormArray>this.form.get("fields")).length - 1; i++) {
|
for (let i = 0; i < (<FormArray>this.form.get('fields')).length - 1; i++) {
|
||||||
(<FormArray>this.form.get("fields")).removeAt(1);
|
(<FormArray>this.form.get('fields')).removeAt(1);
|
||||||
}
|
}
|
||||||
this.dataModel.fields.splice(1);
|
this.dataModel.fields.splice(1);
|
||||||
}
|
}
|
||||||
|
@ -39,19 +41,19 @@ export class CompositeFieldFormComponent {
|
||||||
|
|
||||||
onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) {
|
onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) {
|
||||||
if (!isMultiplicityEnabled) {
|
if (!isMultiplicityEnabled) {
|
||||||
(<FormControl>this.form.get('multiplicity').get("min")).setValue(0);
|
(<FormControl>this.form.get('multiplicity').get('min')).setValue(0);
|
||||||
(<FormControl>this.form.get('multiplicity').get("max")).setValue(0);
|
(<FormControl>this.form.get('multiplicity').get('max')).setValue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addNewField() {
|
addNewField() {
|
||||||
let field: Field = new Field();
|
const field: Field = new Field();
|
||||||
this.dataModel.fields.push(field);
|
this.dataModel.fields.push(field);
|
||||||
(<FormArray>this.form.get("fields")).push(field.buildForm());
|
(<FormArray>this.form.get('fields')).push(field.buildForm());
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteField(index) {
|
DeleteField(index) {
|
||||||
this.dataModel.fields.splice(index, 1);
|
this.dataModel.fields.splice(index, 1);
|
||||||
(<FormArray>this.form.get("fields")).removeAt(index);
|
(<FormArray>this.form.get('fields')).removeAt(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { NgModule } from "@angular/core";
|
import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
|
||||||
import { DatasetProfileRoutes } from "./dataset-profile.router";
|
import { DatasetProfileRoutes } from './dataset-profile.router';
|
||||||
import { RouterModule } from "@angular/router";
|
import { RouterModule } from '@angular/router';
|
||||||
|
|
||||||
import { FormComponent } from './form/form.component';
|
import { FormComponent } from './form/form.component';
|
||||||
//import { GroupFieldFormComponent } from './groupfield-form/groupfield-form.component';
|
//import { GroupFieldFormComponent } from './groupfield-form/groupfield-form.component';
|
||||||
|
@ -12,7 +12,7 @@ import { SectionFormComponent } from './section-form/section-form.component';
|
||||||
import { PageFormComponent } from './page-form/page-component';
|
import { PageFormComponent } from './page-form/page-component';
|
||||||
import { CompositeFieldFormComponent } from './compositefield-form/compositefield-form.component';
|
import { CompositeFieldFormComponent } from './compositefield-form/compositefield-form.component';
|
||||||
import { FieldFormComponent } from './field-form/field-form.component';
|
import { FieldFormComponent } from './field-form/field-form.component';
|
||||||
import { HttpClientModule, HttpClient } from "@angular/common/http";
|
import { HttpClientModule, HttpClient } from '@angular/common/http';
|
||||||
|
|
||||||
import { CheckBoxComponent } from '../shared/componentsAdmin/checkbox/checkbox-component';
|
import { CheckBoxComponent } from '../shared/componentsAdmin/checkbox/checkbox-component';
|
||||||
import { FreeTextData } from '../models/DataField/FreeTextData';
|
import { FreeTextData } from '../models/DataField/FreeTextData';
|
||||||
|
@ -23,9 +23,9 @@ import { RadioBoxComponent } from '../shared/componentsAdmin/radiobox/radiobox-c
|
||||||
import { WordlistComponent } from '../shared/componentsAdmin/wordlist/wordlist-component';
|
import { WordlistComponent } from '../shared/componentsAdmin/wordlist/wordlist-component';
|
||||||
import { AutocompleteComponent } from '../shared/componentsAdmin/autocomplete/autocomplete-component';
|
import { AutocompleteComponent } from '../shared/componentsAdmin/autocomplete/autocomplete-component';
|
||||||
import { ComboboxComponent } from '../shared/componentsAdmin/combobox/combobox-component';
|
import { ComboboxComponent } from '../shared/componentsAdmin/combobox/combobox-component';
|
||||||
import { SharedModule } from "../shared/shared.module";
|
import { SharedModule } from '../shared/shared.module';
|
||||||
import { DatasetProfilePreviewerComponent } from "./previewer/dataset-profile-previewer.component";
|
import { DatasetProfilePreviewerComponent } from './previewer/dataset-profile-previewer.component';
|
||||||
import { DynamicFormModule } from "../form/dynamic-form.module";
|
import { DynamicFormModule } from '../form/dynamic-form.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
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 = [
|
export const DatasetProfileRoutes: Routes = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,22 +64,22 @@
|
||||||
|
|
||||||
<div fxLayout="row" fxLayoutAlign="start center" [ngSwitch]="form.get('viewStyle').get('renderStyle').value">
|
<div fxLayout="row" fxLayoutAlign="start center" [ngSwitch]="form.get('viewStyle').get('renderStyle').value">
|
||||||
<div class="full-width" *ngSwitchCase="'combobox'">
|
<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>
|
||||||
<div class="full-width" *ngSwitchCase="'radiobox'">
|
<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>
|
||||||
<div class="full-width" *ngSwitchCase="'freetext'">
|
<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>
|
||||||
<div class="full-width" *ngSwitchCase="'textarea'">
|
<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>
|
||||||
<div class="full-width" *ngSwitchCase="'booleanDecision'">
|
<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>
|
||||||
<div class="full-width" *ngSwitchCase="'checkBox'">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<mat-checkbox *ngIf="showMultiplicity" [(ngModel)]="isFieldMultiplicityEnabled" (ngModelChange)="onIsFieldMultiplicityEnabledChange(isFieldMultiplicityEnabled)">Multiplicity</mat-checkbox>
|
<mat-checkbox *ngIf="showMultiplicity" [(ngModel)]="isFieldMultiplicityEnabled" (ngModelChange)="onIsFieldMultiplicityEnabledChange(isFieldMultiplicityEnabled)">Multiplicity</mat-checkbox>
|
||||||
|
@ -99,9 +99,6 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</mat-expansion-panel-header>
|
</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>
|
</mat-expansion-panel>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -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 { FormGroup, FormControl, FormArray } from '@angular/forms';
|
||||||
import { ValidationTypes } from '../../models/common/ValidationTypes';
|
import { ValidationTypes } from '../../models/common/ValidationTypes';
|
||||||
import { Field } from '../../models/datasetProfileAdmin/Field';
|
import { Field } from '../../models/datasetProfileAdmin/Field';
|
||||||
import { Rule } from '../../models/datasetProfileAdmin/Rule';
|
import { Rule } from '../../models/datasetProfileAdmin/Rule';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'field-form',
|
selector: 'app-field-form',
|
||||||
templateUrl: './field-form.component.html',
|
templateUrl: './field-form.component.html',
|
||||||
styleUrls: ['./field-form.component.scss']
|
styleUrls: ['./field-form.component.scss']
|
||||||
})
|
})
|
||||||
|
|
||||||
export class FieldFormComponent {
|
export class FieldFormComponent implements OnInit {
|
||||||
@Input() form: FormGroup;
|
@Input() form: FormGroup;
|
||||||
@Input() dataModel: Field;
|
@Input() dataModel: Field;
|
||||||
@Input() showMultiplicity: boolean = true;
|
@Input() showMultiplicity = true;
|
||||||
@Input() indexPath: string;
|
@Input() indexPath: string;
|
||||||
validationsOptions: Array<any>;
|
validationsOptions: Array<any>;
|
||||||
isFieldMultiplicityEnabled: boolean = false;
|
isFieldMultiplicityEnabled = false;
|
||||||
|
|
||||||
constructon() {
|
constructon() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.form.get("multiplicity"))
|
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').value.min > 1 || this.form.get('multiplicity').value.max > 1) {
|
||||||
this.isFieldMultiplicityEnabled = true;
|
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();
|
// this.addNewRule();
|
||||||
}
|
}
|
||||||
|
|
||||||
onIsFieldMultiplicityEnabledChange(isFieldMultiplicityEnabled: boolean) {
|
onIsFieldMultiplicityEnabledChange(isFieldMultiplicityEnabled: boolean) {
|
||||||
if (!isFieldMultiplicityEnabled) {
|
if (!isFieldMultiplicityEnabled) {
|
||||||
(<FormControl>this.form.get('multiplicity').get("min")).setValue(0);
|
(<FormControl>this.form.get('multiplicity').get('min')).setValue(0);
|
||||||
(<FormControl>this.form.get('multiplicity').get("max")).setValue(0);
|
(<FormControl>this.form.get('multiplicity').get('max')).setValue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addNewRule() {
|
addNewRule() {
|
||||||
let rule: Rule = new Rule();
|
const rule: Rule = new Rule();
|
||||||
this.dataModel.visible.rules.push(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) {
|
DeleteRule(index) {
|
||||||
this.dataModel.visible.rules.splice(index, 1);
|
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() {
|
onchangeCombo() {
|
||||||
if (this.form.get("data")) this.form.removeControl("data");
|
if (this.form.get('data')) { this.form.removeControl('data'); }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -30,7 +30,7 @@
|
||||||
</mat-expansion-panel-header>
|
</mat-expansion-panel-header>
|
||||||
<div id="{{'p' + i}}" *ngIf="panel.expanded">
|
<div id="{{'p' + i}}" *ngIf="panel.expanded">
|
||||||
<div>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
</mat-expansion-panel-header>
|
</mat-expansion-panel-header>
|
||||||
<div id="{{'s' + i}}" *ngIf="panel.expanded">
|
<div id="{{'s' + i}}" *ngIf="panel.expanded">
|
||||||
<div>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
|
|
|
@ -4,23 +4,21 @@ import { DatasetProfileModelAdmin } from '../../models/datasetProfileAdmin/Datas
|
||||||
import { Page } from '../../models/datasetProfileAdmin/Page';
|
import { Page } from '../../models/datasetProfileAdmin/Page';
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormGroup, FormControl } from '@angular/forms';
|
import { FormGroup, FormControl } from '@angular/forms';
|
||||||
import { SectionFormComponent } from '../section-form/section-form.component';
|
|
||||||
import { FormArray } from '@angular/forms';
|
import { FormArray } from '@angular/forms';
|
||||||
import { Router, ActivatedRoute, ParamMap, Params } from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
import { PageFormComponent } from '../page-form/page-component'
|
|
||||||
import { DatasetProfileAdmin } from '../../services/datasetProfileAdmin/datasetProfileAfmin.service';
|
import { DatasetProfileAdmin } from '../../services/datasetProfileAdmin/datasetProfileAfmin.service';
|
||||||
import { Section } from '../../models/datasetProfileAdmin/Section';
|
import { Section } from '../../models/datasetProfileAdmin/Section';
|
||||||
import { MatDialog } from '@angular/material';
|
import { MatDialog } from '@angular/material';
|
||||||
import { DatasetProfilePreviewerComponent } from '../previewer/dataset-profile-previewer.component';
|
import { DatasetProfilePreviewerComponent } from '../previewer/dataset-profile-previewer.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'form-comp',
|
selector: 'app-form-comp',
|
||||||
templateUrl: './form.component.html',
|
templateUrl: './form.component.html',
|
||||||
providers: [DatasetProfileAdmin, DatasetProfileService],
|
providers: [DatasetProfileAdmin, DatasetProfileService],
|
||||||
styleUrls: ['./form.component.scss']
|
styleUrls: ['./form.component.scss']
|
||||||
})
|
})
|
||||||
|
|
||||||
export class FormComponent {
|
export class FormComponent implements OnInit {
|
||||||
|
|
||||||
dataModel: DatasetProfileModelAdmin;
|
dataModel: DatasetProfileModelAdmin;
|
||||||
form: FormGroup;
|
form: FormGroup;
|
||||||
|
@ -45,8 +43,7 @@ export class FormComponent {
|
||||||
this.dataModel = JsonSerializer.fromJSONObject(data, DatasetProfileModelAdmin);
|
this.dataModel = JsonSerializer.fromJSONObject(data, DatasetProfileModelAdmin);
|
||||||
this.form = this.dataModel.buildForm();
|
this.form = this.dataModel.buildForm();
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.addSection();
|
this.addSection();
|
||||||
this.addPage();
|
this.addPage();
|
||||||
}
|
}
|
||||||
|
@ -54,31 +51,31 @@ export class FormComponent {
|
||||||
|
|
||||||
onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) {
|
onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) {
|
||||||
if (!isMultiplicityEnabled) {
|
if (!isMultiplicityEnabled) {
|
||||||
(<FormControl>this.form.get('multiplicity').get("min")).setValue(0);
|
(<FormControl>this.form.get('multiplicity').get('min')).setValue(0);
|
||||||
(<FormControl>this.form.get('multiplicity').get("max")).setValue(0);
|
(<FormControl>this.form.get('multiplicity').get('max')).setValue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addSection() {
|
addSection() {
|
||||||
let section: Section = new Section();
|
const section: Section = new Section();
|
||||||
this.dataModel.sections.push(section);
|
this.dataModel.sections.push(section);
|
||||||
(<FormArray>this.form.get("sections")).push(section.buildForm());
|
(<FormArray>this.form.get('sections')).push(section.buildForm());
|
||||||
}
|
}
|
||||||
|
|
||||||
addPage() {
|
addPage() {
|
||||||
let page: Page = new Page(this.dataModel.pages.length);
|
const page: Page = new Page(this.dataModel.pages.length);
|
||||||
this.dataModel.pages.push(page);
|
this.dataModel.pages.push(page);
|
||||||
(<FormArray>this.form.get("pages")).push(page.buildForm());
|
(<FormArray>this.form.get('pages')).push(page.buildForm());
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteSection(index) {
|
DeleteSection(index) {
|
||||||
this.dataModel.sections.splice(index, 1);
|
this.dataModel.sections.splice(index, 1);
|
||||||
(<FormArray>this.form.get("sections")).removeAt(index)
|
(<FormArray>this.form.get('sections')).removeAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeletePage(index) {
|
DeletePage(index) {
|
||||||
this.dataModel.pages.splice(index, 1);
|
this.dataModel.pages.splice(index, 1);
|
||||||
(<FormArray>this.form.get("pages")).removeAt(index)
|
(<FormArray>this.form.get('pages')).removeAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
createForm(data) {
|
createForm(data) {
|
||||||
|
@ -88,18 +85,21 @@ export class FormComponent {
|
||||||
return this.datasetprofileAdmin.updateForm(id, data);
|
return this.datasetprofileAdmin.updateForm(id, data);
|
||||||
}
|
}
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
let data = this.form.value;
|
const data = this.form.value;
|
||||||
|
|
||||||
if (this.profileID) this.updateForm(this.profileID, data).subscribe(() => {
|
if (this.profileID) {
|
||||||
this.router.navigate(['/datasetsProfiles'])
|
this.updateForm(this.profileID, data).subscribe(() => {
|
||||||
|
this.router.navigate(['/datasetsProfiles']);
|
||||||
});
|
});
|
||||||
else this.createForm(data).subscribe(() => {
|
} else {
|
||||||
this.router.navigate(['/datasetsProfiles'])
|
this.createForm(data).subscribe(() => {
|
||||||
|
this.router.navigate(['/datasetsProfiles']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
preview() {
|
preview() {
|
||||||
let dialogRef = this.dialog.open(DatasetProfilePreviewerComponent, {
|
const dialogRef = this.dialog.open(DatasetProfilePreviewerComponent, {
|
||||||
height: '355px',
|
height: '355px',
|
||||||
width: '700px',
|
width: '700px',
|
||||||
data: {
|
data: {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
||||||
import { FormGroup } from '@angular/forms'
|
import { FormGroup } from '@angular/forms';
|
||||||
import { Page } from '../../models/datasetProfileAdmin/Page';
|
import { Page } from '../../models/datasetProfileAdmin/Page';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'page-form',
|
selector: 'app-page-form',
|
||||||
templateUrl: './page-component.html',
|
templateUrl: './page-component.html',
|
||||||
styleUrls: ['./page-component.scss']
|
styleUrls: ['./page-component.scss']
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
<dynamic-form *ngIf="formGroup" [form]="this.formGroup"
|
<app-dynamic-form *ngIf="formGroup" [form]="this.formGroup"
|
||||||
[dataModel]="datasetWizardModel"></dynamic-form>
|
[dataModel]="datasetWizardModel"></app-dynamic-form>
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
import { ViewEncapsulation, Component, Inject } from "@angular/core";
|
import { ViewEncapsulation, Component, Inject, OnInit } from '@angular/core';
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
import { FormGroup } from "@angular/forms";
|
import { FormGroup } from '@angular/forms';
|
||||||
import { DatasetProfileDefinitionModel } from "../../models/DatasetProfileDefinitionModel";
|
import { DatasetProfileDefinitionModel } from '../../models/DatasetProfileDefinitionModel';
|
||||||
import { JsonSerializer } from "../../utilities/JsonSerializer";
|
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
||||||
import { DatasetModel } from "../../models/datasets/DatasetModel";
|
import { DatasetModel } from '../../models/datasets/DatasetModel';
|
||||||
import { DatasetWizardModel } from "../../models/datasets/DatasetWizardModel";
|
import { DatasetWizardModel } from '../../models/datasets/DatasetWizardModel';
|
||||||
import { DatasetProfileService } from "../../services/dataset-profile.service";
|
import { DatasetProfileService } from '../../services/dataset-profile.service';
|
||||||
import { DatasetProfileAdmin } from "../../services/datasetProfileAdmin/datasetProfileAfmin.service";
|
import { DatasetProfileAdmin } from '../../services/datasetProfileAdmin/datasetProfileAfmin.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'dataset-profile-previewer',
|
selector: 'app-dataset-profile-previewer',
|
||||||
templateUrl: './dataset-profile-previewer.component.html',
|
templateUrl: './dataset-profile-previewer.component.html',
|
||||||
styleUrls: ['./dataset-profile-previewer.component.scss'],
|
styleUrls: ['./dataset-profile-previewer.component.scss'],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
|
|
||||||
export class DatasetProfilePreviewerComponent {
|
export class DatasetProfilePreviewerComponent implements OnInit {
|
||||||
formGroup: FormGroup
|
formGroup: FormGroup;
|
||||||
datasetWizardModel: DatasetWizardModel
|
datasetWizardModel: DatasetWizardModel;
|
||||||
constructor(
|
constructor(
|
||||||
private datasetProfileAdminService: DatasetProfileAdmin,
|
private datasetProfileAdminService: DatasetProfileAdmin,
|
||||||
public dialogRef: MatDialogRef<DatasetProfilePreviewerComponent>,
|
public dialogRef: MatDialogRef<DatasetProfilePreviewerComponent>,
|
||||||
|
@ -28,9 +28,9 @@ export class DatasetProfilePreviewerComponent {
|
||||||
|
|
||||||
this.datasetProfileAdminService.preview(this.data['model']).subscribe(x => {
|
this.datasetProfileAdminService.preview(this.data['model']).subscribe(x => {
|
||||||
this.datasetWizardModel = new DatasetWizardModel();
|
this.datasetWizardModel = new DatasetWizardModel();
|
||||||
this.datasetWizardModel.datasetProfileDefinition = JsonSerializer.fromJSONObject(x, DatasetProfileDefinitionModel)
|
this.datasetWizardModel.datasetProfileDefinition = JsonSerializer.fromJSONObject(x, DatasetProfileDefinitionModel);
|
||||||
this.formGroup = this.datasetWizardModel.buildForm();
|
this.formGroup = this.datasetWizardModel.buildForm();
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { FormGroup } from '@angular/forms'
|
import { FormGroup } from '@angular/forms';
|
||||||
import { Rule } from 'app/models/datasetProfileAdmin/Rule'
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'rule-form',
|
selector: 'app-rule-form',
|
||||||
templateUrl: './rule.component.html',
|
templateUrl: './rule.component.html',
|
||||||
styleUrls: ['./rule.component.scss']
|
styleUrls: ['./rule.component.scss']
|
||||||
})
|
})
|
||||||
|
|
||||||
export class RuleFormComponent {
|
export class RuleFormComponent {
|
||||||
@Input() form: FormGroup;
|
@Input() form: FormGroup;
|
||||||
@Input() dataModel: FormGroup;
|
@Input() dataModel: FormGroup;
|
||||||
|
|
||||||
TargetValidation(){
|
TargetValidation() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -54,7 +54,7 @@
|
||||||
</div>
|
</div>
|
||||||
</mat-expansion-panel-header>
|
</mat-expansion-panel-header>
|
||||||
<div id="{{indexPath + 's' + i}}" *ngIf="panel.expanded">
|
<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>
|
</div>
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
</div>
|
</div>
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
</div>
|
</div>
|
||||||
</mat-expansion-panel-header>
|
</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>
|
</mat-expansion-panel>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,13 +9,13 @@ import { Page } from '../../models/datasetProfileAdmin/Page';
|
||||||
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'section-form',
|
selector: 'app-section-form',
|
||||||
templateUrl: './section-form.component.html',
|
templateUrl: './section-form.component.html',
|
||||||
styleUrls: ['./section-form.component.scss'],
|
styleUrls: ['./section-form.component.scss'],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
|
|
||||||
export class SectionFormComponent {
|
export class SectionFormComponent implements OnInit {
|
||||||
@Input() form: FormGroup;
|
@Input() form: FormGroup;
|
||||||
@Input() dataModel: Section;
|
@Input() dataModel: Section;
|
||||||
@Input() indexPath: string;
|
@Input() indexPath: string;
|
||||||
|
@ -23,40 +23,42 @@ export class SectionFormComponent {
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.form.root.get("pages").valueChanges.subscribe(x =>
|
this.form.root.get('pages').valueChanges.subscribe(x =>
|
||||||
this.keepPageSelectionValid(x)
|
this.keepPageSelectionValid(x)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
addField() {
|
addField() {
|
||||||
let fieldSet: FieldSet = new FieldSet();
|
const fieldSet: FieldSet = new FieldSet();
|
||||||
let field: Field = new Field();
|
const field: Field = new Field();
|
||||||
fieldSet.fields.push(field);
|
fieldSet.fields.push(field);
|
||||||
if (this.dataModel.fieldSets)
|
if (this.dataModel.fieldSets) {
|
||||||
this.dataModel.fieldSets.push(fieldSet);
|
this.dataModel.fieldSets.push(fieldSet);
|
||||||
(<FormArray>this.form.get("fieldSets")).push(fieldSet.buildForm());
|
}
|
||||||
|
(<FormArray>this.form.get('fieldSets')).push(fieldSet.buildForm());
|
||||||
}
|
}
|
||||||
|
|
||||||
addSectioninSection() {
|
addSectioninSection() {
|
||||||
let section: Section = new Section();
|
const section: Section = new Section();
|
||||||
this.dataModel.sections.push(section);
|
this.dataModel.sections.push(section);
|
||||||
(<FormArray>this.form.get("sections")).push(section.buildForm());
|
(<FormArray>this.form.get('sections')).push(section.buildForm());
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteSectionInSection(index) {
|
DeleteSectionInSection(index) {
|
||||||
this.dataModel.sections.splice(index);
|
this.dataModel.sections.splice(index);
|
||||||
(<FormArray>this.form.get("sections")).removeAt(index);
|
(<FormArray>this.form.get('sections')).removeAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteFieldSet(index) {
|
DeleteFieldSet(index) {
|
||||||
this.dataModel.fieldSets.splice(index, 1);
|
this.dataModel.fieldSets.splice(index, 1);
|
||||||
(<FormArray>this.form.get("fieldSets")).removeAt(index);
|
(<FormArray>this.form.get('fieldSets')).removeAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
keepPageSelectionValid(pagesJson: Array<any>) {
|
keepPageSelectionValid(pagesJson: Array<any>) {
|
||||||
let selectedPage = this.form.get("page").value as String;
|
const selectedPage = this.form.get('page').value as String;
|
||||||
let pages: Array<Page> = JsonSerializer.fromJSONArray(pagesJson, Page);
|
const pages: Array<Page> = JsonSerializer.fromJSONArray(pagesJson, Page);
|
||||||
if (pages.find(elem => elem.id === selectedPage) === undefined)
|
if (pages.find(elem => elem.id === selectedPage) === undefined) {
|
||||||
this.form.get("page").reset();
|
this.form.get('page').reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import { DataTableRequest } from '../models/data-table/DataTableRequest';
|
import { DataTableRequest } from '../models/data-table/DataTableRequest';
|
||||||
import { DatasetListingModel } from '../models/datasets/DatasetListingModel';
|
import { DatasetListingModel } from '../models/datasets/DatasetListingModel';
|
||||||
import { DatasetCriteria } from '../models/criteria/dataset/DatasetCriteria';
|
import { DatasetCriteria } from '../models/criteria/dataset/DatasetCriteria';
|
||||||
import { Component, ViewChild, OnInit, AfterViewInit } from "@angular/core";
|
import { Component, ViewChild, OnInit, AfterViewInit } from '@angular/core';
|
||||||
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
|
import { MatPaginator, MatSort, MatSnackBar } from '@angular/material';
|
||||||
import { Router, Params, ActivatedRoute } from "@angular/router";
|
import { Router, Params, ActivatedRoute } from '@angular/router';
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { DataSource } from "@angular/cdk/table";
|
import { DataSource } from '@angular/cdk/table';
|
||||||
|
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from 'rxjs/Observable';
|
||||||
import { PageEvent } from '@angular/material';
|
import { PageEvent } from '@angular/material';
|
||||||
import { DataManagementPlanService } from "../services/data-management-plan/data-management-plan.service";
|
import { DataManagementPlanService } from '../services/data-management-plan/data-management-plan.service';
|
||||||
import { DataManagementPlanModel } from "../models/data-managemnt-plans/DataManagementPlanModel";
|
import { DataManagementPlanModel } from '../models/data-managemnt-plans/DataManagementPlanModel';
|
||||||
import { DatasetCriteriaComponent } from '../shared/components/criteria/datasets/datasets-criteria.component';
|
import { DatasetCriteriaComponent } from '../shared/components/criteria/datasets/datasets-criteria.component';
|
||||||
import { DatasetProfileAdmin } from '../services/datasetProfileAdmin/datasetProfileAfmin.service';
|
import { DatasetProfileAdmin } from '../services/datasetProfileAdmin/datasetProfileAfmin.service';
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ export class DatasetAdminListingComponent implements OnInit {
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.params.subscribe((params: Params) => {
|
this.route.params.subscribe((params: Params) => {
|
||||||
this.dmpId = params['dmpId'];
|
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.criteria.setCriteria(this.getDefaultCriteria(this.dmpId));
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.criteria.setRefreshCallback(() => this.refresh());
|
this.criteria.setRefreshCallback(() => this.refresh());
|
||||||
|
@ -122,8 +122,8 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
|
||||||
this.isLoadingResults = true;
|
this.isLoadingResults = true;
|
||||||
});
|
});
|
||||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
||||||
let fields: Array<string> = new Array()
|
let fields: Array<string> = new Array();
|
||||||
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
|
if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; }
|
||||||
const request = new DataTableRequest<DatasetCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
const request = new DataTableRequest<DatasetCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
||||||
request.criteria = this._criteria.criteria;
|
request.criteria = this._criteria.criteria;
|
||||||
return this._service.getPaged(request);
|
return this._service.getPaged(request);
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
|
||||||
import { SharedModule } from '../shared/shared.module'
|
import { SharedModule } from '../shared/shared.module';
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
<div class="container">
|
<div class="container ">
|
||||||
|
<h3 class="text-center">{{'DATASET-PUBLIC-LISTING.TITLE' | translate}} {{titlePrefix}}</h3>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-2">
|
<div class="col-md-3">
|
||||||
<app-facet (facetCriteriaChange)="onCriteriaChange($event)">
|
<app-facet (facetCriteriaChange)="onCriteriaChange($event)">
|
||||||
|
|
||||||
</app-facet>
|
</app-facet>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-10">
|
<div class="col-md-9">
|
||||||
<div>
|
<div>
|
||||||
<h3>{{'DATASET-PUBLIC-LISTING.TITLE' | translate}} {{titlePrefix}}</h3>
|
|
||||||
|
|
||||||
|
|
||||||
<app-datasets-criteria-component [isPublic]='true'></app-datasets-criteria-component>
|
<app-datasets-criteria-component [isPublic]='true'></app-datasets-criteria-component>
|
||||||
<mat-card class="mat-card">
|
<mat-card class="mat-card">
|
||||||
<mat-card-header>
|
<mat-card-header>
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
text-center{
|
||||||
|
text-align: center
|
||||||
|
}
|
|
@ -1,17 +1,17 @@
|
||||||
import { OnInit, Component, ViewChild } from "@angular/core";
|
import { OnInit, Component, ViewChild } from '@angular/core';
|
||||||
import { MatSort, MatPaginator, PageEvent, MatSnackBar } from "@angular/material";
|
import { MatSort, MatPaginator, PageEvent, MatSnackBar } from '@angular/material';
|
||||||
import { DatasetCriteriaComponent } from "../../shared/components/criteria/datasets/datasets-criteria.component";
|
import { DatasetCriteriaComponent } from '../../shared/components/criteria/datasets/datasets-criteria.component';
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from 'rxjs';
|
||||||
import { BreadcrumbItem } from "../../shared/components/breadcrumb/definition/breadcrumb-item";
|
import { BreadcrumbItem } from '../../shared/components/breadcrumb/definition/breadcrumb-item';
|
||||||
import { DatasetService } from "../../services/dataset/dataset.service";
|
import { DatasetService } from '../../services/dataset/dataset.service';
|
||||||
import { Router, ActivatedRoute, Params } from "@angular/router";
|
import { Router, ActivatedRoute, Params } from '@angular/router';
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { DataManagementPlanService } from "../../services/data-management-plan/data-management-plan.service";
|
import { DataManagementPlanService } from '../../services/data-management-plan/data-management-plan.service';
|
||||||
import { DatasetCriteria } from "../../models/criteria/dataset/DatasetCriteria";
|
import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria';
|
||||||
import { DataSource } from "@angular/cdk/table";
|
import { DataSource } from '@angular/cdk/table';
|
||||||
import { DatasetListingModel } from "../../models/datasets/DatasetListingModel";
|
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
|
||||||
import { DataTableRequest } from "../../models/data-table/DataTableRequest";
|
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
|
||||||
import { FacetSearchCriteriaModel } from "../../models/facet-search/FacetSearchCriteriaModel";
|
import { FacetSearchCriteriaModel } from '../../models/facet-search/FacetSearchCriteriaModel';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -51,14 +51,15 @@ export class DatasetPublicListingComponent implements OnInit {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.criteria.setRefreshCallback(() => this.refresh());
|
this.criteria.setRefreshCallback(() => this.refresh());
|
||||||
if (this.dmpId != null) {
|
if (this.dmpId != null) {
|
||||||
let dmp = await this.dataManagementPlanService.getSingle(this.dmpId).toPromise()
|
const dmp = await this.dataManagementPlanService.getSingle(this.dmpId).toPromise();
|
||||||
if (params['dmpLabel'] != undefined)
|
if (params['dmpLabel'] !== undefined) {
|
||||||
this.titlePrefix = "for " + params['dmpLabel'];
|
this.titlePrefix = 'for ' + params['dmpLabel'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onCriteriaChange(event){
|
onCriteriaChange(event) {
|
||||||
//console.log(event)
|
//console.log(event)
|
||||||
this.criteria.setCriteria(event);
|
this.criteria.setCriteria(event);
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
@ -117,8 +118,8 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
|
||||||
this.isLoadingResults = true;
|
this.isLoadingResults = true;
|
||||||
});
|
});
|
||||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
||||||
let fields: Array<string> = new Array()
|
let fields: Array<string> = new Array();
|
||||||
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
|
if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; }
|
||||||
const request = new DataTableRequest<FacetSearchCriteriaModel>(startIndex, this._paginator.pageSize, { fields: fields });
|
const request = new DataTableRequest<FacetSearchCriteriaModel>(startIndex, this._paginator.pageSize, { fields: fields });
|
||||||
request.criteria = this._criteria.criteria;
|
request.criteria = this._criteria.criteria;
|
||||||
//if (this.dmpId) request.criteria.allVersions = true;
|
//if (this.dmpId) request.criteria.allVersions = true;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { Component, ViewEncapsulation, OnInit, Inject } from "@angular/core";
|
import { Component, ViewEncapsulation, OnInit, Inject } from '@angular/core';
|
||||||
import { FormGroup } from "@angular/forms";
|
import { FormGroup } from '@angular/forms';
|
||||||
import { DataRepositoryService } from "../../../services/datarepository/datarepository.service";
|
import { DataRepositoryService } from '../../../services/datarepository/datarepository.service';
|
||||||
import { Router, ActivatedRoute } from "@angular/router";
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
import { DataRepositoryModel } from "../../../models/dataRepositories/DataRepositoryModel";
|
import { DataRepositoryModel } from '../../../models/dataRepositories/DataRepositoryModel';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-datarepository-referenced-model-helper',
|
selector: 'app-datarepository-referenced-model-helper',
|
||||||
|
@ -23,14 +23,14 @@ export class DataRepositoryReferencedModelHelperComponent implements OnInit {
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
let datarepo = new DataRepositoryModel();
|
const datarepo = new DataRepositoryModel();
|
||||||
this.formGroup = datarepo.buildForm();
|
this.formGroup = datarepo.buildForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
send(value: any) {
|
send(value: any) {
|
||||||
this.dataRepositoryService.create(this.formGroup.value).subscribe(
|
this.dataRepositoryService.create(this.formGroup.value).subscribe(
|
||||||
(item)=> this.dialogRef.close(item)
|
(item) => this.dialogRef.close(item)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { ExternalDatasetModel } from "../../../models/external-dataset/ExternalDatasetModel";
|
import { ExternalDatasetModel } from '../../../models/external-dataset/ExternalDatasetModel';
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
import { Inject, ViewEncapsulation, Component, OnInit } from "@angular/core";
|
import { Inject, ViewEncapsulation, Component, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from "@angular/router";
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { ExternalDatasetService } from "../../../services/external-dataset/external-dataset.service";
|
import { ExternalDatasetService } from '../../../services/external-dataset/external-dataset.service';
|
||||||
import { FormGroup } from "@angular/forms";
|
import { FormGroup } from '@angular/forms';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-externaldataset-referenced-model-helper',
|
selector: 'app-externaldataset-referenced-model-helper',
|
||||||
|
@ -23,14 +23,14 @@ export class ExternalDatasetReferencedModelHelperComponent implements OnInit {
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
let externalDatasetModel = new ExternalDatasetModel();
|
const externalDatasetModel = new ExternalDatasetModel();
|
||||||
this.formGroup = externalDatasetModel.buildForm();
|
this.formGroup = externalDatasetModel.buildForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
send(value: any) {
|
send(value: any) {
|
||||||
this.externalDatasetService.create(this.formGroup.value).subscribe(
|
this.externalDatasetService.create(this.formGroup.value).subscribe(
|
||||||
(item)=> this.dialogRef.close(item)
|
(item) => this.dialogRef.close(item)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { Component, ViewEncapsulation, OnInit, Inject } from "@angular/core";
|
import { Component, ViewEncapsulation, OnInit, Inject } from '@angular/core';
|
||||||
import { FormGroup } from "@angular/forms";
|
import { FormGroup } from '@angular/forms';
|
||||||
import { ActivatedRoute, Router } from "@angular/router";
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
import { RegisterModel } from "../../../models/registers/RegisterModel";
|
import { RegisterModel } from '../../../models/registers/RegisterModel';
|
||||||
import { RegistryService } from "../../../services/registries/registry.service";
|
import { RegistryService } from '../../../services/registries/registry.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-registry-referenced-model-helper',
|
selector: 'app-registry-referenced-model-helper',
|
||||||
|
@ -23,14 +23,14 @@ export class RegistryReferencedModelHelperComponent implements OnInit {
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
let registryModel = new RegisterModel();
|
const registryModel = new RegisterModel();
|
||||||
this.formGroup = registryModel.buildForm();
|
this.formGroup = registryModel.buildForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
send(value: any) {
|
send(value: any) {
|
||||||
this.registryService.create(this.formGroup.value).subscribe(
|
this.registryService.create(this.formGroup.value).subscribe(
|
||||||
(item)=> this.dialogRef.close(item)
|
(item) => this.dialogRef.close(item)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { ViewEncapsulation, Component, OnInit, Inject } from "@angular/core";
|
import { ViewEncapsulation, Component, OnInit, Inject } from '@angular/core';
|
||||||
import { FormGroup } from "@angular/forms";
|
import { FormGroup } from '@angular/forms';
|
||||||
import { ActivatedRoute, Router } from "@angular/router";
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
import { ServiceModel } from "../../../models/services/ServiceModel";
|
import { ServiceModel } from '../../../models/services/ServiceModel';
|
||||||
import { ServicesDataService } from "../../../services/services/services-data.service";
|
import { ServicesDataService } from '../../../services/services/services-data.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-services-referenced-model-helper',
|
selector: 'app-services-referenced-model-helper',
|
||||||
|
@ -23,14 +23,14 @@ export class ServicesReferencedModelHelperComponent implements OnInit {
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
let serviceModel = new ServiceModel();
|
const serviceModel = new ServiceModel();
|
||||||
this.formGroup = serviceModel.buildForm();
|
this.formGroup = serviceModel.buildForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
send() {
|
send() {
|
||||||
this.registryService.create(this.formGroup.value).subscribe(
|
this.registryService.create(this.formGroup.value).subscribe(
|
||||||
(item)=> this.dialogRef.close(item)
|
(item) => this.dialogRef.close(item)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,8 +225,8 @@
|
||||||
</mat-step>
|
</mat-step>
|
||||||
<mat-step>
|
<mat-step>
|
||||||
<ng-template matStepLabel>{{'DATASET-WIZARD.THIRD-STEP.TITLE' | translate}}</ng-template>
|
<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')"
|
<app-dynamic-form class="full-width" *ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition" [form]="this.formGroup.get('datasetProfileDefinition')"
|
||||||
[dataModel]="datasetWizardModel"></dynamic-form>
|
[dataModel]="datasetWizardModel"></app-dynamic-form>
|
||||||
<div class="navigation-buttons-container">
|
<div class="navigation-buttons-container">
|
||||||
<button style="margin-top:10px;" matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK'
|
<button style="margin-top:10px;" matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK'
|
||||||
| translate}}</button>
|
| translate}}</button>
|
||||||
|
|
|
@ -15,10 +15,10 @@ import { ExternalSourcesService } from '../../services/external-sources/external
|
||||||
import { DatasetWizardService } from '../../services/dataset-wizard/dataset-wizard.service';
|
import { DatasetWizardService } from '../../services/dataset-wizard/dataset-wizard.service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { ActivatedRoute, Router, Params } from '@angular/router';
|
import { ActivatedRoute, Router, Params } from '@angular/router';
|
||||||
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation, TemplateRef, ChangeDetectionStrategy } from "@angular/core";
|
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation, TemplateRef, ChangeDetectionStrategy } from '@angular/core';
|
||||||
import { FormGroup, Validators, FormBuilder, FormArray } from "@angular/forms";
|
import { FormGroup, Validators, FormBuilder, FormArray } from '@angular/forms';
|
||||||
import * as FileSaver from 'file-saver';
|
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 { ExternalDatasetCriteria } from '../../models/criteria/external-dataset/ExternalDatasetCriteria';
|
||||||
import { ExternalDatasetModel } from '../../models/external-dataset/ExternalDatasetModel';
|
import { ExternalDatasetModel } from '../../models/external-dataset/ExternalDatasetModel';
|
||||||
import { RegistryCriteria } from '../../models/criteria/registry/RegistryCriteria';
|
import { RegistryCriteria } from '../../models/criteria/registry/RegistryCriteria';
|
||||||
|
@ -48,25 +48,11 @@ import { ServicesReferencedModelHelperComponent } from '../dataset-referenced-mo
|
||||||
styleUrls: ['./dataset-wizard.component.scss'],
|
styleUrls: ['./dataset-wizard.component.scss'],
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
})
|
})
|
||||||
export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
export class DatasetWizardComponent implements OnInit, AfterViewInit, IBreadCrumbComponent {
|
||||||
breadCrumbs: Observable<BreadcrumbItem[]>;
|
breadCrumbs: Observable<BreadcrumbItem[]>;
|
||||||
viewOnly = false;
|
viewOnly = false;
|
||||||
@ViewChild('stepper') stepper: MatStepper;
|
@ViewChild('stepper') stepper: MatStepper;
|
||||||
//autocomplete Display Functions;
|
//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;
|
//autocomplete Configurations;
|
||||||
externalDatasetAutoCompleteConfiguration: AutoCompleteConfiguration;
|
externalDatasetAutoCompleteConfiguration: AutoCompleteConfiguration;
|
||||||
registriesAutoCompleteConfiguration: AutoCompleteConfiguration;
|
registriesAutoCompleteConfiguration: AutoCompleteConfiguration;
|
||||||
|
@ -83,7 +69,22 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
||||||
datasetProfileDefinitionModel: DatasetProfileDefinitionModel;
|
datasetProfileDefinitionModel: DatasetProfileDefinitionModel;
|
||||||
|
|
||||||
availableProfiles: DatasetProfileModel[] = [];
|
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(
|
constructor(
|
||||||
private datasetWizardService: DatasetWizardService,
|
private datasetWizardService: DatasetWizardService,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
|
@ -100,54 +101,49 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isLinear = false;
|
|
||||||
firstStepFormGroup: FormGroup;
|
|
||||||
secondFormGroup: FormGroup;
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
|
|
||||||
this.route
|
this.route
|
||||||
.data
|
.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();
|
dmpRequestItem.criteria = new DataManagementPlanCriteria();
|
||||||
|
|
||||||
let externalDatasetRequestItem: RequestItem<ExternalDatasetCriteria> = new RequestItem();
|
const externalDatasetRequestItem: RequestItem<ExternalDatasetCriteria> = new RequestItem();
|
||||||
externalDatasetRequestItem.criteria = new ExternalDatasetCriteria();
|
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();
|
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();
|
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();
|
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();
|
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.externalSourcesConfigurationService.getExternalSourcesConfiguration().subscribe(result => {
|
||||||
this.externalSourcesConfiguration = result;
|
this.externalSourcesConfiguration = result;
|
||||||
this.externalSourcesConfiguration.dataRepositories.push({ key: '', label: "All" })
|
this.externalSourcesConfiguration.dataRepositories.push({ key: '', label: 'All' });
|
||||||
this.externalSourcesConfiguration.externalDatasets.push({ key: '', label: "All" })
|
this.externalSourcesConfiguration.externalDatasets.push({ key: '', label: 'All' });
|
||||||
this.externalSourcesConfiguration.registries.push({ key: '', label: "All" })
|
this.externalSourcesConfiguration.registries.push({ key: '', label: 'All' });
|
||||||
this.externalSourcesConfiguration.services.push({ key: '', label: "All" })
|
this.externalSourcesConfiguration.services.push({ key: '', label: 'All' });
|
||||||
this.externalSourcesConfiguration.tags.push({ key: '', label: "All" })
|
this.externalSourcesConfiguration.tags.push({ key: '', label: 'All' });
|
||||||
})
|
});
|
||||||
|
|
||||||
this.dmpAutoCompleteConfiguration = {
|
this.dmpAutoCompleteConfiguration = {
|
||||||
filterFn: this.searchDmp.bind(this),
|
filterFn: this.searchDmp.bind(this),
|
||||||
items: this.searchDmp(''),
|
items: this.searchDmp(''),
|
||||||
displayFn: (item) => item["label"],
|
displayFn: (item) => item['label'],
|
||||||
titleFn: (item) => item["label"],
|
titleFn: (item) => item['label'],
|
||||||
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
|
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
|
||||||
loadDataOnStart: true
|
loadDataOnStart: true
|
||||||
};
|
};
|
||||||
|
@ -163,27 +159,27 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
||||||
this.breadCrumbs = Observable.of([
|
this.breadCrumbs = Observable.of([
|
||||||
{
|
{
|
||||||
parentComponentName: null,
|
parentComponentName: null,
|
||||||
label: "Datasets",
|
label: 'Datasets',
|
||||||
url: "/datasets",
|
url: '/datasets',
|
||||||
notFoundResolver: [
|
notFoundResolver: [
|
||||||
{
|
{
|
||||||
parentComponentName: null,
|
parentComponentName: null,
|
||||||
label: this.datasetWizardModel.dmp.project.label,
|
label: this.datasetWizardModel.dmp.project.label,
|
||||||
url: "/projects/edit/" + this.datasetWizardModel.dmp.project.id
|
url: '/projects/edit/' + this.datasetWizardModel.dmp.project.id
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
parentComponentName: null,
|
parentComponentName: null,
|
||||||
label: this.datasetWizardModel.dmp.label,
|
label: this.datasetWizardModel.dmp.label,
|
||||||
url: "/dmps/edit/" + this.datasetWizardModel.dmp.id,
|
url: '/dmps/edit/' + this.datasetWizardModel.dmp.id,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}])
|
}]);
|
||||||
this.formGroup = this.datasetWizardModel.buildForm();
|
this.formGroup = this.datasetWizardModel.buildForm();
|
||||||
if (this.datasetWizardModel.status == 1) {
|
if (this.datasetWizardModel.status === 1) {
|
||||||
this.formGroup.disable()
|
this.formGroup.disable();
|
||||||
this.viewOnly = true;
|
this.viewOnly = true;
|
||||||
}
|
}
|
||||||
if (this.viewOnly) this.formGroup.disable();
|
if (this.viewOnly) { this.formGroup.disable(); }
|
||||||
this.loadDatasetProfiles();
|
this.loadDatasetProfiles();
|
||||||
});
|
});
|
||||||
} else if (dmpId != null) {
|
} else if (dmpId != null) {
|
||||||
|
@ -194,8 +190,8 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.datasetWizardModel.dmp = data;
|
this.datasetWizardModel.dmp = data;
|
||||||
this.formGroup = this.datasetWizardModel.buildForm();
|
this.formGroup = this.datasetWizardModel.buildForm();
|
||||||
if (this.datasetWizardModel.status == 1) {
|
if (this.datasetWizardModel.status === 1) {
|
||||||
this.formGroup.disable()
|
this.formGroup.disable();
|
||||||
this.viewOnly = true;
|
this.viewOnly = true;
|
||||||
}
|
}
|
||||||
this.loadDatasetProfiles();
|
this.loadDatasetProfiles();
|
||||||
|
@ -203,61 +199,63 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
||||||
this.breadCrumbs = Observable.of([
|
this.breadCrumbs = Observable.of([
|
||||||
{
|
{
|
||||||
parentComponentName: null,
|
parentComponentName: null,
|
||||||
label: "Datasets",
|
label: 'Datasets',
|
||||||
url: "/datasets",
|
url: '/datasets',
|
||||||
notFoundResolver: [
|
notFoundResolver: [
|
||||||
{
|
{
|
||||||
parentComponentName: null,
|
parentComponentName: null,
|
||||||
label: this.datasetWizardModel.dmp.project.label,
|
label: this.datasetWizardModel.dmp.project.label,
|
||||||
url: "/projects/edit/" + this.datasetWizardModel.dmp.project.id
|
url: '/projects/edit/' + this.datasetWizardModel.dmp.project.id
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
parentComponentName: null,
|
parentComponentName: null,
|
||||||
label: this.datasetWizardModel.dmp.label,
|
label: this.datasetWizardModel.dmp.label,
|
||||||
url: "/dmps/edit/" + this.datasetWizardModel.dmp.id,
|
url: '/dmps/edit/' + this.datasetWizardModel.dmp.id,
|
||||||
}]
|
}]
|
||||||
}])
|
}]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.datasetWizardModel = new DatasetWizardModel();
|
this.datasetWizardModel = new DatasetWizardModel();
|
||||||
this.formGroup = this.datasetWizardModel.buildForm()
|
this.formGroup = this.datasetWizardModel.buildForm();
|
||||||
if (this.datasetWizardModel.status == 1) {
|
if (this.datasetWizardModel.status === 1) {
|
||||||
this.formGroup.disable()
|
this.formGroup.disable();
|
||||||
this.viewOnly = true;
|
this.viewOnly = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.viewOnly) this.formGroup.disable();
|
if (this.viewOnly) { this.formGroup.disable(); }
|
||||||
|
|
||||||
this.formGroup.get('dmp').valueChanges.subscribe(x => {
|
this.formGroup.get('dmp').valueChanges.subscribe(x => {
|
||||||
this.loadDatasetProfiles();
|
this.loadDatasetProfiles();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.route.params.subscribe((params: Params) => {
|
this.route.params.subscribe((params: Params) => {
|
||||||
let itemId = params['id'];
|
const itemId = params['id'];
|
||||||
if (itemId != null) this.stepper.selectedIndex = 2;
|
if (itemId != null) { this.stepper.selectedIndex = 2; }
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
searchDmp(query: string): Observable<DataManagementPlanListingModel[]> {
|
searchDmp(query: string): Observable<DataManagementPlanListingModel[]> {
|
||||||
let dmpRequestItem: RequestItem<DataManagementPlanCriteria> = new RequestItem();
|
const dmpRequestItem: RequestItem<DataManagementPlanCriteria> = new RequestItem();
|
||||||
dmpRequestItem.criteria = new DataManagementPlanCriteria();
|
dmpRequestItem.criteria = new DataManagementPlanCriteria();
|
||||||
dmpRequestItem.criteria.like = query;
|
dmpRequestItem.criteria.like = query;
|
||||||
return this.dataManagementPlanService.get(dmpRequestItem);
|
return this.dataManagementPlanService.get(dmpRequestItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadDatasetProfiles() {
|
loadDatasetProfiles() {
|
||||||
let datasetProfileRequestItem: RequestItem<DatasetProfileCriteria> = new RequestItem();
|
const datasetProfileRequestItem: RequestItem<DatasetProfileCriteria> = new RequestItem();
|
||||||
datasetProfileRequestItem.criteria = new DatasetProfileCriteria();
|
datasetProfileRequestItem.criteria = new DatasetProfileCriteria();
|
||||||
datasetProfileRequestItem.criteria.id = this.formGroup.get("dmp").value.id;
|
datasetProfileRequestItem.criteria.id = this.formGroup.get('dmp').value.id;
|
||||||
if (datasetProfileRequestItem.criteria.id) this.datasetWizardService.getAvailableProfiles(datasetProfileRequestItem).subscribe(items => {
|
if (datasetProfileRequestItem.criteria.id) {
|
||||||
|
this.datasetWizardService.getAvailableProfiles(datasetProfileRequestItem).subscribe(items => {
|
||||||
this.availableProfiles = JsonSerializer.fromJSONArray(items, DatasetProfileModel);
|
this.availableProfiles = JsonSerializer.fromJSONArray(items, DatasetProfileModel);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public cancel(): void {
|
public cancel(): void {
|
||||||
//this.router.navigate(['/dataManagementPlans']);
|
//this.router.navigate(['/dataManagementPlans']);
|
||||||
|
@ -265,11 +263,11 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
||||||
|
|
||||||
getDefinition() {
|
getDefinition() {
|
||||||
if (this.isNew) {
|
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.datasetWizardModel.datasetProfileDefinition = JsonSerializer.fromJSONObject(item, DatasetProfileDefinitionModel);
|
||||||
this.datasetProfileDefinitionModel = this.datasetWizardModel.datasetProfileDefinition;
|
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 => {
|
result => {
|
||||||
this.datasetWizardModel = JsonSerializer.fromJSONObject(result, DatasetWizardModel);
|
this.datasetWizardModel = JsonSerializer.fromJSONObject(result, DatasetWizardModel);
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
this.onCallbackSuccess()
|
this.onCallbackSuccess();
|
||||||
},
|
},
|
||||||
error => this.onCallbackError(error)
|
error => this.onCallbackError(error)
|
||||||
);
|
);
|
||||||
|
@ -299,20 +297,20 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
this.datasetWizardService.createDataset(this.formGroup.value).subscribe(data => {
|
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() {
|
save() {
|
||||||
if (!this.isFormValid()) { return; }
|
if (!this.isFormValid()) { return; }
|
||||||
this.formGroup.get("status").setValue("0");
|
this.formGroup.get('status').setValue('0');
|
||||||
this.submit();
|
this.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
saveFinalize() {
|
saveFinalize() {
|
||||||
if (!this.isFormValid()) { return; }
|
if (!this.isFormValid()) { return; }
|
||||||
this.formGroup.get("status").setValue("1");
|
this.formGroup.get('status').setValue('1');
|
||||||
this.submit();
|
this.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,7 +318,7 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
||||||
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
||||||
data: { message: this.isNew ? 'GENERAL.SNACK-BAR.SUCCESSFUL-CREATION' : 'GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE', language: this.language },
|
data: { message: this.isNew ? 'GENERAL.SNACK-BAR.SUCCESSFUL-CREATION' : 'GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE', language: this.language },
|
||||||
duration: 3000,
|
duration: 3000,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onCallbackError(error: any) {
|
onCallbackError(error: any) {
|
||||||
|
@ -330,25 +328,25 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
||||||
public setErrorModel(errorModel: BaseErrorModel) {
|
public setErrorModel(errorModel: BaseErrorModel) {
|
||||||
Object.keys(errorModel).forEach(item => {
|
Object.keys(errorModel).forEach(item => {
|
||||||
(<any>this.datasetWizardModel.errorModel)[item] = (<any>errorModel)[item];
|
(<any>this.datasetWizardModel.errorModel)[item] = (<any>errorModel)[item];
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadPDF(): void {
|
downloadPDF(): void {
|
||||||
this.datasetWizardService.downloadPDF(this.itemId).subscribe(response => {
|
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'));
|
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
||||||
|
|
||||||
FileSaver.saveAs(blob, filename)
|
FileSaver.saveAs(blob, filename);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadXML(): void {
|
downloadXML(): void {
|
||||||
this.datasetWizardService.downloadXML(this.itemId).subscribe(response => {
|
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'));
|
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
||||||
|
|
||||||
FileSaver.saveAs(blob, filename)
|
FileSaver.saveAs(blob, filename);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getFilenameFromContentDispositionHeader(header: string): string {
|
getFilenameFromContentDispositionHeader(header: string): string {
|
||||||
|
@ -370,41 +368,41 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public redirectToProject() {
|
public redirectToProject() {
|
||||||
this.router.navigate(["projects/edit/" + this.datasetWizardModel.dmp.project.id])
|
this.router.navigate(['projects/edit/' + this.datasetWizardModel.dmp.project.id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public redirectToDmp() {
|
public redirectToDmp() {
|
||||||
this.router.navigate(["dmps/edit/" + this.datasetWizardModel.dmp.id])
|
this.router.navigate(['dmps/edit/' + this.datasetWizardModel.dmp.id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
externalDatasetsOnItemChange(event) {
|
externalDatasetsOnItemChange(event) {
|
||||||
let externalDatasetModel = new ExternalDatasetModel(event.id, event.abbreviation, event.label, event.reference);
|
const externalDatasetModel = new ExternalDatasetModel(event.id, event.abbreviation, event.label, event.reference);
|
||||||
(<FormArray>this.formGroup.get("externalDatasets")).push(externalDatasetModel.buildForm());
|
(<FormArray>this.formGroup.get('externalDatasets')).push(externalDatasetModel.buildForm());
|
||||||
}
|
}
|
||||||
|
|
||||||
registriesOnItemChange(event) {
|
registriesOnItemChange(event) {
|
||||||
let registryModel = new RegisterModel(event.abbreviation, event.definition, event.id, event.label, event.reference, event.uri);
|
const registryModel = new RegisterModel(event.abbreviation, event.definition, event.id, event.label, event.reference, event.uri);
|
||||||
(<FormArray>this.formGroup.get("registries")).push(registryModel.buildForm());
|
(<FormArray>this.formGroup.get('registries')).push(registryModel.buildForm());
|
||||||
}
|
}
|
||||||
|
|
||||||
servicesOnItemChange(event) {
|
servicesOnItemChange(event) {
|
||||||
let serviceModel = new ServiceModel(event.abbreviation, event.definition, event.id, event.label, event.reference, event.uri);
|
const serviceModel = new ServiceModel(event.abbreviation, event.definition, event.id, event.label, event.reference, event.uri);
|
||||||
(<FormArray>this.formGroup.get("services")).push(serviceModel.buildForm());
|
(<FormArray>this.formGroup.get('services')).push(serviceModel.buildForm());
|
||||||
}
|
}
|
||||||
|
|
||||||
tagsOnItemChange(event) {
|
tagsOnItemChange(event) {
|
||||||
let serviceModel = new TagModel(event.id, event.name);
|
const serviceModel = new TagModel(event.id, event.name);
|
||||||
(<FormArray>this.formGroup.get("tags")).push(serviceModel.buildForm());
|
(<FormArray>this.formGroup.get('tags')).push(serviceModel.buildForm());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dataRepositoriesOnItemChange(event) {
|
dataRepositoriesOnItemChange(event) {
|
||||||
let dataRepositoryModel = new DataRepositoryModel(event.id, event.name, event.abbreviation, event.uri, event.pid);
|
const dataRepositoryModel = new DataRepositoryModel(event.id, event.name, event.abbreviation, event.uri, event.pid);
|
||||||
(<FormArray>this.formGroup.get("dataRepositories")).push(dataRepositoryModel.buildForm());
|
(<FormArray>this.formGroup.get('dataRepositories')).push(dataRepositoryModel.buildForm());
|
||||||
}
|
}
|
||||||
|
|
||||||
addDataRepository() {
|
addDataRepository() {
|
||||||
let dialogRef = this.dialog.open(DataRepositoryReferencedModelHelperComponent, {
|
const dialogRef = this.dialog.open(DataRepositoryReferencedModelHelperComponent, {
|
||||||
height: '255px',
|
height: '255px',
|
||||||
width: '700px',
|
width: '700px',
|
||||||
data: {
|
data: {
|
||||||
|
@ -412,14 +410,14 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
if (!result) return
|
if (!result) { return; }
|
||||||
let dataRepositoryModel = new DataRepositoryModel(result.id, result.label, result.pid, result.uri, result.reference);
|
const dataRepositoryModel = new DataRepositoryModel(result.id, result.label, result.pid, result.uri, result.reference);
|
||||||
(<FormArray>this.formGroup.get("dataRepositories")).push(dataRepositoryModel.buildForm());
|
(<FormArray>this.formGroup.get('dataRepositories')).push(dataRepositoryModel.buildForm());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addRegistry() {
|
addRegistry() {
|
||||||
let dialogRef = this.dialog.open(RegistryReferencedModelHelperComponent, {
|
const dialogRef = this.dialog.open(RegistryReferencedModelHelperComponent, {
|
||||||
height: '255px',
|
height: '255px',
|
||||||
width: '700px',
|
width: '700px',
|
||||||
data: {
|
data: {
|
||||||
|
@ -427,14 +425,14 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
if (!result) return
|
if (!result) { return; }
|
||||||
let registryModel = new RegisterModel(result.abbreviation, result.definition, result.id, result.label, result.reference, result.uri);
|
const registryModel = new RegisterModel(result.abbreviation, result.definition, result.id, result.label, result.reference, result.uri);
|
||||||
(<FormArray>this.formGroup.get("registries")).push(registryModel.buildForm());
|
(<FormArray>this.formGroup.get('registries')).push(registryModel.buildForm());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addExternalDataset() {
|
addExternalDataset() {
|
||||||
let dialogRef = this.dialog.open(ExternalDatasetReferencedModelHelperComponent, {
|
const dialogRef = this.dialog.open(ExternalDatasetReferencedModelHelperComponent, {
|
||||||
height: '255px',
|
height: '255px',
|
||||||
width: '700px',
|
width: '700px',
|
||||||
data: {
|
data: {
|
||||||
|
@ -442,14 +440,14 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
if (!result) return
|
if (!result) { return; }
|
||||||
let externalDatasetModel = new ExternalDatasetModel(result.id, result.abbreviation, result.label, result.reference);
|
const externalDatasetModel = new ExternalDatasetModel(result.id, result.abbreviation, result.label, result.reference);
|
||||||
(<FormArray>this.formGroup.get("externalDatasets")).push(externalDatasetModel.buildForm());
|
(<FormArray>this.formGroup.get('externalDatasets')).push(externalDatasetModel.buildForm());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addService() {
|
addService() {
|
||||||
let dialogRef = this.dialog.open(ServicesReferencedModelHelperComponent, {
|
const dialogRef = this.dialog.open(ServicesReferencedModelHelperComponent, {
|
||||||
height: '255px',
|
height: '255px',
|
||||||
width: '700px',
|
width: '700px',
|
||||||
data: {
|
data: {
|
||||||
|
@ -457,9 +455,9 @@ export class DatasetWizardComponent implements OnInit, IBreadCrumbComponent {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
if (!result) return
|
if (!result) { return; }
|
||||||
let serviceModel = new ServiceModel(result.id, result.abbreviation, result.definition, result.uri, result.label, result.reference);
|
const serviceModel = new ServiceModel(result.id, result.abbreviation, result.definition, result.uri, result.label, result.reference);
|
||||||
(<FormArray>this.formGroup.get("services")).push(serviceModel.buildForm());
|
(<FormArray>this.formGroup.get('services')).push(serviceModel.buildForm());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
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 { BaseHttpService } from '../utilities/cite-http-service-module/base-http.service';
|
||||||
import { BaseHttpModule } from '../utilities/cite-http-service-module/cite-http.module';
|
import { BaseHttpModule } from '../utilities/cite-http-service-module/cite-http.module';
|
||||||
import { MaterialModule } from '../shared/material/material.module';
|
import { MaterialModule } from '../shared/material/material.module';
|
||||||
|
@ -82,7 +82,7 @@ import { ExternalDatasetService } from '../services/external-dataset/external-da
|
||||||
ServicesDataService,
|
ServicesDataService,
|
||||||
RegistryService
|
RegistryService
|
||||||
],
|
],
|
||||||
entryComponents:[
|
entryComponents: [
|
||||||
DataRepositoryReferencedModelHelperComponent,
|
DataRepositoryReferencedModelHelperComponent,
|
||||||
ExternalDatasetReferencedModelHelperComponent,
|
ExternalDatasetReferencedModelHelperComponent,
|
||||||
ServicesReferencedModelHelperComponent,
|
ServicesReferencedModelHelperComponent,
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { DatasetPublicListingComponent } from './dataset-public/dataset-public-l
|
||||||
|
|
||||||
export const DatasetRoutes: Routes = [
|
export const DatasetRoutes: Routes = [
|
||||||
{
|
{
|
||||||
path: "new/:dmpId",
|
path: 'new/:dmpId',
|
||||||
component: DatasetWizardComponent,
|
component: DatasetWizardComponent,
|
||||||
canActivate: [AuthGuard],
|
canActivate: [AuthGuard],
|
||||||
data: {
|
data: {
|
||||||
|
@ -14,7 +14,7 @@ export const DatasetRoutes: Routes = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "edit/:id",
|
path: 'edit/:id',
|
||||||
component: DatasetWizardComponent,
|
component: DatasetWizardComponent,
|
||||||
canActivate: [AuthGuard],
|
canActivate: [AuthGuard],
|
||||||
data: {
|
data: {
|
||||||
|
@ -23,7 +23,7 @@ export const DatasetRoutes: Routes = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "publicEdit/:id",
|
path: 'publicEdit/:id',
|
||||||
component: DatasetWizardComponent,
|
component: DatasetWizardComponent,
|
||||||
//canActivate: [AuthGuard],
|
//canActivate: [AuthGuard],
|
||||||
data: {
|
data: {
|
||||||
|
@ -31,7 +31,7 @@ export const DatasetRoutes: Routes = [
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "new",
|
path: 'new',
|
||||||
component: DatasetWizardComponent,
|
component: DatasetWizardComponent,
|
||||||
canActivate: [AuthGuard],
|
canActivate: [AuthGuard],
|
||||||
data: {
|
data: {
|
||||||
|
@ -52,7 +52,7 @@ export const DatasetRoutes: Routes = [
|
||||||
//canActivate: [AuthGuard],
|
//canActivate: [AuthGuard],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "dmp/:dmpId",
|
path: 'dmp/:dmpId',
|
||||||
component: DatasetListingComponent,
|
component: DatasetListingComponent,
|
||||||
//canActivate: [AuthGuard],
|
//canActivate: [AuthGuard],
|
||||||
data: {
|
data: {
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
import { AfterViewInit, Component, Input, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
import { AfterViewInit, Component, Input, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||||
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
|
import { MatPaginator, MatSort, MatSnackBar } from '@angular/material';
|
||||||
import { Router, ActivatedRoute, Params } from "@angular/router";
|
import { Router, ActivatedRoute, Params } from '@angular/router';
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { DataSource } from "@angular/cdk/table";
|
import { DataSource } from '@angular/cdk/table';
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from 'rxjs/Observable';
|
||||||
import { JsonSerializer } from "../../utilities/JsonSerializer";
|
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
||||||
import { FormGroup } from "@angular/forms";
|
import { FormGroup } from '@angular/forms';
|
||||||
import { SnackBarNotificationComponent } from "../../shared/components/notificaiton/snack-bar-notification.component";
|
import { SnackBarNotificationComponent } from '../../shared/components/notificaiton/snack-bar-notification.component';
|
||||||
import { BaseErrorModel } from "../../models/error/BaseErrorModel";
|
import { BaseErrorModel } from '../../models/error/BaseErrorModel';
|
||||||
import { DatasetService } from "../../services/dataset/dataset.service";
|
import { DatasetService } from '../../services/dataset/dataset.service';
|
||||||
import { DatasetModel } from "../../models/datasets/DatasetModel";
|
import { DatasetModel } from '../../models/datasets/DatasetModel';
|
||||||
import { ExternalSourcesService } from "../../services/external-sources/external-sources.service";
|
import { ExternalSourcesService } from '../../services/external-sources/external-sources.service';
|
||||||
import { ExternalSourcesItemModel } from "../../models/external-sources/ExternalSourcesItemModel";
|
import { ExternalSourcesItemModel } from '../../models/external-sources/ExternalSourcesItemModel';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,16 +3,16 @@ import { DataTableRequest } from '../../models/data-table/DataTableRequest';
|
||||||
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
|
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
|
||||||
import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria';
|
import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria';
|
||||||
import { DatasetService } from '../../services/dataset/dataset.service';
|
import { DatasetService } from '../../services/dataset/dataset.service';
|
||||||
import { Component, ViewChild, OnInit, AfterViewInit } from "@angular/core";
|
import { Component, ViewChild, OnInit, AfterViewInit } from '@angular/core';
|
||||||
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
|
import { MatPaginator, MatSort, MatSnackBar } from '@angular/material';
|
||||||
import { Router, Params, ActivatedRoute } from "@angular/router";
|
import { Router, Params, ActivatedRoute } from '@angular/router';
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { DataSource } from "@angular/cdk/table";
|
import { DataSource } from '@angular/cdk/table';
|
||||||
|
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from 'rxjs/Observable';
|
||||||
import { PageEvent } from '@angular/material';
|
import { PageEvent } from '@angular/material';
|
||||||
import { DataManagementPlanService } from "../../services/data-management-plan/data-management-plan.service";
|
import { DataManagementPlanService } from '../../services/data-management-plan/data-management-plan.service';
|
||||||
import { DataManagementPlanModel } from "../../models/data-managemnt-plans/DataManagementPlanModel";
|
import { DataManagementPlanModel } from '../../models/data-managemnt-plans/DataManagementPlanModel';
|
||||||
import { DatasetCriteriaComponent } from '../../shared/components/criteria/datasets/datasets-criteria.component';
|
import { DatasetCriteriaComponent } from '../../shared/components/criteria/datasets/datasets-criteria.component';
|
||||||
import { BreadcrumbItem } from '../../shared/components/breadcrumb/definition/breadcrumb-item';
|
import { BreadcrumbItem } from '../../shared/components/breadcrumb/definition/breadcrumb-item';
|
||||||
import { IBreadCrumbComponent } from '../../shared/components/breadcrumb/definition/IBreadCrumbComponent';
|
import { IBreadCrumbComponent } from '../../shared/components/breadcrumb/definition/IBreadCrumbComponent';
|
||||||
|
@ -24,7 +24,7 @@ import { JsonSerializer } from '../../utilities/JsonSerializer';
|
||||||
selector: 'app-dataset-listing-component',
|
selector: 'app-dataset-listing-component',
|
||||||
templateUrl: 'dataset-listing.component.html',
|
templateUrl: 'dataset-listing.component.html',
|
||||||
styleUrls: ['./dataset-listing.component.scss'],
|
styleUrls: ['./dataset-listing.component.scss'],
|
||||||
providers:[Utilities]
|
providers: [Utilities]
|
||||||
})
|
})
|
||||||
export class DatasetListingComponent implements OnInit, IBreadCrumbComponent {
|
export class DatasetListingComponent implements OnInit, IBreadCrumbComponent {
|
||||||
|
|
||||||
|
@ -66,12 +66,13 @@ export class DatasetListingComponent implements OnInit, IBreadCrumbComponent {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.criteria.setRefreshCallback(() => this.refresh());
|
this.criteria.setRefreshCallback(() => this.refresh());
|
||||||
if (this.dmpId != null) {
|
if (this.dmpId != null) {
|
||||||
let dmp = await this.dataManagementPlanService.getSingle(this.dmpId).toPromise()
|
const dmp = await this.dataManagementPlanService.getSingle(this.dmpId).toPromise();
|
||||||
this.breadCrumbs = Observable.of([{ parentComponentName: "DataManagementPlanEditorComponent", label: dmp.label, url: "dmps/edit/" + this.dmpId }])
|
this.breadCrumbs = Observable.of([{ parentComponentName: 'DataManagementPlanEditorComponent', label: dmp.label, url: 'dmps/edit/' + this.dmpId }]);
|
||||||
if (params['dmpLabel'] != undefined)
|
if (params['dmpLabel'] !== undefined) {
|
||||||
this.titlePrefix = "for " + params['dmpLabel'];
|
this.titlePrefix = 'for ' + params['dmpLabel'];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.breadCrumbs = Observable.of([])
|
this.breadCrumbs = Observable.of([]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -129,11 +130,11 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
|
||||||
this.isLoadingResults = true;
|
this.isLoadingResults = true;
|
||||||
});
|
});
|
||||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
||||||
let fields: Array<string> = new Array()
|
let fields: Array<string> = new Array();
|
||||||
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
|
if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; }
|
||||||
const request = new DataTableRequest<DatasetCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
const request = new DataTableRequest<DatasetCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
||||||
request.criteria = this._criteria.criteria;
|
request.criteria = this._criteria.criteria;
|
||||||
if (this.dmpId) request.criteria.allVersions = true;
|
if (this.dmpId) { request.criteria.allVersions = true; }
|
||||||
return this._service.getPaged(request);
|
return this._service.getPaged(request);
|
||||||
})
|
})
|
||||||
/*.catch((error: any) => {
|
/*.catch((error: any) => {
|
||||||
|
@ -146,7 +147,7 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
|
||||||
return Observable.of(null);
|
return Observable.of(null);
|
||||||
})*/
|
})*/
|
||||||
.map(result => {
|
.map(result => {
|
||||||
result.data = JsonSerializer.fromJSONArray(result.data, DatasetListingModel)
|
result.data = JsonSerializer.fromJSONArray(result.data, DatasetListingModel);
|
||||||
return result;
|
return result;
|
||||||
})
|
})
|
||||||
.map(result => {
|
.map(result => {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
<div class="dmp-profile-editor">
|
<div class="dmp-profile-editor">
|
||||||
<form *ngIf="formGroup" (ngSubmit)="formSubmit()" [formGroup]="formGroup">
|
<form *ngIf="formGroup" (ngSubmit)="formSubmit()" [formGroup]="formGroup">
|
||||||
<mat-card>
|
<mat-card>
|
||||||
|
@ -11,8 +9,8 @@
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
|
|
||||||
<mat-form-field class="full-width">
|
<mat-form-field class="full-width">
|
||||||
<input matInput placeholder="{{'DMP-PROFILE-EDITOR.FIELDS.LABEL' | translate}}" type="text" name="label" formControlName="label"
|
<input matInput placeholder="{{'DMP-PROFILE-EDITOR.FIELDS.LABEL' | translate}}" type="text" name="label"
|
||||||
required>
|
formControlName="label" required>
|
||||||
<mat-error *ngIf="formGroup.get('label').errors?.backendError">{{baseErrorModel.label}}</mat-error>
|
<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-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
@ -22,24 +20,29 @@
|
||||||
<mat-list-item *ngFor="let field of formGroup.controls.definition.controls.fields.controls;let i=index">
|
<mat-list-item *ngFor="let field of formGroup.controls.definition.controls.fields.controls;let i=index">
|
||||||
<div [formGroupName]="i">
|
<div [formGroupName]="i">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input matInput placeholder="{{'DMP-PROFILE-EDITOR.FIELDS.LABEL' | translate}}" type="text" name="label" formControlName="label"
|
<input matInput placeholder="{{'DMP-PROFILE-EDITOR.FIELDS.LABEL' | translate}}" type="text" name="label"
|
||||||
required>
|
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?.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-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="{{'DMP-PROFILE-EDITOR.FIELDS.TYPE' | translate}}" formControlName="type">
|
<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-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?.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-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="{{'DMP-PROFILE-EDITOR.FIELDS.DATATYPE' | translate}}" formControlName="dataType">
|
<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-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?.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-form-field>
|
||||||
<mat-checkbox formControlName="required">
|
<mat-checkbox formControlName="required">
|
||||||
{{'DMP-PROFILE-EDITOR.FIELDS.REQUIRED' | translate}}
|
{{'DMP-PROFILE-EDITOR.FIELDS.REQUIRED' | translate}}
|
||||||
|
@ -52,9 +55,11 @@
|
||||||
</mat-list>
|
</mat-list>
|
||||||
</div>
|
</div>
|
||||||
<div layout="row" class="full-width text-right" align="end">
|
<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 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>
|
</div>
|
||||||
|
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation } from "@angular/core";
|
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
|
import { MatPaginator, MatSort, MatSnackBar } from '@angular/material';
|
||||||
import { Router, ActivatedRoute, Params } from "@angular/router";
|
import { Router, ActivatedRoute, Params } from '@angular/router';
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { DataSource } from "@angular/cdk/table";
|
import { DataSource } from '@angular/cdk/table';
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from 'rxjs/Observable';
|
||||||
import { DataManagementPlanService } from "../../services/data-management-plan/data-management-plan.service";
|
import { DataManagementPlanService } from '../../services/data-management-plan/data-management-plan.service';
|
||||||
import { ProjectModel } from "../../models/projects/ProjectModel";
|
import { ProjectModel } from '../../models/projects/ProjectModel';
|
||||||
import { JsonSerializer } from "../../utilities/JsonSerializer";
|
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
||||||
import { FormGroup, AbstractControl, FormControl, FormArray } from "@angular/forms";
|
import { FormGroup, AbstractControl, FormControl, FormArray } from '@angular/forms';
|
||||||
import { SnackBarNotificationComponent } from "../../shared/components/notificaiton/snack-bar-notification.component";
|
import { SnackBarNotificationComponent } from '../../shared/components/notificaiton/snack-bar-notification.component';
|
||||||
import { BaseErrorModel } from "../../models/error/BaseErrorModel";
|
import { BaseErrorModel } from '../../models/error/BaseErrorModel';
|
||||||
import { TdDialogService } from "@covalent/core";
|
import { TdDialogService } from '@covalent/core';
|
||||||
import { HostConfiguration } from "../../app.constants";
|
import { HostConfiguration } from '../../app.constants';
|
||||||
import { DataManagementPlanProfileService } from "../../services/data-management-plan-profile/datamanagement-profile.service";
|
import { DataManagementPlanProfileService } from '../../services/data-management-plan-profile/datamanagement-profile.service';
|
||||||
import { DataManagementPlanProfileModel } from "../../models/data-management-plan-profile/DataManagementPlanProfileModel";
|
import { DataManagementPlanProfileModel } from '../../models/data-management-plan-profile/DataManagementPlanProfileModel';
|
||||||
import { DMPProfileFieldDataType, DMPProfileType, DataManagementProfileField } from "../../models/data-management-plan-profile/DataManagementProfileField";
|
import { DMPProfileFieldDataType, DMPProfileType, DataManagementProfileField } from '../../models/data-management-plan-profile/DataManagementProfileField';
|
||||||
import { Utilities } from "../../utilities/utilities";
|
import { Utilities } from '../../utilities/utilities';
|
||||||
import { DataManagementPlanProfileListingModel } from "../../models/data-management-plan-profile/DataManagementPlanProfileListingModel";
|
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',
|
selector: 'app-dmp-profile-editor-component',
|
||||||
templateUrl: 'dmp-profile-editor.component.html',
|
templateUrl: 'dmp-profile-editor.component.html',
|
||||||
styleUrls: ['./dmp-profile-editor.component.scss'],
|
styleUrls: ['./dmp-profile-editor.component.scss'],
|
||||||
providers: [DataManagementPlanProfileService],
|
providers: [DataManagementPlanProfileService, Utilities],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class DataManagementPlanProfileEditorComponent implements AfterViewInit {
|
export class DataManagementPlanProfileEditorComponent implements AfterViewInit {
|
||||||
|
@ -89,7 +89,7 @@ export class DataManagementPlanProfileEditorComponent implements AfterViewInit {
|
||||||
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
||||||
data: { message: this.isNew ? 'GENERAL.SNACK-BAR.SUCCESSFUL-CREATION' : 'GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE', language: this.language },
|
data: { message: this.isNew ? 'GENERAL.SNACK-BAR.SUCCESSFUL-CREATION' : 'GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE', language: this.language },
|
||||||
duration: 3000,
|
duration: 3000,
|
||||||
})
|
});
|
||||||
this.router.navigate(['/dmp-profiles']);
|
this.router.navigate(['/dmp-profiles']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ export class DataManagementPlanProfileEditorComponent implements AfterViewInit {
|
||||||
public setErrorModel(errorModel: BaseErrorModel) {
|
public setErrorModel(errorModel: BaseErrorModel) {
|
||||||
Object.keys(errorModel).forEach(item => {
|
Object.keys(errorModel).forEach(item => {
|
||||||
(<any>this.dataManagementPlanProfileModel.errorModel)[item] = (<any>errorModel)[item];
|
(<any>this.dataManagementPlanProfileModel.errorModel)[item] = (<any>errorModel)[item];
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public cancel(): void {
|
public cancel(): void {
|
||||||
|
@ -116,33 +116,31 @@ export class DataManagementPlanProfileEditorComponent implements AfterViewInit {
|
||||||
Object.keys(formControl.controls).forEach(item => {
|
Object.keys(formControl.controls).forEach(item => {
|
||||||
const control = formControl.get(item);
|
const control = formControl.get(item);
|
||||||
this.touchAllFormFields(control);
|
this.touchAllFormFields(control);
|
||||||
})
|
});
|
||||||
}
|
} else if (formControl instanceof FormArray) {
|
||||||
else if (formControl instanceof FormArray) {
|
|
||||||
formControl.controls.forEach(item => {
|
formControl.controls.forEach(item => {
|
||||||
this.touchAllFormFields(item);
|
this.touchAllFormFields(item);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public validateAllFormFields(formControl: AbstractControl) {
|
public validateAllFormFields(formControl: AbstractControl) {
|
||||||
if (formControl instanceof FormControl) {
|
if (formControl instanceof FormControl) {
|
||||||
formControl.updateValueAndValidity({ emitEvent: false })
|
formControl.updateValueAndValidity({ emitEvent: false });
|
||||||
} else if (formControl instanceof FormGroup) {
|
} else if (formControl instanceof FormGroup) {
|
||||||
Object.keys(formControl.controls).forEach(item => {
|
Object.keys(formControl.controls).forEach(item => {
|
||||||
const control = formControl.get(item);
|
const control = formControl.get(item);
|
||||||
this.validateAllFormFields(control);
|
this.validateAllFormFields(control);
|
||||||
})
|
});
|
||||||
}
|
} else if (formControl instanceof FormArray) {
|
||||||
else if (formControl instanceof FormArray) {
|
|
||||||
formControl.controls.forEach(item => {
|
formControl.controls.forEach(item => {
|
||||||
this.validateAllFormFields(item);
|
this.validateAllFormFields(item);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addField() {
|
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[] {
|
getDMPProfileFieldDataTypeValues(): Number[] {
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { Component, ViewChild, OnInit } from "@angular/core";
|
import { Component, ViewChild, OnInit } from '@angular/core';
|
||||||
import { MatPaginator, MatSort, PageEvent, MatSnackBar } from "@angular/material";
|
import { MatPaginator, MatSort, PageEvent, MatSnackBar } from '@angular/material';
|
||||||
import { DataManagementPlanProfileCriteriaComponent } from "../../shared/components/criteria/datamanagementplanprofile/dmp-profile-criteria.component";
|
import { DataManagementPlanProfileCriteriaComponent } from '../../shared/components/criteria/datamanagementplanprofile/dmp-profile-criteria.component';
|
||||||
import { ActivatedRoute, Router, Params } from "@angular/router";
|
import { ActivatedRoute, Router, Params } from '@angular/router';
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { DataSource } from "@angular/cdk/table";
|
import { DataSource } from '@angular/cdk/table';
|
||||||
import { DataManagementPlanProfileCriteria } from "../../models/criteria/dmp-profile/DataManagementPlanProfileCriteria";
|
import { DataManagementPlanProfileCriteria } from '../../models/criteria/dmp-profile/DataManagementPlanProfileCriteria';
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from 'rxjs';
|
||||||
import { DataTableRequest } from "../../models/data-table/DataTableRequest";
|
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
|
||||||
import { DataManagementPlanProfileListingModel } from "../../models/data-management-plan-profile/DataManagementPlanProfileListingModel";
|
import { DataManagementPlanProfileListingModel } from '../../models/data-management-plan-profile/DataManagementPlanProfileListingModel';
|
||||||
import { DataManagementPlanProfileService } from "../../services/data-management-plan-profile/datamanagement-profile.service";
|
import { DataManagementPlanProfileService } from '../../services/data-management-plan-profile/datamanagement-profile.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dmp-profile-listing-component',
|
selector: 'app-dmp-profile-listing-component',
|
||||||
|
@ -105,8 +105,8 @@ export class DatasetDataSource extends DataSource<DataManagementPlanProfileListi
|
||||||
this.isLoadingResults = true;
|
this.isLoadingResults = true;
|
||||||
});
|
});
|
||||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
||||||
let fields: Array<string> = new Array()
|
let fields: Array<string> = new Array();
|
||||||
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
|
if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; }
|
||||||
const request = new DataTableRequest<DataManagementPlanProfileCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
const request = new DataTableRequest<DataManagementPlanProfileCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
||||||
request.criteria = this._criteria.criteria;
|
request.criteria = this._criteria.criteria;
|
||||||
return this._service.getPaged(request);
|
return this._service.getPaged(request);
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
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 { DataManagementPlanProfileRoutes } from './dmp-profile.routes';
|
||||||
import { DataManagementPlanProfileEditorComponent } from './dmp-profile-editor/dmp-profile-editor.component';
|
import { DataManagementPlanProfileEditorComponent } from './dmp-profile-editor/dmp-profile-editor.component';
|
||||||
import { DataManagementPlanProfileListingComponent } from './dmp-profile-listing/dmp-profile-listing.component';
|
import { DataManagementPlanProfileListingComponent } from './dmp-profile-listing/dmp-profile-listing.component';
|
||||||
|
|
|
@ -15,10 +15,10 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { CovalentDialogsModule } from '@covalent/core';
|
import { CovalentDialogsModule } from '@covalent/core';
|
||||||
|
|
||||||
import { SharedModule } from '../shared/shared.module'
|
import { SharedModule } from '../shared/shared.module';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { AvailableProfilesComponent } from '../shared/components/available-profiles/available-profiles.component';
|
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 { 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 { DynamicFieldProjectComponent } from './editor/dynamic-fields-project/dynamic-field-project/dynamic-field-project.component';
|
||||||
import { BaseHttpModule } from '../utilities/cite-http-service-module/cite-http.module';
|
import { BaseHttpModule } from '../utilities/cite-http-service-module/cite-http.module';
|
||||||
|
@ -62,7 +62,7 @@ import { FlexLayoutModule } from '@angular/flex-layout';
|
||||||
DatasetWizardListingComponent,
|
DatasetWizardListingComponent,
|
||||||
AddResearchersComponent,
|
AddResearchersComponent,
|
||||||
AvailableProfilesComponent,
|
AvailableProfilesComponent,
|
||||||
DynamicDmpFieldResolver,
|
DynamicDmpFieldResolverComponent,
|
||||||
DynamicFieldsProjectComponent,
|
DynamicFieldsProjectComponent,
|
||||||
DynamicFieldProjectComponent
|
DynamicFieldProjectComponent
|
||||||
],
|
],
|
||||||
|
|
|
@ -58,7 +58,7 @@ export const DataManagementPlanRoutes: Routes = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "invitation/:id",
|
path: 'invitation/:id',
|
||||||
component: InvitationAcceptedComponent,
|
component: InvitationAcceptedComponent,
|
||||||
data: {
|
data: {
|
||||||
breadcrumb: true
|
breadcrumb: true
|
||||||
|
|
|
@ -14,15 +14,19 @@
|
||||||
</div> -->
|
</div> -->
|
||||||
<div>
|
<div>
|
||||||
<button mat-button type="button" (click)="redirectToDatasets()">
|
<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>
|
</div>
|
||||||
<mat-menu #actionsMenu="matMenu">
|
<mat-menu #actionsMenu="matMenu">
|
||||||
<button mat-menu-item (click)="newVersion(this.dataManagementPlan.id, this.dataManagementPlan.label)">
|
<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)">
|
<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)">
|
<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>
|
</mat-menu>
|
||||||
<div>
|
<div>
|
||||||
<button mat-icon-button type="button" [matMenuTriggerFor]="actionsMenu">
|
<button mat-icon-button type="button" [matMenuTriggerFor]="actionsMenu">
|
||||||
|
@ -34,14 +38,15 @@
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<mat-form-field class="col-md-12">
|
<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?.backendError">{{baseErrorModel.label}}</mat-error>
|
||||||
<mat-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field class="col-md-12">
|
<mat-form-field class="col-md-12">
|
||||||
<textarea matInput class="description-area" placeholder="{{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}}" formControlName="description"
|
<textarea matInput class="description-area" placeholder="{{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}}"
|
||||||
required></textarea>
|
formControlName="description" required></textarea>
|
||||||
<mat-error *ngIf="formGroup.get('description').errors?.backendError">{{errorModel.description}}</mat-error>
|
<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-error *ngIf="formGroup.get('description').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
@ -54,8 +59,8 @@
|
||||||
<!-- <app-dynamic-fields-project [formGroup]="formGroup"></app-dynamic-fields-project> -->
|
<!-- <app-dynamic-fields-project [formGroup]="formGroup"></app-dynamic-fields-project> -->
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<app-multiple-auto-complete required='true' class="col-md-10" [reactiveFormControl]="formGroup.get('profiles')" placeholder="{{'DMP-EDITOR.FIELDS.PROFILES' | translate}}"
|
<app-multiple-auto-complete required='true' class="col-md-10" [reactiveFormControl]="formGroup.get('profiles')"
|
||||||
[configuration]="profilesAutoCompleteConfiguration">
|
placeholder="{{'DMP-EDITOR.FIELDS.PROFILES' | translate}}" [configuration]="profilesAutoCompleteConfiguration">
|
||||||
</app-multiple-auto-complete>
|
</app-multiple-auto-complete>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<button mat-icon-button type="button" (click)="availableProfiles()">
|
<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>
|
<h3 mat-subheader class="col-md-12">{{'DMP-EDITOR.FIELDS.PROFILE' | translate}}</h3>
|
||||||
|
|
||||||
<mat-form-field class="col-md-6">
|
<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-autocomplete #auto="matAutocomplete" [displayWith]="displayWith">
|
||||||
<mat-option *ngFor="let option of filteredOptions | async" [value]="option" (click)="selectOption(option)">
|
<mat-option *ngFor="let option of filteredOptions | async" [value]="option" (click)="selectOption(option)">
|
||||||
{{ option.label }}
|
{{ option.label }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-autocomplete>
|
</mat-autocomplete>
|
||||||
</mat-form-field>
|
</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">
|
<mat-form-field class="col-md-6">
|
||||||
<input matInput placeholder="Version" disabled [value]="formGroup.get('version').value== undefined ?0 :formGroup.get('version').value">
|
<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="col-md-12">
|
||||||
<div class="right-button">
|
<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 *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 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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,38 +1,38 @@
|
||||||
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation } from "@angular/core";
|
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { MatPaginator, MatSort, MatSnackBar, MatDialog, MatChipList, MatChip } from "@angular/material";
|
import { MatPaginator, MatSort, MatSnackBar, MatDialog, MatChipList, MatChip } from '@angular/material';
|
||||||
import { Router, ActivatedRoute, Params } from "@angular/router";
|
import { Router, ActivatedRoute, Params } from '@angular/router';
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { DataSource } from "@angular/cdk/table";
|
import { DataSource } from '@angular/cdk/table';
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from 'rxjs/Observable';
|
||||||
import { JsonSerializer } from "../../utilities/JsonSerializer";
|
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
||||||
import { FormGroup, FormControl } from "@angular/forms";
|
import { FormGroup, FormControl } from '@angular/forms';
|
||||||
import { SnackBarNotificationComponent } from "../../shared/components/notificaiton/snack-bar-notification.component";
|
import { SnackBarNotificationComponent } from '../../shared/components/notificaiton/snack-bar-notification.component';
|
||||||
import { BaseErrorModel } from "../../models/error/BaseErrorModel";
|
import { BaseErrorModel } from '../../models/error/BaseErrorModel';
|
||||||
import { DataManagementPlanService } from "../../services/data-management-plan/data-management-plan.service";
|
import { DataManagementPlanService } from '../../services/data-management-plan/data-management-plan.service';
|
||||||
import { DataManagementPlanModel } from "../../models/data-managemnt-plans/DataManagementPlanModel";
|
import { DataManagementPlanModel } from '../../models/data-managemnt-plans/DataManagementPlanModel';
|
||||||
import { ExternalSourcesService } from "../../services/external-sources/external-sources.service";
|
import { ExternalSourcesService } from '../../services/external-sources/external-sources.service';
|
||||||
import { ExternalSourcesItemModel } from "../../models/external-sources/ExternalSourcesItemModel";
|
import { ExternalSourcesItemModel } from '../../models/external-sources/ExternalSourcesItemModel';
|
||||||
import { RequestItem } from "../../models/criteria/RequestItem";
|
import { RequestItem } from '../../models/criteria/RequestItem';
|
||||||
import { DatasetProfileCriteria } from "../../models/criteria/dataset/DatasetProfileCriteria";
|
import { DatasetProfileCriteria } from '../../models/criteria/dataset/DatasetProfileCriteria';
|
||||||
import { DataManagementPlanCriteriaComponent } from "../../shared/components/criteria/data-management-plan/dmp-criteria.component";
|
import { DataManagementPlanCriteriaComponent } from '../../shared/components/criteria/data-management-plan/dmp-criteria.component';
|
||||||
import { DatasetProfileModel } from "../../models/datasets/DatasetProfileModel";
|
import { DatasetProfileModel } from '../../models/datasets/DatasetProfileModel';
|
||||||
import { ProjectCriteria } from "../../models/criteria/project/ProjectCriteria";
|
import { ProjectCriteria } from '../../models/criteria/project/ProjectCriteria';
|
||||||
import { ProjectService } from "../../services/project/project.service";
|
import { ProjectService } from '../../services/project/project.service';
|
||||||
import { DmpUsersModel } from "../../models/dmpUsers/DmpUsersModel";
|
import { DmpUsersModel } from '../../models/dmpUsers/DmpUsersModel';
|
||||||
import { AddResearchersComponent } from "../../shared/components/add-researchers/add-researchers.component";
|
import { AddResearchersComponent } from '../../shared/components/add-researchers/add-researchers.component';
|
||||||
import { ViewContainerRef } from '@angular/core';
|
import { ViewContainerRef } from '@angular/core';
|
||||||
import { TdDialogService } from '@covalent/core';
|
import { TdDialogService } from '@covalent/core';
|
||||||
import { AvailableProfilesComponent } from "../../shared/components/available-profiles/available-profiles.component";
|
import { AvailableProfilesComponent } from '../../shared/components/available-profiles/available-profiles.component';
|
||||||
import { BaseCriteria } from "../../models/criteria/BaseCriteria";
|
import { BaseCriteria } from '../../models/criteria/BaseCriteria';
|
||||||
import { DataManagementPlanProfileService } from "../../services/data-management-plan-profile/datamanagement-profile.service";
|
import { DataManagementPlanProfileService } from '../../services/data-management-plan-profile/datamanagement-profile.service';
|
||||||
import { DataManagementPlanProfileListingModel } from "../../models/data-management-plan-profile/DataManagementPlanProfileListingModel";
|
import { DataManagementPlanProfileListingModel } from '../../models/data-management-plan-profile/DataManagementPlanProfileListingModel';
|
||||||
import { DataManagementPlanProfileCriteria } from "../../models/criteria/dmp-profile/DataManagementPlanProfileCriteria";
|
import { DataManagementPlanProfileCriteria } from '../../models/criteria/dmp-profile/DataManagementPlanProfileCriteria';
|
||||||
import { DataManagementPlanProfile } from "../../models/data-management-plan-profile/DataManagementPlanProfile";
|
import { DataManagementPlanProfile } from '../../models/data-management-plan-profile/DataManagementPlanProfile';
|
||||||
import { LanguageResolverService } from "../../services/language-resolver/language-resolver.service";
|
import { LanguageResolverService } from '../../services/language-resolver/language-resolver.service';
|
||||||
import { IBreadCrumbComponent } from "../../shared/components/breadcrumb/definition/IBreadCrumbComponent";
|
import { IBreadCrumbComponent } from '../../shared/components/breadcrumb/definition/IBreadCrumbComponent';
|
||||||
import { BreadcrumbItem } from "../../shared/components/breadcrumb/definition/breadcrumb-item";
|
import { BreadcrumbItem } from '../../shared/components/breadcrumb/definition/breadcrumb-item';
|
||||||
import { SingleAutoCompleteConfiguration } from "../../shared/components/autocompletes/single/single-auto-complete-configuration";
|
import { SingleAutoCompleteConfiguration } from '../../shared/components/autocompletes/single/single-auto-complete-configuration';
|
||||||
import { MultipleAutoCompleteConfiguration } from "../../shared/components/autocompletes/multiple/multiple-auto-complete-configuration";
|
import { MultipleAutoCompleteConfiguration } from '../../shared/components/autocompletes/multiple/multiple-auto-complete-configuration';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dmp-editor-component',
|
selector: 'app-dmp-editor-component',
|
||||||
|
@ -49,9 +49,9 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
|
||||||
dataManagementPlan: DataManagementPlanModel;
|
dataManagementPlan: DataManagementPlanModel;
|
||||||
formGroup: FormGroup = null;
|
formGroup: FormGroup = null;
|
||||||
|
|
||||||
filteringOrganisationsAsync: boolean = false;
|
filteringOrganisationsAsync = false;
|
||||||
filteringResearchersAsync: boolean = false;
|
filteringResearchersAsync = false;
|
||||||
filteredProfilesAsync: boolean = false;
|
filteredProfilesAsync = false;
|
||||||
filteredOrganisations: ExternalSourcesItemModel[];
|
filteredOrganisations: ExternalSourcesItemModel[];
|
||||||
filteredResearchers: ExternalSourcesItemModel[];
|
filteredResearchers: ExternalSourcesItemModel[];
|
||||||
filteredProfiles: DatasetProfileModel[];
|
filteredProfiles: DatasetProfileModel[];
|
||||||
|
@ -62,8 +62,8 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
|
||||||
researchersAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
researchersAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
||||||
|
|
||||||
createNewVersion;
|
createNewVersion;
|
||||||
associatedUsers: Array<DmpUsersModel>
|
associatedUsers: Array<DmpUsersModel>;
|
||||||
filteredOptions: Observable<DataManagementPlanProfileListingModel>
|
filteredOptions: Observable<DataManagementPlanProfileListingModel>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private dmpProfileService: DataManagementPlanProfileService,
|
private dmpProfileService: DataManagementPlanProfileService,
|
||||||
|
@ -87,9 +87,9 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
|
||||||
this.route.params.subscribe((params: Params) => {
|
this.route.params.subscribe((params: Params) => {
|
||||||
const itemId = params['id'];
|
const itemId = params['id'];
|
||||||
|
|
||||||
let projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
|
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
|
||||||
projectRequestItem.criteria = new ProjectCriteria();
|
projectRequestItem.criteria = new ProjectCriteria();
|
||||||
let organisationRequestItem: RequestItem<BaseCriteria> = new RequestItem();
|
const organisationRequestItem: RequestItem<BaseCriteria> = new RequestItem();
|
||||||
organisationRequestItem.criteria = new BaseCriteria();
|
organisationRequestItem.criteria = new BaseCriteria();
|
||||||
//this.projectAutoCompleteConfiguration = new AutoCompleteConfiguration(this.projectService.getWithExternal.bind(this.projectService), projectRequestItem);
|
//this.projectAutoCompleteConfiguration = new AutoCompleteConfiguration(this.projectService.getWithExternal.bind(this.projectService), projectRequestItem);
|
||||||
|
|
||||||
|
@ -97,34 +97,34 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
|
||||||
this.projectAutoCompleteConfiguration = {
|
this.projectAutoCompleteConfiguration = {
|
||||||
filterFn: this.searchProject.bind(this),
|
filterFn: this.searchProject.bind(this),
|
||||||
items: this.searchProject(''),
|
items: this.searchProject(''),
|
||||||
displayFn: (item) => item["label"],
|
displayFn: (item) => item['label'],
|
||||||
titleFn: (item) => item["label"],
|
titleFn: (item) => item['label'],
|
||||||
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
|
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
|
||||||
loadDataOnStart: true
|
loadDataOnStart: true
|
||||||
};
|
};
|
||||||
|
|
||||||
this.profilesAutoCompleteConfiguration = {
|
this.profilesAutoCompleteConfiguration = {
|
||||||
filterFn: this.filterProfiles.bind(this),
|
filterFn: this.filterProfiles.bind(this),
|
||||||
initialItems: (excludedItems: any[]) => this.filterProfiles('').map(result => result.filter(x => excludedItems.map(x => x.id).indexOf(x.id) == -1)),
|
initialItems: (excludedItems: any[]) => this.filterProfiles('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
|
||||||
displayFn: (item) => item["label"],
|
displayFn: (item) => item['label'],
|
||||||
titleFn: (item) => item["label"],
|
titleFn: (item) => item['label'],
|
||||||
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
|
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
|
||||||
loadDataOnStart: true
|
loadDataOnStart: true
|
||||||
};
|
};
|
||||||
|
|
||||||
this.organisationsAutoCompleteConfiguration = {
|
this.organisationsAutoCompleteConfiguration = {
|
||||||
filterFn: this.filterOrganisations.bind(this),
|
filterFn: this.filterOrganisations.bind(this),
|
||||||
initialItems: (excludedItems: any[]) => this.filterOrganisations('').map(result => result.filter(x => excludedItems.map(x => x.id).indexOf(x.id) == -1)),
|
initialItems: (excludedItems: any[]) => this.filterOrganisations('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
|
||||||
displayFn: (item) => item["name"],
|
displayFn: (item) => item['name'],
|
||||||
titleFn: (item) => item["name"],
|
titleFn: (item) => item['name'],
|
||||||
loadDataOnStart: true
|
loadDataOnStart: true
|
||||||
};
|
};
|
||||||
|
|
||||||
this.researchersAutoCompleteConfiguration = {
|
this.researchersAutoCompleteConfiguration = {
|
||||||
filterFn: this.filterResearchers.bind(this),
|
filterFn: this.filterResearchers.bind(this),
|
||||||
initialItems: (excludedItems: any[]) => this.filterResearchers('').map(result => result.filter(x => excludedItems.map(x => x.id).indexOf(x.id) == -1)),
|
initialItems: (excludedItems: any[]) => this.filterResearchers('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
|
||||||
displayFn: (item) => item["name"],
|
displayFn: (item) => item['name'],
|
||||||
titleFn: (item) => item["name"],
|
titleFn: (item) => item['name'],
|
||||||
loadDataOnStart: true
|
loadDataOnStart: true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -134,34 +134,34 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
|
||||||
.subscribe(async data => {
|
.subscribe(async data => {
|
||||||
this.dataManagementPlan = JsonSerializer.fromJSONObject(data, DataManagementPlanModel);
|
this.dataManagementPlan = JsonSerializer.fromJSONObject(data, DataManagementPlanModel);
|
||||||
this.formGroup = this.dataManagementPlan.buildForm();
|
this.formGroup = this.dataManagementPlan.buildForm();
|
||||||
if (this.formGroup.get("profile") && this.formGroup.get("profile").value) {
|
if (this.formGroup.get('profile') && this.formGroup.get('profile').value) {
|
||||||
this.textCtrl.patchValue(this.formGroup.get("profile").value);
|
this.textCtrl.patchValue(this.formGroup.get('profile').value);
|
||||||
}
|
}
|
||||||
this.breadCrumbs = Observable.of([
|
this.breadCrumbs = Observable.of([
|
||||||
{
|
{
|
||||||
parentComponentName: "DataManagementPlanListingComponent",
|
parentComponentName: 'DataManagementPlanListingComponent',
|
||||||
label: 'DMPs',
|
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()]
|
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;
|
this.associatedUsers = data.associatedUsers;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.dataManagementPlan = new DataManagementPlanModel();
|
this.dataManagementPlan = new DataManagementPlanModel();
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
this.formGroup = this.dataManagementPlan.buildForm();
|
this.formGroup = this.dataManagementPlan.buildForm();
|
||||||
if (this.formGroup.get("profile") && this.formGroup.get("profile").value) {
|
if (this.formGroup.get('profile') && this.formGroup.get('profile').value) {
|
||||||
this.textCtrl.patchValue(this.formGroup.get("profile").value);
|
this.textCtrl.patchValue(this.formGroup.get('profile').value);
|
||||||
}
|
}
|
||||||
this.breadCrumbs = Observable.of([
|
this.breadCrumbs = Observable.of([
|
||||||
{
|
{
|
||||||
parentComponentName: "DataManagementPlanListingComponent",
|
parentComponentName: 'DataManagementPlanListingComponent',
|
||||||
label: 'DMPs',
|
label: 'DMPs',
|
||||||
url: "dmps",
|
url: 'dmps',
|
||||||
}
|
}
|
||||||
])
|
]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,12 +169,12 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
|
||||||
this.route
|
this.route
|
||||||
.queryParams
|
.queryParams
|
||||||
.subscribe(params => {
|
.subscribe(params => {
|
||||||
this.createNewVersion = params["clone"];
|
this.createNewVersion = params['clone'];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
searchProject(query: string) {
|
searchProject(query: string) {
|
||||||
let projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
|
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
|
||||||
projectRequestItem.criteria = new ProjectCriteria();
|
projectRequestItem.criteria = new ProjectCriteria();
|
||||||
projectRequestItem.criteria.like = query;
|
projectRequestItem.criteria.like = query;
|
||||||
return this.projectService.getWithExternal(projectRequestItem);
|
return this.projectService.getWithExternal(projectRequestItem);
|
||||||
|
@ -194,14 +194,14 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
|
||||||
this.dataManagementPlanService.createDataManagementPlan(this.formGroup.value).subscribe(
|
this.dataManagementPlanService.createDataManagementPlan(this.formGroup.value).subscribe(
|
||||||
complete => this.onCallbackSuccess(),
|
complete => this.onCallbackSuccess(),
|
||||||
error => this.onCallbackError(error)
|
error => this.onCallbackError(error)
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
onCallbackSuccess(): void {
|
onCallbackSuccess(): void {
|
||||||
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
||||||
data: { message: this.isNew ? 'GENERAL.SNACK-BAR.SUCCESSFUL-CREATION' : 'GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE', language: this.language },
|
data: { message: this.isNew ? 'GENERAL.SNACK-BAR.SUCCESSFUL-CREATION' : 'GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE', language: this.language },
|
||||||
duration: 3000,
|
duration: 3000,
|
||||||
})
|
});
|
||||||
this.router.navigate(['/dmps']);
|
this.router.navigate(['/dmps']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
|
||||||
public setErrorModel(errorModel: BaseErrorModel) {
|
public setErrorModel(errorModel: BaseErrorModel) {
|
||||||
Object.keys(errorModel).forEach(item => {
|
Object.keys(errorModel).forEach(item => {
|
||||||
(<any>this.dataManagementPlan.errorModel)[item] = (<any>errorModel)[item];
|
(<any>this.dataManagementPlan.errorModel)[item] = (<any>errorModel)[item];
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public cancel(): void {
|
public cancel(): void {
|
||||||
|
@ -229,7 +229,7 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
|
||||||
this.filteredOrganisations = undefined;
|
this.filteredOrganisations = undefined;
|
||||||
this.filteringOrganisationsAsync = true;
|
this.filteringOrganisationsAsync = true;
|
||||||
|
|
||||||
return this.externalSourcesService.searchDMPOrganizations(value)
|
return this.externalSourcesService.searchDMPOrganizations(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
filterResearchers(value: string): Observable<ExternalSourcesItemModel[]> {
|
filterResearchers(value: string): Observable<ExternalSourcesItemModel[]> {
|
||||||
|
@ -237,7 +237,7 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
|
||||||
this.filteredResearchers = undefined;
|
this.filteredResearchers = undefined;
|
||||||
this.filteringResearchersAsync = true;
|
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[]> {
|
filterProfiles(value: string): Observable<DatasetProfileModel[]> {
|
||||||
|
@ -246,14 +246,14 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
|
||||||
this.filteredProfilesAsync = true;
|
this.filteredProfilesAsync = true;
|
||||||
|
|
||||||
const request = new RequestItem<DatasetProfileCriteria>();
|
const request = new RequestItem<DatasetProfileCriteria>();
|
||||||
let criteria = new DatasetProfileCriteria();
|
const criteria = new DatasetProfileCriteria();
|
||||||
criteria.like = value;
|
criteria.like = value;
|
||||||
request.criteria = criteria;
|
request.criteria = criteria;
|
||||||
return this._service.searchDMPProfiles(request)
|
return this._service.searchDMPProfiles(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
addResearcher(rowId: any, rowName: any) {
|
addResearcher(rowId: any, rowName: any) {
|
||||||
let dialogRef = this.dialog.open(AddResearchersComponent, {
|
const dialogRef = this.dialog.open(AddResearchersComponent, {
|
||||||
height: '255px',
|
height: '255px',
|
||||||
width: '700px',
|
width: '700px',
|
||||||
data: {
|
data: {
|
||||||
|
@ -265,11 +265,11 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
|
||||||
}
|
}
|
||||||
|
|
||||||
availableProfiles() {
|
availableProfiles() {
|
||||||
let dialogRef = this.dialog.open(AvailableProfilesComponent, {
|
const dialogRef = this.dialog.open(AvailableProfilesComponent, {
|
||||||
height: '355px',
|
height: '355px',
|
||||||
width: '700px',
|
width: '700px',
|
||||||
data: {
|
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) => {
|
}).afterClosed().subscribe((accept: boolean) => {
|
||||||
if (accept) {
|
if (accept) {
|
||||||
this.dataManagementPlanService.delete(id).subscribe(() => {
|
this.dataManagementPlanService.delete(id).subscribe(() => {
|
||||||
this.router.navigate(['/dmps'])
|
this.router.navigate(['/dmps']);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// DO SOMETHING ELSE
|
// DO SOMETHING ELSE
|
||||||
|
@ -299,23 +299,23 @@ export class DataManagementPlanEditorComponent implements AfterViewInit, IBreadC
|
||||||
|
|
||||||
selectOption(option: any) {
|
selectOption(option: any) {
|
||||||
this.dataManagementPlan.definition = null;
|
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.dmpProfileService.getSingle(option.id).subscribe(result => {
|
||||||
this.dataManagementPlan.definition = result.definition;
|
this.dataManagementPlan.definition = result.definition;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
displayWith(item: any) {
|
displayWith(item: any) {
|
||||||
if (!item) return null;
|
if (!item) { return null; }
|
||||||
return item["label"];
|
return item['label'];
|
||||||
}
|
}
|
||||||
|
|
||||||
redirectToProject() {
|
redirectToProject() {
|
||||||
this.router.navigate(["projects/edit/" + this.dataManagementPlan.project.id])
|
this.router.navigate(['projects/edit/' + this.dataManagementPlan.project.id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
redirectToDatasets() {
|
redirectToDatasets() {
|
||||||
this.router.navigate(["datasets/dmp/" + this.dataManagementPlan.id])
|
this.router.navigate(['datasets/dmp/' + this.dataManagementPlan.id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
newVersion(id: String, label: String) {
|
newVersion(id: String, label: String) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Component, ViewEncapsulation, AfterViewInit, Input, OnInit, OnDestroy } from "@angular/core";
|
import { Component, ViewEncapsulation, AfterViewInit, Input, OnInit, OnDestroy } from '@angular/core';
|
||||||
import { DataManagementPlanProfile } from "../../../models/data-management-plan-profile/DataManagementPlanProfile";
|
import { DataManagementPlanProfile } from '../../../models/data-management-plan-profile/DataManagementPlanProfile';
|
||||||
import { DMPProfileFieldDataType, DMPProfileType } from "../../../models/data-management-plan-profile/DataManagementProfileField";
|
import { DMPProfileFieldDataType, DMPProfileType } from '../../../models/data-management-plan-profile/DataManagementProfileField';
|
||||||
import { FormGroup, FormBuilder, FormArray } from "@angular/forms";
|
import { FormGroup, FormBuilder, FormArray } from '@angular/forms';
|
||||||
import { LanguageResolverService } from "../../../services/language-resolver/language-resolver.service";
|
import { LanguageResolverService } from '../../../services/language-resolver/language-resolver.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dynamic-dmp-field-resolver',
|
selector: 'app-dynamic-dmp-field-resolver',
|
||||||
|
@ -10,7 +10,7 @@ import { LanguageResolverService } from "../../../services/language-resolver/lan
|
||||||
styleUrls: ['./dynamic-dmp-field-resolver.component.scss'],
|
styleUrls: ['./dynamic-dmp-field-resolver.component.scss'],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class DynamicDmpFieldResolver implements OnInit, OnDestroy {
|
export class DynamicDmpFieldResolverComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
|
|
||||||
DMPProfileFieldDataType = DMPProfileFieldDataType;
|
DMPProfileFieldDataType = DMPProfileFieldDataType;
|
||||||
|
@ -20,21 +20,21 @@ export class DynamicDmpFieldResolver implements OnInit, OnDestroy {
|
||||||
dataManagementPlanProfile: DataManagementPlanProfile;
|
dataManagementPlanProfile: DataManagementPlanProfile;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
formGroup: FormGroup
|
formGroup: FormGroup;
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.formGroup.addControl("properties", new FormBuilder().group([]));
|
this.formGroup.addControl('properties', new FormBuilder().group([]));
|
||||||
(<FormGroup>this.formGroup.get("properties")).addControl("fields", new FormBuilder().array([]))
|
(<FormGroup>this.formGroup.get('properties')).addControl('fields', new FormBuilder().array([]));
|
||||||
|
|
||||||
this.dataManagementPlanProfile.fields.forEach(item => {
|
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],
|
id: [item.id],
|
||||||
value: [item.value]
|
value: [item.value]
|
||||||
}))
|
}));
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.formGroup.removeControl("properties")
|
this.formGroup.removeControl('properties');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { Component, ViewEncapsulation, OnInit, Input, ViewChild } from "@angular/core";
|
import { Component, ViewEncapsulation, OnInit, Input, ViewChild } from '@angular/core';
|
||||||
import { FormGroup } from "@angular/forms";
|
import { FormGroup } from '@angular/forms';
|
||||||
import { DataManagementPlanService } from "../../../../services/data-management-plan/data-management-plan.service";
|
import { DataManagementPlanService } from '../../../../services/data-management-plan/data-management-plan.service';
|
||||||
import { RequestItem } from "../../../../models/criteria/RequestItem";
|
import { RequestItem } from '../../../../models/criteria/RequestItem';
|
||||||
import { DynamicFieldProjectCriteria, DynamicFieldProjectCriteriaDependencies } from "../../../../models/dynamic-field-project/DynamicFieldProjectCriteria";
|
import { DynamicFieldProjectCriteria, DynamicFieldProjectCriteriaDependencies } from '../../../../models/dynamic-field-project/DynamicFieldProjectCriteria';
|
||||||
import { AutoCompleteComponent } from "../../../../shared/components/auto-complete/auto-complete.component";
|
import { AutoCompleteComponent } from '../../../../shared/components/auto-complete/auto-complete.component';
|
||||||
import { DynamicFieldDependency } from "../../../../models/data-managemnt-plans/DynamicFieldDependency";
|
import { DynamicFieldDependency } from '../../../../models/data-managemnt-plans/DynamicFieldDependency';
|
||||||
import { LanguageResolverService } from "../../../../services/language-resolver/language-resolver.service";
|
import { LanguageResolverService } from '../../../../services/language-resolver/language-resolver.service';
|
||||||
import { AutoCompleteConfiguration } from "../../../../shared/components/auto-complete/AutoCompleteConfiguration";
|
import { AutoCompleteConfiguration } from '../../../../shared/components/auto-complete/AutoCompleteConfiguration';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dynamic-field-project',
|
selector: 'app-dynamic-field-project',
|
||||||
|
@ -19,66 +19,66 @@ export class DynamicFieldProjectComponent implements OnInit {
|
||||||
constructor(private languageResolverService: LanguageResolverService, private dmpService: DataManagementPlanService) { }
|
constructor(private languageResolverService: LanguageResolverService, private dmpService: DataManagementPlanService) { }
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
dependencies: Array<FormGroup>
|
dependencies: Array<FormGroup>;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
formGroup: FormGroup;
|
formGroup: FormGroup;
|
||||||
|
|
||||||
@ViewChild(AutoCompleteComponent)
|
@ViewChild(AutoCompleteComponent)
|
||||||
autocomplete: AutoCompleteComponent
|
autocomplete: AutoCompleteComponent;
|
||||||
|
|
||||||
autoCompleteConfiguration: AutoCompleteConfiguration
|
autoCompleteConfiguration: AutoCompleteConfiguration;
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
let requestItem = new RequestItem<DynamicFieldProjectCriteria>()
|
const requestItem = new RequestItem<DynamicFieldProjectCriteria>();
|
||||||
requestItem.criteria = { id: this.formGroup.get("id").value, dynamicFields: this.buildDependencies() }
|
requestItem.criteria = { id: this.formGroup.get('id').value, dynamicFields: this.buildDependencies() };
|
||||||
this.autoCompleteConfiguration = new AutoCompleteConfiguration(this.dmpService.getDynamicField.bind(this.dmpService), requestItem);
|
this.autoCompleteConfiguration = new AutoCompleteConfiguration(this.dmpService.getDynamicField.bind(this.dmpService), requestItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
hasUnResolvedDependencies() {
|
hasUnResolvedDependencies() {
|
||||||
if (this.dependencies == null || this.dependencies.length == 0) {
|
if (this.dependencies == null || this.dependencies.length === 0) {
|
||||||
if (this.formGroup.get("value").disabled) {
|
if (this.formGroup.get('value').disabled) {
|
||||||
this.updateConfiguration();
|
this.updateConfiguration();
|
||||||
this.formGroup.get("value").enable({ onlySelf: true, emitEvent: false })
|
this.formGroup.get('value').enable({ onlySelf: true, emitEvent: false });
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (let i = 0; i < this.dependencies.length; i++) {
|
for (let i = 0; i < this.dependencies.length; i++) {
|
||||||
if (!this.dependencies[i].get("value").value) {
|
if (!this.dependencies[i].get('value').value) {
|
||||||
this.formGroup.get("value").disable({ onlySelf: true, emitEvent: false })
|
this.formGroup.get('value').disable({ onlySelf: true, emitEvent: false });
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.formGroup.get("value").disabled) {
|
if (this.formGroup.get('value').disabled) {
|
||||||
this.updateConfiguration();
|
this.updateConfiguration();
|
||||||
this.formGroup.get("value").enable({ onlySelf: true, emitEvent: false })
|
this.formGroup.get('value').enable({ onlySelf: true, emitEvent: false });
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateConfiguration() {
|
updateConfiguration() {
|
||||||
let requestItem = new RequestItem<DynamicFieldProjectCriteria>()
|
const requestItem = new RequestItem<DynamicFieldProjectCriteria>();
|
||||||
requestItem.criteria = { id: this.formGroup.get("id").value, dynamicFields: this.buildDependencies() }
|
requestItem.criteria = { id: this.formGroup.get('id').value, dynamicFields: this.buildDependencies() };
|
||||||
this.autoCompleteConfiguration = new AutoCompleteConfiguration(this.dmpService.getDynamicField.bind(this.dmpService), requestItem);
|
this.autoCompleteConfiguration = new AutoCompleteConfiguration(this.dmpService.getDynamicField.bind(this.dmpService), requestItem);
|
||||||
this.autocomplete.inputData = this.autoCompleteConfiguration;
|
this.autocomplete.inputData = this.autoCompleteConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildDependencies(): Array<DynamicFieldProjectCriteriaDependencies> {
|
buildDependencies(): Array<DynamicFieldProjectCriteriaDependencies> {
|
||||||
if (!this.dependencies || this.dependencies.length == 0) return []
|
if (!this.dependencies || this.dependencies.length === 0) { return []; }
|
||||||
let dependencies = new Array<DynamicFieldProjectCriteriaDependencies>();
|
const dependencies = new Array<DynamicFieldProjectCriteriaDependencies>();
|
||||||
for (let i = 0; i < this.dependencies.length; i++) {
|
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;
|
return dependencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
displayFunction(item: any): any {
|
displayFunction(item: any): any {
|
||||||
if (!item) return null;
|
if (!item) { return null; }
|
||||||
return item["label"];
|
return item['label'];
|
||||||
}
|
}
|
||||||
|
|
||||||
assignFunction(item: any): any {
|
assignFunction(item: any): any {
|
||||||
if (!item) return null;
|
if (!item) { return null; }
|
||||||
return item["id"];
|
return item['id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Component, ViewEncapsulation, OnInit, OnDestroy, Input } from "@angular/core";
|
import { Component, ViewEncapsulation, OnInit, OnDestroy, Input } from '@angular/core';
|
||||||
import { FormGroup, FormArray } from "@angular/forms";
|
import { FormGroup, FormArray } from '@angular/forms';
|
||||||
import { DynamicFieldDependency } from "../../../models/data-managemnt-plans/DynamicFieldDependency";
|
import { DynamicFieldDependency } from '../../../models/data-managemnt-plans/DynamicFieldDependency';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dynamic-fields-project',
|
selector: 'app-dynamic-fields-project',
|
||||||
|
@ -17,16 +17,16 @@ export class DynamicFieldsProjectComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
findDependencies(id: number) {
|
findDependencies(id: number) {
|
||||||
let formGroupDependencies: Array<FormGroup> = new Array<FormGroup>();
|
const formGroupDependencies: Array<FormGroup> = new Array<FormGroup>();
|
||||||
let dynamicFieldDependency: DynamicFieldDependency[] = (<FormArray>this.formGroup.get("dynamicFields")).at(id).get("dependencies").value
|
const dynamicFieldDependency: DynamicFieldDependency[] = (<FormArray>this.formGroup.get('dynamicFields')).at(id).get('dependencies').value;
|
||||||
if (dynamicFieldDependency.length > 0) {
|
if (dynamicFieldDependency.length > 0) {
|
||||||
dynamicFieldDependency.forEach(item => {
|
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++) {
|
for (let i = 0; i < length; i++) {
|
||||||
let formGroup = (<FormArray>this.formGroup.get("dynamicFields")).at(i);
|
const formGroup = (<FormArray>this.formGroup.get('dynamicFields')).at(i);
|
||||||
if (formGroup.get("id").value === item.id) formGroupDependencies.push(<FormGroup>formGroup);
|
if (formGroup.get('id').value === item.id) { formGroupDependencies.push(<FormGroup>formGroup); }
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
return formGroupDependencies;
|
return formGroupDependencies;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,12 @@ import {
|
||||||
DataManagementPlanCriteriaComponent,
|
DataManagementPlanCriteriaComponent,
|
||||||
} from '../../shared/components/criteria/data-management-plan/dmp-criteria.component';
|
} from '../../shared/components/criteria/data-management-plan/dmp-criteria.component';
|
||||||
import { DataManagementPlanService } from '../../services/data-management-plan/data-management-plan.service';
|
import { DataManagementPlanService } from '../../services/data-management-plan/data-management-plan.service';
|
||||||
import { Component, ViewChild, OnInit, AfterViewInit } from "@angular/core";
|
import { Component, ViewChild, OnInit, AfterViewInit } from '@angular/core';
|
||||||
import { MatPaginator, MatSort, MatSnackBar, MatDialog } from "@angular/material";
|
import { MatPaginator, MatSort, MatSnackBar, MatDialog } from '@angular/material';
|
||||||
import { Router, ActivatedRoute, ActivatedRouteSnapshot } from "@angular/router";
|
import { Router, ActivatedRoute, ActivatedRouteSnapshot } from '@angular/router';
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { DataSource } from "@angular/cdk/table";
|
import { DataSource } from '@angular/cdk/table';
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from 'rxjs/Observable';
|
||||||
import { DataManagementPlanRoutes } from '../../dmps/dmps.routes';
|
import { DataManagementPlanRoutes } from '../../dmps/dmps.routes';
|
||||||
import { DatasetRoutes } from '../../datasets/dataset.routes';
|
import { DatasetRoutes } from '../../datasets/dataset.routes';
|
||||||
import { ProjectModel } from '../../models/projects/ProjectModel';
|
import { ProjectModel } from '../../models/projects/ProjectModel';
|
||||||
|
@ -55,39 +55,41 @@ export class DataManagementPlanListingComponent implements OnInit, IBreadCrumbCo
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.params.subscribe(async params => {
|
this.route.params.subscribe(async params => {
|
||||||
let projectLabel;
|
let projectLabel;
|
||||||
if (params["projectId"]) {
|
if (params['projectId']) {
|
||||||
this.projectId = params["projectId"];
|
this.projectId = params['projectId'];
|
||||||
this.showProject = false;
|
this.showProject = false;
|
||||||
let project = new ProjectModel();
|
const project = new ProjectModel();
|
||||||
project.id = this.projectId;
|
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();
|
this.refresh();
|
||||||
projectLabel = this.route.snapshot.queryParams.projectLabel
|
projectLabel = this.route.snapshot.queryParams.projectLabel;
|
||||||
this.breadCrumbs = Observable.of([{ parentComponentName: "ProjectEditorComponent", label: projectLabel, url: "/projects/edit/" + this.projectId }])
|
this.breadCrumbs = Observable.of([{ parentComponentName: 'ProjectEditorComponent', label: projectLabel, url: '/projects/edit/' + this.projectId }]);
|
||||||
this.criteria.setRefreshCallback(() => this.refresh());
|
this.criteria.setRefreshCallback(() => this.refresh());
|
||||||
} else {
|
} else {
|
||||||
this.itemId = params['groupId'];
|
this.itemId = params['groupId'];
|
||||||
this.showProject = true;
|
this.showProject = true;
|
||||||
let breadCrumbs = [];
|
const breadCrumbs = [];
|
||||||
|
|
||||||
if (this.itemId) {
|
if (this.itemId) {
|
||||||
let dmplabel = this.route.snapshot.queryParams.groupLabel
|
const dmplabel = this.route.snapshot.queryParams.groupLabel;
|
||||||
breadCrumbs.push(
|
breadCrumbs.push(
|
||||||
{ parentComponentName: null, label: 'DMPs', url: "/dmps" },
|
{ parentComponentName: null, label: 'DMPs', url: '/dmps' },
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
//else breadCrumbs.push({ 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.criteria.setCriteria(this.getDefaultCriteria());
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.criteria.setRefreshCallback(() => this.refresh());
|
this.criteria.setRefreshCallback(() => this.refresh());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.projectId != null)
|
if (this.projectId != null) {
|
||||||
if (projectLabel != undefined)
|
if (projectLabel !== undefined) {
|
||||||
this.titlePrefix = "for " + projectLabel;
|
this.titlePrefix = 'for ' + projectLabel;
|
||||||
})
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +119,7 @@ export class DataManagementPlanListingComponent implements OnInit, IBreadCrumbCo
|
||||||
}
|
}
|
||||||
|
|
||||||
openShareDialog(rowId: any, rowName: any) {
|
openShareDialog(rowId: any, rowName: any) {
|
||||||
let dialogRef = this.dialog.open(InvitationComponent, {
|
const dialogRef = this.dialog.open(InvitationComponent, {
|
||||||
height: '200px',
|
height: '200px',
|
||||||
width: '700px',
|
width: '700px',
|
||||||
data: {
|
data: {
|
||||||
|
@ -156,8 +158,8 @@ export class DataManagementPlanDataSource extends DataSource<DataManagementPlanL
|
||||||
this.isLoadingResults = true;
|
this.isLoadingResults = true;
|
||||||
});
|
});
|
||||||
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
||||||
let fields: Array<string> = new Array()
|
let fields: Array<string> = new Array();
|
||||||
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
|
if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; }
|
||||||
const request = new DataTableRequest<DataManagementPlanCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
const request = new DataTableRequest<DataManagementPlanCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
||||||
request.criteria = this._criteria.formGroup.value;
|
request.criteria = this._criteria.formGroup.value;
|
||||||
if (this.itemId) {
|
if (this.itemId) {
|
||||||
|
@ -175,7 +177,7 @@ export class DataManagementPlanDataSource extends DataSource<DataManagementPlanL
|
||||||
return Observable.of(null);
|
return Observable.of(null);
|
||||||
})*/
|
})*/
|
||||||
.map(result => {
|
.map(result => {
|
||||||
result.data = JsonSerializer.fromJSONArray(result.data, DataManagementPlanListingModel)
|
result.data = JsonSerializer.fromJSONArray(result.data, DataManagementPlanListingModel);
|
||||||
return result;
|
return result;
|
||||||
})
|
})
|
||||||
.map(result => {
|
.map(result => {
|
||||||
|
@ -188,11 +190,11 @@ export class DataManagementPlanDataSource extends DataSource<DataManagementPlanL
|
||||||
if (!result) { return []; }
|
if (!result) { return []; }
|
||||||
if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; }
|
if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; }
|
||||||
return result.data.map(item => {
|
return result.data.map(item => {
|
||||||
item["datasets"].map(dmp => {
|
item['datasets'].map(dmp => {
|
||||||
dmp.url = "datasets/edit/" + dmp.url;
|
dmp.url = 'datasets/edit/' + dmp.url;
|
||||||
dmp.all = "datasets/dmp/" + item.id
|
dmp.all = 'datasets/dmp/' + item.id;
|
||||||
return dmp;
|
return dmp;
|
||||||
})
|
});
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,10 +26,10 @@ export class DataManagementPlanWizardComponent implements OnInit, IBreadCrumbCom
|
||||||
private router: Router
|
private router: Router
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
public itemId: string
|
public itemId: string;
|
||||||
public dataManagementPlan: DataManagementPlanModel;
|
public dataManagementPlan: DataManagementPlanModel;
|
||||||
public formGroup: FormGroup
|
public formGroup: FormGroup;
|
||||||
public isClone: boolean
|
public isClone: boolean;
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
||||||
|
@ -39,11 +39,10 @@ export class DataManagementPlanWizardComponent implements OnInit, IBreadCrumbCom
|
||||||
.subscribe(data => {
|
.subscribe(data => {
|
||||||
this.dataManagementPlan = JsonSerializer.fromJSONObject(data, DataManagementPlanModel);
|
this.dataManagementPlan = JsonSerializer.fromJSONObject(data, DataManagementPlanModel);
|
||||||
this.isClone = this.route.snapshot.data.clone;
|
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();
|
this.formGroup = this.dataManagementPlan.buildForm();
|
||||||
|
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,7 +64,7 @@ export class DataManagementPlanWizardComponent implements OnInit, IBreadCrumbCom
|
||||||
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
||||||
data: { message: 'GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE', language: this.language },
|
data: { message: 'GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE', language: this.language },
|
||||||
duration: 3000,
|
duration: 3000,
|
||||||
})
|
});
|
||||||
this.router.navigate(['/dmps']);
|
this.router.navigate(['/dmps']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +76,7 @@ export class DataManagementPlanWizardComponent implements OnInit, IBreadCrumbCom
|
||||||
public setErrorModel(errorModel: BaseErrorModel) {
|
public setErrorModel(errorModel: BaseErrorModel) {
|
||||||
Object.keys(errorModel).forEach(item => {
|
Object.keys(errorModel).forEach(item => {
|
||||||
// (<any>this.dataManagementPlan.errorModel)[item] = (<any>errorModel)[item];
|
// (<any>this.dataManagementPlan.errorModel)[item] = (<any>errorModel)[item];
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
<mat-card>
|
<mat-card>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<mat-form-field class="full-width">
|
<mat-form-field class="full-width">
|
||||||
<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"
|
||||||
[attr.disabled]="labelDisabled">
|
required [attr.disabled]="labelDisabled">
|
||||||
<mat-error *ngIf="formGroup.get('label').errors?.backendError">{{baseErrorModel.label}}</mat-error>
|
<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-error *ngIf="formGroup.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field class="full-width">
|
<mat-form-field class="full-width">
|
||||||
<textarea matInput class="description-area" placeholder="{{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}}" formControlName="description"
|
<textarea matInput class="description-area" placeholder="{{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}}"
|
||||||
required></textarea>
|
formControlName="description" required></textarea>
|
||||||
<mat-error *ngIf="formGroup.get('description').errors?.backendError">{{errorModel.description}}</mat-error>
|
<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-error *ngIf="formGroup.get('description').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
|
@ -11,12 +11,12 @@ import { DataManagementPlanModel } from '../../../models/data-managemnt-plans/Da
|
||||||
import { ProjectService } from '../../../services/project/project.service';
|
import { ProjectService } from '../../../services/project/project.service';
|
||||||
import { ExternalSourcesService } from '../../../services/external-sources/external-sources.service';
|
import { ExternalSourcesService } from '../../../services/external-sources/external-sources.service';
|
||||||
import { DataManagementPlanService } from '../../../services/data-management-plan/data-management-plan.service';
|
import { DataManagementPlanService } from '../../../services/data-management-plan/data-management-plan.service';
|
||||||
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation, Input } from "@angular/core";
|
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation, Input } from '@angular/core';
|
||||||
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
|
import { MatPaginator, MatSort, MatSnackBar } from '@angular/material';
|
||||||
import { Router, ActivatedRoute, Params } from "@angular/router";
|
import { Router, ActivatedRoute, Params } from '@angular/router';
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { DataSource } from "@angular/cdk/table";
|
import { DataSource } from '@angular/cdk/table';
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from 'rxjs/Observable';
|
||||||
import { FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
import { BaseCriteria } from '../../../models/criteria/BaseCriteria';
|
import { BaseCriteria } from '../../../models/criteria/BaseCriteria';
|
||||||
import { SingleAutoCompleteConfiguration } from '../../../shared/components/autocompletes/single/single-auto-complete-configuration';
|
import { SingleAutoCompleteConfiguration } from '../../../shared/components/autocompletes/single/single-auto-complete-configuration';
|
||||||
|
@ -36,9 +36,9 @@ export class DataManagementPlanWizardEditorComponent implements OnInit {
|
||||||
isNew = true;
|
isNew = true;
|
||||||
@Input() formGroup: FormGroup = null;
|
@Input() formGroup: FormGroup = null;
|
||||||
|
|
||||||
filteringOrganisationsAsync: boolean = false;
|
filteringOrganisationsAsync = false;
|
||||||
filteringResearchersAsync: boolean = false;
|
filteringResearchersAsync = false;
|
||||||
filteredProfilesAsync: boolean = false;
|
filteredProfilesAsync = false;
|
||||||
filteredOrganisations: ExternalSourcesItemModel[];
|
filteredOrganisations: ExternalSourcesItemModel[];
|
||||||
filteredResearchers: ExternalSourcesItemModel[];
|
filteredResearchers: ExternalSourcesItemModel[];
|
||||||
filteredProfiles: DatasetProfileModel[];
|
filteredProfiles: DatasetProfileModel[];
|
||||||
|
@ -48,8 +48,8 @@ export class DataManagementPlanWizardEditorComponent implements OnInit {
|
||||||
organisationsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
organisationsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
||||||
researchersAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
researchersAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
||||||
createNewVersion;
|
createNewVersion;
|
||||||
associatedUsers: Array<DmpUsersModel>
|
associatedUsers: Array<DmpUsersModel>;
|
||||||
labelDisabled: boolean = false;
|
labelDisabled = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private dataManagementPlanService: DataManagementPlanService,
|
private dataManagementPlanService: DataManagementPlanService,
|
||||||
|
@ -67,55 +67,55 @@ export class DataManagementPlanWizardEditorComponent implements OnInit {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
let projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
|
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
|
||||||
projectRequestItem.criteria = new ProjectCriteria();
|
projectRequestItem.criteria = new ProjectCriteria();
|
||||||
this.projectAutoCompleteConfiguration = {
|
this.projectAutoCompleteConfiguration = {
|
||||||
filterFn: this.searchProject.bind(this.projectService),
|
filterFn: this.searchProject.bind(this.projectService),
|
||||||
items: this.searchProject(''),
|
items: this.searchProject(''),
|
||||||
displayFn: (item) => item["label"],
|
displayFn: (item) => item['label'],
|
||||||
titleFn: (item) => item["label"],
|
titleFn: (item) => item['label'],
|
||||||
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
|
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
|
||||||
loadDataOnStart: true
|
loadDataOnStart: true
|
||||||
};
|
};
|
||||||
|
|
||||||
this.profilesAutoCompleteConfiguration = {
|
this.profilesAutoCompleteConfiguration = {
|
||||||
filterFn: this.filterProfiles.bind(this),
|
filterFn: this.filterProfiles.bind(this),
|
||||||
initialItems: (excludedItems: any[]) => this.filterProfiles('').map(result => result.filter(x => excludedItems.map(x => x.id).indexOf(x.id) == -1)),
|
initialItems: (excludedItems: any[]) => this.filterProfiles('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
|
||||||
displayFn: (item) => item["label"],
|
displayFn: (item) => item['label'],
|
||||||
titleFn: (item) => item["label"],
|
titleFn: (item) => item['label'],
|
||||||
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
|
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
|
||||||
loadDataOnStart: true
|
loadDataOnStart: true
|
||||||
};
|
};
|
||||||
|
|
||||||
this.organisationsAutoCompleteConfiguration = {
|
this.organisationsAutoCompleteConfiguration = {
|
||||||
filterFn: this.filterOrganisations.bind(this),
|
filterFn: this.filterOrganisations.bind(this),
|
||||||
initialItems: (excludedItems: any[]) => this.filterOrganisations('').map(result => result.filter(x => excludedItems.map(x => x.id).indexOf(x.id) == -1)),
|
initialItems: (excludedItems: any[]) => this.filterOrganisations('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
|
||||||
displayFn: (item) => item["name"],
|
displayFn: (item) => item['name'],
|
||||||
titleFn: (item) => item["name"],
|
titleFn: (item) => item['name'],
|
||||||
loadDataOnStart: true
|
loadDataOnStart: true
|
||||||
};
|
};
|
||||||
|
|
||||||
this.researchersAutoCompleteConfiguration = {
|
this.researchersAutoCompleteConfiguration = {
|
||||||
filterFn: this.filterResearchers.bind(this),
|
filterFn: this.filterResearchers.bind(this),
|
||||||
initialItems: (excludedItems: any[]) => this.filterResearchers('').map(result => result.filter(x => excludedItems.map(x => x.id).indexOf(x.id) == -1)),
|
initialItems: (excludedItems: any[]) => this.filterResearchers('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
|
||||||
displayFn: (item) => item["name"],
|
displayFn: (item) => item['name'],
|
||||||
titleFn: (item) => item["name"],
|
titleFn: (item) => item['name'],
|
||||||
loadDataOnStart: true
|
loadDataOnStart: true
|
||||||
};
|
};
|
||||||
|
|
||||||
let organisationRequestItem: RequestItem<BaseCriteria> = new RequestItem();
|
const organisationRequestItem: RequestItem<BaseCriteria> = new RequestItem();
|
||||||
organisationRequestItem.criteria = new BaseCriteria();
|
organisationRequestItem.criteria = new BaseCriteria();
|
||||||
|
|
||||||
this.route.data.subscribe(value => {
|
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.labelDisabled = true;
|
||||||
}
|
}
|
||||||
this.formGroup.controls["version"].disable();
|
this.formGroup.controls['version'].disable();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
searchProject(query: string) {
|
searchProject(query: string) {
|
||||||
let projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
|
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
|
||||||
projectRequestItem.criteria = new ProjectCriteria();
|
projectRequestItem.criteria = new ProjectCriteria();
|
||||||
projectRequestItem.criteria.like = query;
|
projectRequestItem.criteria.like = query;
|
||||||
return this.projectService.getWithExternal(projectRequestItem);
|
return this.projectService.getWithExternal(projectRequestItem);
|
||||||
|
@ -142,7 +142,7 @@ export class DataManagementPlanWizardEditorComponent implements OnInit {
|
||||||
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
||||||
data: { message: this.isNew ? 'GENERAL.SNACK-BAR.SUCCESSFUL-CREATION' : 'GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE', language: this.language },
|
data: { message: this.isNew ? 'GENERAL.SNACK-BAR.SUCCESSFUL-CREATION' : 'GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE', language: this.language },
|
||||||
duration: 3000,
|
duration: 3000,
|
||||||
})
|
});
|
||||||
this.router.navigate(['/dmps']);
|
this.router.navigate(['/dmps']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ export class DataManagementPlanWizardEditorComponent implements OnInit {
|
||||||
public setErrorModel(errorModel: BaseErrorModel) {
|
public setErrorModel(errorModel: BaseErrorModel) {
|
||||||
Object.keys(errorModel).forEach(item => {
|
Object.keys(errorModel).forEach(item => {
|
||||||
// (<any>this.dataManagementPlan.errorModel)[item] = (<any>errorModel)[item];
|
// (<any>this.dataManagementPlan.errorModel)[item] = (<any>errorModel)[item];
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public cancel(): void {
|
public cancel(): void {
|
||||||
|
@ -166,7 +166,7 @@ export class DataManagementPlanWizardEditorComponent implements OnInit {
|
||||||
this.filteredOrganisations = undefined;
|
this.filteredOrganisations = undefined;
|
||||||
this.filteringOrganisationsAsync = true;
|
this.filteringOrganisationsAsync = true;
|
||||||
|
|
||||||
return this.externalSourcesService.searchDMPOrganizations(value)
|
return this.externalSourcesService.searchDMPOrganizations(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
filterResearchers(value: string): Observable<ExternalSourcesItemModel[]> {
|
filterResearchers(value: string): Observable<ExternalSourcesItemModel[]> {
|
||||||
|
@ -174,7 +174,7 @@ export class DataManagementPlanWizardEditorComponent implements OnInit {
|
||||||
this.filteredResearchers = undefined;
|
this.filteredResearchers = undefined;
|
||||||
this.filteringResearchersAsync = true;
|
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[]> {
|
filterProfiles(value: string): Observable<DatasetProfileModel[]> {
|
||||||
|
@ -183,10 +183,10 @@ export class DataManagementPlanWizardEditorComponent implements OnInit {
|
||||||
this.filteredProfilesAsync = true;
|
this.filteredProfilesAsync = true;
|
||||||
|
|
||||||
const request = new RequestItem<DatasetProfileCriteria>();
|
const request = new RequestItem<DatasetProfileCriteria>();
|
||||||
let criteria = new DatasetProfileCriteria();
|
const criteria = new DatasetProfileCriteria();
|
||||||
criteria.like = value;
|
criteria.like = value;
|
||||||
request.criteria = criteria;
|
request.criteria = criteria;
|
||||||
return this._service.searchDMPProfiles(request)
|
return this._service.searchDMPProfiles(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,13 +7,13 @@ import { DataManagementPlanModel } from '../../../models/data-managemnt-plans/Da
|
||||||
import { DatasetCriteriaComponent } from '../../../shared/components/criteria/datasets/datasets-criteria.component';
|
import { DatasetCriteriaComponent } from '../../../shared/components/criteria/datasets/datasets-criteria.component';
|
||||||
import { DataManagementPlanService } from '../../../services/data-management-plan/data-management-plan.service';
|
import { DataManagementPlanService } from '../../../services/data-management-plan/data-management-plan.service';
|
||||||
import { DatasetService } from '../../../services/dataset/dataset.service';
|
import { DatasetService } from '../../../services/dataset/dataset.service';
|
||||||
import { Component, ViewChild, OnInit, AfterViewInit, Input } from "@angular/core";
|
import { Component, ViewChild, OnInit, AfterViewInit, Input } from '@angular/core';
|
||||||
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
|
import { MatPaginator, MatSort, MatSnackBar } from '@angular/material';
|
||||||
import { Router, Params, ActivatedRoute } from "@angular/router";
|
import { Router, Params, ActivatedRoute } from '@angular/router';
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { DataSource } from "@angular/cdk/table";
|
import { DataSource } from '@angular/cdk/table';
|
||||||
import { FormGroup, FormBuilder, FormControl, FormArray } from "@angular/forms"
|
import { FormGroup, FormBuilder, FormControl, FormArray } from '@angular/forms';
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from 'rxjs/Observable';
|
||||||
import { PageEvent } from '@angular/material';
|
import { PageEvent } from '@angular/material';
|
||||||
import { SelectionModel } from '@angular/cdk/collections';
|
import { SelectionModel } from '@angular/cdk/collections';
|
||||||
|
|
||||||
|
@ -31,10 +31,10 @@ export class DatasetWizardListingComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
titlePrefix: String;
|
titlePrefix: String;
|
||||||
datasets: DatasetListingModel[] = []
|
datasets: DatasetListingModel[] = [];
|
||||||
|
|
||||||
@Input() dmpId: String;
|
@Input() dmpId: String;
|
||||||
@Input() formGroup: FormGroup
|
@Input() formGroup: FormGroup;
|
||||||
selection = new SelectionModel<Element>(true, []);
|
selection = new SelectionModel<Element>(true, []);
|
||||||
|
|
||||||
statuses = [
|
statuses = [
|
||||||
|
@ -56,24 +56,26 @@ export class DatasetWizardListingComponent implements OnInit {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.params.subscribe((params: Params) => {
|
this.route.params.subscribe((params: Params) => {
|
||||||
if (this.dmpId != null)
|
if (this.dmpId != null) {
|
||||||
if (params['dmpLabel'] != undefined)
|
if (params['dmpLabel'] !== undefined) {
|
||||||
this.titlePrefix = "for " + params['dmpLabel'];
|
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 = new DatasetCriteria();
|
||||||
request.criteria.dmpIds = [this.dmpId];
|
request.criteria.dmpIds = [this.dmpId];
|
||||||
this.datasetService.getPaged(request).subscribe(items => {
|
this.datasetService.getPaged(request).subscribe(items => {
|
||||||
this.datasets = JsonSerializer.fromJSONArray(items.data, DatasetListingModel)
|
this.datasets = JsonSerializer.fromJSONArray(items.data, DatasetListingModel);
|
||||||
})
|
});
|
||||||
this.formGroup.addControl("datasets", new FormBuilder().array(new Array<FormControl>()))
|
this.formGroup.addControl('datasets', new FormBuilder().array(new Array<FormControl>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
selectionChanged(event, selectedItems) {
|
selectionChanged(event, selectedItems) {
|
||||||
this.formGroup.removeControl("datasets");
|
this.formGroup.removeControl('datasets');
|
||||||
this.formGroup.addControl("datasets", new FormBuilder().array(new Array<FormControl>()))
|
this.formGroup.addControl('datasets', new FormBuilder().array(new Array<FormControl>()));
|
||||||
selectedItems.selectedOptions.selected.forEach(element => {
|
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 }));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ declare var $: any;
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'df-autocomplete',
|
selector: 'app-df-autocomplete',
|
||||||
templateUrl: './autocomplete-remote.component.html',
|
templateUrl: './autocomplete-remote.component.html',
|
||||||
styleUrls: ['./autocomplete-remote.component.css'],
|
styleUrls: ['./autocomplete-remote.component.css'],
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
|
@ -20,14 +20,14 @@ export class AutocompleteRemoteComponent implements OnInit/* , ControlValueAcces
|
||||||
|
|
||||||
|
|
||||||
@Input() field: Field;
|
@Input() field: Field;
|
||||||
@Input() disabled = false
|
@Input() disabled = false;
|
||||||
@Input() form: FormGroup;
|
@Input() form: FormGroup;
|
||||||
|
|
||||||
public autoCompleteConfiguration: AutoCompleteConfiguration;
|
public autoCompleteConfiguration: AutoCompleteConfiguration;
|
||||||
public loading: boolean;
|
public loading: boolean;
|
||||||
public datasetId;
|
public datasetId;
|
||||||
public values: any[] = new Array();
|
public values: any[] = new Array();
|
||||||
public typeaheadMS: number = 1400;
|
public typeaheadMS = 1400;
|
||||||
|
|
||||||
constructor(private datasetProfileService: DatasetProfileService, route: ActivatedRoute) {
|
constructor(private datasetProfileService: DatasetProfileService, route: ActivatedRoute) {
|
||||||
this.datasetId = route.snapshot.params['id'];
|
this.datasetId = route.snapshot.params['id'];
|
||||||
|
@ -35,7 +35,7 @@ export class AutocompleteRemoteComponent implements OnInit/* , ControlValueAcces
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
let autocompleteRequestItem: RequestItem<AutocompleteLookupItem> = new RequestItem();
|
const autocompleteRequestItem: RequestItem<AutocompleteLookupItem> = new RequestItem();
|
||||||
autocompleteRequestItem.criteria = new AutocompleteLookupItem();
|
autocompleteRequestItem.criteria = new AutocompleteLookupItem();
|
||||||
autocompleteRequestItem.criteria.fieldID = this.field.id;
|
autocompleteRequestItem.criteria.fieldID = this.field.id;
|
||||||
autocompleteRequestItem.criteria.profileID = this.datasetId;
|
autocompleteRequestItem.criteria.profileID = this.datasetId;
|
||||||
|
@ -44,19 +44,18 @@ export class AutocompleteRemoteComponent implements OnInit/* , ControlValueAcces
|
||||||
}
|
}
|
||||||
|
|
||||||
displayWith(item: any) {
|
displayWith(item: any) {
|
||||||
if (!item) return null;
|
if (!item) { return null; }
|
||||||
if (typeof item === 'string') item = this.transform(item);
|
if (typeof item === 'string') { item = this.transform(item); }
|
||||||
return item["label"];
|
return item['label'];
|
||||||
}
|
}
|
||||||
|
|
||||||
assign(item: any) {
|
assign(item: any) {
|
||||||
if (!item) return null;
|
if (!item) { return null; }
|
||||||
return this.transform(item);
|
return this.transform(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
transform(item: any) {
|
transform(item: any) {
|
||||||
if (typeof item === 'string') return JSON.parse(item)
|
if (typeof item === 'string') { return JSON.parse(item); } else { return JSON.stringify(item); }
|
||||||
else return JSON.stringify(item);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { Field } from '../../../models/Field';
|
||||||
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'df-booleanDecision',
|
selector: 'app-df-boolean-decision',
|
||||||
templateUrl: './dynamic-field-boolean-decision.component.html',
|
templateUrl: './dynamic-field-boolean-decision.component.html',
|
||||||
styleUrls: [
|
styleUrls: [
|
||||||
'./dynamic-field-boolean-decision.component.css'
|
'./dynamic-field-boolean-decision.component.css'
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { FormGroup } from '@angular/forms';
|
||||||
import { Component, Input, ViewEncapsulation, OnInit } from '@angular/core';
|
import { Component, Input, ViewEncapsulation, OnInit } from '@angular/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'df-checkbox',
|
selector: 'app-df-checkbox',
|
||||||
templateUrl: './dynamic-field-checkbox.html',
|
templateUrl: './dynamic-field-checkbox.html',
|
||||||
styleUrls: [
|
styleUrls: [
|
||||||
'./dynamic-field-checkbox.css'
|
'./dynamic-field-checkbox.css'
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { Field } from '../../../models/Field';
|
||||||
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'df-dropdown',
|
selector: 'app-df-dropdown',
|
||||||
templateUrl: './dynamic-field-dropdown.html',
|
templateUrl: './dynamic-field-dropdown.html',
|
||||||
styleUrls: [
|
styleUrls: [
|
||||||
'./dynamic-field-dropdown.css'
|
'./dynamic-field-dropdown.css'
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'df-radiobox',
|
selector: 'app-df-radiobox',
|
||||||
templateUrl: './dynamic-field-radiobox.component.html',
|
templateUrl: './dynamic-field-radiobox.component.html',
|
||||||
styleUrls: [
|
styleUrls: [
|
||||||
'./dynamic-field-radiobox.component.css'
|
'./dynamic-field-radiobox.component.css'
|
||||||
|
|
|
@ -19,16 +19,16 @@
|
||||||
<div *ngSwitchCase="'combobox'">
|
<div *ngSwitchCase="'combobox'">
|
||||||
<!--TODO-->
|
<!--TODO-->
|
||||||
<div *ngIf="this.field.data.type === 'autocomplete'">
|
<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>
|
||||||
<div *ngIf="this.field.data.type === 'wordlist'">
|
<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>
|
</div>
|
||||||
|
|
||||||
<div *ngSwitchCase="'checkBox'" class="checkbox">
|
<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>
|
||||||
|
|
||||||
<div *ngSwitchCase="'textarea'">
|
<div *ngSwitchCase="'textarea'">
|
||||||
|
@ -44,11 +44,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngSwitchCase="'booleanDecision'">
|
<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>
|
||||||
|
|
||||||
<div *ngSwitchCase="'radiobox'">
|
<div *ngSwitchCase="'radiobox'">
|
||||||
<df-radiobox [form]="form" [field]="field"></df-radiobox>
|
<app-df-radiobox [form]="form" [field]="field"></app-df-radiobox>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngSwitchCase="'label'"> </div>
|
<div *ngSwitchCase="'label'"> </div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Field } from '../../models/Field';
|
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 { FormGroup, ValidatorFn, AbstractControl, Validators } from '@angular/forms';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { VisibilityRulesService } from '../../utilities/visibility-rules/visibility-rules.service';
|
import { VisibilityRulesService } from '../../utilities/visibility-rules/visibility-rules.service';
|
||||||
|
@ -7,7 +7,7 @@ import { Subscription } from 'rxjs';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'df-field',
|
selector: 'app-df-field',
|
||||||
templateUrl: './dynamic-form-field.component.html',
|
templateUrl: './dynamic-form-field.component.html',
|
||||||
// styles: ['.checkBoxLabelCustom {font-weight: 700;}']
|
// styles: ['.checkBoxLabelCustom {font-weight: 700;}']
|
||||||
styleUrls: [
|
styleUrls: [
|
||||||
|
@ -16,25 +16,23 @@ import { Subscription } from 'rxjs';
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
|
|
||||||
export class DynamicFormFieldComponent implements OnInit {
|
export class DynamicFormFieldComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
@Input() field: Field;
|
@Input() field: Field;
|
||||||
form: FormGroup;
|
form: FormGroup;
|
||||||
@Input() pathName: string;
|
@Input() pathName: string;
|
||||||
@Input() path: string;
|
@Input() path: string;
|
||||||
change: Subscription;
|
change: Subscription;
|
||||||
trackByFn = (index, item) => item ? item["id"] : null
|
trackByFn = (index, item) => item ? item['id'] : null;
|
||||||
constructor(private route: ActivatedRoute, public visibilityRulesService: VisibilityRulesService) {
|
constructor(private route: ActivatedRoute, public visibilityRulesService: VisibilityRulesService) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.field) {
|
if (this.field) {
|
||||||
this.form = this.visibilityRulesService.getFormGroup(this.field.id)
|
this.form = this.visibilityRulesService.getFormGroup(this.field.id);
|
||||||
if (!this.form) debugger;
|
|
||||||
if (!this.form.get('value')) debugger;
|
|
||||||
this.change = this.form.get('value').valueChanges.subscribe(item => {
|
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 {
|
ngOnDestroy(): void {
|
||||||
//Called once, before the instance is destroyed.
|
//Called once, before the instance is destroyed.
|
||||||
//Add 'implements OnDestroy' to the class.
|
//Add 'implements OnDestroy' to the class.
|
||||||
if(this.change) this.change.unsubscribe()
|
if (this.change) { this.change.unsubscribe(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
clearInput() {
|
clearInput() {
|
||||||
}
|
}
|
||||||
|
|
||||||
get isValid() {
|
get isValid() {
|
||||||
return this.form.get("value").valid;
|
return this.form.get('value').valid;
|
||||||
}
|
}
|
||||||
get isValidRequired() {
|
get isValidRequired() {
|
||||||
return this.form.get("value").hasError("required");
|
return this.form.get('value').hasError('required');
|
||||||
}
|
}
|
||||||
get isValidPattern() {
|
get isValidPattern() {
|
||||||
return this.form.get("value").hasError("pattern");
|
return this.form.get('value').hasError('pattern');
|
||||||
}
|
}
|
||||||
get isValidCustom() {
|
get isValidCustom() {
|
||||||
return this.form.get("value").hasError("forbiddenName");
|
return this.form.get('value').hasError('forbiddenName');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<h5 *ngIf="compositeField.extendedDescription" class="fieldset-extended-desc">
|
<h5 *ngIf="compositeField.extendedDescription" class="fieldset-extended-desc">
|
||||||
<i>{{compositeField.extendedDescription}}</i>
|
<i>{{compositeField.extendedDescription}}</i>
|
||||||
</h5>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -28,10 +28,10 @@
|
||||||
</div>
|
</div>
|
||||||
</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 *ngIf="field">
|
||||||
<div *ngFor="let multipleField of field.multiplicityItems; let j = index; trackBy: trackByFn">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { FormGroup, FormArray } from '@angular/forms';
|
||||||
import { Component, Input, OnInit, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';
|
import { Component, Input, OnInit, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';
|
||||||
import { Field } from '../../models/Field';
|
import { Field } from '../../models/Field';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'df-composite-field',
|
selector: 'app-df-composite-field',
|
||||||
templateUrl: './dynamic-form-composite-field.html',
|
templateUrl: './dynamic-form-composite-field.html',
|
||||||
styleUrls: [
|
styleUrls: [
|
||||||
'./dynamic-form-composite-field.css'
|
'./dynamic-form-composite-field.css'
|
||||||
|
@ -13,25 +13,25 @@ import { Field } from '../../models/Field';
|
||||||
})
|
})
|
||||||
export class DynamicFormCompositeFieldComponent implements OnInit {
|
export class DynamicFormCompositeFieldComponent implements OnInit {
|
||||||
|
|
||||||
@Input() compositeField: CompositeField
|
@Input() compositeField: CompositeField;
|
||||||
form: FormGroup;
|
form: FormGroup;
|
||||||
@Input() pathName: string;
|
@Input() pathName: string;
|
||||||
@Input() path: string;
|
@Input() path: string;
|
||||||
trackByFn = (index, item) => item ? item["id"] : null
|
trackByFn = (index, item) => item ? item['id'] : null;
|
||||||
|
|
||||||
constructor(private visibilityRulesService: VisibilityRulesService) {
|
constructor(private visibilityRulesService: VisibilityRulesService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.compositeField) {
|
if (this.compositeField) {
|
||||||
this.form = this.visibilityRulesService.getFormGroup(this.compositeField.id)
|
this.form = this.visibilityRulesService.getFormGroup(this.compositeField.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
addMultipleField(fieldIndex: number) {
|
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);
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</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 *ngIf="compositeField">
|
||||||
<div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn">
|
<div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn">
|
||||||
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,32 +8,32 @@ import { CompositeField } from '../../models/CompositeField';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'df-group',
|
selector: 'app-df-group',
|
||||||
templateUrl: './dynamic-form-group.component.html',
|
templateUrl: './dynamic-form-group.component.html',
|
||||||
styleUrls: ['./dynamic-form-group.component.css'],
|
styleUrls: ['./dynamic-form-group.component.css'],
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
})
|
})
|
||||||
export class DynamicFormGroupComponent implements OnInit {
|
export class DynamicFormGroupComponent implements OnInit {
|
||||||
@Input() group: FieldGroup
|
@Input() group: FieldGroup;
|
||||||
form: FormGroup;
|
form: FormGroup;
|
||||||
@Input() pathName: string;
|
@Input() pathName: string;
|
||||||
|
|
||||||
@Input() path: string;
|
@Input() path: string;
|
||||||
trackByFn = (index, item) => item ? item["id"] : null
|
trackByFn = (index, item) => item ? item['id'] : null;
|
||||||
constructor(public visibilityRulesService: VisibilityRulesService) {
|
constructor(public visibilityRulesService: VisibilityRulesService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.group) {
|
if (this.group) {
|
||||||
this.form = this.visibilityRulesService.getFormGroup(this.group.id)
|
this.form = this.visibilityRulesService.getFormGroup(this.group.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
addMultipleField(fieldsetIndex: number) {
|
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);
|
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() {
|
addFieldSet() {
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
Add one more fieldset +
|
Add one more fieldset +
|
||||||
</a>
|
</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 *ngIf="compositeField">
|
||||||
<div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn">
|
<div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index; trackBy: trackByFn">
|
||||||
<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 *ngIf="compositeField.hasCommentField" [formGroup]="form.get('compositeFields').get(''+i)">
|
<div *ngIf="compositeField.hasCommentField" [formGroup]="form.get('compositeFields').get(''+i)">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
<div *ngIf="section?.sections">
|
<div *ngIf="section?.sections">
|
||||||
<div *ngFor="let itemsection of section.sections; let j = index;">
|
<div *ngFor="let itemsection of section.sections; let j = index;">
|
||||||
<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>
|
||||||
</div>
|
</div>
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
|
|
|
@ -1,49 +1,50 @@
|
||||||
import { VisibilityRulesService } from '../../utilities/visibility-rules/visibility-rules.service';
|
import { VisibilityRulesService } from '../../utilities/visibility-rules/visibility-rules.service';
|
||||||
import { FormGroup, Form, FormArray } from '@angular/forms';
|
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 { CompositeField } from '../../models/CompositeField';
|
||||||
import { Section } from '../../models/Section';
|
import { Section } from '../../models/Section';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'df-section',
|
selector: 'app-df-section',
|
||||||
templateUrl: './dynamic-form-section.html',
|
templateUrl: './dynamic-form-section.html',
|
||||||
styleUrls: [
|
styleUrls: [
|
||||||
'./dynamic-form-section.css'
|
'./dynamic-form-section.css'
|
||||||
],
|
],
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
})
|
})
|
||||||
export class DynamicFormSectionComponent implements OnInit {
|
export class DynamicFormSectionComponent implements OnInit, AfterViewInit {
|
||||||
|
|
||||||
@Input() section: Section
|
@Input() section: Section;
|
||||||
form: FormGroup;
|
form: FormGroup;
|
||||||
@Input() pathName: string;
|
@Input() pathName: string;
|
||||||
@Input() path: string;
|
@Input() path: string;
|
||||||
trackByFn = (index, item) => item ? item["id"] : null
|
trackByFn = (index, item) => item ? item['id'] : null;
|
||||||
constructor(public visibilityRulesService: VisibilityRulesService) { }
|
constructor(public visibilityRulesService: VisibilityRulesService) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.section) {
|
if (this.section) {
|
||||||
this.form = this.visibilityRulesService.getFormGroup(this.section.id)
|
this.form = this.visibilityRulesService.getFormGroup(this.section.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.visibilityRulesService.triggerVisibilityEvaluation()
|
this.visibilityRulesService.triggerVisibilityEvaluation();
|
||||||
}
|
}
|
||||||
|
|
||||||
addMultipleField(fieldsetIndex: number) {
|
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);
|
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 {
|
isElementVisible(fieldSet: CompositeField): boolean {
|
||||||
if (!fieldSet) return false;
|
if (!fieldSet) { return false; }
|
||||||
for (var i = 0; i < fieldSet.fields.length; i++) {
|
for (let i = 0; i < fieldSet.fields.length; i++) {
|
||||||
if (fieldSet.fields[i])
|
if (fieldSet.fields[i]) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import { SharedModule } from '../shared/shared.module';
|
||||||
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { NgModule } from "@angular/core";
|
import { NgModule } from '@angular/core';
|
||||||
import { DatasetProfileAdmin } from '../services/datasetProfileAdmin/datasetProfileAfmin.service';
|
import { DatasetProfileAdmin } from '../services/datasetProfileAdmin/datasetProfileAfmin.service';
|
||||||
import { DatasetProfileService } from '../services/dataset-profile.service';
|
import { DatasetProfileService } from '../services/dataset-profile.service';
|
||||||
import { DatasetWizardService } from '../services/dataset-wizard/dataset-wizard.service';
|
import { DatasetWizardService } from '../services/dataset-wizard/dataset-wizard.service';
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<div>
|
<div>
|
||||||
<div class="alignment-center">
|
<div class="alignment-center">
|
||||||
<!-- <ngb-pagination *ngIf="pages" [collectionSize]="pages.length*10" [page]="currentPageIndex" (pageChange)="changePageIndex($event)" aria-label="Default pagination"></ngb-pagination> -->
|
<!-- <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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
<mat-step [stepControl]="section">
|
<mat-step [stepControl]="section">
|
||||||
<ng-template matStepLabel>{{page.title}}</ng-template>
|
<ng-template matStepLabel>{{page.title}}</ng-template>
|
||||||
<div *ngIf="stepper.selectedIndex == z">
|
<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>
|
</div>
|
||||||
</mat-step>
|
</mat-step>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { MatSidenavModule } from '@angular/material/sidenav';
|
||||||
declare function simple_notifier(type: string, title: string, message: string): any;
|
declare function simple_notifier(type: string, title: string, message: string): any;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'dynamic-form',
|
selector: 'app-dynamic-form',
|
||||||
templateUrl: './dynamic-form.component.html',
|
templateUrl: './dynamic-form.component.html',
|
||||||
styleUrls: [
|
styleUrls: [
|
||||||
'./dynamic-form.component.scss'
|
'./dynamic-form.component.scss'
|
||||||
|
@ -28,24 +28,24 @@ declare function simple_notifier(type: string, title: string, message: string):
|
||||||
})
|
})
|
||||||
export class DynamicFormComponent implements OnInit, AfterViewInit {
|
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() dataModel: DatasetWizardModel = new DatasetWizardModel();
|
||||||
@Input() path: string;
|
@Input() path: string;
|
||||||
@Input() form: FormGroup;
|
@Input() form: FormGroup;
|
||||||
id: string;
|
id: string;
|
||||||
trackByFn = (index, item) => item ? item["id"] : null
|
trackByFn = (index, item) => item ? item['id'] : null;
|
||||||
pageTrackByFn = (index, item) => item["id"]
|
pageTrackByFn = (index, item) => item['id'];
|
||||||
|
|
||||||
// @Input() datasetId: string;
|
// @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,
|
constructor(private router: Router,
|
||||||
private _location: Location,
|
private _location: Location,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
|
@ -63,27 +63,28 @@ export class DynamicFormComponent implements OnInit, AfterViewInit {
|
||||||
|
|
||||||
ngOnInit() {
|
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.formGroup = this.form;
|
||||||
this.visibilityRulesService.buildVisibilityRules(rules)
|
this.visibilityRulesService.buildVisibilityRules(rules);
|
||||||
this.datasetProfileDefinitionModel = this.dataModel.datasetProfileDefinition
|
this.datasetProfileDefinitionModel = this.dataModel.datasetProfileDefinition;
|
||||||
this.visibilityRulesService.setModel(this.datasetProfileDefinitionModel)
|
this.visibilityRulesService.setModel(this.datasetProfileDefinitionModel);
|
||||||
this.createPagination();
|
this.createPagination();
|
||||||
this.progressbar = true;
|
this.progressbar = true;
|
||||||
|
|
||||||
this.route.fragment.subscribe((fragment: string) => {
|
this.route.fragment.subscribe((fragment: string) => {
|
||||||
var self = this;
|
const self = this;
|
||||||
setTimeout(function () { self.scrollTo(fragment) });
|
setTimeout(function () { self.scrollTo(fragment); });
|
||||||
});
|
});
|
||||||
|
|
||||||
this.route.queryParams.subscribe((params) => {
|
this.route.queryParams.subscribe((params) => {
|
||||||
if (params && "page" in params)
|
if (params && 'page' in params) {
|
||||||
this.changeCurrentPage(params["page"]);
|
this.changeCurrentPage(params['page']);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.visibilityRulesService.triggerVisibilityEvaluation()
|
this.visibilityRulesService.triggerVisibilityEvaluation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,7 +103,7 @@ export class DynamicFormComponent implements OnInit, AfterViewInit {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
shouldDisplaySection(section: Section): Boolean {
|
shouldDisplaySection(section: Section): Boolean {
|
||||||
return (section.page) == this.currentPageIndex;
|
return (section.page) === this.currentPageIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
createPagination() {
|
createPagination() {
|
||||||
|
@ -114,25 +115,25 @@ export class DynamicFormComponent implements OnInit, AfterViewInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
changePageIndex(index: any) {
|
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) {
|
scrollTo(sectionID: string) {
|
||||||
if (!sectionID) return;
|
if (!sectionID) { return; }
|
||||||
var element = document.querySelector('#' + sectionID);
|
const element = document.querySelector('#' + sectionID);
|
||||||
if (!element) return;
|
if (!element) { return; }
|
||||||
element.scrollIntoView();
|
element.scrollIntoView();
|
||||||
this.visibleSidebar = true;
|
this.visibleSidebar = true;
|
||||||
var scrollElement = document.querySelector('.scrollableContent');
|
const scrollElement = document.querySelector('.scrollableContent');
|
||||||
//scrollElement.scrollTop = topElement.offsetTop;
|
//scrollElement.scrollTop = topElement.offsetTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
changeCurrentPage(pageString: string) {
|
changeCurrentPage(pageString: string) {
|
||||||
if (!pageString) return;
|
if (!pageString) { return; }
|
||||||
var page = parseInt(pageString);
|
const page = parseInt(pageString);
|
||||||
if (isNaN(page)) return;
|
if (isNaN(page)) { return; }
|
||||||
var pageIndex = this.pages.indexOf(page);
|
const pageIndex = this.pages.indexOf(page);
|
||||||
if (pageIndex === -1) return;
|
if (pageIndex === -1) { return; }
|
||||||
this.currentPageIndex = page;
|
this.currentPageIndex = page;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
export class DropdownField {
|
export class DropdownField {
|
||||||
controlType = 'dropdown';
|
controlType = 'dropdown';
|
||||||
options: {key: string, value: string}[] =[];
|
options: { key: string, value: string }[] = [];
|
||||||
|
|
||||||
constructor(options: {} = {}){
|
constructor(options: {} = {}) {
|
||||||
this.options = options['options'] || [];
|
this.options = options['options'] || [];
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
import { Injectable } from '@angular/core'
|
import { Injectable } from '@angular/core';
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PaginationService {
|
export class PaginationService {
|
||||||
|
|
||||||
|
@ -8,11 +8,11 @@ export class PaginationService {
|
||||||
this.currentPageIndex = currentPageIndex;
|
this.currentPageIndex = currentPageIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getCurrentIndex():number{
|
public getCurrentIndex(): number {
|
||||||
return this.currentPageIndex;
|
return this.currentPageIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public isElementVisible(elementPage: number):boolean {
|
public isElementVisible(elementPage: number): boolean {
|
||||||
return elementPage == this.currentPageIndex ; //TODO
|
return elementPage === this.currentPageIndex; //TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,23 +2,23 @@
|
||||||
import { ViewEncapsulation } from '@angular/core';
|
import { ViewEncapsulation } from '@angular/core';
|
||||||
|
|
||||||
import { Component, Input, OnInit } 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({
|
@Component({
|
||||||
selector: 'progress-bar',
|
selector: 'app-progress-bar',
|
||||||
templateUrl: './progress-bar.component.html',
|
templateUrl: './progress-bar.component.html',
|
||||||
styles: ['.alwaysVisible .ui-progressbar-label { display:block!important; }'],
|
styles: ['.alwaysVisible .ui-progressbar-label { display:block!important; }'],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class ProgressBarComponent implements OnInit {
|
export class ProgressBarComponent implements OnInit {
|
||||||
@Input() formGroup: FormGroup
|
@Input() formGroup: FormGroup;
|
||||||
@Input("progressValueAccuracy") public accuracy: number = 1;
|
@Input() public progressValueAccuracy = 1;
|
||||||
determinateProgressValue: number;
|
determinateProgressValue: number;
|
||||||
|
|
||||||
constructor(private visibilityRulesService: VisibilityRulesService) { }
|
constructor(private visibilityRulesService: VisibilityRulesService) { }
|
||||||
|
|
||||||
public value: number = 0;
|
public value = 0;
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.calculateValueForProgressbar()
|
this.calculateValueForProgressbar();
|
||||||
this.formGroup
|
this.formGroup
|
||||||
.valueChanges
|
.valueChanges
|
||||||
.subscribe(control => {
|
.subscribe(control => {
|
||||||
|
@ -27,24 +27,22 @@ export class ProgressBarComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
calculateValueForProgressbar() {
|
calculateValueForProgressbar() {
|
||||||
var progressSoFar = this.countFormControlsWithValue(this.formGroup);
|
const progressSoFar = this.countFormControlsWithValue(this.formGroup);
|
||||||
var total = this.getFormControlDepthLength(this.formGroup);
|
const total = this.getFormControlDepthLength(this.formGroup);
|
||||||
var perc = (progressSoFar / total) * 100;
|
const perc = (progressSoFar / total) * 100;
|
||||||
this.value = Number.parseFloat(perc.toPrecision(this.accuracy));
|
this.value = Number.parseFloat(perc.toPrecision(this.progressValueAccuracy));
|
||||||
}
|
}
|
||||||
|
|
||||||
countFormControlsWithValue(form: FormGroup): number {
|
countFormControlsWithValue(form: FormGroup): number {
|
||||||
let value = 0;
|
let value = 0;
|
||||||
Object.keys(form.controls).forEach(key => {
|
Object.keys(form.controls).forEach(key => {
|
||||||
let control = form.controls[key]
|
const control = form.controls[key];
|
||||||
if (control instanceof FormGroup) value += this.countFormControlsWithValue(control);
|
if (control instanceof FormGroup) { value += this.countFormControlsWithValue(control); } else if (control instanceof FormArray) {
|
||||||
else if (control instanceof FormArray) {
|
const formArray = (<FormArray>control);
|
||||||
let formArray = (<FormArray>control);
|
|
||||||
for (let i = 0; i < formArray.length; i++) {
|
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;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -52,10 +50,9 @@ export class ProgressBarComponent implements OnInit {
|
||||||
getFormControlDepthLength(form: FormGroup): number {
|
getFormControlDepthLength(form: FormGroup): number {
|
||||||
let value = 0;
|
let value = 0;
|
||||||
Object.keys(form.controls).forEach(key => {
|
Object.keys(form.controls).forEach(key => {
|
||||||
let control = form.controls[key];
|
const control = form.controls[key];
|
||||||
if (control instanceof FormGroup) { value += this.getFormControlDepthLength(control); }
|
if (control instanceof FormGroup) { value += this.getFormControlDepthLength(control); } else if (control instanceof FormArray) {
|
||||||
else if (control instanceof FormArray) {
|
const formArray = (<FormArray>control);
|
||||||
let formArray = (<FormArray>control);
|
|
||||||
for (let i = 0; i < formArray.length; i++) {
|
for (let i = 0; i < formArray.length; i++) {
|
||||||
//if (<FormGroup>formArray.get("" + i).value && this.visibilityRulesService.isElementVisible(null, formArray.get("" + i).value.id))
|
//if (<FormGroup>formArray.get("" + i).value && this.visibilityRulesService.isElementVisible(null, formArray.get("" + i).value.id))
|
||||||
//value += this.getFormControlDepthLength(<FormGroup>formArray.get("" + i))
|
//value += this.getFormControlDepthLength(<FormGroup>formArray.get("" + i))
|
||||||
|
|
|
@ -5,6 +5,6 @@ export class BaseTableOfContent {
|
||||||
|
|
||||||
scrollToId(elementId, page: number) {
|
scrollToId(elementId, page: number) {
|
||||||
//this.paginationService.setCurrentIndex(page-1);
|
//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 } });
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,11 +4,11 @@ import { CompositeField } from '../../../models/CompositeField';
|
||||||
import { Field } from '../../../models/Field';
|
import { Field } from '../../../models/Field';
|
||||||
import { Section } from '../../../models/Section';
|
import { Section } from '../../../models/Section';
|
||||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||||
import { Router, ActivatedRoute } from '@angular/router'
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'table-of-contents-field',
|
selector: 'app-table-of-contents-field',
|
||||||
templateUrl: './table-of-content-field.component.html',
|
templateUrl: './table-of-content-field.component.html',
|
||||||
providers: []
|
providers: []
|
||||||
})
|
})
|
||||||
|
@ -18,6 +18,6 @@ export class TableOfContentsFieldComponent extends BaseTableOfContent {
|
||||||
@Input() public path: string;
|
@Input() public path: string;
|
||||||
@Input() public page: number;
|
@Input() public page: number;
|
||||||
constructor(public router: Router, public route: ActivatedRoute, private visibilityRulesService: VisibilityRulesService) {
|
constructor(public router: Router, public route: ActivatedRoute, private visibilityRulesService: VisibilityRulesService) {
|
||||||
super(router, route)
|
super(router, route);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,13 @@ import { CompositeField } from '../../../models/CompositeField';
|
||||||
import { FieldGroup } from '../../../models/FieldGroup';
|
import { FieldGroup } from '../../../models/FieldGroup';
|
||||||
import { Section } from '../../../models/Section';
|
import { Section } from '../../../models/Section';
|
||||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
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'
|
//import * as $ from '../../../../node_modules/jquery/dist/jquery'
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'table-of-contents-fieldset',
|
selector: 'app-table-of-contents-fieldset',
|
||||||
templateUrl: './table-of-content-fieldset.component.html',
|
templateUrl: './table-of-content-fieldset.component.html',
|
||||||
providers: []
|
providers: []
|
||||||
})
|
})
|
||||||
|
@ -21,6 +21,6 @@ export class TableOfContentsFieldSetComponent extends BaseTableOfContent {
|
||||||
@Input() public path: string;
|
@Input() public path: string;
|
||||||
@Input() public page: number;
|
@Input() public page: number;
|
||||||
constructor(public router: Router, public route: ActivatedRoute, private visibilityRulesService: VisibilityRulesService) {
|
constructor(public router: Router, public route: ActivatedRoute, private visibilityRulesService: VisibilityRulesService) {
|
||||||
super(router, route)
|
super(router, route);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,12 @@ import { BaseTableOfContent } from '../base-table-of-content.component';
|
||||||
import { FieldGroup } from '../../../models/FieldGroup';
|
import { FieldGroup } from '../../../models/FieldGroup';
|
||||||
import { Section } from '../../../models/Section';
|
import { Section } from '../../../models/Section';
|
||||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
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'
|
//import * as $ from '../../../../node_modules/jquery/dist/jquery'
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'table-of-contents-group',
|
selector: 'app-table-of-contents-group',
|
||||||
templateUrl: './table-of-content-group.component.html',
|
templateUrl: './table-of-content-group.component.html',
|
||||||
providers: []
|
providers: []
|
||||||
})
|
})
|
||||||
|
@ -23,7 +23,7 @@ export class TableOfContentsGroupComponent extends BaseTableOfContent {
|
||||||
|
|
||||||
*/
|
*/
|
||||||
constructor(public router: Router, public route: ActivatedRoute, private visibilityRulesService: VisibilityRulesService) {
|
constructor(public router: Router, public route: ActivatedRoute, private visibilityRulesService: VisibilityRulesService) {
|
||||||
super(router, route)
|
super(router, route);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
<!-- All contents in the first page -->
|
<!-- All contents in the first page -->
|
||||||
<ul>
|
<ul>
|
||||||
<li *ngFor="let sectionModel of model.sections let i = index">
|
<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>
|
</li>
|
||||||
</ul>
|
</ul>
|
|
@ -8,7 +8,7 @@ import { ActivatedRouteSnapshot, Router, ActivatedRoute } from '@angular/router'
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'table-of-contents-section',
|
selector: 'app-table-of-contents-section',
|
||||||
templateUrl: './table-of-content-section.component.html',
|
templateUrl: './table-of-content-section.component.html',
|
||||||
providers: []
|
providers: []
|
||||||
})
|
})
|
||||||
|
@ -19,7 +19,7 @@ export class TableOfContentsSectionComponent extends BaseTableOfContent implemen
|
||||||
@Input() public path: string;
|
@Input() public path: string;
|
||||||
@Input() public page: number;
|
@Input() public page: number;
|
||||||
constructor(public router: Router, public route: ActivatedRoute, private visibilityRulesService: VisibilityRulesService) {
|
constructor(public router: Router, public route: ActivatedRoute, private visibilityRulesService: VisibilityRulesService) {
|
||||||
super(router, route)
|
super(router, route);
|
||||||
}
|
}
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li *ngFor="let section of model['sections'] let i = index">
|
<li *ngFor="let section of model['sections'] let i = index">
|
||||||
<!-- && field.label for sections without field label as data summery -->
|
<!-- && 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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||||
//import * as scroll from '../../../assets/jquery.scrollTo.min.js';
|
//import * as scroll from '../../../assets/jquery.scrollTo.min.js';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'table-of-content',
|
selector: 'app-table-of-content',
|
||||||
templateUrl: './table-of-contents.component.html',
|
templateUrl: './table-of-contents.component.html',
|
||||||
styleUrls: ['./toc.component.css'],
|
styleUrls: ['./toc.component.css'],
|
||||||
providers: []
|
providers: []
|
||||||
|
@ -15,7 +15,7 @@ export class TableOfContentsComponent implements OnInit {
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
public model: DatasetProfileDefinitionModel;
|
public model: DatasetProfileDefinitionModel;
|
||||||
public path: string = "";
|
public path = '';
|
||||||
/* @Output()
|
/* @Output()
|
||||||
setPage:EventEmitter<number> = new EventEmitter<number>();
|
setPage:EventEmitter<number> = new EventEmitter<number>();
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { SearchBarItem } from '../models/dashboard/SearchBarItem';
|
||||||
import { SearchBarType } from '../shared/components/search-bar/types/search-bar-type';
|
import { SearchBarType } from '../shared/components/search-bar/types/search-bar-type';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'homepage',
|
selector: 'app-homepage',
|
||||||
templateUrl: './homepage.component.html',
|
templateUrl: './homepage.component.html',
|
||||||
styleUrls: ['./homepage.component.scss'],
|
styleUrls: ['./homepage.component.scss'],
|
||||||
providers: [ProjectService, UserReferenceService]
|
providers: [ProjectService, UserReferenceService]
|
||||||
|
@ -32,7 +32,7 @@ export class HomepageComponent implements OnInit {
|
||||||
projectAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
projectAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||||
public searchControl = new FormControl();
|
public searchControl = new FormControl();
|
||||||
filteredOptions: Observable<SearchBarItem[]>;
|
filteredOptions: Observable<SearchBarItem[]>;
|
||||||
RecentActivityTypes = RecentActivityTypes
|
RecentActivityTypes = RecentActivityTypes;
|
||||||
public search = false;
|
public search = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -54,17 +54,17 @@ export class HomepageComponent implements OnInit {
|
||||||
|
|
||||||
if (this.isAuthenticated()) {
|
if (this.isAuthenticated()) {
|
||||||
this.userReferenceService.getRecentActivity().subscribe(response => {
|
this.userReferenceService.getRecentActivity().subscribe(response => {
|
||||||
this.datasetActivities = response["recentDatasetActivities"];
|
this.datasetActivities = response['recentDatasetActivities'];
|
||||||
this.dmpActivities = response["recentDmpActivities"];
|
this.dmpActivities = response['recentDmpActivities'];
|
||||||
this.projectActivities = response["recentProjectActivities"];
|
this.projectActivities = response['recentProjectActivities'];
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.projectAutoCompleteConfiguration = {
|
this.projectAutoCompleteConfiguration = {
|
||||||
filterFn: this.searchProject.bind(this),
|
filterFn: this.searchProject.bind(this),
|
||||||
items: this.searchProject(''),
|
items: this.searchProject(''),
|
||||||
displayFn: (item) => item["label"],
|
displayFn: (item) => item['label'],
|
||||||
titleFn: (item) => item["label"],
|
titleFn: (item) => item['label'],
|
||||||
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
|
//mapFn: (item) => new JsonSerializer<ProjectReference>().fromJSONArray(item, ProjectReference).map(item => item.toDropdownList()),
|
||||||
loadDataOnStart: true
|
loadDataOnStart: true
|
||||||
};
|
};
|
||||||
|
@ -73,25 +73,25 @@ export class HomepageComponent implements OnInit {
|
||||||
this.dashBoardService.getStatistics().subscribe(results => {
|
this.dashBoardService.getStatistics().subscribe(results => {
|
||||||
//let data = results['payload'];
|
//let data = results['payload'];
|
||||||
this.dashboardStatisticsData = JsonSerializer.fromJSONObject(results, DashboardStatisticsModel);
|
this.dashboardStatisticsData = JsonSerializer.fromJSONObject(results, DashboardStatisticsModel);
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.dashBoardService.getStatisticsSpecificuser().subscribe(results => {
|
this.dashBoardService.getStatisticsSpecificuser().subscribe(results => {
|
||||||
this.dashboardStatisticsData = JsonSerializer.fromJSONObject(results, DashboardStatisticsModel);
|
this.dashboardStatisticsData = JsonSerializer.fromJSONObject(results, DashboardStatisticsModel);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.filteredOptions = this.searchControl.valueChanges.flatMap(x => {
|
this.filteredOptions = this.searchControl.valueChanges.flatMap(x => {
|
||||||
return this.dashBoardService.searchUserItems(x);
|
return this.dashBoardService.searchUserItems(x);
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public isAuthenticated(): boolean {
|
public isAuthenticated(): boolean {
|
||||||
return !(!this.authentication.current())
|
return !(!this.authentication.current());
|
||||||
}
|
}
|
||||||
|
|
||||||
searchProject(query: string) {
|
searchProject(query: string) {
|
||||||
let projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
|
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
|
||||||
projectRequestItem.criteria = new ProjectCriteria();
|
projectRequestItem.criteria = new ProjectCriteria();
|
||||||
projectRequestItem.criteria.like = query;
|
projectRequestItem.criteria.like = query;
|
||||||
return this.projectService.getWithExternal(projectRequestItem);
|
return this.projectService.getWithExternal(projectRequestItem);
|
||||||
|
@ -100,26 +100,26 @@ export class HomepageComponent implements OnInit {
|
||||||
redirect(id: string, type: RecentActivityTypes) {
|
redirect(id: string, type: RecentActivityTypes) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case RecentActivityTypes.PROJECT: {
|
case RecentActivityTypes.PROJECT: {
|
||||||
this.router.navigate(["projects/edit/" + id]);
|
this.router.navigate(['projects/edit/' + id]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RecentActivityTypes.DATASET: {
|
case RecentActivityTypes.DATASET: {
|
||||||
this.router.navigate(["datasets/edit/" + id]);
|
this.router.navigate(['datasets/edit/' + id]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case RecentActivityTypes.DMP: {
|
case RecentActivityTypes.DMP: {
|
||||||
this.router.navigate(["dmps/edit/" + id]);
|
this.router.navigate(['dmps/edit/' + id]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default: throw new Error("Unsupported Activity Type ")
|
default: throw new Error('Unsupported Activity Type ');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onOptionSelected(event: any) {
|
onOptionSelected(event: any) {
|
||||||
let selectedSearchBarItem = event.option.value;
|
const selectedSearchBarItem = event.option.value;
|
||||||
if (selectedSearchBarItem.type == SearchBarType.DATASET) this.router.navigate(["datasets/edit/" + selectedSearchBarItem.id])
|
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.PROJECT) { this.router.navigate(['projects/edit/' + selectedSearchBarItem.id]); }
|
||||||
if (selectedSearchBarItem.type == SearchBarType.DATAMANAGEMENTPLAN) this.router.navigate(["dmps/edit/" + selectedSearchBarItem.id])
|
if (selectedSearchBarItem.type === SearchBarType.DATAMANAGEMENTPLAN) { this.router.navigate(['dmps/edit/' + selectedSearchBarItem.id]); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { FormBuilder } from '@angular/forms';
|
import { FormBuilder } from '@angular/forms';
|
||||||
export abstract class BaseModel{
|
export abstract class BaseModel {
|
||||||
public formBuilder:FormBuilder = new FormBuilder();
|
public formBuilder: FormBuilder = new FormBuilder();
|
||||||
}
|
}
|
|
@ -2,17 +2,17 @@ import { FormGroup } from '@angular/forms';
|
||||||
import { JsonSerializer } from '../utilities/JsonSerializer';
|
import { JsonSerializer } from '../utilities/JsonSerializer';
|
||||||
import { Serializable } from './interfaces/Serializable';
|
import { Serializable } from './interfaces/Serializable';
|
||||||
import { BaseModel } from './BaseModel';
|
import { BaseModel } from './BaseModel';
|
||||||
import { Field } from './Field'
|
import { Field } from './Field';
|
||||||
import { Multiplicity } from './Multiplicity';
|
import { Multiplicity } from './Multiplicity';
|
||||||
export class CompositeField extends BaseModel implements Serializable<CompositeField> {
|
export class CompositeField extends BaseModel implements Serializable<CompositeField> {
|
||||||
public fields: Array<Field> = new Array<Field>();
|
public fields: Array<Field> = new Array<Field>();
|
||||||
public ordinal: number
|
public ordinal: number;
|
||||||
public id: string
|
public id: string;
|
||||||
public multiplicity: Multiplicity;
|
public multiplicity: Multiplicity;
|
||||||
public multiplicityItems: Array<CompositeField> = new Array<CompositeField>();
|
public multiplicityItems: Array<CompositeField> = new Array<CompositeField>();
|
||||||
public title: string
|
public title: string;
|
||||||
public description: string
|
public description: string;
|
||||||
public extendedDescription: string
|
public extendedDescription: string;
|
||||||
public hasCommentField: boolean;
|
public hasCommentField: boolean;
|
||||||
public commentFieldValue: string;
|
public commentFieldValue: string;
|
||||||
|
|
||||||
|
@ -29,12 +29,12 @@ export class CompositeField extends BaseModel implements Serializable<CompositeF
|
||||||
this.multiplicity = JsonSerializer.fromJSONObject(item.multiplicity, Multiplicity);
|
this.multiplicity = JsonSerializer.fromJSONObject(item.multiplicity, Multiplicity);
|
||||||
//this.multiplicity = new Multiplicity();
|
//this.multiplicity = new Multiplicity();
|
||||||
//this.multiplicity.max = 2;
|
//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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(): FormGroup {
|
||||||
let formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
id: this.id,
|
id: this.id,
|
||||||
ordinal: this.ordinal,
|
ordinal: this.ordinal,
|
||||||
title: this.title,
|
title: this.title,
|
||||||
|
@ -44,28 +44,28 @@ export class CompositeField extends BaseModel implements Serializable<CompositeF
|
||||||
commentFieldValue: this.commentFieldValue
|
commentFieldValue: this.commentFieldValue
|
||||||
});
|
});
|
||||||
|
|
||||||
let fieldsFormArray = new Array<FormGroup>();
|
const fieldsFormArray = new Array<FormGroup>();
|
||||||
this.fields.forEach(item => {
|
this.fields.forEach(item => {
|
||||||
let form: FormGroup = item.buildForm();
|
const form: FormGroup = item.buildForm();
|
||||||
fieldsFormArray.push(form)
|
fieldsFormArray.push(form);
|
||||||
})
|
});
|
||||||
formGroup.addControl('fields', this.formBuilder.array(fieldsFormArray));
|
formGroup.addControl('fields', this.formBuilder.array(fieldsFormArray));
|
||||||
|
|
||||||
let multiplicityItemsFormArray = new Array<FormGroup>();
|
const multiplicityItemsFormArray = new Array<FormGroup>();
|
||||||
this.multiplicityItems.forEach(item => {
|
this.multiplicityItems.forEach(item => {
|
||||||
let form: FormGroup = item.buildForm();
|
const form: FormGroup = item.buildForm();
|
||||||
multiplicityItemsFormArray.push(form)
|
multiplicityItemsFormArray.push(form);
|
||||||
})
|
});
|
||||||
formGroup.addControl('multiplicityItems', this.formBuilder.array(multiplicityItemsFormArray));
|
formGroup.addControl('multiplicityItems', this.formBuilder.array(multiplicityItemsFormArray));
|
||||||
|
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
cloneForMultiplicity(index: number): CompositeField {
|
cloneForMultiplicity(index: number): CompositeField {
|
||||||
let newItem: CompositeField = new CompositeField();
|
const newItem: CompositeField = new CompositeField();
|
||||||
newItem.id = 'multiple_' + this.id + '_' + index;
|
newItem.id = 'multiple_' + this.id + '_' + index;
|
||||||
this.fields.forEach(field => {
|
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;
|
newItem.ordinal = this.ordinal;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { DataField } from './DataField';
|
import { DataField } from './DataField';
|
||||||
import { FormGroup } from '@angular/forms'
|
import { FormGroup } from '@angular/forms';
|
||||||
import { ListingItem } from '../common/ListingItem';
|
import { ListingItem } from '../common/ListingItem';
|
||||||
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
||||||
|
|
||||||
export class AutocompleteData extends DataField<AutocompleteData>{
|
export class AutocompleteData extends DataField<AutocompleteData> {
|
||||||
|
|
||||||
public type: string;
|
public type: string;
|
||||||
public url: string;
|
public url: string;
|
||||||
|
@ -11,13 +11,13 @@ export class AutocompleteData extends DataField<AutocompleteData>{
|
||||||
public autoCompleteOptions: ListingItem = new ListingItem();
|
public autoCompleteOptions: ListingItem = new ListingItem();
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(): FormGroup {
|
||||||
let formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
label: [this.label],
|
label: [this.label],
|
||||||
type: [this.type],
|
type: [this.type],
|
||||||
url: [this.url],
|
url: [this.url],
|
||||||
optionsRoot: [this.optionsRoot]
|
optionsRoot: [this.optionsRoot]
|
||||||
})
|
});
|
||||||
formGroup.addControl("autoCompleteOptions", this.autoCompleteOptions.buildForm());
|
formGroup.addControl('autoCompleteOptions', this.autoCompleteOptions.buildForm());
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import { DataField } from './DataField';
|
import { DataField } from './DataField';
|
||||||
import { FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
export class BooleanDecisionData extends DataField<BooleanDecisionData>{
|
export class BooleanDecisionData extends DataField<BooleanDecisionData> {
|
||||||
|
|
||||||
buildForm():FormGroup{
|
buildForm(): FormGroup {
|
||||||
let formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
label:this.label
|
label: this.label
|
||||||
});
|
});
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
fromJSONObject(item:any):BooleanDecisionData{
|
fromJSONObject(item: any): BooleanDecisionData {
|
||||||
this.label = item.label
|
this.label = item.label;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,16 +1,16 @@
|
||||||
import { DataField } from './DataField';
|
import { DataField } from './DataField';
|
||||||
import { FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
export class CheckBoxData extends DataField<CheckBoxData>{
|
export class CheckBoxData extends DataField<CheckBoxData> {
|
||||||
|
|
||||||
buildForm():FormGroup{
|
buildForm(): FormGroup {
|
||||||
let formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
label:this.label
|
label: this.label
|
||||||
});
|
});
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
fromJSONObject(item:any):CheckBoxData{
|
fromJSONObject(item: any): CheckBoxData {
|
||||||
this.label = item.label
|
this.label = item.label;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,16 +1,16 @@
|
||||||
import { BaseModel } from '../BaseModel';
|
import { BaseModel } from '../BaseModel';
|
||||||
import { FormGenerator } from '../interfaces/FormGenerator';
|
import { FormGenerator } from '../interfaces/FormGenerator';
|
||||||
import { Serializable } from '../interfaces/Serializable';
|
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>{
|
export abstract class DataField<T> extends BaseModel implements Serializable<T>, FormGenerator<FormGroup> {
|
||||||
public label:string;
|
public label: string;
|
||||||
|
|
||||||
buildForm():FormGroup{
|
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{
|
fromJSONObject(item: any): T {
|
||||||
throw new Error("From Json Object is not correctly overriden")
|
throw new Error('From Json Object is not correctly overriden');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,16 +1,16 @@
|
||||||
import { DataField } from './DataField';
|
import { DataField } from './DataField';
|
||||||
import { FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
export class FreeTextData extends DataField<FreeTextData>{
|
export class FreeTextData extends DataField<FreeTextData> {
|
||||||
|
|
||||||
buildForm():FormGroup{
|
buildForm(): FormGroup {
|
||||||
let formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
label:this.label
|
label: this.label
|
||||||
});
|
});
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
fromJSONObject(item:any):FreeTextData{
|
fromJSONObject(item: any): FreeTextData {
|
||||||
this.label = item.label
|
this.label = item.label;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,21 +1,21 @@
|
||||||
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
||||||
import { DataField } from './DataField';
|
import { DataField } from './DataField';
|
||||||
import { ListingItem } from '../common/ListingItem';
|
import { ListingItem } from '../common/ListingItem';
|
||||||
import { FormGroup } from '@angular/forms'
|
import { FormGroup } from '@angular/forms';
|
||||||
|
|
||||||
export class RadioBoxData extends DataField<RadioBoxData>{
|
export class RadioBoxData extends DataField<RadioBoxData> {
|
||||||
public options: Array<ListingItem>;
|
public options: Array<ListingItem>;
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(): FormGroup {
|
||||||
let formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
label: [this.label]
|
label: [this.label]
|
||||||
});
|
});
|
||||||
let optionsFormArray = new Array<FormGroup>();
|
const optionsFormArray = new Array<FormGroup>();
|
||||||
if (this.options) {
|
if (this.options) {
|
||||||
this.options.forEach(item => {
|
this.options.forEach(item => {
|
||||||
let form: FormGroup = item.buildForm();
|
const form: FormGroup = item.buildForm();
|
||||||
optionsFormArray.push(form)
|
optionsFormArray.push(form);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
formGroup.addControl('options', this.formBuilder.array(optionsFormArray));
|
formGroup.addControl('options', this.formBuilder.array(optionsFormArray));
|
||||||
return formGroup;
|
return formGroup;
|
||||||
|
@ -23,7 +23,7 @@ export class RadioBoxData extends DataField<RadioBoxData>{
|
||||||
|
|
||||||
fromJSONObject(item: any): RadioBoxData {
|
fromJSONObject(item: any): RadioBoxData {
|
||||||
this.options = JsonSerializer.fromJSONArray(item.options, ListingItem);
|
this.options = JsonSerializer.fromJSONArray(item.options, ListingItem);
|
||||||
this.label = item.label
|
this.label = item.label;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import { DataField } from './DataField';
|
import { DataField } from './DataField';
|
||||||
import { FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
export class TextArea extends DataField<TextArea>{
|
export class TextArea extends DataField<TextArea> {
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(): FormGroup {
|
||||||
let formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
label: this.label
|
label: this.label
|
||||||
});
|
});
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
fromJSONObject(item: any): TextArea {
|
fromJSONObject(item: any): TextArea {
|
||||||
this.label = item.label
|
this.label = item.label;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,22 +1,22 @@
|
||||||
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
||||||
import { ListingItem } from '../common/ListingItem';
|
import { ListingItem } from '../common/ListingItem';
|
||||||
import { DataField } from './DataField';
|
import { DataField } from './DataField';
|
||||||
import { FormGroup } from '@angular/forms'
|
import { FormGroup } from '@angular/forms';
|
||||||
|
|
||||||
export class WordListData extends DataField<WordListData>{
|
export class WordListData extends DataField<WordListData> {
|
||||||
public type: string;
|
public type: string;
|
||||||
public options: Array<ListingItem>;
|
public options: Array<ListingItem>;
|
||||||
buildForm(): FormGroup {
|
buildForm(): FormGroup {
|
||||||
let formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
type: [this.type],
|
type: [this.type],
|
||||||
label: [this.label]
|
label: [this.label]
|
||||||
});
|
});
|
||||||
let optionsFormArray = new Array<FormGroup>();
|
const optionsFormArray = new Array<FormGroup>();
|
||||||
if (this.options) {
|
if (this.options) {
|
||||||
this.options.forEach(item => {
|
this.options.forEach(item => {
|
||||||
let form: FormGroup = item.buildForm();
|
const form: FormGroup = item.buildForm();
|
||||||
optionsFormArray.push(form)
|
optionsFormArray.push(form);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
formGroup.addControl('options', this.formBuilder.array(optionsFormArray));
|
formGroup.addControl('options', this.formBuilder.array(optionsFormArray));
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ import { JsonSerializer } from '../utilities/JsonSerializer';
|
||||||
import { Section } from './Section';
|
import { Section } from './Section';
|
||||||
import { Serializable } from './interfaces/Serializable';
|
import { Serializable } from './interfaces/Serializable';
|
||||||
import { Page } from '../models/Page';
|
import { Page } from '../models/Page';
|
||||||
export class DatasetProfileDefinitionModel extends BaseModel implements Serializable<DatasetProfileDefinitionModel>, FormGenerator<FormGroup>{
|
export class DatasetProfileDefinitionModel extends BaseModel implements Serializable<DatasetProfileDefinitionModel>, FormGenerator<FormGroup> {
|
||||||
public status: number
|
public status: number;
|
||||||
public pages: Array<Page>;
|
public pages: Array<Page>;
|
||||||
public rules: Rule[];
|
public rules: Rule[];
|
||||||
//public sections:Array<Section>
|
//public sections:Array<Section>
|
||||||
|
@ -20,8 +20,8 @@ export class DatasetProfileDefinitionModel extends BaseModel implements Serializ
|
||||||
}
|
}
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(): FormGroup {
|
||||||
let formGroup: FormGroup = new FormBuilder().group({});
|
const formGroup: FormGroup = new FormBuilder().group({});
|
||||||
let pagesFormArray = new Array<FormGroup>();
|
const pagesFormArray = new Array<FormGroup>();
|
||||||
// let sectionsFormArray = new Array<FormGroup>();
|
// let sectionsFormArray = new Array<FormGroup>();
|
||||||
// this.pages.forEach (page => {
|
// this.pages.forEach (page => {
|
||||||
// page.sections.forEach(item => {
|
// page.sections.forEach(item => {
|
||||||
|
@ -30,9 +30,9 @@ export class DatasetProfileDefinitionModel extends BaseModel implements Serializ
|
||||||
// })
|
// })
|
||||||
// })
|
// })
|
||||||
this.pages.forEach(item => {
|
this.pages.forEach(item => {
|
||||||
let form: FormGroup = item.buildForm();
|
const form: FormGroup = item.buildForm();
|
||||||
pagesFormArray.push(form)
|
pagesFormArray.push(form);
|
||||||
})
|
});
|
||||||
formGroup.addControl('pages', this.formBuilder.array(pagesFormArray));
|
formGroup.addControl('pages', this.formBuilder.array(pagesFormArray));
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { FormGroup } from '@angular/forms';
|
||||||
import { FormGenerator } from './interfaces/FormGenerator';
|
import { FormGenerator } from './interfaces/FormGenerator';
|
||||||
import { Serializable } from './interfaces/Serializable';
|
import { Serializable } from './interfaces/Serializable';
|
||||||
|
|
||||||
export class DefaultValue extends BaseModel implements Serializable<DefaultValue>, FormGenerator<FormGroup>{
|
export class DefaultValue extends BaseModel implements Serializable<DefaultValue>, FormGenerator<FormGroup> {
|
||||||
public type: string;
|
public type: string;
|
||||||
public value: string;
|
public value: string;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ export class DefaultValue extends BaseModel implements Serializable<DefaultValue
|
||||||
}
|
}
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(): FormGroup {
|
||||||
let formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
type: [this.type],
|
type: [this.type],
|
||||||
value: [this.value]
|
value: [this.value]
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { DefaultValue } from './DefaultValue';
|
||||||
import { ValidationTypes } from '../models/common/ValidationTypes';
|
import { ValidationTypes } from '../models/common/ValidationTypes';
|
||||||
import { ViewStyle } from './datasetProfileAdmin/ViewStyle';
|
import { ViewStyle } from './datasetProfileAdmin/ViewStyle';
|
||||||
|
|
||||||
export class Field extends BaseModel implements Serializable<Field>, FormGenerator<FormGroup>{
|
export class Field extends BaseModel implements Serializable<Field>, FormGenerator<FormGroup> {
|
||||||
|
|
||||||
public id: string;
|
public id: string;
|
||||||
public title: string;
|
public title: string;
|
||||||
|
@ -22,7 +22,7 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
|
||||||
public multiplicity: Multiplicity;
|
public multiplicity: Multiplicity;
|
||||||
public multiplicityItems: Array<Field> = new Array<Field>();
|
public multiplicityItems: Array<Field> = new Array<Field>();
|
||||||
public data: any;
|
public data: any;
|
||||||
public validations: Array<any>;//Array<ValidationTypes>
|
public validations: Array<any>; //Array<ValidationTypes>
|
||||||
public validationRequired = false;
|
public validationRequired = false;
|
||||||
|
|
||||||
fromJSONObject(item: any): Field {
|
fromJSONObject(item: any): Field {
|
||||||
|
@ -39,11 +39,11 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
|
||||||
this.defaultValue = JsonSerializer.fromJSONObject(item.defaultValue, DefaultValue);
|
this.defaultValue = JsonSerializer.fromJSONObject(item.defaultValue, DefaultValue);
|
||||||
this.value = this.defaultValue.value && !item.value ? this.defaultValue.value : item.value;
|
this.value = this.defaultValue.value && !item.value ? this.defaultValue.value : item.value;
|
||||||
//this.multiplicity = new Multiplicity();
|
//this.multiplicity = new Multiplicity();
|
||||||
if (this.viewStyle.renderStyle === "checkBox") {
|
if (this.viewStyle.renderStyle === 'checkBox') {
|
||||||
this.value = this.value === 'true';
|
this.value = this.value === 'true';
|
||||||
}
|
}
|
||||||
//this.multiplicity.max = 2;
|
//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;
|
this.data = item.data;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -52,16 +52,17 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
|
||||||
|
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(): FormGroup {
|
||||||
if (this.validations)
|
if (this.validations) {
|
||||||
this.validations.forEach(validation => {
|
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],
|
id: [this.id],
|
||||||
data: [this.data],
|
data: [this.data],
|
||||||
/* title: [this.title], */
|
/* title: [this.title], */
|
||||||
value: [this.value, this.validationRequired == true ? Validators.required : null]/* ,
|
value: [this.value, this.validationRequired === true ? Validators.required : null]/* ,
|
||||||
description: [this.description],
|
description: [this.description],
|
||||||
extendedDescription:[this.extendedDescription],
|
extendedDescription:[this.extendedDescription],
|
||||||
viewStyle: [this.viewStyle],
|
viewStyle: [this.viewStyle],
|
||||||
|
@ -70,18 +71,18 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
|
||||||
data:[this.data] */
|
data:[this.data] */
|
||||||
});
|
});
|
||||||
|
|
||||||
let multiplicityItemsFormArray = new Array<FormGroup>();
|
const multiplicityItemsFormArray = new Array<FormGroup>();
|
||||||
this.multiplicityItems.forEach(item => {
|
this.multiplicityItems.forEach(item => {
|
||||||
let form: FormGroup = item.buildForm();
|
const form: FormGroup = item.buildForm();
|
||||||
multiplicityItemsFormArray.push(form)
|
multiplicityItemsFormArray.push(form);
|
||||||
})
|
});
|
||||||
formGroup.addControl('multiplicityItems', this.formBuilder.array(multiplicityItemsFormArray));
|
formGroup.addControl('multiplicityItems', this.formBuilder.array(multiplicityItemsFormArray));
|
||||||
|
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
cloneForMultiplicity(index: number, idPath: string): Field {
|
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.id = idPath ? idPath + index : 'multiple_' + this.id + '_' + index;
|
||||||
newItem.title = this.title;
|
newItem.title = this.title;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { JsonSerializer } from '../utilities/JsonSerializer';
|
||||||
import { Serializable } from './interfaces/Serializable';
|
import { Serializable } from './interfaces/Serializable';
|
||||||
import { Field } from './Field';
|
import { Field } from './Field';
|
||||||
|
|
||||||
export class FieldGroup extends BaseModel implements Serializable<FieldGroup>, FormGenerator<FormGroup>{
|
export class FieldGroup extends BaseModel implements Serializable<FieldGroup>, FormGenerator<FormGroup> {
|
||||||
public id: string;
|
public id: string;
|
||||||
public title: string;
|
public title: string;
|
||||||
public section: string;
|
public section: string;
|
||||||
|
@ -32,7 +32,7 @@ export class FieldGroup extends BaseModel implements Serializable<FieldGroup>, F
|
||||||
}
|
}
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(): FormGroup {
|
||||||
let formGroup: FormGroup = this.formBuilder.group({
|
const formGroup: FormGroup = this.formBuilder.group({
|
||||||
/* id: [this.id],
|
/* id: [this.id],
|
||||||
title: [this.title],
|
title: [this.title],
|
||||||
value: [this.value],
|
value: [this.value],
|
||||||
|
@ -41,12 +41,12 @@ export class FieldGroup extends BaseModel implements Serializable<FieldGroup>, F
|
||||||
defaultVisibility: [this.defaultVisibility],
|
defaultVisibility: [this.defaultVisibility],
|
||||||
page: [this.page] */
|
page: [this.page] */
|
||||||
});
|
});
|
||||||
let compositeFieldsFormArray = new Array<FormGroup>();
|
const compositeFieldsFormArray = new Array<FormGroup>();
|
||||||
if (this.compositeFields) {
|
if (this.compositeFields) {
|
||||||
this.compositeFields.forEach(item => {
|
this.compositeFields.forEach(item => {
|
||||||
let form: FormGroup = item.buildForm();
|
const form: FormGroup = item.buildForm();
|
||||||
compositeFieldsFormArray.push(form)
|
compositeFieldsFormArray.push(form);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
formGroup.addControl('compositeFields', this.formBuilder.array(compositeFieldsFormArray));
|
formGroup.addControl('compositeFields', this.formBuilder.array(compositeFieldsFormArray));
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue