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

This commit is contained in:
annampak 2017-11-07 10:05:10 +02:00
commit 8874177986
30 changed files with 278 additions and 192 deletions

View File

@ -19,14 +19,14 @@
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"./../node_modules/bootstrap/dist/css/bootstrap.min.css",
"./../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css"
],
"scripts": [
"./../node_modules/jquery/dist/jquery.min.js",
"./../node_modules/bootstrap/dist/js/bootstrap.min.js",
"./assets/xml2json.min.js",
"./assets/jquery.scrollTo.min.js"
"./assets/jquery.scrollTo.min.js"
],
"environmentSource": "environments/environment.ts",
"environments": {

View File

@ -526,6 +526,12 @@
"graceful-fs": "4.1.11"
}
},
"moment": {
"version": "2.18.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.18.1.tgz",
"integrity": "sha1-w2GT3Tzhwu7SrbfIAtu8d6gbHA8=",
"dev": true
},
"ms": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz",
@ -2220,6 +2226,11 @@
}
}
},
"date-fns": {
"version": "1.29.0",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.29.0.tgz",
"integrity": "sha512-lbTXWZ6M20cWH8N9S6afb0SBm6tMk+uUg6z3MqHPKE9atmsY3kJkTm8vKe93izJ2B2+q5MV990sM2CHgtAZaOw=="
},
"date-now": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
@ -5404,10 +5415,9 @@
"dev": true
},
"moment": {
"version": "2.18.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.18.1.tgz",
"integrity": "sha1-w2GT3Tzhwu7SrbfIAtu8d6gbHA8=",
"dev": true
"version": "2.19.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.19.1.tgz",
"integrity": "sha1-VtoaLRy/AdOLfhr8McELz6GSkWc="
},
"ms": {
"version": "2.0.0",
@ -5490,6 +5500,20 @@
"resolved": "https://registry.npmjs.org/ng-sidebar/-/ng-sidebar-6.0.4.tgz",
"integrity": "sha1-QtxRdV6FPBiBs7iFg1T0yEWpbzM="
},
"ng2-datepicker": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ng2-datepicker/-/ng2-datepicker-2.1.3.tgz",
"integrity": "sha512-09Hwrf9IHsWzp/2FPSGo00P/XtiHSsHLBCeFCK1LG1nuuhNZbQ7LXLR+e+znhjPJyTkhelmODkhmy5DByYWpcA==",
"requires": {
"date-fns": "1.29.0",
"ngx-slimscroll": "3.4.1"
}
},
"ngx-slimscroll": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/ngx-slimscroll/-/ngx-slimscroll-3.4.1.tgz",
"integrity": "sha512-PMbOai2OeXCFCHnPigYXquN6fAUeAc+CC3AhHugt9wIp8xUB6lIt8OqOWS3IPRRaeKQWyxFCuDfiPKY8n2QuOQ=="
},
"ngx-webstorage": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/ngx-webstorage/-/ngx-webstorage-1.8.0.tgz",

View File

@ -31,7 +31,9 @@
"core-js": "^2.4.1",
"flat": "^4.0.0",
"jquery": "^3.2.1",
"moment": "^2.19.1",
"ng-sidebar": "^6.0.4",
"ng2-datepicker": "^2.1.3",
"ngx-webstorage": "^1.8.0",
"rxjs": "^5.4.2",
"zone.js": "^0.8.17"

View File

@ -1,27 +1,32 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { PageNotFoundComponent } from './not-found.component';
import { EmptyComponent } from './empty.component';
import { DynamicFormComponent } from './form/dynamic-form.component';
import { AuthGuard } from './guards/auth.guard';
import { ProjectsComponent } from './projects/projects.component';
import { DatasetsComponent } from './datasets/dataset.component';
import { DmpComponent } from './dmps/dmp.component';
import { AppComponent } from './app.component';
import { UserWorkspaceComponent } from './user-workspace/user-workspace.component';
import { MainSignInComponent } from './login/main-sign-in/main-sign-in.component';
const appRoutes: Routes = [
{ path: 'dynamic-form', component: DynamicFormComponent, canActivate: [AuthGuard] },
{ path: 'login', component: MainSignInComponent},
{ path: 'projects', component: ProjectsComponent},
{ path: 'dmps', component: DmpComponent},
{ path: '', redirectTo: '/login', pathMatch: 'full' },
//{ path: 'projects', component: ProjectsComponent},
//{ path: 'dmps', component: DmpComponent},
{ path: 'workspace', component: UserWorkspaceComponent},
//{ path: '', component: EmptyComponent},
//{ path: '', redirectTo: '/login', pathMatch: 'full' },
{ path: '**', component: PageNotFoundComponent },
/*
{
path: '',
redirectTo: 'app-root',
pathMatch: 'full'
}
*/
];
@NgModule({

View File

@ -44,10 +44,10 @@
<div id="appSidebar" class="sidenav child_div">
<!--<a href="javascript:void(0)" class="closebtn" (click)='slideNav()'>&times;</a>-->
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Clients</a>
<a href="#">Contact</a>
<a class="cursor">My Workspace</a>
<a class="cursor">Orphan Datasets</a>
<a class="cursor">Clients</a>
<a class="cursor">Contact</a>
</div>
<div id="appBody" class="child_div">

View File

@ -21,6 +21,7 @@ import { DynamicFormGroupComponent } from './form/dynamic-form-group/dynamic-for
import { AppRoutingModule } from './app-routing.module';
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 { PaginationService } from './services/pagination.service';
@ -57,9 +58,11 @@ import { ProjectsComponent } from './projects/projects.component';
import { ProjectRoutingModule } from './projects/project-routing.module';
import { ProjectDetailComponent } from './projects/project.detail';
import { ModalComponent } from './modal/modal.component';
import { NgDatepickerModule } from 'ng2-datepicker';
import { StatusToString } from './pipes/various/status-to-string';
import { SidebarModule } from 'ng-sidebar';
import { UserWorkspaceComponent } from './user-workspace/user-workspace.component';
@ -75,11 +78,13 @@ import { SidebarModule } from 'ng-sidebar';
GooggleSignInComponent,
MainSignInComponent,
PageNotFoundComponent,
EmptyComponent,
ModalComponent,
ProjectDetailComponent,
ProjectsComponent,
DmpComponent,
DatasetsComponent,
UserWorkspaceComponent,
ProjectTableFilterPipe,
DmpVersionFilterPipe,
@ -102,6 +107,7 @@ import { SidebarModule } from 'ng-sidebar';
AppRoutingModule,
AngularDraggableModule,
DataTableModule,
NgDatepickerModule,
SidebarModule.forRoot()
],

View File

@ -87,8 +87,7 @@ export class DatasetsComponent implements OnInit {
this.datasetProfileDropDown.options = [];
this.saveAndDescribe = false;
this.statusDropDown = new DropdownField();
this.statusDropDown.options =[];
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"}]
}
@ -115,6 +114,7 @@ export class DatasetsComponent implements OnInit {
)
}
SaveDataset(){
if(this.dataset.id ==null){
this.dataset.dmp = { "id": this.dmpIdforDatasets }
@ -130,7 +130,6 @@ export class DatasetsComponent implements OnInit {
$("#newDatasetModal").modal("hide");
}
else{
this.dataset.dmp = { "id": this.dmpIdforDatasets }
this.dataset.profile = { "id": this.dataset.profile }
@ -166,10 +165,11 @@ export class DatasetsComponent implements OnInit {
editRow(item, event) {
if (event.toElement.id == "editDataset"){
this.dataset = item;
this.dataset.label = item.label;
this.dataset.uri = item.uri;
//this.dataset.dmp = item.dmp;
this.dataset.profile = item.profile.id;
this.dataset.profile = item.profile==null ? null : item.profile.id;
this.dataset.id = item.id;
$("#newDatasetModal").modal("show");
}
@ -192,8 +192,22 @@ export class DatasetsComponent implements OnInit {
this.SaveDataset();
}
describeDataset(item) {debugger;
describeDataset(item) {
this.ngZone.run(() => this.router.navigate(['dynamic-form', {id: item.profile.id, datasetId:item.id}]));
}
deleteRow(dataset, $event){
this.serverService.deleteDataset(dataset).subscribe(
response => {
console.log("Deleted Successfully the dataset")
},
err => {
console.log("Could not delete the dataset")
}
);
this.getDatasets();
}
}

View File

@ -10,10 +10,9 @@
</th>
<th colspan="1">
<!-- <input class="form-control" [(ngModel)]="versionFilter" placeholder='Filter' /> -->
<select class="form-control" [id]="statusid" [(ngModel)]="statusFilter" [name]="statusDropDown"
#datasetfield >
<select class="form-control" [id]="statusid" [(ngModel)]="statusFilter" [name]="statusDropDown" #datasetfield >
<option *ngFor="let opt of statusDropDown.options" [value]="opt.key">{{opt.value}}</option>
</select>
</select>
</th>
<th>
<button class="btn btn-default" (click)="getDatasets()">
@ -63,7 +62,7 @@
<td>{{dataset?.created | date:'yyyy-MM-dd HH:mm:ss Z'}}</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>
<i class="fa fa-eraser fa-fw" data-toggle="tooltip" title="delete Dataset"></i>
<i class="fa fa-eraser fa-fw" data-toggle="tooltip" (click)="deleteRow(dataset, $event)" title="delete Dataset"></i>
<i class="fa fa-list-alt fa-fw" data-toggle="tooltip" title="describe dataset" id="describeDataset"></i></a></td>
</tr>
@ -84,13 +83,13 @@
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Dataset</h5>
<h5 class="modal-title" >Dataset</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form #newProjectForm="ngForm" (ngSubmit)="SaveNewDmp()">
<form #newProjectForm="ngForm" (ngSubmit)="SaveDataset()">
<div class="form-group">
<label for="recipient-name" class="col-form-label">Dataset Profile:</label>
<select class="form-control" [id]="datasetProfileDropDownKey" [(ngModel)]="dataset.profile" [name]="datasetProfileDropDown"

View File

@ -1,36 +0,0 @@
/*
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {DataTableModule} from 'angular2-datatable';
import { DatasetTableFilterPipe } from '../pipes/dataset-table-filter.pipe';
import { DatasetStatusFilterPipe } from '../pipes/dataset-status-filter.pipe';
import { DatasetsComponent } from './dataset.component';
import { DatasetRoutingModule } from './dataset-routing.module';
//import { ProjectDetailComponent } from './project.detail';
@NgModule({
imports: [
CommonModule,
FormsModule,
DatasetRoutingModule,
DataTableModule
],
declarations: [
DatasetsComponent,
StatusToString,
DatasetTableFilterPipe,
DatasetStatusFilterPipe
//ProjectDetailComponent
],
providers: [ ],
exports: [
DatasetsComponent
]
})
export class DatasetsModule {}
*/

View File

@ -216,6 +216,24 @@ newDmp(item){
$("#newDmpModal").modal("show");
}
deleteRow(dmp, $event){
console.log("delete row")
console.log(dmp);
console.log($event)
this.serverService.deleteDmp(dmp).subscribe(
response => {
console.log("Deleted Successfully the dmp")
},
(err: HttpErrorResponse) => {
console.log("Could not delete the dmp")
}
);
this.getDmps();
}
}

View File

@ -70,9 +70,8 @@
<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>
<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" title="delete DMP"></i>
<i class="fa fa-eraser fa-fw" data-toggle="tooltip" (click)="deleteRow(dmp, $event)" 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>
</tr>
</tbody>
<tfoot>
@ -124,7 +123,7 @@
</div>
<div class="form-group">
<label for="abbreviation-text" class="form-control-label">Description:</label>
<textarea class="form-control" id="abbreviation-text" [(ngModel)]="dmp.description" name="description"></textarea>
<textarea rows="3" class="form-control" id="abbreviation-text" [(ngModel)]="dmp.description" name="description"></textarea>
</div>
<!-- <div class="form-group">
<label for="reference-text" class="form-control-label">Profile Data:</label>

View File

@ -0,0 +1,6 @@
import { Component } from '@angular/core';
@Component({
template: ''
})
export class EmptyComponent {}

View File

@ -57,7 +57,7 @@ export class GooggleSignInComponent implements OnInit, AfterViewInit {
//simple_notifier("success",null,"Successful login");
let profile = googleUser.getBasicProfile();
this.tokenService.login(googleUser.getAuthResponse().id_token, TokenProvider.google, profile.getName(), profile.getEmail());
this.router.navigate(['/dmps'], { queryParams: { /*returnUrl: this.state.url*/ }});
this.router.navigate(['/workspace'], { queryParams: { /*returnUrl: this.state.url*/ }});
},
function (error) {
//simple_notifier("danger",null,"Failed to login");

View File

@ -37,6 +37,10 @@ export class MainSignInComponent implements OnInit {
ngOnInit() {
this.createProjectEditorForm();
//debugger;
if(this.tokenService.isLoggedIn()){
this.router.navigate(['workspace'], { queryParams: { /*returnUrl: this.state.url*/ }});
}
}
@ -49,7 +53,7 @@ export class MainSignInComponent implements OnInit {
simple_notifier("success",null,"Successful login");
this.tokenService.login(response['token'], TokenProvider.native, this.creds.username, response['email']);
this.router.navigate(['/dmps'], { queryParams: { /*returnUrl: this.state.url*/ }});
this.router.navigate(['/workspace'], { queryParams: { /*returnUrl: this.state.url*/ }});
},
err => {
simple_notifier("danger",null,"Failed to login");

View File

@ -6,16 +6,14 @@ import { Pipe, PipeTransform } from "@angular/core";
})
export class DatasetStatusFilterPipe implements PipeTransform {
transform(array: any[], status: string): any {
transform(array: any[], status: number): any {
if (status) {
return _.filter(array, row => {
return (
row.uri.indexOf(status) > -1 ||
//row.version == query ||
row.id.indexOf(status) > -1
row.status == status
)
});

View File

@ -16,10 +16,9 @@ export class DatasetTableFilterPipe implements PipeTransform {
if (row.id == null) row.id = "";
return (
row.label.indexOf(query) > -1 ||
//row.version == query ||
row.id.indexOf(query) > -1
row.label.indexOf(query) > -1
//|| row.version == query
//|| row.id.indexOf(query) > -1
)
});

View File

@ -1,4 +1,3 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({

View File

@ -30,10 +30,10 @@
<mfDefaultSorter by="endDate">End Date</mfDefaultSorter>
</th>
<th>
<mfDefaultSorter by="description">Description</mfDefaultSorter>
<mfDefaultSorter by="status">Status</mfDefaultSorter>
</th>
<th>
<mfDefaultSorter by="status">Status</mfDefaultSorter>
<mfDefaultSorter by="description">Definition</mfDefaultSorter>
</th>
<th>
<mfDefaultSorter>Actions </mfDefaultSorter>
@ -47,13 +47,13 @@
</tr>
<tr *ngFor="let project of mf.data" class="hover">
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{project.id}}</td>
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{project?.id}}</td>
<td>{{project?.label}}</td>
<td>{{project?.abbreviation}}</td>
<td>{{project?.startDate}}</td>
<td>{{project?.endDate}}</td>
<td>{{project?.description}}</td>
<td>{{project?.status}}</td>
<td>{{project?.startdate | date:'yyyy-MM-dd HH:mm:ss Z' }}</td>
<td>{{project?.enddate | date:'yyyy-MM-dd HH:mm:ss Z'}}</td>
<td>{{project?.status | statusToString}}</td>
<td>{{project?.definition}}</td>
<td><a class="editGridColumn" (click)="editRow(project, $event)"><i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit properties" id="editDMP"></i>
<i class="fa fa-eraser fa-fw" data-toggle="tooltip" title="delete project"></i></a></td>
@ -80,7 +80,7 @@
</button>
</div>
<div class="modal-body">
<form #newProjectForm="ngForm" (ngSubmit)="SaveNewProject()">
<form #newProjectForm="ngForm" (ngSubmit)="SaveProject()">
<div class="form-group">
<label for="label-name" class="form-control-label">Label:</label>
<input type="text" class="form-control" id="label-name" [(ngModel)]= "project.label" name = "label">
@ -99,21 +99,21 @@
</div>
<div class="form-group">
<label for="start-date" class="form-control-label">Start Date:</label>
<input class="form-control" id="startDate-date" [(ngModel)]= "project.startDate" name = "startDate">
<input class="form-control" type='date' class="form-control" [(ngModel)]= "project.startdate" id='start-date' name = "startdate"/>
</div>
<div class="form-group">
<label for="end-date" class="form-control-label">End Date:</label>
<input class="form-control" id="endDate-date" [(ngModel)]= "project.endDate" name = "endDate">
<input class="form-control" type='date' class="form-control" [(ngModel)]= "project.enddate" id='end-date' name = "enddate"/>
</div>
<div class="form-group">
<label for="code-name" class="form-control-label">Description:</label>
<input type="text" class="form-control" name="desc" id="descr" [(ngModel)]= "project.description">
<label for="code-name" class="form-control-label">Definition:</label>
<textarea rows="3" class="form-control" name="desc" id="definition" [(ngModel)]= "project.definition"> </textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" (click)="SaveNewProject();">Save project</button>
<button type="submit" class="btn btn-primary" (click)="SaveProject();">Save project</button>
</div>
</div>
</div>

View File

@ -1,33 +0,0 @@
/*
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {DataTableModule} from 'angular2-datatable';
import { ProjectTableFilterPipe } from '../pipes/project-table-filter.pipe';
import { ProjectsComponent } from './projects.component';
import { ProjectRoutingModule } from './project-routing.module';
import { ProjectDetailComponent } from './project.detail';
import { DatasetsModule } from '../datasets/dataset.module';
import { ModalComponent } from '../modal/modal.component';
@NgModule({
imports: [
CommonModule,
FormsModule,
ProjectRoutingModule,
DataTableModule,
DatasetsModule
],
declarations: [
ProjectsComponent,
ProjectDetailComponent,
ModalComponent,
ProjectTableFilterPipe
],
providers: [ ]
})
export class ProjectsModule {}
*/

View File

@ -1,4 +1,5 @@
import { Component, OnInit, Input, Output, EventEmitter, ViewChild } from '@angular/core';
import { Component, OnInit, Input, Output, EventEmitter, ViewChild } from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {GoogleSignInSuccess} from 'angular-google-signin';
import { Router, ActivatedRoute } from '@angular/router';
import { ServerService } from '../../app/services/server.service';
@ -13,12 +14,16 @@ import { ModalComponent } from '../modal/modal.component';
import { HttpErrorResponse } from '@angular/common/http';
import { FormGroup, FormControl } from '@angular/forms'; //na dw an xreiazontai
import { NgForm } from '@angular/forms';
import { DatepickerOptions } from 'ng2-datepicker';
import { StatusToString} from '../pipes/various/status-to-string';
import { ProjectTableFilterPipe } from '../pipes/project-table-filter.pipe';
declare var $ :any;
@Component({
selector: 'projects',
templateUrl: 'project.html',
@ -52,7 +57,6 @@ export class ProjectsComponent implements OnInit{
// END ALTERNATIVE
returnUrl: string;
@Input() projects: Project[];
@Input() projectCount = 0;
@Input() datasetDropDown:DropdownField;
//@Input() dataSetVisibe:boolean;
@ -66,60 +70,59 @@ export class ProjectsComponent implements OnInit{
@ViewChild(DataTable) datasetsTable;
@ViewChild('isignOutBtn') isignOutBtn;
options: DatepickerOptions = {
minYear: 1900,
maxYear: 2050,
displayFormat: 'MMM D[,] YYYY',
barTitleFormat: 'MMMM YYYY',
firstCalendarDay: 0 // 0 - Sunday, 1 - Monday
};
constructor(
private serverService: ServerService,
private route: ActivatedRoute,
private router: Router){
private router: Router) {
this.datasetDropDown = new DropdownField();
this.datasetDropDown.options = [];
this.datasets = [];
this.project = {
label: '',
abbreviation:'',
reference:'',
uri:'',
definition:'',
endDate:'',
startDate:''
}
this.project = this.getEmptyProject();
}
ngAfterViewInit() {
}
getEmptyProject(){
return {
label: '',
abbreviation:'',
reference:'',
uri:'',
definition:'',
enddate:'',
startdate:''
}
}
ngOnInit() {
this.projects = [];
this.getProjects();
}
getProjects(){
this.serverService.getProjectOfUer().subscribe(
this.serverService.getProjectsOfUser().subscribe(
response => {
this.tableData = response;
response.forEach(resp => {
let pr = new Project();
pr.id = resp.id;
pr.label = resp.label;
pr.abbreviation = resp.abbreviation;
pr.definition = resp.definition;
pr.uri = resp.uri;
this.projects.push(pr);
}
);
}
// (err: HttpErrorResponse) => {
// if (err.error instanceof Error) {
// // A client-side or network error occurred. Handle it accordingly.
// console.log('An error occurred:', err.error.message);
// } else {
// // The backend returned an unsuccessful response code.
// // The response body may contain clues as to what went wrong,
// if(err.status == 401){
// this.isignOutBtn.nativeElement.click();
// }
// console.log(`Backend returned code ${err.status}, body was: ${err.error}`);
// }
// }
console.log(this.tableData)
},
err => {
}
);
}
@ -146,45 +149,36 @@ showDatasets(){debugger; //dmpId, event
}
// editRow(item){
// this.show = true;
// this.item = item;
// }
SaveNewProject(){
console.log(this.project);
//this.http.post('http://someurl', JSON.stringify(this.project))
this.serverService.createProject(this.project)
.subscribe(
SaveProject(){
let action : Observable<any>;
if(this.project.id == null) //means it's a new one
action = this.serverService.createProject(this.project);
else
action = this.serverService.updateProject(this.project);
action.subscribe(
response =>{
console.log("response");
console.log(response);
}
);
$("#newEditProjectModal").modal("hide");
}
newProject(item){
this.project.label = "";
this.project.id = null;
this.project.abbreviation = "";
this.project.reference = "";
this.project.uri = "";
this.project.definition = "";
this.project = this.getEmptyProject();
$("#newEditProjectModal").modal("show");
}
editRow(item, event){
if (event.toElement.id == "editDMP"){
this.project.label = item.label;
this.project.abbreviation = item.abbreviation;
this.project.reference = item.reference;
this.project.uri = item.uri;
this.project.definition = item.definition;
this.project.id = item.id;
this.project = item; //this will have id - that defines whether it's an update or not
$("#newEditProjectModal").modal("show");
}

View File

@ -18,14 +18,14 @@ export class RestBase {
/*
/*
protocol: string = "http";
hostname: string ="dl010.madgik.di.uoa.gr" ;//"localhost";//"dl010.madgik.di.uoa.gr";//
port: number = 8080;//8080;//
webappname: string = "dmp-backend";//"dmp-backend-new";//
*/
*/
protocol: string = "http";
hostname: string = "dionysus.di.uoa.gr" ;

View File

@ -81,7 +81,7 @@ export class ServerService {
return this.restBase.get("dmp/listDMPLabelID");
}
public getProjectOfUer(){
public getProjectsOfUser(){
return this.restBase.get("project/getofuser");
}
@ -89,6 +89,10 @@ export class ServerService {
return this.restBase.post("project/createofuser", data);
}
public updateProject(data:any){
return this.restBase.post("project/update", data);
}
public getAllDataSet(){
return this.restBase.get("dataset/getAll");
}
@ -106,6 +110,9 @@ export class ServerService {
return this.restBase.post("dmp/update", data);
}
public deleteDmp(dmp: any){
return this.restBase.post("dmp/softdelete", dmp);
}
public getDatasetForDmp(data:any){
return this.restBase.post("dmp/getdatasets", data);
@ -127,6 +134,11 @@ public updateDatsetsProfile(data:any){
return this.restBase.post("dataset/update", data);
}
public deleteDataset(dataset: any){
return this.restBase.post("dataset/softdelete", dataset);
}
logOut() {
this.tokenService.logout();

View File

@ -0,0 +1,26 @@
<ul class="nav nav-tabs">
<li class="active">
<a href="#my-dmps" data-toggle="tab">My DMPs</a>
</li>
<li>
<a href="#all-projects" data-toggle="tab">Projects</a>
</li>
</ul>
<div class="tab-content clearfix">
<div class="tab-pane active" id="my-dmps">
<dmps></dmps>
</div>
<div class="tab-pane" id="all-projects">
<projects></projects>
</div>
<div class="tab-pane" id="3a">
<h3>We applied clearfix to the tab-content to rid of the gap between the tab and the content</h3>
</div>
<div class="tab-pane" id="4a">
<h3>We use css to change the background color of the content to be equal to the tab</h3>
</div>
</div>

View File

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

View File

@ -0,0 +1,19 @@
import { Component, OnInit } from '@angular/core';
import { DmpComponent } from '../dmps/dmp.component';
import { ProjectsComponent } from '../projects/projects.component';
@Component({
selector: 'user-workspace',
templateUrl: './user-workspace.component.html',
styleUrls: ['./user-workspace.component.css']
})
export class UserWorkspaceComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -37,15 +37,13 @@
<!-- font-awesome css -->
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- my custom global code and css -->
<link rel="stylesheet" type="text/css" href="assets/custom.css">
<script src="assets/custom.js"></script>
</head>
<body>
<script>