Merge branch 'master' of git@gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot.git

This commit is contained in:
Nikolaos Laskaris 2017-11-08 10:31:19 +02:00
commit 2de50ecbfb
21 changed files with 325 additions and 83 deletions

View File

@ -24,8 +24,7 @@
], ],
"scripts": [ "scripts": [
"./../node_modules/bootstrap/dist/js/bootstrap.min.js", "./../node_modules/bootstrap/dist/js/bootstrap.min.js",
"./assets/xml2json.min.js", "./assets/xml2json.min.js"
"./assets/jquery.scrollTo.min.js"
], ],
"environmentSource": "environments/environment.ts", "environmentSource": "environments/environment.ts",
"environments": { "environments": {

View File

@ -33,7 +33,10 @@ const appRoutes: Routes = [
imports: [ imports: [
RouterModule.forRoot( RouterModule.forRoot(
appRoutes appRoutes
// { enableTracing: true } // <-- debugging purposes only ,{
useHash: true
//,enableTracing: true <-- debugging purposes only
}
) )
], ],
exports: [ exports: [

View File

@ -81,19 +81,25 @@
padding-bottom: 500px; padding-bottom: 500px;
*/ */
z-index: 1; z-index: 1;
overflow-x: hidden; overflow-x: hidden;
height: 100%; height: 100%;
width: 0px; width: 0px;
top: 0px; top: 0px;
left: 0px; left: 0px;
background-color: #111; background-color: #f8f8f8;
transition: 0.5s; transition: 0.5s;
padding-top: 60px; padding-top: 60px;
} }
.sidenav.expanded{ .sidenav.expanded{
width: 15%; width: 15%;
border-style: solid;
border-width: thin;
} }
#appBody { #appBody {
@ -116,7 +122,7 @@
} }
.sidenav a:hover { .sidenav a:hover {
color: #f1f1f1; color: #000;
} }
.sidenav .closebtn { .sidenav .closebtn {

View File

@ -46,8 +46,12 @@
<!--<a href="javascript:void(0)" class="closebtn" (click)='slideNav()'>&times;</a>--> <!--<a href="javascript:void(0)" class="closebtn" (click)='slideNav()'>&times;</a>-->
<a class="cursor">My Workspace</a> <a class="cursor">My Workspace</a>
<a class="cursor">Orphan Datasets</a> <a class="cursor">Orphan Datasets</a>
<a class="cursor">Clients</a> <a class="cursor">...</a>
<a class="cursor">Contact</a> <a class="cursor">Basically</a>
<a class="cursor">George</a>
<a class="cursor">tell us</a>
<a class="cursor">what to</a>
<a class="cursor">put here</a>
</div> </div>
<div id="appBody" class="child_div"> <div id="appBody" class="child_div">
@ -59,7 +63,8 @@
<!--this should be invisible --> <!--this should be invisible -->
<app-main-sign-in [ngClass]="'invisible'"></app-main-sign-in> <app-main-sign-in [ngClass]="'invisible'"></app-main-sign-in>
<!--
-->
</div> </div>

View File

@ -14,6 +14,7 @@ import { RestBase } from './services/rest-base';
import { DynamicFormComponent } from './form/dynamic-form.component'; import { DynamicFormComponent } from './form/dynamic-form.component';
import { DynamicFormFieldComponent } from './form/fields/dynamic-form-field.component'; import { DynamicFormFieldComponent } from './form/fields/dynamic-form-field.component';
import { ServerService } from './services/server.service'; import { ServerService } from './services/server.service';
import { GlobalVariables } from './services/global-variables.service';
import { TokenService, TokenProvider } from './services/login/token.service'; import { TokenService, TokenProvider } from './services/login/token.service';
import { LocalStorageService } from 'ngx-webstorage'; import { LocalStorageService } from 'ngx-webstorage';
import { dataModelBuilder } from './services/dataModelBuilder.service'; import { dataModelBuilder } from './services/dataModelBuilder.service';
@ -23,6 +24,8 @@ import { AuthGuard } from './guards/auth.guard';
import { PageNotFoundComponent } from './not-found.component'; import { PageNotFoundComponent } from './not-found.component';
import { EmptyComponent } from './empty.component'; import { EmptyComponent } from './empty.component';
import { TocComponent } from './form/tableOfContents/toc.component'; import { TocComponent } from './form/tableOfContents/toc.component';
import { ConfirmationComponent } from './widgets/confirmation/confirmation.component';
import { PaginationService } from './services/pagination.service'; import { PaginationService } from './services/pagination.service';
import { EestoreService } from './services/eestore.service'; import { EestoreService } from './services/eestore.service';
@ -50,6 +53,7 @@ import { DatasetRoutingModule } from './datasets/dataset-routing.module';
import { DmpComponent } from './dmps/dmp.component'; import { DmpComponent } from './dmps/dmp.component';
import { DmpTableFilterPipe } from './pipes/dmp-table-filter.pipe'; import { DmpTableFilterPipe } from './pipes/dmp-table-filter.pipe';
import { DmpStatusFilterPipe } from './pipes/dmp-status-filter.pipe';
import { DmpVersionFilterPipe } from './pipes/dmp-version-filter.pipe'; import { DmpVersionFilterPipe } from './pipes/dmp-version-filter.pipe';
import { DmpRoutingModule } from './dmps/dmp-routing.module'; import { DmpRoutingModule } from './dmps/dmp-routing.module';
@ -85,9 +89,11 @@ import { UserWorkspaceComponent } from './user-workspace/user-workspace.componen
DmpComponent, DmpComponent,
DatasetsComponent, DatasetsComponent,
UserWorkspaceComponent, UserWorkspaceComponent,
ConfirmationComponent,
ProjectTableFilterPipe, ProjectTableFilterPipe,
DmpVersionFilterPipe, DmpVersionFilterPipe,
DmpStatusFilterPipe,
DmpTableFilterPipe, DmpTableFilterPipe,
DatasetTableFilterPipe, DatasetTableFilterPipe,
DatasetStatusFilterPipe, DatasetStatusFilterPipe,
@ -116,7 +122,7 @@ import { UserWorkspaceComponent } from './user-workspace/user-workspace.componen
useClass: GlobalInterceptor, useClass: GlobalInterceptor,
multi: true, multi: true,
}, },
ServerService, dataModelBuilder, AuthGuard, PaginationService, TokenService, LocalStorageService, RestBase, EestoreService,NativeLoginService ServerService, dataModelBuilder, GlobalVariables, AuthGuard, PaginationService, TokenService, LocalStorageService, RestBase, EestoreService,NativeLoginService
], ],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })

View File

@ -9,6 +9,7 @@ import {DataTable} from 'angular2-datatable';
import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown'; import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown';
import { Param } from '../entities/model/param'; import { Param } from '../entities/model/param';
import { StatusToString } from '../pipes/various/status-to-string'; import { StatusToString } from '../pipes/various/status-to-string';
import { ConfirmationComponent } from '../widgets/confirmation/confirmation.component';
declare var $: any; declare var $: any;
@ -217,7 +218,17 @@ export class DatasetsComponent implements OnInit {
this.ngZone.run(() => this.router.navigate(['dynamic-form', {id: item.profile.id, datasetId:item.id}])); this.ngZone.run(() => this.router.navigate(['dynamic-form', {id: item.profile.id, datasetId:item.id}]));
} }
deleteRow(dataset, $event){ markDatasetForDelete(dataset){
this.dataset = dataset;
}
deleteDataset(confirmation){
if(confirmation==true)
this.deleteRow(this.dataset);
}
deleteRow(dataset){
this.serverService.deleteDataset(dataset).subscribe( this.serverService.deleteDataset(dataset).subscribe(
response => { response => {
simple_notifier("success",null,"Deleted dataset"); simple_notifier("success",null,"Deleted dataset");

View File

@ -62,7 +62,7 @@
<td>{{dataset?.created | date:'yyyy-MM-dd HH:mm:ss Z'}}</td> <td>{{dataset?.created | date:'yyyy-MM-dd HH:mm:ss Z'}}</td>
<td>{{dataset?.status | statusToString }}</td> <td>{{dataset?.status | statusToString }}</td>
<td><a class="editGridColumn" (click)="editRow(dataset, $event)"><i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit Properties" id="editDataset"></i> <td><a class="editGridColumn" (click)="editRow(dataset, $event)"><i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit Properties" id="editDataset"></i>
<i class="fa fa-eraser fa-fw" data-toggle="tooltip" (click)="deleteRow(dataset, $event)" title="delete Dataset"></i> <i class="fa fa-eraser fa-fw" data-toggle="modal" data-target="#delete-dataset-confirm" (click)="markDatasetForDelete(dataset)" title="delete Dataset"></i>
<i class="fa fa-list-alt fa-fw" data-toggle="tooltip" title="describe dataset" id="describeDataset"></i></a></td> <i class="fa fa-list-alt fa-fw" data-toggle="tooltip" title="describe dataset" id="describeDataset"></i></a></td>
</tr> </tr>
@ -136,4 +136,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- Confirmation module- do not delete -->
<confirmation [confirmationID]="'delete-dataset-confirm'" [confirmationTitle]="'Caution'" [confirmationDescr]="'This action will delete this dataset. Are you sure you want to delete this dataset ? This is not revertable !'" (responseSender)="deleteDataset($event)"></confirmation>

View File

@ -5,6 +5,7 @@ import { ServerService } from '../../app/services/server.service';
import { Dmp } from '../entities/model/dmp'; import { Dmp } from '../entities/model/dmp';
import { Dataset } from '../entities/model/dataset'; import { Dataset } from '../entities/model/dataset';
import { Project } from '../entities/model/project'; import { Project } from '../entities/model/project';
import { ConfirmationComponent } from '../widgets/confirmation/confirmation.component';
import {DataTable} from 'angular2-datatable'; import {DataTable} from 'angular2-datatable';
import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown'; import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown';
@ -53,13 +54,13 @@ export class DmpComponent implements OnInit{
showIDs : boolean = false; showIDs : boolean = false;
// END ALTERNATIVE // END ALTERNATIVE
dmp:any; dmp:any;
@Input() dmpTableVisible: boolean; @Input() dmpTableVisible: boolean;
@Input() dmpCount = 0; @Input() dmpCount = 0;
@Input() projectsDropDown:DropdownField; @Input() projectsDropDown:DropdownField;
@Input() dataSetVisibe:boolean; @Input() dataSetVisibe:boolean;
@Input() statusDropDown: DropdownField; @Input() statusDropDown: DropdownField;
@Input() isSelected:boolean;
//@Input() projects: Project[]; //@Input() projects: Project[];
dmpIdforDatasets: string; dmpIdforDatasets: string;
dmpLabelforDatasets:string; dmpLabelforDatasets:string;
@ -74,10 +75,11 @@ export class DmpComponent implements OnInit{
this.projectsDropDown = new DropdownField(); this.projectsDropDown = new DropdownField();
this.projectsDropDown.options = []; this.projectsDropDown.options = [];
this.statusDropDown = new DropdownField(); this.statusDropDown = new DropdownField();
this.statusDropDown.options= [{key:'0', value:"Active"},{key:'1', value:"Inactive"}] this.statusDropDown.options= [{key:'', value:null},{key:'0', value:"Active"},{key:'1', value:"Inactive"}]
//this.projects = []; //this.projects = [];
this.dmpTableVisible = false; this.dmpTableVisible = false;
this.dataSetVisibe = false; this.dataSetVisibe = false;
this.isSelected=false;
this.dmp = { this.dmp = {
id: null, id: null,
@ -165,7 +167,7 @@ updateDMP(){
} }
cloneDMP(dmp){ cloneDMP(dmp){
dmp = {"id": dmp.id}; dmp = {"id": dmp.id, "label": dmp.label};
this.serverService.cloneDmp(dmp).subscribe( this.serverService.cloneDmp(dmp).subscribe(
response => { response => {
simple_notifier("success",null,"Successfully cloned the DMP"); simple_notifier("success",null,"Successfully cloned the DMP");
@ -196,6 +198,7 @@ selectDmp(item){
} }
editRow(item, event){ editRow(item, event){
this.isSelected = true;
if (event.toElement.id == "editDMP"){ if (event.toElement.id == "editDMP"){
this.dmp.label = item.label; this.dmp.label = item.label;
this.dmp.previous = item.previous; this.dmp.previous = item.previous;
@ -241,7 +244,16 @@ newDmp(item){
$("#newDmpModal").modal("show"); $("#newDmpModal").modal("show");
} }
deleteRow(dmp, $event){ markDMPForDelete(dmp){
this.dmp = dmp;
}
deleteDMP(confirmation){
if(confirmation==true)
this.deleteRow(this.dmp);
}
deleteRow(dmp){
this.serverService.deleteDmp(dmp).subscribe( this.serverService.deleteDmp(dmp).subscribe(
response => { response => {
@ -255,7 +267,13 @@ deleteRow(dmp, $event){
} }
clickFilters(element){
console.log(element);
if(element.textContent == "More filters")
element.textContent = "Less Filters";
else
element.textContent = "More Filters";
}
} }

View File

@ -1,11 +1,9 @@
<meta name="google-signin-client_id" content="524432312250-vhgidft856v8qftsc81kls4c74v87d8o.apps.googleusercontent.com"> <meta name="google-signin-client_id" content="524432312250-vhgidft856v8qftsc81kls4c74v87d8o.apps.googleusercontent.com">
<!-- <div [ngClass]="{true:'visible', false:'invisible'}[editorVisible]"> --> <table class="table table-striped customTable" [mfData]="tableData | dmpTableFilter : filterQuery | dmpVersionFilter : versionFilter |dmpstatusFilter: statusFilter"
<table class="table table-striped customTable" [mfData]="tableData | dmpTableFilter : filterQuery | dmpVersionFilter : versionFilter"
#mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder"> #mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
<thead> <thead>
<tr class = "rowFilter"> <tr class="rowFilter">
<th colspan="1"> <th colspan="1">
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Search in Labels' /> <input class="form-control" [(ngModel)]="filterQuery" placeholder='Search in Labels' />
</th> </th>
@ -15,15 +13,18 @@
</button> </button>
</th> </th>
<th class = "rowFilterTopBorder" colspan="3"> <th class="rowFilterTopBorder" colspan="3">
<button type="button" class="btn btn-info btnMoreFilters" data-toggle="collapse" data-target="#demo">More filters</button> <button type="button" class="btn btn-info btnMoreFilters" data-toggle="collapse" data-target="#demo" (click)="clickFilters($event.target)">More filters</button>
<div id="demo" class="collapse"> <div id="demo" class="collapse">
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Search in Labels' /> <input style="margin-top: 5px;" class="form-control" type="number" [(ngModel)]="versionFilter" placeholder='Version' />
<input class="form-control" type="number" [(ngModel)]="versionFilter" placeholder='Version'/> <select style="margin-top: 5px;" class="form-control" [id]="statusid" [(ngModel)]="statusFilter" [name]="statusDropDown"
#datasetfield>
<option *ngFor="let opt of statusDropDown.options" [value]="opt.key">{{opt.value}}</option>
</select>
</div> </div>
</th> </th>
</tr> </tr>
<tr> <tr>
<th [ngClass]="{true:'visible', false:'invisible'}[showIDs]"> <th [ngClass]="{true:'visible', false:'invisible'}[showIDs]">
<mfDefaultSorter by="id">ID</mfDefaultSorter> <mfDefaultSorter by="id">ID</mfDefaultSorter>
@ -71,7 +72,7 @@
<td>{{dmp?.status | statusToString }}</td> <td>{{dmp?.status | statusToString }}</td>
<td><a class="editGridColumn" (click)="editRow(dmp, $event)"><i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit properties" id="editDMP"></i> <td><a class="editGridColumn" (click)="editRow(dmp, $event)"><i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit properties" id="editDMP"></i>
<i class="fa fa-clone fa-fw" data-toggle="tooltip" title="create new version" id="changeVersionDMP"></i> <i class="fa fa-clone fa-fw" data-toggle="tooltip" title="create new version" id="changeVersionDMP"></i>
<i class="fa fa-eraser fa-fw" data-toggle="tooltip" (click)="deleteRow(dmp, $event)" title="delete DMP"></i> <i class="fa fa-eraser fa-fw" data-toggle="modal" data-target="#delete-dmp-confirm" (click)="markDMPForDelete(dmp)" title="delete DMP"></i>
<i class="fa fa-table fa-fw" data-toggle="tooltip" title="show dataset for this DMP" id="showDatasets"></i></a></td> <i class="fa fa-table fa-fw" data-toggle="tooltip" title="show dataset for this DMP" id="showDatasets"></i></a></td>
</tr> </tr>
</tbody> </tbody>
@ -162,36 +163,43 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form #newProjectForm="ngForm" (ngSubmit)="SaveNewDmp()"> <form #newProjectForm="ngForm" (ngSubmit)="SaveNewDmp()">
<div class="form-group" hidden>
<div class="form-group"> <div class="form-group">
<label for="label-name" class="form-control-label">Label:</label> <label for="label-name" class="form-control-label">Label:</label>
<input type="text" class="form-control" id="label-name" [(ngModel)]="dmp.label" name="label"> <input type="text" class="form-control" id="label-name" [(ngModel)]="dmp.label" name="label">
</div> </div>
<label for="recipient-name" class="col-form-label">Project:</label> <div class="form-group" hidden>
<select class="form-control" [id]="projectsDropDownKey" [(ngModel)]="dmp.project" [name]="projectsDropDown" #datasetfield> <label for="recipient-name" class="col-form-label">Project:</label>
<option *ngFor="let opt of projectsDropDown.options" [value]="opt.key">{{opt.value}}</option> <select class="form-control" [id]="projectsDropDownKey" [(ngModel)]="dmp.project" [name]="projectsDropDown" #datasetfield>
</select> <option *ngFor="let opt of projectsDropDown.options" [value]="opt.key">{{opt.value}}</option>
</div> </select>
<div class="form-group" hidden> </div>
<label for="label-name" class="form-control-label">Previous:</label>
<input type="text" class="form-control" id="label-previous" [(ngModel)]="dmp.previous" name="previous">
</div> <div class="form-group" hidden>
<div class="form-group"> <label for="label-name" class="form-control-label">Previous:</label>
<label for="abbreviation-text" class="form-control-label">Version:</label> <input type="text" class="form-control" id="label-previous" [(ngModel)]="dmp.previous" name="previous">
<input class="form-control" id="abbreviation-text" [(ngModel)]="dmp.version" name="version"> </div>
</div> <div class="form-group" hidden>
<label for="abbreviation-text" class="form-control-label">Version:</label>
<input class="form-control" id="abbreviation-text" [(ngModel)]="dmp.version" name="version">
</div>
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" (click)="cloneDMP(dmp);">Save Dmp</button> <button type="submit" class="btn btn-primary" (click)="cloneDMP(dmp);">Save Dmp</button>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
<!--Modal for DMPs--> <!--Modal for DMPs-->
<!-- <modal *ngIf="item && show" [(show)]="show" [item]="item" [(dataSetVisibe)]="dataSetVisibe"></modal> --> <!-- <modal *ngIf="item && show" [(show)]="show" [item]="item" [(dataSetVisibe)]="dataSetVisibe"></modal> -->
<!--DATASET TABLE--> <!--DATASET TABLE-->
<datasets-table *ngIf="dataSetVisibe" [dmpIdforDatasets]="dmpIdforDatasets" [dmpLabelforDatasets]="dmpLabelforDatasets" [(dataSetVisibe)]="dataSetVisibe"></datasets-table> <datasets-table *ngIf="dataSetVisibe" [dmpIdforDatasets]="dmpIdforDatasets" [dmpLabelforDatasets]="dmpLabelforDatasets" [(dataSetVisibe)]="dataSetVisibe"></datasets-table>
<!-- Confirmation module- do not delete -->
<confirmation [confirmationID]="'delete-dmp-confirm'" [confirmationTitle]="'Caution'" [confirmationDescr]="'This action will delete this DMP. Are you sure you want to delete this DMP ? This is not revertable !'"
(responseSender)="deleteDMP($event)"></confirmation>

View File

@ -29,7 +29,7 @@
<div> <div>
<button type="submit" class="btn btn-default btncustom" [disabled]="!form.valid">Save</button> <button type="submit" class="btn btn-default btncustom" [disabled]="!form.valid">Save</button>
<button type="submit" class="btn btn-default btncustom" [disabled]="!form.valid">Finalize</button> <button type="button" class="btn btn-default btncustom" [disabled]="!form.valid" data-toggle="modal" data-target="#confirmModal">Finalize</button>
</div> </div>
<div *ngIf="payLoad" class="form-row"> <div *ngIf="payLoad" class="form-row">
@ -102,3 +102,23 @@
<a href="#" (click)="signOut2();">Sign out</a> <a href="#" (click)="signOut2();">Sign out</a>
</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">&times;</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>

View File

@ -12,17 +12,18 @@ import { DataModel } from '../entities/DataModel';
import { GroupBase } from './dynamic-form-group/group-base'; import { GroupBase } from './dynamic-form-group/group-base';
import { PaginationService } from '../../app/services/pagination.service'; import { PaginationService } from '../../app/services/pagination.service';
import { TokenService, TokenProvider } from '../services/login/token.service'; import { TokenService, TokenProvider } from '../services/login/token.service';
import { ModalComponent } from '../modal/modal.component';
import { AngularDraggableModule } from 'angular2-draggable'; import { AngularDraggableModule } from 'angular2-draggable';
import './../../assets/xml2json.min.js'; import './../../assets/xml2json.min.js';
declare var X2JS: any; declare var X2JS: any;
var flatten = require('flat'); var flatten = require('flat');
declare var $ :any;
import * as $ from '../../../node_modules/jquery/dist/jquery' //import * as $ from '../../../node_modules/jquery/dist/jquery'
import * as scroll from '../../assets/jquery.scrollTo.min.js'; import * as scroll from '../../assets/jquery.scrollTo.min.js';
@ -220,9 +221,7 @@ export class DynamicFormComponent implements OnInit {
} catch (e) { } } catch (e) { }
} }
onSubmit() { submitForm(){
this.serverService.getDatasetByID(this.datasetId).subscribe( this.serverService.getDatasetByID(this.datasetId).subscribe(
(data) => { (data) => {
@ -231,8 +230,8 @@ export class DynamicFormComponent implements OnInit {
data.properties = JSON.stringify(this.form.value); data.properties = JSON.stringify(this.form.value);
this.serverService.setDataset(data).subscribe((data) => { this.serverService.setDataset(data).subscribe((data) => {
console.log("Updated dataset"); console.log("Updated dataset");
this.router.navigate(['/workspace'], { queryParams: { /*returnUrl: this.state.url*/ }});
//VALE EDW NA SE PIGAINEI PISW KAI NA SOU VGAZEI ENA MHNYMA SUCCESS... (to success tha to valw egw an thes) //VALE EDW NA SE PIGAINEI PISW KAI NA SOU VGAZEI ENA MHNYMA SUCCESS... (to success tha to valw egw an thes)
}, },
@ -243,11 +242,19 @@ export class DynamicFormComponent implements OnInit {
(err) => { (err) => {
}); });
}
onSubmit() {
this.submitForm();
this.payLoad = JSON.stringify(this.form.value); this.payLoad = JSON.stringify(this.form.value);
} }
SaveFinalize(){
$("#confirmModal").modal("hide");
this.submitForm();
}
shouldIShow(element) { //pagination , pages are declared in xml for every groupfield shouldIShow(element) { //pagination , pages are declared in xml for every groupfield
if (this.pagination.currentPage == element.page){ if (this.pagination.currentPage == element.page){

View File

@ -1,10 +1,10 @@
import { Component, OnInit, ElementRef, AfterViewInit, VERSION } from '@angular/core'; import { Component, OnInit, ElementRef, AfterViewInit, VERSION, Injectable } from '@angular/core';
import { TokenService, TokenProvider } from '../../services/login/token.service'; import { TokenService, TokenProvider } from '../../services/login/token.service';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
declare const gapi: any; declare const gapi: any;
var $ = require("jquery"); declare var $ :any;
import '../../../assets/custom.js'; import '../../../assets/custom.js';
declare function simple_notifier(type: string, title: string, message:string): any; declare function simple_notifier(type: string, title: string, message:string): any;
@ -14,17 +14,35 @@ declare function simple_notifier(type: string, title: string, message:string): a
templateUrl: './googgle-sign-in.component.html', templateUrl: './googgle-sign-in.component.html',
styleUrls: ['./googgle-sign-in.component.css'] styleUrls: ['./googgle-sign-in.component.css']
}) })
export class GooggleSignInComponent implements OnInit, AfterViewInit { export class GooggleSignInComponent implements OnInit, AfterViewInit, Injectable {
//token:any;
constructor(private element: ElementRef, private tokenService : TokenService, private router : Router) { constructor(private element: ElementRef, private tokenService : TokenService, private router : Router) {
} }
ngOnInit() { ngOnInit() {
//this.googleInit();
} }
ngAfterViewInit() {
/*
$( window ).on( "load", function(){
if($("#googleBtn").length == 0) {
alert("GoogleButton found");
}
});
*/
this.googleInit();
}
private clientId:string = '1010962018903-glegmqudqtl1lub0150vacopbu06lgsg.apps.googleusercontent.com'; private clientId:string = '1010962018903-glegmqudqtl1lub0150vacopbu06lgsg.apps.googleusercontent.com';
private scope = [ private scope = [
@ -68,9 +86,7 @@ export class GooggleSignInComponent implements OnInit, AfterViewInit {
ngAfterViewInit() {
this.googleInit();
}
} }

View File

@ -0,0 +1,23 @@
import * as _ from "lodash";
import { Pipe, PipeTransform } from "@angular/core";
@Pipe({
name: "dmpstatusFilter"
})
export class DmpStatusFilterPipe implements PipeTransform {
transform(array: any[], status: number): any {
if (status) {
return _.filter(array, row => {
return (
row.status == status
)
});
}
return array;
}
}

View File

@ -80,11 +80,10 @@
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form #newProjectForm="ngForm" (ngSubmit)="SaveProject()"> <form #newProjectForm="ngForm" (ngSubmit)="SaveProject()" novalidate>
<div class="form-group">
<label for="label-name" class="form-control-label">Label:</label> <label for="label-name" class="form-control-label">Label:</label>
<input type="text" class="form-control" id="label-name" [(ngModel)]= "project.label" name = "label"> <input type="text" class="form-control" id="label-name" [(ngModel)]= "project.label" name = "label" required>
</div>
<div class="form-group"> <div class="form-group">
<label for="abbreviation-text" class="form-control-label">Abbreviation:</label> <label for="abbreviation-text" class="form-control-label">Abbreviation:</label>
<input class="form-control" id="abbreviation-text" [(ngModel)]= "project.abbreviation" name = "abbreviation"> <input class="form-control" id="abbreviation-text" [(ngModel)]= "project.abbreviation" name = "abbreviation">
@ -99,11 +98,11 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="start-date" class="form-control-label">Start Date:</label> <label for="start-date" class="form-control-label">Start Date:</label>
<input class="form-control" type='date' class="form-control" [(ngModel)]= "project.startdate" id='start-date' name = "startdate"/> <input class="form-control" type='date' class="form-control" [(ngModel)]= "project.startdate" id='start-date' name = "startdate" required/>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="end-date" class="form-control-label">End Date:</label> <label for="end-date" class="form-control-label">End Date:</label>
<input class="form-control" type='date' class="form-control" [(ngModel)]= "project.enddate" id='end-date' name = "enddate"/> <input class="form-control" type='date' class="form-control" [(ngModel)]= "project.enddate" id='end-date' name = "enddate" required/>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="status-name" class="col-form-label">Status:</label> <label for="status-name" class="col-form-label">Status:</label>
@ -119,7 +118,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" (click)="SaveProject();">Save project</button> <button type="submit" class="btn btn-primary" [disabled]="!newProjectForm.form.valid" (click)="SaveProject();">Save project</button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -16,6 +16,7 @@ import { FormGroup, FormControl } from '@angular/forms'; //na dw
import { NgForm } from '@angular/forms'; import { NgForm } from '@angular/forms';
import { DatepickerOptions } from 'ng2-datepicker'; import { DatepickerOptions } from 'ng2-datepicker';
import { StatusToString} from '../pipes/various/status-to-string'; import { StatusToString} from '../pipes/various/status-to-string';
import { ConfirmationComponent } from '../widgets/confirmation/confirmation.component';
import { ProjectTableFilterPipe } from '../pipes/project-table-filter.pipe'; import { ProjectTableFilterPipe } from '../pipes/project-table-filter.pipe';
@ -182,22 +183,27 @@ SaveProject(){
$("#newEditProjectModal").modal("hide"); $("#newEditProjectModal").modal("hide");
} }
newProject(item){ newProject(item){
this.project = this.getEmptyProject(); this.project = this.getEmptyProject();
$("#newEditProjectModal").modal("show");
}
editRow(item, event){
this.project = item; //this will have id - that defines whether it's an update or not
$("#newEditProjectModal").modal("show"); $("#newEditProjectModal").modal("show");
}
editRow(item, event){
this.project = item; //this will have id - that defines whether it's an update or not
$("#newEditProjectModal").modal("show");
} }
/*
markProjectForDelete(project){
this.project = project;
}
deleteProject(confirmation){
if(confirmation==true)
this.deleteRow(this.project);
}
*/
} }

View File

@ -0,0 +1,20 @@
import { Injectable, Inject} from '@angular/core';
import { Observable } from 'rxjs';
import {LocalStorageService} from 'ngx-webstorage';
import 'rxjs/add/operator/map';
import { DOCUMENT } from '@angular/platform-browser';
@Injectable()
export class GlobalVariables {
constructor (private storage : LocalStorageService, @Inject(DOCUMENT) private document) {
}
}

View File

@ -0,0 +1,11 @@
.modal-header {
padding:9px 15px;
border-bottom:1px solid #eee;
background-color: #0480be;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}

View File

@ -0,0 +1,21 @@
<!-- Modal -->
<div class="modal fade" id="{{confirmationID}}" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">{{confirmationTitle}}</h4>
</div>
<div class="modal-body">
<p>{{confirmationDescr}}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-success" data-dismiss="modal" (click)=saidYes()>Yes</button>
<button type="button" class="btn btn-default btn-danger" data-dismiss="modal" (click)=saidNo()>NO</button>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ConfirmationComponent } from './confirmation.component';
describe('ConfirmationComponent', () => {
let component: ConfirmationComponent;
let fixture: ComponentFixture<ConfirmationComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ConfirmationComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ConfirmationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,35 @@
import { Component, OnInit, Input,Output,EventEmitter } from '@angular/core';
@Component({
selector: 'confirmation',
templateUrl: './confirmation.component.html',
styleUrls: ['./confirmation.component.css']
})
export class ConfirmationComponent implements OnInit {
@Input() confirmationID : string;
@Input() confirmationTitle : string;
@Input() confirmationDescr : string;
@Input() subjectObj : any;
@Output() responseSender: EventEmitter<any> = new EventEmitter<any>();
constructor() {
}
ngOnInit() {
}
saidNo(){
this.responseSender.emit(false);
}
saidYes(){
this.responseSender.emit(true);
}
}