changes on projects
This commit is contained in:
parent
9428ab55a9
commit
f1dbe240a4
|
@ -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": {
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -58,6 +58,7 @@ 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';
|
||||
|
@ -106,6 +107,7 @@ import { UserWorkspaceComponent } from './user-workspace/user-workspace.componen
|
|||
AppRoutingModule,
|
||||
AngularDraggableModule,
|
||||
DataTableModule,
|
||||
NgDatepickerModule,
|
||||
SidebarModule.forRoot()
|
||||
|
||||
],
|
||||
|
|
|
@ -192,7 +192,7 @@ 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}]));
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {}
|
||||
|
||||
*/
|
|
@ -123,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>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 {}
|
||||
|
||||
*/
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import { ProjectsComponent } from '../projects/projects.component';
|
|||
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-workspace',
|
||||
selector: 'user-workspace',
|
||||
templateUrl: './user-workspace.component.html',
|
||||
styleUrls: ['./user-workspace.component.css']
|
||||
})
|
||||
|
|
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
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue