Merge branch 'master' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot
This commit is contained in:
commit
6084125de0
|
@ -86,7 +86,7 @@ export class DatasetsComponent implements OnInit {
|
|||
this.datasetProfileDropDown.options = [];
|
||||
this.saveAndDescribe = false;
|
||||
this.statusDropDown = new DropdownField();
|
||||
this.statusDropDown.options= [{key:'', value:null},{key:'0', value:"Active"},{key:'1', value:"Inactive"}]
|
||||
this.statusDropDown.options= [{key:'', value:null},{key:'0', value:"Active"},{key:'1', value:"Inactive"}, {key:'2', value:"Submitted"}, {key:'3', value:"Cancel"}]
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ export class DmpComponent implements OnInit{
|
|||
this.projectsDropDown = new DropdownField();
|
||||
this.projectsDropDown.options = [];
|
||||
this.statusDropDown = new DropdownField();
|
||||
this.statusDropDown.options= [{key:'', value:null},{key:'0', value:"Active"},{key:'1', value:"Inactive"}]
|
||||
this.statusDropDown.options= [{key:'', value:null},{key:'0', value:"Active"},{key:'1', value:"Inactive"}, {key:'2', value:"Submitted"}, {key:'3', value:"Cancel"}]
|
||||
//this.projects = [];
|
||||
this.dmpTableVisible = false;
|
||||
this.dataSetVisibe = false;
|
||||
|
@ -270,11 +270,35 @@ deleteRow(dmp){
|
|||
}
|
||||
|
||||
clickFilters(element){
|
||||
console.log(element);
|
||||
if(element.textContent == "More filters")
|
||||
element.textContent = "Less Filters";
|
||||
else
|
||||
element.textContent = "More Filters";
|
||||
if(element.textContent == "More filters")
|
||||
element.textContent = "Less Filters";
|
||||
else
|
||||
element.textContent = "More Filters";
|
||||
}
|
||||
|
||||
SelectDMPStatus(dmp, event, oldValue){
|
||||
console.log(dmp);
|
||||
let cannotChangeStatus:boolean;
|
||||
if(dmp.status == 2){
|
||||
this.serverService.getDatasetForDmp({ "id": dmp.id }).subscribe(
|
||||
response => {
|
||||
response.forEach(dataset => {
|
||||
if(dataset.status !==2 || dataset.status !==3){
|
||||
cannotChangeStatus=true;
|
||||
}
|
||||
return;
|
||||
});
|
||||
if(cannotChangeStatus == true){
|
||||
dmp.status = 0;
|
||||
$("#messageForChangingStatus").modal("show");
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log("could not retrieve dataset for dpm: "+dmp.id);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="status-name" class="col-form-label">Status:</label>
|
||||
<select class="form-control" id="statusid" [(ngModel)]="dmp.status" name="statusDropDown">
|
||||
<select class="form-control" id="statusid" [(ngModel)]="dmp.status" name="statusDropDown" (change)="SelectDMPStatus(dmp, $event, oldValue);">
|
||||
<option *ngFor="let opt of statusDropDown.options" [value]="opt.key">{{opt.value}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
@ -197,6 +197,25 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal" tabindex="-1" id="messageForChangingStatus" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Change Staus</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>The submitted status is available only when all the DMP's datasets are "Submitted" or "Cancel"</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--Modal for DMPs-->
|
||||
<!-- <modal *ngIf="item && show" [(show)]="show" [item]="item" [(dataSetVisibe)]="dataSetVisibe"></modal> -->
|
||||
|
||||
|
|
|
@ -1,119 +1,125 @@
|
|||
<div class="parent-div">
|
||||
|
||||
|
||||
<div class="col-md-8 col-sm-9 child-div-left" >
|
||||
<div class="col-md-8 col-sm-9 child-div-left" >
|
||||
|
||||
|
||||
|
||||
<div class="col-md-12 form-body-container" id="form-container">
|
||||
<div class="col-md-12 form-body-container" id="form-container">
|
||||
|
||||
<form novalidate [formGroup]="form" (ngSubmit)="onSubmit()">
|
||||
<form novalidate [formGroup]="form" (ngSubmit)="onSubmit()">
|
||||
|
||||
<div *ngFor = "let section of dataModel.sections; let i = index;">
|
||||
<div *ngIf="section.groupFields.length>0 else sectionHeader">
|
||||
<div *ngIf="shouldIShow(section);"><h3>{{section.title}}</h3></div>
|
||||
<div *ngFor="let group of section.groupFields">
|
||||
<div *ngIf="shouldIShow(group);" >
|
||||
<df-group [group]="group" [dataModel]="dataModel" [form]="getSubForm(group.key)"></df-group>
|
||||
<div *ngFor = "let section of dataModel.sections; let i = index;">
|
||||
<div *ngIf="section.groupFields.length>0 else sectionHeader">
|
||||
<div *ngIf="shouldIShow(section);"><h3>{{section.title}}</h3></div>
|
||||
<div *ngFor="let group of section.groupFields">
|
||||
<div *ngIf="shouldIShow(group);" >
|
||||
<df-group [group]="group" [dataModel]="dataModel" [form]="getSubForm(group.key)"></df-group>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<ng-template *ngIf="shouldIShow(section);" #sectionHeader>
|
||||
<h2>{{section.title}}</h2>
|
||||
</ng-template>
|
||||
</div>
|
||||
<ng-template *ngIf="shouldIShow(section);" #sectionHeader>
|
||||
<h2>{{section.title}}</h2>
|
||||
</ng-template>
|
||||
</div>
|
||||
|
||||
<div *ngFor="let field of dataModel.fields">
|
||||
<div [formGroup]="form" class="form-group">
|
||||
<df-field [field]="field" [form]="form" [dataModel]="dataModel" ></df-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div *ngFor="let group of dataModel.groups">
|
||||
<df-group [group]="group" [dataModel]="dataModel" [form]="getSubForm(group.key)"></df-group>
|
||||
</div> -->
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div *ngFor="let field of dataModel.fields">
|
||||
<div [formGroup]="form" class="form-group">
|
||||
<df-field [field]="field" [form]="form" [dataModel]="dataModel" ></df-field>
|
||||
<div class="col-md-12 form-footer-container" >
|
||||
|
||||
|
||||
<div>
|
||||
<button type="button" class="btn btn-default btncustom" [disabled]="!form.valid || finalizeStatus" (click)="SaveFinalize();">Save</button>
|
||||
<button type="button" class="btn btn-default btncustom" [disabled]="!form.valid || finalizeStatus" data-toggle="modal" data-target="#confirmModal">Finalize</button>
|
||||
</div>
|
||||
|
||||
<div *ngIf="payLoad" class="form-row">
|
||||
<strong>Saved the following values</strong><br>{{payLoad}}
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<p>Form value: {{ form.value | json }}</p>
|
||||
-->
|
||||
|
||||
|
||||
<div class="text-center">
|
||||
<!-- pagination -->
|
||||
<ul *ngIf="pagination.pages && pagination.pages.length" class="pagination">
|
||||
<li [ngClass]="{disabled:pagination.currentPage === 1}">
|
||||
<a (click)="setPage(1)" class="cursor-link" >First</a>
|
||||
</li>
|
||||
<li [ngClass]="{disabled:pagination.currentPage === 1}">
|
||||
<a (click)="setPage(pagination.currentPage - 1)" class="cursor-link">Previous</a>
|
||||
</li>
|
||||
<li *ngFor="let page of pagination.pages" [ngClass]="{active:pagination.currentPage === page}">
|
||||
<a (click)="setPage(page)" class="cursor-link">{{page}}</a>
|
||||
</li>
|
||||
<li [ngClass]="{disabled:pagination.currentPage === pagination.totalPages}">
|
||||
<a (click)="setPage(pagination.currentPage + 1)" class="cursor-link">Next</a>
|
||||
</li>
|
||||
<li [ngClass]="{disabled:pagination.currentPage === pagination.totalPages}">
|
||||
<a (click)="setPage(pagination.totalPages)" class="cursor-link">Last</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-4 col-sm-3 child-div-right" id="toc-container">
|
||||
<toc [dataModel]="dataModel" (setPage)="setPage($event)"></toc>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--Modal for Confirmation -->
|
||||
<div class="modal fade" id="confirmModal" tabindex="-1" role="dialog" aria-labelledby="newVersionDmpModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Confirmation Message</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Are you sure you want to save and finalize?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" (click)="SaveFinalize();">Save and Finalize</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div *ngFor="let group of dataModel.groups">
|
||||
<df-group [group]="group" [dataModel]="dataModel" [form]="getSubForm(group.key)"></df-group>
|
||||
</div> -->
|
||||
|
||||
<!--
|
||||
<p>Form value: {{ form.value | json }}</p>
|
||||
-->
|
||||
<div *ngIf="payLoad" class="form-row">
|
||||
<strong>Saved the following values</strong><br>{{payLoad}}
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 form-footer-container" >
|
||||
|
||||
<div class="text-center">
|
||||
<!-- pagination -->
|
||||
<ul *ngIf="pagination.pages && pagination.pages.length" class="pagination">
|
||||
<li [ngClass]="{disabled:pagination.currentPage === 1}">
|
||||
<a (click)="setPage(1)" class="cursor-link" >First</a>
|
||||
</li>
|
||||
<li [ngClass]="{disabled:pagination.currentPage === 1}">
|
||||
<a (click)="setPage(pagination.currentPage - 1)" class="cursor-link">Previous</a>
|
||||
</li>
|
||||
<li *ngFor="let page of pagination.pages" [ngClass]="{active:pagination.currentPage === page}">
|
||||
<a (click)="setPage(page)" class="cursor-link">{{page}}</a>
|
||||
</li>
|
||||
<li [ngClass]="{disabled:pagination.currentPage === pagination.totalPages}">
|
||||
<a (click)="setPage(pagination.currentPage + 1)" class="cursor-link">Next</a>
|
||||
</li>
|
||||
<li [ngClass]="{disabled:pagination.currentPage === pagination.totalPages}">
|
||||
<a (click)="setPage(pagination.totalPages)" class="cursor-link">Last</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<button type="button" class="btn btn-default btncustom" [disabled]="!form.valid" (click)="SaveFinalize();">Save</button>
|
||||
<button type="button" class="btn btn-default btncustom" [disabled]="!form.valid" data-toggle="modal" data-target="#confirmModal">Finalize</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-4 col-sm-3 child-div-right" id="toc-container">
|
||||
<toc [dataModel]="dataModel" (setPage)="setPage($event)"></toc>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--Modal for Confirmation -->
|
||||
<div class="modal fade" id="confirmModal" tabindex="-1" role="dialog" aria-labelledby="newVersionDmpModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Confirmation Message</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Are you sure you want to save and finalize?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" (click)="SaveFinalize();">Save and Finalize</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -53,6 +53,7 @@ export class DynamicFormComponent implements OnInit {
|
|||
@Input() dirtyValues: number = 0;
|
||||
// pagination object
|
||||
@Input() pagination: any = {};
|
||||
finalizeStatus:boolean = false;
|
||||
id: string;
|
||||
datasetId: string;
|
||||
//datasetProperties:string;
|
||||
|
@ -77,11 +78,7 @@ export class DynamicFormComponent implements OnInit {
|
|||
|
||||
ngOnInit() {
|
||||
|
||||
this.route.fragment.subscribe(fragment => { this.fragment = fragment; }); //navigate to certain section of the page
|
||||
|
||||
|
||||
//let id = this.route.snapshot.paramMap.get('id'); //get the project id
|
||||
|
||||
//this.route.fragment.subscribe(fragment => { this.fragment = fragment; }); //navigate to certain section of the page, it doesn't use anymore
|
||||
let sub = this.route.params.subscribe(params => {
|
||||
this.id = params.id;
|
||||
this.datasetId = params.datasetId;
|
||||
|
@ -99,6 +96,7 @@ export class DynamicFormComponent implements OnInit {
|
|||
formValues = JSON.parse(data.properties);
|
||||
flatList = flatten(formValues);
|
||||
//this.patchForm(flatList);
|
||||
if(data.status == 2) this.finalizeStatus=true;
|
||||
}
|
||||
|
||||
//η κληση για το dataset profile pou htan prin pio panw anexarthth
|
||||
|
@ -224,10 +222,10 @@ export class DynamicFormComponent implements OnInit {
|
|||
} catch (e) { }
|
||||
}
|
||||
|
||||
submitForm(){
|
||||
submitForm(final){
|
||||
this.serverService.getDatasetByID(this.datasetId).subscribe(
|
||||
(data) => {
|
||||
|
||||
if (final) data.status = 2;
|
||||
//is xml, so transform them to xml (it's json)
|
||||
//data.properties = this.xml2jsonOBJ.json2xml_str(JSON.stringify(this.form.value));
|
||||
data.properties = JSON.stringify(this.form.value);
|
||||
|
@ -248,14 +246,16 @@ export class DynamicFormComponent implements OnInit {
|
|||
}
|
||||
|
||||
onSubmit() {
|
||||
this.submitForm();
|
||||
let final = false;
|
||||
this.submitForm(false);
|
||||
|
||||
this.payLoad = JSON.stringify(this.form.value);
|
||||
}
|
||||
|
||||
SaveFinalize(){
|
||||
$("#confirmModal").modal("hide");
|
||||
this.submitForm();
|
||||
let final = true;
|
||||
this.submitForm(final);
|
||||
}
|
||||
|
||||
shouldIShow(element) { //pagination , pages are declared in xml for every groupfield
|
||||
|
|
|
@ -15,6 +15,7 @@ export class FieldBase<T>{
|
|||
attributes: Attribute;
|
||||
regex:string;
|
||||
url: string;
|
||||
datatype: string;
|
||||
|
||||
constructor(options: {
|
||||
value?: T,
|
||||
|
@ -29,7 +30,8 @@ export class FieldBase<T>{
|
|||
description?: string,
|
||||
attributes?: Attribute,
|
||||
regex?:string,
|
||||
url?: string
|
||||
url?: string,
|
||||
datatype?:string
|
||||
} = {}) {
|
||||
this.value = options.value;
|
||||
this.key = options.key || '';
|
||||
|
@ -44,5 +46,6 @@ export class FieldBase<T>{
|
|||
this.attributes = options.attributes || new Attribute();
|
||||
this.regex = options.regex || '';
|
||||
this.url = options.url || "";
|
||||
this.datatype = options.datatype || "";
|
||||
}
|
||||
}
|
|
@ -17,6 +17,12 @@ export class StatusToString implements PipeTransform {
|
|||
else if(input == 1) {
|
||||
return "Inactive";
|
||||
}
|
||||
else if(input == 2) {
|
||||
return "Submitted";
|
||||
}
|
||||
else if(input == 3) {
|
||||
return "Cancel";
|
||||
}
|
||||
else {
|
||||
return input.toString();
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ export class dataModelBuilder {
|
|||
this.dataModel.semanticAttr = new Array(new Attribute);
|
||||
this.dataModel.semanticAttr = this.getFieldsAttributes(data.definition.root.fields.field, data.ruleset.definition.root.functions.function, this.fields);
|
||||
this.dataModel.sections = this.getSections(data.viewstyle.definition.root.sections.section, this.dataModel.groups);
|
||||
//this.getDatatypes(data.definition.root);
|
||||
this.dataModel.buildIndex();
|
||||
|
||||
this.checkDuplicateInObject('order', this.dataModel.groups[13].groupFields); //for future use , for composite field
|
||||
|
@ -298,6 +299,17 @@ export class dataModelBuilder {
|
|||
return sects;
|
||||
}
|
||||
|
||||
private getDatatypes(dataTypes){
|
||||
if (dataTypes.datatypes.datatype.id == "compositeField"){
|
||||
dataTypes.datatypes.datatype.fields.forEach(field => {
|
||||
this.dataModel.fields.forEach(fieldinModel=>{
|
||||
if (field.id == fieldinModel.key)
|
||||
fieldinModel.datatype = "compositeField";
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
checkDuplicateInObject(propertyName, inputArray) {
|
||||
let DuplicateArray = [];
|
||||
inputArray.forEach(item => {
|
||||
|
|
Loading…
Reference in New Issue