From 8132fbc1610b6bb225b51384afac2a9e6b442ef1 Mon Sep 17 00:00:00 2001 From: Diamadis Tziotzios Date: Thu, 14 Dec 2017 19:13:28 +0200 Subject: [PATCH] no message --- dmp-frontend/src/app/app-routing.module.ts | 52 +++-- dmp-frontend/src/app/app.constants.ts | 2 +- dmp-frontend/src/app/app.module.ts | 17 +- .../src/app/dmps/dmp-listing.component.css | 20 ++ .../src/app/dmps/dmp-listing.component.html | 190 ++++++++++++++++++ .../src/app/dmps/dmp-listing.component.ts | 146 ++++++++++++++ .../app/dmps/editor/dmp-editor.component.css | 20 ++ .../app/dmps/editor/dmp-editor.component.html | 190 ++++++++++++++++++ .../app/dmps/editor/dmp-editor.component.ts | 34 ++++ .../src/app/homepage/homepage.component.html | 148 -------------- .../DataManagementPlanCriteria.ts | 2 +- .../criteria/project/ProjectCriteria.ts | 2 +- ...l.ts => DataManagementPlanListingModel.ts} | 4 +- ...ingModel.ts => DataManagementPlanModel.ts} | 4 +- .../app/models/data-table/DataTableRequest.ts | 4 +- .../models/projects/ProjectListingModel.ts | 4 +- .../src/app/models/projects/ProjectModel.ts | 34 ++++ .../editor/project-editor.component.css | 20 ++ .../editor/project-editor.component.html | 66 ++++++ .../editor/project-editor.component.ts | 51 +++++ .../projects/project-listing.component.html | 6 +- .../app/projects/project-listing.component.ts | 12 +- .../data-management-plan.service.ts | 14 +- .../app/services/project/project.service.ts | 4 +- .../criteria/base/base-criteria.component.ts | 17 +- .../dmp-criteria.component.html | 34 ++++ .../dmp-criteria.component.scss | 10 + .../dmp-criteria.component.ts | 68 +++++++ .../projects/projects-criteria.component.html | 54 ++--- .../projects/projects-criteria.component.ts | 3 +- dmp-frontend/src/app/shared/shared.module.ts | 22 +- .../src/app/tabs/tabs-routing.module.ts | 12 +- .../src/app/utilities/forms/FormGenerator.ts | 6 + .../utilities/validators/ValidationContext.ts | 2 +- dmp-frontend/src/assets/lang/en.json | 32 +++ 35 files changed, 1039 insertions(+), 267 deletions(-) create mode 100644 dmp-frontend/src/app/dmps/dmp-listing.component.css create mode 100644 dmp-frontend/src/app/dmps/dmp-listing.component.html create mode 100644 dmp-frontend/src/app/dmps/dmp-listing.component.ts create mode 100644 dmp-frontend/src/app/dmps/editor/dmp-editor.component.css create mode 100644 dmp-frontend/src/app/dmps/editor/dmp-editor.component.html create mode 100644 dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts rename dmp-frontend/src/app/models/data-managemnt-plans/{DmpModel.ts => DataManagementPlanListingModel.ts} (78%) rename dmp-frontend/src/app/models/data-managemnt-plans/{DmpListingModel.ts => DataManagementPlanModel.ts} (81%) create mode 100644 dmp-frontend/src/app/projects/editor/project-editor.component.css create mode 100644 dmp-frontend/src/app/projects/editor/project-editor.component.html create mode 100644 dmp-frontend/src/app/projects/editor/project-editor.component.ts create mode 100644 dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.html create mode 100644 dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.scss create mode 100644 dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.ts create mode 100644 dmp-frontend/src/app/utilities/forms/FormGenerator.ts diff --git a/dmp-frontend/src/app/app-routing.module.ts b/dmp-frontend/src/app/app-routing.module.ts index 0d2ea6119..459ab5d7d 100644 --- a/dmp-frontend/src/app/app-routing.module.ts +++ b/dmp-frontend/src/app/app-routing.module.ts @@ -4,13 +4,16 @@ import { PageNotFoundComponent } from './not-found.component'; import { HomepageComponent } from './homepage/homepage.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 { MainSignInComponent } from './login/main-sign-in/main-sign-in.component'; import { DmpDetailedComponent } from './viewers/dmp-detailed/dmp-detailed.component'; import { ProjectDetailedComponent } from './viewers/project-detailed/project-detailed.component'; +import { ProjectListingModel } from './models/projects/ProjectListingModel'; +import { ProjectListingComponent } from './projects/project-listing.component'; +import { DataManagementPlanListingComponent } from './dmps/dmp-listing.component'; +import { ProjectEditorComponent } from './projects/editor/project-editor.component'; +import { DataManagementPlanEditorComponent } from './dmps/editor/dmp-editor.component'; const appRoutes: Routes = [ @@ -18,26 +21,31 @@ const appRoutes: Routes = [ { path: 'dynamic-form/:id', component: DynamicFormComponent, canActivate: [AuthGuard] }, { path: 'dataset', component: DatasetsComponent }, { path: 'login', component: MainSignInComponent}, - { path: 'projects', component: ProjectsComponent}, - { path: 'dmps', - component: DmpComponent, - children: [ - { - path: "dmp", - component: DmpDetailedComponent, - data: { - //breadcrumb: "Sign In" - } - }, - { - path: "project", - component: ProjectDetailedComponent, - data: { - //breadcrumb: "Sign Up" - } - } - ] - }, + { path: 'projects', component: ProjectListingComponent}, + { path: 'project/:id', component: ProjectEditorComponent}, + { path: 'projects/new', component: ProjectEditorComponent}, + { path: 'dmps', component: DataManagementPlanListingComponent}, + { path: 'dmp/:id', component: DataManagementPlanEditorComponent}, + { path: 'dmps/new', component: DataManagementPlanEditorComponent}, + // { path: 'dmps', + // component: DataManagementPlanListingComponent, + // children: [ + // { + // path: "dmp", + // component: DmpDetailedComponent, + // data: { + // //breadcrumb: "Sign In" + // } + // }, + // { + // path: "project", + // component: ProjectDetailedComponent, + // data: { + // //breadcrumb: "Sign Up" + // } + // } + // ] + // }, { path: 'welcome', component: HomepageComponent}, { path: '', redirectTo: '/login', pathMatch: 'full' }, { path: '**', component: PageNotFoundComponent } diff --git a/dmp-frontend/src/app/app.constants.ts b/dmp-frontend/src/app/app.constants.ts index f5ea48485..c33d7a2ef 100644 --- a/dmp-frontend/src/app/app.constants.ts +++ b/dmp-frontend/src/app/app.constants.ts @@ -1,5 +1,5 @@ export const HostConfiguration = { - Server: 'http://localhost:4200/', + Server: 'http://192.168.32.103:8080/', //CASHost: 'https://login-devel.uoa.gr/login', //Service: 'http://elkefinman/login' } \ No newline at end of file diff --git a/dmp-frontend/src/app/app.module.ts b/dmp-frontend/src/app/app.module.ts index 72102ad8f..47de7ae49 100644 --- a/dmp-frontend/src/app/app.module.ts +++ b/dmp-frontend/src/app/app.module.ts @@ -71,15 +71,12 @@ import { DatasetTableFilterPipe } from './pipes/dataset-table-filter.pipe'; import { DatasetStatusFilterPipe } from './pipes/dataset-status-filter.pipe'; import { DatasetsComponent } from './datasets/dataset.component'; - -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 { ProjectTableFilterPipe } from './pipes/project-table-filter.pipe'; -import { ProjectsComponent } from './projects/projects.component'; import { ModalComponent } from './modal/modal.component'; import { NgDatepickerModule } from 'ng2-datepicker'; @@ -106,6 +103,11 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { SharedModule } from './shared/shared.module'; import { MaterialModule } from './shared/material/material.module'; import { AuthService } from './services/auth/auth.service'; +import { ProjectListingComponent } from './projects/project-listing.component'; +import { BaseHttpService } from './utilities/cite-http-service-module/base-http.service'; +import { DataManagementPlanListingComponent } from './dmps/dmp-listing.component'; +import { ProjectEditorComponent } from './projects/editor/project-editor.component'; +import { DataManagementPlanEditorComponent } from './dmps/editor/dmp-editor.component'; @NgModule({ declarations: [ @@ -125,8 +127,8 @@ import { AuthService } from './services/auth/auth.service'; PageNotFoundComponent, HomepageComponent, ModalComponent, - ProjectsComponent, - DmpComponent, + ProjectListingComponent, + DataManagementPlanListingComponent, DatasetsComponent, ConfirmationComponent, AutocompleteRemoteComponent, @@ -143,6 +145,8 @@ import { AuthService } from './services/auth/auth.service'; ProgressBarComponent, DynamicFieldCheckBoxComponent, BreadcrumbComponent, DmpDetailedComponent, ProjectDetailedComponent, + ProjectEditorComponent, + DataManagementPlanEditorComponent ], imports: [ @@ -187,7 +191,8 @@ import { AuthService } from './services/auth/auth.service'; }, ServerService, VisibilityRulesService, PaginationService, GlobalVariables, AuthGuard, TokenService, LocalStorageService, RestBase, EestoreService, NativeLoginService, PDFService, - AuthService + AuthService, + BaseHttpService ], bootstrap: [AppComponent] }) diff --git a/dmp-frontend/src/app/dmps/dmp-listing.component.css b/dmp-frontend/src/app/dmps/dmp-listing.component.css new file mode 100644 index 000000000..957c39499 --- /dev/null +++ b/dmp-frontend/src/app/dmps/dmp-listing.component.css @@ -0,0 +1,20 @@ +.mat-card { + overflow: auto; + padding: 0px; +} + +.mat-table { + margin: 24px; +} + +.mat-progress-bar { + position: absolute; +} + +.mat-fab-bottom-right { + top: auto !important; + right: 20px !important; + bottom: 10px !important; + left: auto !important; + position: fixed !important; +} diff --git a/dmp-frontend/src/app/dmps/dmp-listing.component.html b/dmp-frontend/src/app/dmps/dmp-listing.component.html new file mode 100644 index 000000000..3086e8b41 --- /dev/null +++ b/dmp-frontend/src/app/dmps/dmp-listing.component.html @@ -0,0 +1,190 @@ +
+

{{'DMP-LISTING.TITLE' | translate}}

+ + + + + + + + + + {{'DMP-LISTING.COLUMNS.NAME' | translate}} + {{row.name}} + + + + + {{'DMP-LISTING.COLUMNS.ABBREVIATION' | translate}} + {{row.abbreviation}} + + + + + {{'DMP-LISTING.COLUMNS.START' | translate}} + {{row.start}} + + + + + {{'DMP-LISTING.COLUMNS.END' | translate}} + {{row.end}} + + + + + {{'DMP-LISTING.COLUMNS.ACTIONS' | translate}} + + + + + + + + + + + + +
+ diff --git a/dmp-frontend/src/app/dmps/dmp-listing.component.ts b/dmp-frontend/src/app/dmps/dmp-listing.component.ts new file mode 100644 index 000000000..850ccd527 --- /dev/null +++ b/dmp-frontend/src/app/dmps/dmp-listing.component.ts @@ -0,0 +1,146 @@ +import { Component, ViewChild, OnInit, AfterViewInit } from "@angular/core"; +import { MatPaginator, MatSort, MatSnackBar } from "@angular/material"; +import { Router } from "@angular/router"; +import { TranslateService } from "@ngx-translate/core"; +import { DataSource } from "@angular/cdk/table"; +import { Observable } from "rxjs/Observable"; +import { DataTableRequest } from "../models/data-table/DataTableRequest"; +import { SnackBarNotificationComponent } from "../shared/components/notificaiton/snack-bar-notification.component"; +import { DataManagementPlanService } from "../services/data-management-plan/data-management-plan.service"; +import { DataManagementPlanCriteriaComponent } from "../shared/components/criteria/data-management-plan/dmp-criteria.component"; +import { DataManagementPlanCriteria } from "../models/criteria/data-management-plan/DataManagementPlanCriteria"; +import { DataManagementPlanListingModel } from "../models/data-managemnt-plans/DataManagementPlanListingModel"; + + + +@Component({ + selector: 'app-dmp-listing-component', + templateUrl: 'dmp-listing.component.html', + styleUrls: ['./dmp-listing.component.css'], + providers: [DataManagementPlanService] +}) +export class DataManagementPlanListingComponent implements OnInit, AfterViewInit { + + @ViewChild(MatPaginator) _paginator: MatPaginator; + @ViewChild(MatSort) sort: MatSort; + @ViewChild(DataManagementPlanCriteriaComponent) criteria: DataManagementPlanCriteriaComponent; + + dataSource: DataManagementPlanDataSource | null; + displayedColumns: String[] = ['name', 'abbreviation', 'start', 'end']; + + constructor( + private projectService: DataManagementPlanService, + private router: Router, + private languageService: TranslateService, + public snackBar: MatSnackBar, + ) { + + } + + ngOnInit() { + + } + + ngAfterViewInit() { + setTimeout(() => { + this.criteria.setRefreshCallback(() => this.refresh()); + this.criteria.setCriteria(this.getDefaultCriteria()); + this.criteria.controlModified(); + }); + } + + refresh() { + this.dataSource = new DataManagementPlanDataSource(this.projectService, this._paginator, this.sort, this.languageService, this.snackBar, this.criteria, ); + } + + rowClick(rowId: String) { + this.router.navigate(['/forms/' + rowId]); + } + + getDefaultCriteria(): DataManagementPlanCriteria { + const defaultCriteria = new DataManagementPlanCriteria(); + return defaultCriteria; + } + + // canShowOwner(): boolean { + // const principal: Principal = this.authentication.current(); + // if (principal) { + // const principalRoles = principal.appRoles; + // for (let i = 0; i < principalRoles.length; i++) { + // if (principalRoles[i] === Principal.AppRole.Admin || principalRoles[i] === Principal.AppRole.BudgetManager) { + // return true; + // } + // } + // } + // return false; + // } +} + +export class DataManagementPlanDataSource extends DataSource { + + totalCount = 0; + isLoadingResults = false; + + constructor( + private _service: DataManagementPlanService, + private _paginator: MatPaginator, + private _sort: MatSort, + private _languageService: TranslateService, + private _snackBar: MatSnackBar, + private _criteria: DataManagementPlanCriteriaComponent + ) { + super(); + + //this._paginator.page.subscribe((pageEvent: PageEvent) => { + // this.store.dispatch(new LoadPhotosRequestAction(pageEvent.pageIndex, pageEvent.pageSize)) + //}) + } + + connect(): Observable { + const displayDataChanges = [ + this._paginator.page + //this._sort.matSortChange + ]; + + // If the user changes the sort order, reset back to the first page. + //this._sort.matSortChange.subscribe(() => { + // this._paginator.pageIndex = 0; + //}) + + return Observable.merge(...displayDataChanges) + .startWith(null) + .switchMap(() => { + setTimeout(() => { + this.isLoadingResults = true; + }); + const startIndex = this._paginator.pageIndex * this._paginator.pageSize; + const request = new DataTableRequest(startIndex, this._paginator.pageSize); + request.projectCriteria = this._criteria.getFormData(); + return this._service.getPaged(request); + }) + .catch((error: any) => { + this._snackBar.openFromComponent(SnackBarNotificationComponent, { + data: { message: 'GENERAL.SNACK-BAR.FORMS-BAD-REQUEST', language: this._languageService }, + duration: 3000, + extraClasses: ['snackbar-warning'] + }); + this._criteria.onCallbackError(error); + return Observable.of(null); + }) + .map(result => { + setTimeout(() => { + this.isLoadingResults = false; + }); + return result; + }) + .map(result => { + if (!result) { return []; } + if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; } + return result.data; + }); + } + + disconnect() { + // No-op + } +} diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.css b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.css new file mode 100644 index 000000000..957c39499 --- /dev/null +++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.css @@ -0,0 +1,20 @@ +.mat-card { + overflow: auto; + padding: 0px; +} + +.mat-table { + margin: 24px; +} + +.mat-progress-bar { + position: absolute; +} + +.mat-fab-bottom-right { + top: auto !important; + right: 20px !important; + bottom: 10px !important; + left: auto !important; + position: fixed !important; +} diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html new file mode 100644 index 000000000..8d5c11e1c --- /dev/null +++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html @@ -0,0 +1,190 @@ +
+

{{'PROJECT-LISTING.TITLE' | translate}}

+ + + + + + + + + + {{'PROJECT-LISTING.COLUMNS.NAME' | translate}} + {{row.name}} + + + + + {{'PROJECT-LISTING.COLUMNS.ABBREVIATION' | translate}} + {{row.abbreviation}} + + + + + {{'PROJECT-LISTING.COLUMNS.START' | translate}} + {{row.start}} + + + + + {{'PROJECT-LISTING.COLUMNS.END' | translate}} + {{row.end}} + + + + + {{'PROJECT-LISTING.COLUMNS.ACTIONS' | translate}} + + + + + + + + + + + + +
+ diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts new file mode 100644 index 000000000..481d06eab --- /dev/null +++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.ts @@ -0,0 +1,34 @@ +import { Component, ViewChild, OnInit, AfterViewInit } from "@angular/core"; +import { MatPaginator, MatSort, MatSnackBar } from "@angular/material"; +import { Router } from "@angular/router"; +import { TranslateService } from "@ngx-translate/core"; +import { DataSource } from "@angular/cdk/table"; +import { Observable } from "rxjs/Observable"; +import { DataManagementPlanService } from "../../services/data-management-plan/data-management-plan.service"; + + + +@Component({ + selector: 'app-dmp-editor-component', + templateUrl: 'dmp-editor.component.html', + styleUrls: ['./dmp-editor.component.css'], +}) +export class DataManagementPlanEditorComponent implements OnInit, AfterViewInit { + + constructor( + private projectService: DataManagementPlanService, + private router: Router, + private languageService: TranslateService, + public snackBar: MatSnackBar + ) { + + } + + ngOnInit() { + + } + + ngAfterViewInit() { + + } +} \ No newline at end of file diff --git a/dmp-frontend/src/app/homepage/homepage.component.html b/dmp-frontend/src/app/homepage/homepage.component.html index 92116242b..da54d7661 100644 --- a/dmp-frontend/src/app/homepage/homepage.component.html +++ b/dmp-frontend/src/app/homepage/homepage.component.html @@ -6,151 +6,3 @@

Learn more

--> - - - -
- -
-
-
-
- assignment -
-
-

Simple Table

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
First NameCountryCitySalary
Dakota RiceNigerOud-Turnhout$36,738
Minerva HooperCuraçaoSinaai-Waas$23,789
Sage RodriguezNetherlandsBaileux$56,142
Philip ChaneyKorea, SouthOverland Park$38,735
Doris GreeneMalawiFeldkirchen in Kärnten$63,542
Mason PorterChileGloucester$78,615
-
-
-
-
-
-
-
-
-
- assignment -
-
-

Striped Table

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#Product NameTypeQuantityPriceAmount
1Moleskine AgendaOud-Office25€ 49€ 1,225
2Stabilo PenOffice35€ 10€ 300
3A4 Paper PackOffice50€ 599.00€ 109
4Apple iPadMeeting20€ 10.99€ 4,999
5Apple iPhoneCommunication10€ 499.00€ 5,999
Total€12,999
-
-
-
-
-
-
- \ No newline at end of file diff --git a/dmp-frontend/src/app/models/criteria/data-management-plan/DataManagementPlanCriteria.ts b/dmp-frontend/src/app/models/criteria/data-management-plan/DataManagementPlanCriteria.ts index d7631c684..a26696afe 100644 --- a/dmp-frontend/src/app/models/criteria/data-management-plan/DataManagementPlanCriteria.ts +++ b/dmp-frontend/src/app/models/criteria/data-management-plan/DataManagementPlanCriteria.ts @@ -1,4 +1,4 @@ -import { BaseCriteria } from "./BaseCriteria"; +import { BaseCriteria } from "../BaseCriteria"; export class DataManagementPlanCriteria extends BaseCriteria { public PeriodStart: Date; diff --git a/dmp-frontend/src/app/models/criteria/project/ProjectCriteria.ts b/dmp-frontend/src/app/models/criteria/project/ProjectCriteria.ts index 5bd4287b4..7b40640c4 100644 --- a/dmp-frontend/src/app/models/criteria/project/ProjectCriteria.ts +++ b/dmp-frontend/src/app/models/criteria/project/ProjectCriteria.ts @@ -1,4 +1,4 @@ -import { BaseCriteria } from "./BaseCriteria"; +import { BaseCriteria } from "../BaseCriteria"; export class ProjectCriteria extends BaseCriteria { public PeriodStart: Date; diff --git a/dmp-frontend/src/app/models/data-managemnt-plans/DmpModel.ts b/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanListingModel.ts similarity index 78% rename from dmp-frontend/src/app/models/data-managemnt-plans/DmpModel.ts rename to dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanListingModel.ts index f787cfec2..e8ab737c5 100644 --- a/dmp-frontend/src/app/models/data-managemnt-plans/DmpModel.ts +++ b/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanListingModel.ts @@ -1,6 +1,6 @@ import { Serializable } from "../Serializable"; -export class DmpModel implements Serializable { +export class DataManagementPlanListingModel implements Serializable { public id: String; public label: String; public abbreviation: String; @@ -11,7 +11,7 @@ export class DmpModel implements Serializable { public endDate: Date; public description: String; - fromJSONObject(item: any): DmpModel { + fromJSONObject(item: any): DataManagementPlanListingModel { this.id = item.id; this.label = item.label; this.abbreviation = item.abbreviation; diff --git a/dmp-frontend/src/app/models/data-managemnt-plans/DmpListingModel.ts b/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanModel.ts similarity index 81% rename from dmp-frontend/src/app/models/data-managemnt-plans/DmpListingModel.ts rename to dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanModel.ts index 96f214421..fea9dd081 100644 --- a/dmp-frontend/src/app/models/data-managemnt-plans/DmpListingModel.ts +++ b/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanModel.ts @@ -1,6 +1,6 @@ import { Serializable } from "../Serializable"; -export class DmpListingModel implements Serializable { +export class DataManagementPlanModel implements Serializable { public id: String; public label: String; public abbreviation: String; @@ -11,7 +11,7 @@ export class DmpListingModel implements Serializable { public endDate: Date; public description: String; - fromJSONObject(item: any): DmpListingModel { + fromJSONObject(item: any): DataManagementPlanModel { this.id = item.id; this.label = item.label; this.abbreviation = item.abbreviation; diff --git a/dmp-frontend/src/app/models/data-table/DataTableRequest.ts b/dmp-frontend/src/app/models/data-table/DataTableRequest.ts index 2210d72db..1938c01e4 100644 --- a/dmp-frontend/src/app/models/data-table/DataTableRequest.ts +++ b/dmp-frontend/src/app/models/data-table/DataTableRequest.ts @@ -1,5 +1,5 @@ -import { ProjectCriteria } from "../criteria/ProjectCriteria"; -import { DataManagementPlanCriteria } from "../criteria/DataManagementPlanCriteria"; +import { DataManagementPlanCriteria } from "../criteria/data-management-plan/DataManagementPlanCriteria"; +import { ProjectCriteria } from "../criteria/project/ProjectCriteria"; export class DataTableRequest { offset = 0; diff --git a/dmp-frontend/src/app/models/projects/ProjectListingModel.ts b/dmp-frontend/src/app/models/projects/ProjectListingModel.ts index e3d1d2d62..d4e567ebc 100644 --- a/dmp-frontend/src/app/models/projects/ProjectListingModel.ts +++ b/dmp-frontend/src/app/models/projects/ProjectListingModel.ts @@ -18,8 +18,8 @@ export class ProjectListingModel implements Serializable { this.reference = item.reference; this.uri = item.uri; this.status = item.status; - this.startDate = item.startDate; - this.endDate = item.endDate; + this.startDate = item.startdate; + this.endDate = item.enddate; this.description = item.description; return this; diff --git a/dmp-frontend/src/app/models/projects/ProjectModel.ts b/dmp-frontend/src/app/models/projects/ProjectModel.ts index e5d9ecf35..622f80428 100644 --- a/dmp-frontend/src/app/models/projects/ProjectModel.ts +++ b/dmp-frontend/src/app/models/projects/ProjectModel.ts @@ -1,4 +1,8 @@ import { Serializable } from "../Serializable"; +import { ValidationContext } from "../../utilities/validators/ValidationContext"; +import { FormGroup, FormBuilder, FormControl, Validators } from "@angular/forms"; +import { BackendErrorValidator } from "../../utilities/validators/BackendErrorValidator"; +import { BaseErrorModel } from "../error/BaseErrorModel"; export class ProjectModel implements Serializable { public id: String; @@ -11,6 +15,8 @@ export class ProjectModel implements Serializable { public endDate: Date; public description: String; + public errorModel: BaseErrorModel = new BaseErrorModel(); + fromJSONObject(item: any): ProjectModel { this.id = item.id; this.label = item.label; @@ -24,4 +30,32 @@ export class ProjectModel implements Serializable { return this; } + + buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup { + if (context == null) { context = this.createValidationContext(); } + + const formGroup = new FormBuilder().group({ + label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators], + abbreviation: [{ value: this.abbreviation, disabled: disabled }, context.getValidation('abbreviation').validators], + reference: [{ value: this.reference, disabled: disabled }], + uri: [{ value: this.uri, disabled: disabled }, context.getValidation('uri').validators], + description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators], + startDate: [{ value: this.startDate, disabled: disabled }, context.getValidation('startDate').validators], + endDate: [{ value: this.endDate, disabled: disabled }, context.getValidation('endDate').validators] + }); + + return formGroup; + } + + createValidationContext(): ValidationContext { + const baseContext: ValidationContext = new ValidationContext(); + baseContext.validation.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'label')] }); + baseContext.validation.push({ key: 'abbreviation', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'abbreviation')] }); + baseContext.validation.push({ key: 'uri', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'uri')] }); + baseContext.validation.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'description')] }); + baseContext.validation.push({ key: 'startDate', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'startDate')] }); + baseContext.validation.push({ key: 'endDate', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'endDate')] }); + + return baseContext; + } } \ No newline at end of file diff --git a/dmp-frontend/src/app/projects/editor/project-editor.component.css b/dmp-frontend/src/app/projects/editor/project-editor.component.css new file mode 100644 index 000000000..957c39499 --- /dev/null +++ b/dmp-frontend/src/app/projects/editor/project-editor.component.css @@ -0,0 +1,20 @@ +.mat-card { + overflow: auto; + padding: 0px; +} + +.mat-table { + margin: 24px; +} + +.mat-progress-bar { + position: absolute; +} + +.mat-fab-bottom-right { + top: auto !important; + right: 20px !important; + bottom: 10px !important; + left: auto !important; + position: fixed !important; +} diff --git a/dmp-frontend/src/app/projects/editor/project-editor.component.html b/dmp-frontend/src/app/projects/editor/project-editor.component.html new file mode 100644 index 000000000..903635a2a --- /dev/null +++ b/dmp-frontend/src/app/projects/editor/project-editor.component.html @@ -0,0 +1,66 @@ +
+
+ + {{'PROJECT-EDITOR.TITLE.NEW' | translate}} + {{'PROJECT-EDITOR.TITLE.EDIT' | translate}} {{project.label}} + + + + + {{baseErrorModel.label}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + + + + {{baseErrorModel.abbreviation}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + + + + {{baseErrorModel.uri}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + + + + + + +
+ + + + + {{baseErrorModel.startDate}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + + + + + + {{baseErrorModel.endDate}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
+
+
+ + + +
+ +
+
+
+
+
\ No newline at end of file diff --git a/dmp-frontend/src/app/projects/editor/project-editor.component.ts b/dmp-frontend/src/app/projects/editor/project-editor.component.ts new file mode 100644 index 000000000..5a26b076d --- /dev/null +++ b/dmp-frontend/src/app/projects/editor/project-editor.component.ts @@ -0,0 +1,51 @@ +import { Component, ViewChild, OnInit, AfterViewInit } from "@angular/core"; +import { MatPaginator, MatSort, MatSnackBar } from "@angular/material"; +import { Router, ActivatedRoute, Params } from "@angular/router"; +import { TranslateService } from "@ngx-translate/core"; +import { DataSource } from "@angular/cdk/table"; +import { Observable } from "rxjs/Observable"; +import { DataManagementPlanService } from "../../services/data-management-plan/data-management-plan.service"; +import { ProjectModel } from "../../models/projects/ProjectModel"; +import { ProjectService } from "../../services/project/project.service"; +import { JsonSerializer } from "../../utilities/JsonSerializer"; +import { FormGroup } from "@angular/forms"; + + + +@Component({ + selector: 'app-project-editor-component', + templateUrl: 'project-editor.component.html', + styleUrls: ['./project-editor.component.css'], + providers: [ProjectService] +}) +export class ProjectEditorComponent implements AfterViewInit { + + isNew = true; + project: ProjectModel; + formGroup: FormGroup = null; + + constructor( + private projectService: ProjectService, + private route: ActivatedRoute, + ) { + + } + + ngAfterViewInit() { + this.route.params.subscribe((params: Params) => { + const itemId = params['id']; + + if (itemId != null) { + this.isNew = false; + this.projectService.getSingle(itemId).map(data => data as ProjectModel) + .subscribe(data => { + this.project = new JsonSerializer().fromJSONObject(data, ProjectModel); + this.formGroup = this.project.buildForm(); + }); + } else { + this.project = new ProjectModel(); + this.formGroup = this.project.buildForm(); + } + }); + } +} \ No newline at end of file diff --git a/dmp-frontend/src/app/projects/project-listing.component.html b/dmp-frontend/src/app/projects/project-listing.component.html index 8d5c11e1c..b6c115dfb 100644 --- a/dmp-frontend/src/app/projects/project-listing.component.html +++ b/dmp-frontend/src/app/projects/project-listing.component.html @@ -10,7 +10,7 @@ {{'PROJECT-LISTING.COLUMNS.NAME' | translate}} - {{row.name}} + {{row.label}} @@ -22,13 +22,13 @@ {{'PROJECT-LISTING.COLUMNS.START' | translate}} - {{row.start}} + {{row.startDate}} {{'PROJECT-LISTING.COLUMNS.END' | translate}} - {{row.end}} + {{row.endDate}} diff --git a/dmp-frontend/src/app/projects/project-listing.component.ts b/dmp-frontend/src/app/projects/project-listing.component.ts index 32c04b497..8caa28a88 100644 --- a/dmp-frontend/src/app/projects/project-listing.component.ts +++ b/dmp-frontend/src/app/projects/project-listing.component.ts @@ -19,14 +19,14 @@ import { SnackBarNotificationComponent } from "../shared/components/notificaiton styleUrls: ['./project-listing.component.css'], providers: [ProjectService] }) -export class FormsComponent implements OnInit, AfterViewInit { +export class ProjectListingComponent implements OnInit, AfterViewInit { @ViewChild(MatPaginator) _paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; @ViewChild(ProjectCriteriaComponent) criteria: ProjectCriteriaComponent; - dataSource: FormsDataSource | null; - displayedColumns: String[] = ['type', 'projectName', 'submissionTime', 'description', 'status']; + dataSource: ProjectDataSource | null; + displayedColumns: String[] = ['name', 'abbreviation', 'start', 'end', 'actions']; constructor( private projectService: ProjectService, @@ -50,11 +50,11 @@ export class FormsComponent implements OnInit, AfterViewInit { } refresh() { - this.dataSource = new FormsDataSource(this.projectService, this._paginator, this.sort, this.languageService, this.snackBar, this.criteria, ); + this.dataSource = new ProjectDataSource(this.projectService, this._paginator, this.sort, this.languageService, this.snackBar, this.criteria, ); } rowClick(rowId: String) { - this.router.navigate(['/forms/' + rowId]); + this.router.navigate(['/project/' + rowId]); } getDefaultCriteria(): ProjectCriteria { @@ -76,7 +76,7 @@ export class FormsComponent implements OnInit, AfterViewInit { // } } -export class FormsDataSource extends DataSource { +export class ProjectDataSource extends DataSource { totalCount = 0; isLoadingResults = false; diff --git a/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts b/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts index 6cc27661a..13b5312c1 100644 --- a/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts +++ b/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts @@ -6,8 +6,8 @@ import { BaseHttpService } from '../../utilities/cite-http-service-module/base-h import { Observable } from 'rxjs/Observable'; import { DataTableRequest } from '../../models/data-table/DataTableRequest'; import { DataTableData } from '../../models/data-table/DataTableData'; -import { DmpListingModel } from '../../models/data-managemnt-plans/DmpListingModel'; -import { DmpModel } from '../../models/data-managemnt-plans/DmpModel'; +import { DataManagementPlanModel } from '../../models/data-managemnt-plans/DataManagementPlanModel'; +import { DataManagementPlanListingModel } from '../../models/data-managemnt-plans/DataManagementPlanListingModel'; @Injectable() @@ -18,18 +18,18 @@ export class DataManagementPlanService { constructor(private http: BaseHttpService) { - this.actionUrl = HostConfiguration.Server + 'api/dmp/'; + this.actionUrl = HostConfiguration.Server + 'api/dmps/'; this.headers = new HttpHeaders(); this.headers = this.headers.set('Content-Type', 'application/json'); this.headers = this.headers.set('Accept', 'application/json'); } - getPaged(dataTableRequest: DataTableRequest): Observable> { - return this.http.post>(this.actionUrl + 'getPaged', JSON.stringify(dataTableRequest), { headers: this.headers }); + getPaged(dataTableRequest: DataTableRequest): Observable> { + return this.http.post>(this.actionUrl + 'getPaged', dataTableRequest, { headers: this.headers }); } - getSingle(id: string): Observable { - return this.http.get(this.actionUrl + id, { headers: this.headers }); + getSingle(id: string): Observable { + return this.http.get(this.actionUrl + id, { headers: this.headers }); } } diff --git a/dmp-frontend/src/app/services/project/project.service.ts b/dmp-frontend/src/app/services/project/project.service.ts index 153d3cbd6..426b18030 100644 --- a/dmp-frontend/src/app/services/project/project.service.ts +++ b/dmp-frontend/src/app/services/project/project.service.ts @@ -18,7 +18,7 @@ export class ProjectService { constructor(private http: BaseHttpService) { - this.actionUrl = HostConfiguration.Server + 'api/project/'; + this.actionUrl = HostConfiguration.Server + 'dmp-backend/rest/projects/'; this.headers = new HttpHeaders(); this.headers = this.headers.set('Content-Type', 'application/json'); @@ -26,7 +26,7 @@ export class ProjectService { } getPaged(dataTableRequest: DataTableRequest): Observable> { - return this.http.post>(this.actionUrl + 'getPaged', JSON.stringify(dataTableRequest), { headers: this.headers }); + return this.http.post>(this.actionUrl + 'getPaged', dataTableRequest, { headers: this.headers }); } getSingle(id: string): Observable { diff --git a/dmp-frontend/src/app/shared/components/criteria/base/base-criteria.component.ts b/dmp-frontend/src/app/shared/components/criteria/base/base-criteria.component.ts index 51adac6f2..2ed93d09f 100644 --- a/dmp-frontend/src/app/shared/components/criteria/base/base-criteria.component.ts +++ b/dmp-frontend/src/app/shared/components/criteria/base/base-criteria.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, Input } from '@angular/core'; import { FormControl, FormGroup, NgForm, FormArray, AbstractControl } from '@angular/forms'; -import { CriteriaErrorModel } from '../../../../models/criteria/criteriaErrorModel'; +import { BaseCriteriaErrorModel } from '../../../../models/criteria/BaseCriteriaErrorModel'; @Component({ selector: 'base-criteria-component', @@ -14,14 +14,13 @@ export class BaseCriteriaComponent implements OnInit { public refreshCallback: Function = null; public formGroup: FormGroup = null; + public errorModel: BaseCriteriaErrorModel = new BaseCriteriaErrorModel(); - constructor( - public baseErrorModel?: CriteriaErrorModel, - ) { + constructor(errorModel: BaseCriteriaErrorModel) { + this.errorModel = errorModel; } ngOnInit() { - if (this.baseErrorModel == null) { this.baseErrorModel = new CriteriaErrorModel(); } } controlModified(): void { @@ -87,15 +86,15 @@ export class BaseCriteriaComponent implements OnInit { this.validateAllFormFields(this.formGroup); } - public setErrorModel(errorModel: CriteriaErrorModel) { + public setErrorModel(errorModel: BaseCriteriaErrorModel) { Object.keys(errorModel).forEach(item => { - (this.baseErrorModel)[item] = (errorModel)[item]; + (this.errorModel)[item] = (errorModel)[item]; }) } public clearErrorModel() { - Object.keys(this.baseErrorModel).forEach(item => { - (this.baseErrorModel)[item] = ''; + Object.keys(this.errorModel).forEach(item => { + (this.errorModel)[item] = ''; }) } diff --git a/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.html b/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.html new file mode 100644 index 000000000..f01d9a8b4 --- /dev/null +++ b/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.html @@ -0,0 +1,34 @@ +
+ +
+
+ + + {{baseErrorModel['Criteria.PeriodStart']}} + + + +
+
+ + + {{baseErrorModel['Criteria.PeriodEnd']}} + + + +
+
+
+
\ No newline at end of file diff --git a/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.scss b/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.scss new file mode 100644 index 000000000..263cc1548 --- /dev/null +++ b/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.scss @@ -0,0 +1,10 @@ +.form-criteria { + mat-form-field { + padding-bottom: 5px; + width: 100%; + } + + mat-card { + padding-bottom: 0px; + } +} diff --git a/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.ts b/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.ts new file mode 100644 index 000000000..01174ffc8 --- /dev/null +++ b/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.ts @@ -0,0 +1,68 @@ +import { TranslateService } from '@ngx-translate/core'; +import { Component, OnInit } from '@angular/core'; +import { FormControl, FormGroup, FormBuilder, Validators } from '@angular/forms'; +import { BaseCriteriaComponent } from '../base/base-criteria.component'; +import { ValidationContext, Validation } from '../../../../utilities/validators/ValidationContext'; +import { BackendErrorValidator } from '../../../../utilities/validators/BackendErrorValidator'; +import { DataManagementPlanCriteria } from '../../../../models/criteria/data-management-plan/DataManagementPlanCriteria'; +import { DataManagementPlanCriteriaErrorModel } from '../../../../models/criteria/data-management-plan/DataManagementPlanCriteriaErrorModel'; + +@Component({ + selector: 'app-dmp-criteria-component', + templateUrl: './dmp-criteria.component.html', + styleUrls: ['./dmp-criteria.component.scss'], + providers: [ + ] +}) + +export class DataManagementPlanCriteriaComponent extends BaseCriteriaComponent implements OnInit { + + // public form: DataManagementPlanType; + // public formStatus: DataManagementPlanStatus; + public criteria: DataManagementPlanCriteria = new DataManagementPlanCriteria(); + + constructor( + public language: TranslateService, + public formBuilder: FormBuilder + ) { + super(new DataManagementPlanCriteriaErrorModel()); + } + + ngOnInit() { + super.ngOnInit(); + if (this.criteria == null) { this.criteria = new DataManagementPlanCriteria(); } + if (this.formGroup == null) { this.formGroup = this.buildForm(); } + } + + setCriteria(criteria: DataManagementPlanCriteria): void { + this.criteria = criteria; + this.formGroup = this.buildForm(); + } + + public fromJSONObject(item: any): DataManagementPlanCriteria { + this.criteria = new DataManagementPlanCriteria(); + this.criteria.PeriodStart = new Date(item.PeriodStart); + this.criteria.PeriodEnd = new Date(item.PeriodEnd); + return this.criteria; + } + + buildForm(): FormGroup { + const context: ValidationContext = this.createValidationContext(); + + return this.formBuilder.group({ + periodStart: [this.criteria.PeriodStart, context.getValidation('periodStart').validators], + periodEnd: [this.criteria.PeriodEnd, context.getValidation('periodEnd').validators], + }); + } + + createValidationContext(): ValidationContext { + const validationContext: ValidationContext = new ValidationContext(); + const validationArray: Validation[] = new Array(); + + validationArray.push({ key: 'periodStart', validators: [BackendErrorValidator(this.errorModel, 'Criteria.PeriodStart')] }); //must add 'Criteria.' because the criteria validator is inside the request validator + validationArray.push({ key: 'periodEnd', validators: [BackendErrorValidator(this.errorModel, 'Criteria.PeriodEnd')] }); + + validationContext.validation = validationArray; + return validationContext; + } +} diff --git a/dmp-frontend/src/app/shared/components/criteria/projects/projects-criteria.component.html b/dmp-frontend/src/app/shared/components/criteria/projects/projects-criteria.component.html index 5e5a437df..f01d9a8b4 100644 --- a/dmp-frontend/src/app/shared/components/criteria/projects/projects-criteria.component.html +++ b/dmp-frontend/src/app/shared/components/criteria/projects/projects-criteria.component.html @@ -1,52 +1,32 @@ -
+
- {{baseErrorModel['Criteria.PeriodFrom']}} - - + [matDatepicker]="periodStartPicker" + name="projectCriteriaPeriodStart" + [ngModel]="this.criteria.PeriodStart" (ngModelChange)="controlModified()"> + {{baseErrorModel['Criteria.PeriodStart']}} + +
- {{baseErrorModel['Criteria.PeriodTo']}} - - - -
-
- - - {{'TYPES.FORM-TYPE.ANY' | translate}} - {{getFormTypeWithLanguage(type)}} - - -
-
- - - {{getFormStatusWithLanguage(status)}} - + [matDatepicker]="periodEndPicker" + [ngModel]="this.criteria.PeriodEnd" (ngModelChange)="controlModified()"> + {{baseErrorModel['Criteria.PeriodEnd']}} + +
diff --git a/dmp-frontend/src/app/shared/components/criteria/projects/projects-criteria.component.ts b/dmp-frontend/src/app/shared/components/criteria/projects/projects-criteria.component.ts index 3868df811..59d8c7611 100644 --- a/dmp-frontend/src/app/shared/components/criteria/projects/projects-criteria.component.ts +++ b/dmp-frontend/src/app/shared/components/criteria/projects/projects-criteria.component.ts @@ -23,10 +23,9 @@ export class ProjectCriteriaComponent extends BaseCriteriaComponent implements O constructor( public language: TranslateService, - public errorModel: ProjectCriteriaErrorModel, public formBuilder: FormBuilder ) { - super(errorModel); + super(new ProjectCriteriaErrorModel()); } ngOnInit() { diff --git a/dmp-frontend/src/app/shared/shared.module.ts b/dmp-frontend/src/app/shared/shared.module.ts index 1ced8c13a..f34ff67e0 100644 --- a/dmp-frontend/src/app/shared/shared.module.ts +++ b/dmp-frontend/src/app/shared/shared.module.ts @@ -5,23 +5,31 @@ import { NavigationComponent } from './components/navigation/navigation.componen import { SnackBarNotificationComponent } from './components/notificaiton/snack-bar-notification.component'; import { MaterialModule } from './material/material.module'; import { TranslateModule } from '@ngx-translate/core'; +import { ProjectCriteriaComponent } from './components/criteria/projects/projects-criteria.component'; +import { FormsModule } from '@angular/forms'; +import { DataManagementPlanCriteriaComponent } from './components/criteria/data-management-plan/dmp-criteria.component'; @NgModule({ imports: [ CommonModule, - RouterModule, - MaterialModule, - TranslateModule + RouterModule, + MaterialModule, + TranslateModule, + FormsModule ], declarations: [ - NavigationComponent, - SnackBarNotificationComponent + NavigationComponent, + SnackBarNotificationComponent, + ProjectCriteriaComponent, + DataManagementPlanCriteriaComponent ], exports: [ - NavigationComponent, - SnackBarNotificationComponent + NavigationComponent, + SnackBarNotificationComponent, + ProjectCriteriaComponent, + DataManagementPlanCriteriaComponent ], entryComponents: [ ] diff --git a/dmp-frontend/src/app/tabs/tabs-routing.module.ts b/dmp-frontend/src/app/tabs/tabs-routing.module.ts index e7f07ee79..ae948c309 100644 --- a/dmp-frontend/src/app/tabs/tabs-routing.module.ts +++ b/dmp-frontend/src/app/tabs/tabs-routing.module.ts @@ -3,8 +3,8 @@ import { RouterModule, Routes } from '@angular/router'; import { TabComponent } from './tabs.component'; import { AuthGuard } from '../guards/auth.guard'; -import { ProjectsComponent } from '../projects/projects.component'; -import { DmpComponent } from '../dmps/dmp.component'; +import { ProjectListingComponent } from '../projects/project-listing.component'; +import { DataManagementPlanListingComponent } from '../dmps/dmp-listing.component'; const tabsRoutes: Routes = [ { @@ -12,16 +12,16 @@ const tabsRoutes: Routes = [ children: [ { path: 'projects', - component: ProjectsComponent + component: ProjectListingComponent }, { path: 'dmps', - component: DmpComponent + component: DataManagementPlanListingComponent } ] }, - { path: 'tabs/projects', component: ProjectsComponent }, // canActivate: [AuthGuard] - { path: 'tabs/dmps', component: DmpComponent } + // { path: 'tabs/projects', component: ProjectListingComponent }, // canActivate: [AuthGuard] + // { path: 'tabs/dmps', component: DataManagementPlanListingComponent } ]; @NgModule({ diff --git a/dmp-frontend/src/app/utilities/forms/FormGenerator.ts b/dmp-frontend/src/app/utilities/forms/FormGenerator.ts new file mode 100644 index 000000000..a30da24a8 --- /dev/null +++ b/dmp-frontend/src/app/utilities/forms/FormGenerator.ts @@ -0,0 +1,6 @@ +import { ValidationContext } from "../validators/ValidationContext"; +import { FormGroup } from "@angular/forms"; + +export interface FormGenerator { + buildForm(validation: ValidationContext, disabled?: boolean): FormGroup; +} \ No newline at end of file diff --git a/dmp-frontend/src/app/utilities/validators/ValidationContext.ts b/dmp-frontend/src/app/utilities/validators/ValidationContext.ts index cf5019697..ef3528ff2 100644 --- a/dmp-frontend/src/app/utilities/validators/ValidationContext.ts +++ b/dmp-frontend/src/app/utilities/validators/ValidationContext.ts @@ -1,7 +1,7 @@ import { ValidatorFn } from '@angular/forms'; export class ValidationContext { - validation: Validation[]; + validation: Validation[] = []; getValidation(key: string): Validation { for (let i = 0; i < this.validation.length; i++) { diff --git a/dmp-frontend/src/assets/lang/en.json b/dmp-frontend/src/assets/lang/en.json index 4c0cfacfe..184d150d0 100644 --- a/dmp-frontend/src/assets/lang/en.json +++ b/dmp-frontend/src/assets/lang/en.json @@ -1,5 +1,37 @@ { "NAV-BAR": { "TITLE": "DMPS" + }, + "PROJECT-LISTING": { + "TITLE": "Projects", + "COLUMNS": { + "NAME": "Name", + "ABBREVIATION": "Abbreviation", + "START": "Start", + "END": "End", + "ACTIONS": "Actions" + } + }, + "DMP-LISTING": { + "TITLE": "Data Management Plans", + "COLUMNS": { + "NAME": "Name", + "ABBREVIATION": "Abbreviation", + "START": "Start", + "END": "End", + "ACTIONS": "Actions" + } + }, + "PROJECT-EDITOR": { + "TITLE": { + "NEW": "New Project", + "EDIT": "Edit" + } + }, + "CRITERIA": { + "FORMS": { + "PERIOD-FROM": "Start", + "PERIOD-TO": "End" + } } } \ No newline at end of file