diff --git a/dmp-frontend/src/app/form/dynamic-form/dynamic-form.component.ts b/dmp-frontend/src/app/form/dynamic-form/dynamic-form.component.ts
index 81ca5f7b4..3a380f70d 100644
--- a/dmp-frontend/src/app/form/dynamic-form/dynamic-form.component.ts
+++ b/dmp-frontend/src/app/form/dynamic-form/dynamic-form.component.ts
@@ -58,11 +58,11 @@ export class DynamicFormComponent implements OnInit {
ngOnInit() {
- this.datasetProfileDefinitionModel = this.dataModel.datasetProfileDefinition
- this.createPagination();
+ let rules: Rule[] = JsonSerializer.fromJSONArray(this.dataModel.datasetProfileDefinition.rules, Rule);
this.visibilityRulesService.formGroup = this.form;
- let rules: Rule[] = JsonSerializer.fromJSONArray(this.datasetProfileDefinitionModel.rules, Rule);
this.visibilityRulesService.buildVisibilityRules(rules)
+ this.datasetProfileDefinitionModel = this.dataModel.datasetProfileDefinition
+ this.createPagination();
this.progressbar = true;
this.route.fragment.subscribe((fragment: string) => {
diff --git a/dmp-frontend/src/app/models/Field.ts b/dmp-frontend/src/app/models/Field.ts
index c21090a1f..c0bdcd268 100644
--- a/dmp-frontend/src/app/models/Field.ts
+++ b/dmp-frontend/src/app/models/Field.ts
@@ -6,16 +6,17 @@ import { Serializable } from './interfaces/Serializable';
import { Multiplicity } from './Multiplicity';
import { DefaultValue } from './DefaultValue';
import { ValidationTypes } from '@app/models/common/ValidationTypes';
+import { ViewStyle } from './datasetProfileAdmin/ViewStyle';
export class Field extends BaseModel implements Serializable, FormGenerator{
public id: string;
public title: string;
- public value: string;
+ public value: any;
public defaultValue: DefaultValue;
public description: string;
public extendedDescription: string;
- public viewStyle: any;
+ public viewStyle: ViewStyle;
public defaultVisibility: boolean;
public page: number;
public multiplicity: Multiplicity;
@@ -38,26 +39,29 @@ export class Field extends BaseModel implements Serializable, FormGenerat
this.defaultValue = JsonSerializer.fromJSONObject(item.defaultValue, DefaultValue);
this.value = this.defaultValue.value && !item.value ? this.defaultValue.value : item.value;
//this.multiplicity = new Multiplicity();
+ if (this.viewStyle.renderStyle === "checkBox") {
+ this.value = this.value === 'true';
+ }
//this.multiplicity.max = 2;
- if(item.multiplicityItems)this.multiplicityItems = JsonSerializer.fromJSONArray(item.multiplicityItems, Field);
+ if (item.multiplicityItems) this.multiplicityItems = JsonSerializer.fromJSONArray(item.multiplicityItems, Field);
this.data = item.data;
return this;
}
-
- buildForm(): FormGroup {
- if(this.validations)
+
+ buildForm(): FormGroup {
+ if (this.validations)
this.validations.forEach(validation => {
- if (validation == ValidationTypes.Required ) this.validationRequired = true;
+ if (validation == ValidationTypes.Required) this.validationRequired = true;
});
let formGroup = this.formBuilder.group({
id: [this.id],
- data:[this.data],
+ data: [this.data],
/* title: [this.title], */
- value: [this.value, this.validationRequired == true? Validators.required:null]/* ,
+ value: [this.value, this.validationRequired == true ? Validators.required : null]/* ,
description: [this.description],
extendedDescription:[this.extendedDescription],
viewStyle: [this.viewStyle],
diff --git a/dmp-frontend/src/app/services/dataset-wizard/dataset-wizard.service.ts b/dmp-frontend/src/app/services/dataset-wizard/dataset-wizard.service.ts
index 2525fa815..6d64957e3 100644
--- a/dmp-frontend/src/app/services/dataset-wizard/dataset-wizard.service.ts
+++ b/dmp-frontend/src/app/services/dataset-wizard/dataset-wizard.service.ts
@@ -2,7 +2,7 @@ import { DatasetProfileDefinitionModel } from '../../models/DatasetProfileDefini
import { DatasetWizardModel } from '../../models/datasets/DatasetWizardModel';
import { DatasetProfileCriteria } from '../../models/criteria/dataset-profile/DatasetProfileCriteria';
import 'rxjs/add/operator/map';
-import { HttpHeaders } from '@angular/common/http';
+import { HttpHeaders, HttpResponse, HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { HostConfiguration } from './../../app.constants';
import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service';
@@ -11,6 +11,7 @@ import { DataManagementPlanModel } from '../../models/data-managemnt-plans/DataM
import { DataManagementPlanCriteria } from '../../models/criteria/data-management-plan/DataManagementPlanCriteria';
import { RequestItem } from '../../models/criteria/RequestItem';
import { DatasetProfileModel } from '@app/models/datasetprofile/DatasetProfileModel';
+import { ResponseContentType } from '@angular/http';
@Injectable()
@@ -19,7 +20,7 @@ export class DatasetWizardService {
private actionUrl: string;
private headers: HttpHeaders;
- constructor(private http: BaseHttpService) {
+ constructor(private http: BaseHttpService, private httpClient: HttpClient) {
this.actionUrl = HostConfiguration.Server + 'datasetwizard/';
@@ -44,10 +45,9 @@ export class DatasetWizardService {
return this.http.post(this.actionUrl + 'createOrUpdate', datasetModel, { headers: this.headers });
}
-/* public saveDataset(datasetWizard: DatasetWizardModel, formValue) {
- datasetWizard.properties = formValue;
- return this.createDataset(datasetWizard)
- } */
+ public downloadPDF(id: string): Observable> {
+ return this.httpClient.get(this.actionUrl + 'getWordDocument/' + id, { responseType: 'blob', observe: 'response' })
+ }
public getDefinition(id: String): Observable {
return this.http.get(this.actionUrl + 'get/' + id, { headers: this.headers });
diff --git a/dmp-frontend/src/app/shared/components/criteria/datasets/datasets-criteria.component.ts b/dmp-frontend/src/app/shared/components/criteria/datasets/datasets-criteria.component.ts
index fa15a6b09..f25300251 100644
--- a/dmp-frontend/src/app/shared/components/criteria/datasets/datasets-criteria.component.ts
+++ b/dmp-frontend/src/app/shared/components/criteria/datasets/datasets-criteria.component.ts
@@ -22,8 +22,8 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
public criteria: DatasetCriteria= new DatasetCriteria();
statuses = [
- {value: '0', viewValue: 'Active'},
- {value: '1', viewValue: 'Inactive'}
+ {value: '0', viewValue: 'Saved'},
+ {value: '1', viewValue: 'Finalised'}
];
constructor(
diff --git a/dmp-frontend/src/app/utilities/cite-http-service-module/base-http.service.ts b/dmp-frontend/src/app/utilities/cite-http-service-module/base-http.service.ts
index 31ca4bf26..f0188098c 100644
--- a/dmp-frontend/src/app/utilities/cite-http-service-module/base-http.service.ts
+++ b/dmp-frontend/src/app/utilities/cite-http-service-module/base-http.service.ts
@@ -10,6 +10,7 @@ import { HttpClient } from '@angular/common/http';
import { AuthService } from '../../services/auth/auth.service';
import { SnackBarNotificationComponent } from '../../shared/components/notificaiton/snack-bar-notification.component';
import { BaseHttpResponseModel } from '../../models/http/BaseHttpResponseModel';
+import { ApiResponseCode } from '@app/utilities/types/ApiResponseCode';
@Injectable()
export class BaseHttpService {
@@ -22,39 +23,39 @@ export class BaseHttpService {
public route: ActivatedRoute
) {
}
- get(url: string, options?: any): Observable {
- return this.interceptRepsonse(this.http.get(url, this.buildRequestOptions(options)));
+ get(url: string, options?: any, appendOptions: boolean = true): Observable {
+ return this.interceptRepsonse(this.http.get(url, this.buildRequestOptions(appendOptions, options)));
}
- post(url: string, body: any, options?: any): Observable {
- return this.interceptRepsonse(this.http.post(url, body, this.buildRequestOptions(options)));
+ post(url: string, body: any, options?: any, appendOptions: boolean = true): Observable {
+ return this.interceptRepsonse(this.http.post(url, body, this.buildRequestOptions(appendOptions, options)));
}
- put(url: string, body: any, options?: any): Observable {
- return this.interceptRepsonse(this.http.put(url, body, this.buildRequestOptions(options)));
+ put(url: string, body: any, options?: any, appendOptions: boolean = true): Observable {
+ return this.interceptRepsonse(this.http.put(url, body, this.buildRequestOptions(appendOptions, options)));
}
- delete(url: string, options?: any): Observable {
- return this.interceptRepsonse(this.http.delete(url, this.buildRequestOptions(options)));
+ delete(url: string, options?: any, appendOptions: boolean = true): Observable {
+ return this.interceptRepsonse(this.http.delete(url, this.buildRequestOptions(appendOptions, options)));
}
- patch(url: string, body: any, options?: any): Observable {
- return this.interceptRepsonse(this.http.patch(url, body, this.buildRequestOptions(options)));
+ patch(url: string, body: any, options?: any, appendOptions: boolean = true): Observable {
+ return this.interceptRepsonse(this.http.patch(url, body, this.buildRequestOptions(appendOptions, options)));
}
- head(url: string, options?: any): Observable {
- return this.interceptRepsonse(this.http.head(url, this.buildRequestOptions(options)));
+ head(url: string, options?: any, appendOptions: boolean = true): Observable {
+ return this.interceptRepsonse(this.http.head(url, this.buildRequestOptions(appendOptions, options)));
}
- options(url: string, options?: any): Observable {
- return this.interceptRepsonse(this.http.options(url, this.buildRequestOptions(options)));
+ options(url: string, options?: any, appendOptions: boolean = true): Observable {
+ return this.interceptRepsonse(this.http.options(url, this.buildRequestOptions(appendOptions, options)));
}
- protected buildRequestOptions(options?: any): Object {
+ protected buildRequestOptions(appendOptions: boolean, options?: any): Object {
if (options == null) {
options = new RequestOptions();
}
if (options.headers == null) {
options.headers = new Headers();
}
- if (!options.headers.has('Content-Type')) {
+ if (!options.headers.has('Content-Type') && appendOptions) {
options.headers = options.headers.set('Content-Type', 'application/json');
}
- if (!options.headers.has('Content-Type')) {
+ if (!options.headers.has('Content-Type') && appendOptions) {
options.headers = options.headers.set('Content-Type', 'application/json');
}
if (!options.headers.has('AuthToken')) {
@@ -81,26 +82,27 @@ export class BaseHttpService {
//this.notification.httpError(error);
return Observable.of();
} else {
- let error:any = errorResponse.error
- if(error.statusCode == ApiMessageCode.ERROR_MESSAGE){
+ let error: any = errorResponse.error
+ if (error.statusCode == ApiMessageCode.ERROR_MESSAGE) {
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
data: { message: error.message, language: null },
duration: 3000,
extraClasses: ['snackbar-warning']
})
- return Observable.throw(errorResponse);
+ return Observable.throw(errorResponse);
}
- else{
+ else {
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
data: { message: 'GENERAL.ERRORS.HTTP-REQUEST-ERROR', language: this.language },
duration: 3000,
extraClasses: ['snackbar-warning']
})
- return Observable.throw(errorResponse);
+ return Observable.throw(errorResponse);
}
}
})
.map(response => {
+ if (response instanceof Blob) return response
if (response.statusCode == ApiMessageCode.SUCCESS_MESSAGE) {
//throw new Error('Request failed');
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
@@ -109,12 +111,12 @@ export class BaseHttpService {
extraClasses: ['snackbar-success']
})
return response.payload;
-
+
}
- else if(response.statusCode == ApiMessageCode.NO_MESSAGE){
+ else if (response.statusCode == ApiMessageCode.NO_MESSAGE) {
return response.payload;
}
- else{
+ else {
return response.payload;
}
});
diff --git a/dmp-frontend/src/app/utilities/types/ApiResponseCode.ts b/dmp-frontend/src/app/utilities/types/ApiResponseCode.ts
new file mode 100644
index 000000000..fa650dc3b
--- /dev/null
+++ b/dmp-frontend/src/app/utilities/types/ApiResponseCode.ts
@@ -0,0 +1,4 @@
+export enum ApiResponseCode {
+ JSON_RESPONSE = 0,
+ FILE_RESPONSE = 1,
+}
\ No newline at end of file
diff --git a/dmp-frontend/src/app/visibility-rules/visibility-rules.service.ts b/dmp-frontend/src/app/visibility-rules/visibility-rules.service.ts
index 075bfb147..4c8b43901 100644
--- a/dmp-frontend/src/app/visibility-rules/visibility-rules.service.ts
+++ b/dmp-frontend/src/app/visibility-rules/visibility-rules.service.ts
@@ -40,11 +40,11 @@ export class VisibilityRulesService {
private evaluateVisibility(visibilityRule: VisibilityRule) {
for (let i = 0; i < visibilityRule.sourceVisibilityRules.length; i++) {
let pathKey = this.fieldsPathMemory[visibilityRule.sourceVisibilityRules[i].sourceControlId];
- if (this.formGroup.get(pathKey + '.value') && this.formGroup.get(pathKey + '.value').value != '' + visibilityRule.sourceVisibilityRules[i].sourceControlValue) {
+ if (this.formGroup.get(pathKey + '.value') && (!this.formGroup.get(pathKey + '.value').value || ""+this.formGroup.get(pathKey + '.value').value != ""+visibilityRule.sourceVisibilityRules[i].sourceControlValue)) {
this.elementVisibilityMap.set(visibilityRule.targetControlId, false)
- } else {
- this.elementVisibilityMap.set(visibilityRule.targetControlId, true)
+ return;
}
+ this.elementVisibilityMap.set(visibilityRule.targetControlId, true)
}
}
diff --git a/welcome.docx b/welcome.docx
new file mode 100644
index 000000000..acb1dd36b
Binary files /dev/null and b/welcome.docx differ