diff --git a/dmp-frontend/.angular-cli.json b/dmp-frontend/.angular-cli.json index 4991a0caf..f71ddd6e0 100644 --- a/dmp-frontend/.angular-cli.json +++ b/dmp-frontend/.angular-cli.json @@ -24,8 +24,7 @@ ], "scripts": [ "./../node_modules/bootstrap/dist/js/bootstrap.min.js", - "./assets/xml2json.min.js", - "./assets/jquery.scrollTo.min.js" + "./assets/xml2json.min.js" ], "environmentSource": "environments/environment.ts", "environments": { diff --git a/dmp-frontend/dmp-frontend-1-nov-2017.tar.gz b/dmp-frontend/dmp-frontend-1-nov-2017.tar.gz deleted file mode 100644 index 11a14df3f..000000000 Binary files a/dmp-frontend/dmp-frontend-1-nov-2017.tar.gz and /dev/null differ diff --git a/dmp-frontend/src/app/app-routing.module.ts b/dmp-frontend/src/app/app-routing.module.ts index c261cbe4e..884023531 100644 --- a/dmp-frontend/src/app/app-routing.module.ts +++ b/dmp-frontend/src/app/app-routing.module.ts @@ -33,7 +33,10 @@ const appRoutes: Routes = [ imports: [ RouterModule.forRoot( appRoutes - // { enableTracing: true } // <-- debugging purposes only + ,{ + useHash: true + //,enableTracing: true <-- debugging purposes only + } ) ], exports: [ diff --git a/dmp-frontend/src/app/app.component.css b/dmp-frontend/src/app/app.component.css index 0955e30ae..7c310ecd1 100644 --- a/dmp-frontend/src/app/app.component.css +++ b/dmp-frontend/src/app/app.component.css @@ -81,19 +81,25 @@ padding-bottom: 500px; */ + + z-index: 1; overflow-x: hidden; height: 100%; width: 0px; top: 0px; left: 0px; - background-color: #111; + background-color: #f8f8f8; transition: 0.5s; padding-top: 60px; } .sidenav.expanded{ width: 15%; + + border-style: solid; + border-width: thin; + } #appBody { @@ -116,7 +122,7 @@ } .sidenav a:hover { - color: #f1f1f1; + color: #000; } .sidenav .closebtn { diff --git a/dmp-frontend/src/app/app.component.html b/dmp-frontend/src/app/app.component.html index 10d34c8ea..fa83f61da 100644 --- a/dmp-frontend/src/app/app.component.html +++ b/dmp-frontend/src/app/app.component.html @@ -46,8 +46,12 @@ My Workspace Orphan Datasets - Clients - Contact + ... + Basically + George + tell us + what to + put here
@@ -59,7 +63,8 @@ - +
diff --git a/dmp-frontend/src/app/app.module.ts b/dmp-frontend/src/app/app.module.ts index e9768810f..726c68d97 100644 --- a/dmp-frontend/src/app/app.module.ts +++ b/dmp-frontend/src/app/app.module.ts @@ -14,6 +14,7 @@ import { RestBase } from './services/rest-base'; import { DynamicFormComponent } from './form/dynamic-form.component'; import { DynamicFormFieldComponent } from './form/fields/dynamic-form-field.component'; import { ServerService } from './services/server.service'; +import { GlobalVariables } from './services/global-variables.service'; import { TokenService, TokenProvider } from './services/login/token.service'; import { LocalStorageService } from 'ngx-webstorage'; import { dataModelBuilder } from './services/dataModelBuilder.service'; @@ -23,6 +24,8 @@ import { AuthGuard } from './guards/auth.guard'; import { PageNotFoundComponent } from './not-found.component'; import { EmptyComponent } from './empty.component'; import { TocComponent } from './form/tableOfContents/toc.component'; +import { ConfirmationComponent } from './widgets/confirmation/confirmation.component'; + import { PaginationService } from './services/pagination.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 { DmpTableFilterPipe } from './pipes/dmp-table-filter.pipe'; +import { DmpStatusFilterPipe } from './pipes/dmp-status-filter.pipe'; import { DmpVersionFilterPipe } from './pipes/dmp-version-filter.pipe'; import { DmpRoutingModule } from './dmps/dmp-routing.module'; @@ -85,9 +89,11 @@ import { UserWorkspaceComponent } from './user-workspace/user-workspace.componen DmpComponent, DatasetsComponent, UserWorkspaceComponent, + ConfirmationComponent, ProjectTableFilterPipe, DmpVersionFilterPipe, + DmpStatusFilterPipe, DmpTableFilterPipe, DatasetTableFilterPipe, DatasetStatusFilterPipe, @@ -116,7 +122,7 @@ import { UserWorkspaceComponent } from './user-workspace/user-workspace.componen useClass: GlobalInterceptor, multi: true, }, - ServerService, dataModelBuilder, AuthGuard, PaginationService, TokenService, LocalStorageService, RestBase, EestoreService,NativeLoginService + ServerService, dataModelBuilder, GlobalVariables, AuthGuard, PaginationService, TokenService, LocalStorageService, RestBase, EestoreService,NativeLoginService ], bootstrap: [AppComponent] }) diff --git a/dmp-frontend/src/app/datasets/dataset.component.ts b/dmp-frontend/src/app/datasets/dataset.component.ts index d3da0f538..cdacd04a2 100644 --- a/dmp-frontend/src/app/datasets/dataset.component.ts +++ b/dmp-frontend/src/app/datasets/dataset.component.ts @@ -9,6 +9,7 @@ import {DataTable} from 'angular2-datatable'; import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown'; import { Param } from '../entities/model/param'; import { StatusToString } from '../pipes/various/status-to-string'; +import { ConfirmationComponent } from '../widgets/confirmation/confirmation.component'; 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}])); } - deleteRow(dataset, $event){ + markDatasetForDelete(dataset){ + this.dataset = dataset; + } + + deleteDataset(confirmation){ + if(confirmation==true) + this.deleteRow(this.dataset); + } + + + deleteRow(dataset){ this.serverService.deleteDataset(dataset).subscribe( response => { simple_notifier("success",null,"Deleted dataset"); diff --git a/dmp-frontend/src/app/datasets/dataset.html b/dmp-frontend/src/app/datasets/dataset.html index a4621f0b9..81d97fcfb 100644 --- a/dmp-frontend/src/app/datasets/dataset.html +++ b/dmp-frontend/src/app/datasets/dataset.html @@ -62,7 +62,7 @@ {{dataset?.created | date:'yyyy-MM-dd HH:mm:ss Z'}} {{dataset?.status | statusToString }} - + @@ -136,4 +136,7 @@ - \ No newline at end of file + + + + diff --git a/dmp-frontend/src/app/dmps/dmp.component.ts b/dmp-frontend/src/app/dmps/dmp.component.ts index 8940766c1..2886ddf43 100644 --- a/dmp-frontend/src/app/dmps/dmp.component.ts +++ b/dmp-frontend/src/app/dmps/dmp.component.ts @@ -5,6 +5,7 @@ import { ServerService } from '../../app/services/server.service'; import { Dmp } from '../entities/model/dmp'; import { Dataset } from '../entities/model/dataset'; import { Project } from '../entities/model/project'; +import { ConfirmationComponent } from '../widgets/confirmation/confirmation.component'; import {DataTable} from 'angular2-datatable'; import { DropdownField } from '../../app/form/fields/dropdown/field-dropdown'; @@ -53,13 +54,13 @@ export class DmpComponent implements OnInit{ showIDs : boolean = false; // END ALTERNATIVE - dmp:any; @Input() dmpTableVisible: boolean; @Input() dmpCount = 0; @Input() projectsDropDown:DropdownField; @Input() dataSetVisibe:boolean; @Input() statusDropDown: DropdownField; + @Input() isSelected:boolean; //@Input() projects: Project[]; dmpIdforDatasets: string; dmpLabelforDatasets:string; @@ -74,10 +75,11 @@ export class DmpComponent implements OnInit{ this.projectsDropDown = new DropdownField(); this.projectsDropDown.options = []; 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.dmpTableVisible = false; this.dataSetVisibe = false; + this.isSelected=false; this.dmp = { id: null, @@ -165,7 +167,7 @@ updateDMP(){ } cloneDMP(dmp){ - dmp = {"id": dmp.id}; + dmp = {"id": dmp.id, "label": dmp.label}; this.serverService.cloneDmp(dmp).subscribe( response => { simple_notifier("success",null,"Successfully cloned the DMP"); @@ -196,6 +198,7 @@ selectDmp(item){ } editRow(item, event){ + this.isSelected = true; if (event.toElement.id == "editDMP"){ this.dmp.label = item.label; this.dmp.previous = item.previous; @@ -241,7 +244,16 @@ newDmp(item){ $("#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( 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"; +} } diff --git a/dmp-frontend/src/app/dmps/dmps.html b/dmp-frontend/src/app/dmps/dmps.html index e20ac5b5e..75ef807d6 100644 --- a/dmp-frontend/src/app/dmps/dmps.html +++ b/dmp-frontend/src/app/dmps/dmps.html @@ -1,11 +1,9 @@ - - - - + @@ -15,15 +13,18 @@ - - + @@ -162,36 +163,43 @@ - + - - - + + - - + + + + + + \ No newline at end of file diff --git a/dmp-frontend/src/app/form/dynamic-form.component.html b/dmp-frontend/src/app/form/dynamic-form.component.html index eaacc15b0..69c1a97e0 100644 --- a/dmp-frontend/src/app/form/dynamic-form.component.html +++ b/dmp-frontend/src/app/form/dynamic-form.component.html @@ -29,7 +29,7 @@
- +
@@ -102,3 +102,23 @@ Sign out
+ + diff --git a/dmp-frontend/src/app/form/dynamic-form.component.ts b/dmp-frontend/src/app/form/dynamic-form.component.ts index c78b31b1c..5a4d9be40 100644 --- a/dmp-frontend/src/app/form/dynamic-form.component.ts +++ b/dmp-frontend/src/app/form/dynamic-form.component.ts @@ -12,17 +12,18 @@ import { DataModel } from '../entities/DataModel'; import { GroupBase } from './dynamic-form-group/group-base'; import { PaginationService } from '../../app/services/pagination.service'; import { TokenService, TokenProvider } from '../services/login/token.service'; +import { ModalComponent } from '../modal/modal.component'; import { AngularDraggableModule } from 'angular2-draggable'; import './../../assets/xml2json.min.js'; declare var X2JS: any; - 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'; @@ -220,9 +221,7 @@ export class DynamicFormComponent implements OnInit { } catch (e) { } } - onSubmit() { - - + submitForm(){ this.serverService.getDatasetByID(this.datasetId).subscribe( (data) => { @@ -231,8 +230,8 @@ export class DynamicFormComponent implements OnInit { data.properties = JSON.stringify(this.form.value); 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) }, @@ -243,11 +242,19 @@ export class DynamicFormComponent implements OnInit { (err) => { }); + } + onSubmit() { + this.submitForm(); this.payLoad = JSON.stringify(this.form.value); } + SaveFinalize(){ + $("#confirmModal").modal("hide"); + this.submitForm(); + } + shouldIShow(element) { //pagination , pages are declared in xml for every groupfield if (this.pagination.currentPage == element.page){ diff --git a/dmp-frontend/src/app/login/googgle-sign-in/googgle-sign-in.component.ts b/dmp-frontend/src/app/login/googgle-sign-in/googgle-sign-in.component.ts index 8bae92618..5914af6b2 100644 --- a/dmp-frontend/src/app/login/googgle-sign-in/googgle-sign-in.component.ts +++ b/dmp-frontend/src/app/login/googgle-sign-in/googgle-sign-in.component.ts @@ -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 {Router} from '@angular/router'; declare const gapi: any; -var $ = require("jquery"); +declare var $ :any; import '../../../assets/custom.js'; 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', 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) { } 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 scope = [ @@ -68,9 +86,7 @@ export class GooggleSignInComponent implements OnInit, AfterViewInit { - ngAfterViewInit() { - this.googleInit(); - } + } diff --git a/dmp-frontend/src/app/pipes/dmp-status-filter.pipe.ts b/dmp-frontend/src/app/pipes/dmp-status-filter.pipe.ts new file mode 100644 index 000000000..bf4af0093 --- /dev/null +++ b/dmp-frontend/src/app/pipes/dmp-status-filter.pipe.ts @@ -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; + } +} \ No newline at end of file diff --git a/dmp-frontend/src/app/projects/project.html b/dmp-frontend/src/app/projects/project.html index 8873fb763..975042ffb 100644 --- a/dmp-frontend/src/app/projects/project.html +++ b/dmp-frontend/src/app/projects/project.html @@ -80,11 +80,10 @@ diff --git a/dmp-frontend/src/app/projects/projects.component.ts b/dmp-frontend/src/app/projects/projects.component.ts index 3b1c00eb2..6e96f1b0c 100644 --- a/dmp-frontend/src/app/projects/projects.component.ts +++ b/dmp-frontend/src/app/projects/projects.component.ts @@ -16,6 +16,7 @@ import { FormGroup, FormControl } from '@angular/forms'; //na dw import { NgForm } from '@angular/forms'; import { DatepickerOptions } from 'ng2-datepicker'; import { StatusToString} from '../pipes/various/status-to-string'; +import { ConfirmationComponent } from '../widgets/confirmation/confirmation.component'; import { ProjectTableFilterPipe } from '../pipes/project-table-filter.pipe'; @@ -182,22 +183,27 @@ SaveProject(){ $("#newEditProjectModal").modal("hide"); } -newProject(item){ - 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 + newProject(item){ + 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"); } + /* + markProjectForDelete(project){ + this.project = project; + } + + deleteProject(confirmation){ + if(confirmation==true) + this.deleteRow(this.project); + } + */ } diff --git a/dmp-frontend/src/app/services/global-variables.service.ts b/dmp-frontend/src/app/services/global-variables.service.ts new file mode 100644 index 000000000..f607948da --- /dev/null +++ b/dmp-frontend/src/app/services/global-variables.service.ts @@ -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) { + + } + + + + +} + + diff --git a/dmp-frontend/src/app/widgets/confirmation/confirmation.component.css b/dmp-frontend/src/app/widgets/confirmation/confirmation.component.css new file mode 100644 index 000000000..4838ba5c1 --- /dev/null +++ b/dmp-frontend/src/app/widgets/confirmation/confirmation.component.css @@ -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; + } \ No newline at end of file diff --git a/dmp-frontend/src/app/widgets/confirmation/confirmation.component.html b/dmp-frontend/src/app/widgets/confirmation/confirmation.component.html new file mode 100644 index 000000000..b15047cc2 --- /dev/null +++ b/dmp-frontend/src/app/widgets/confirmation/confirmation.component.html @@ -0,0 +1,21 @@ + + \ No newline at end of file diff --git a/dmp-frontend/src/app/widgets/confirmation/confirmation.component.spec.ts b/dmp-frontend/src/app/widgets/confirmation/confirmation.component.spec.ts new file mode 100644 index 000000000..fd4da952c --- /dev/null +++ b/dmp-frontend/src/app/widgets/confirmation/confirmation.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ConfirmationComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ConfirmationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should be created', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/dmp-frontend/src/app/widgets/confirmation/confirmation.component.ts b/dmp-frontend/src/app/widgets/confirmation/confirmation.component.ts new file mode 100644 index 000000000..2f35931d8 --- /dev/null +++ b/dmp-frontend/src/app/widgets/confirmation/confirmation.component.ts @@ -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 = new EventEmitter(); + + constructor() { + + } + + + ngOnInit() { + + } + + saidNo(){ + this.responseSender.emit(false); + } + + saidYes(){ + this.responseSender.emit(true); + } + + +}
- + +
- - + +
ID @@ -71,7 +72,7 @@ {{dmp?.status | statusToString }} - +