no message

This commit is contained in:
Ioannis Kalyvas 2018-01-30 11:35:26 +02:00
parent 56531976de
commit f1ee3095f9
36 changed files with 617 additions and 388 deletions

View File

@ -2,42 +2,17 @@ import { InvitationAcceptedComponent } from './invitation-accepted/invitation-ac
import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
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 { AppComponent } from './app.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';
import { DatasetEditorComponent } from './datasets/editor/dataset-editor.component';
import { DatasetListingComponent } from './datasets/dataset-listing.component';
import { DatasetWizardComponent } from './dataset-wizard/dataset-wizard.component';
import { LoginComponent } from './user-management/login/login.component';
const appRoutes: Routes = [
{ path: 'dynamic-form/:id', component: DynamicFormComponent, canActivate: [AuthGuard] },
{ path: 'projects', component: ProjectListingComponent, canActivate: [AuthGuard] },
{ path: 'project/:id', component: ProjectEditorComponent, canActivate: [AuthGuard] },
{ path: 'projects/new', component: ProjectEditorComponent, canActivate: [AuthGuard] },
{ path: 'dmps', component: DataManagementPlanListingComponent, canActivate: [AuthGuard] },
{ path: 'dmp/:id', component: DataManagementPlanEditorComponent,canActivate: [AuthGuard] },
{ path: 'dmp/:id/new_version', component: DataManagementPlanEditorComponent, canActivate: [AuthGuard], data:{clone:"clone"} },
{ path: 'dmps/new', component: DataManagementPlanEditorComponent, canActivate: [AuthGuard] },
{ path: 'datasets', component: DatasetListingComponent, canActivate: [AuthGuard] },
//{ path: 'dataset/new', component: DatasetWizardComponent, canActivate: [AuthGuard] },
{ path: 'dataset/new/:dmpId', component: DatasetWizardComponent, canActivate: [AuthGuard] },
{ path: 'dataset/:id', component: DatasetWizardComponent, canActivate: [AuthGuard] },
{ path: 'datasets/new', component: DatasetWizardComponent, canActivate: [AuthGuard] },
{ path: 'datasets/:dmpId', component: DatasetListingComponent, canActivate: [AuthGuard] },
{ path: 'invitation/:id', component: InvitationAcceptedComponent},
{ path: 'login', loadChildren: './user-management/login.module#LoginModule' },
{ path: "unauthorized", loadChildren: './unauthorized/unauthorized.module#UnauthorizedModule' },
{ path: 'datasets', loadChildren: './datasets/dataset.module#DatasetModule' ,canActivate: [AuthGuard]},
{ path: 'projects', loadChildren: './projects/projects.module#ProjectsModule',canActivate: [AuthGuard] },
{ path: "dmps", loadChildren: './dmps/dmps.module#DataManagementPlanModule',canActivate: [AuthGuard] },
{ path: 'welcome', component: HomepageComponent, canActivate: [AuthGuard] },
{ path: '', redirectTo: '/welcome', pathMatch: 'full' },
{ path: "unauthorized", loadChildren: './unauthorized/unauthorized.module#UnauthorizedModule' }
];
@ -47,7 +22,6 @@ const appRoutes: Routes = [
appRoutes
, {
useHash: false
//,enableTracing: true <-- debugging purposes only
}
)
],
@ -55,6 +29,7 @@ const appRoutes: Routes = [
RouterModule
],
providers: [
AuthGuard
]
})
export class AppRoutingModule { }

View File

@ -1,6 +1,6 @@
export const HostConfiguration = {
Server: 'http://localhost:8080/',
App: 'http://localhost:8080/'
App: 'http://localhost:8080'
//CASHost: 'https://login-devel.uoa.gr/login',
//Service: 'http://elkefinman/login'
}

View File

@ -1,96 +1,42 @@
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { BaseHttpService } from './utilities/cite-http-service-module/base-http.service';
import { DashboardService } from './services/dashboard/dashboard.service';
import { DatasetService } from './services/dataset/dataset.service';
import { AuthService } from './services/auth/auth.service';
import { AuthGuard } from './guards/auth.guard';
import { PaginationService } from './services/pagination.service';
import { VisibilityRulesService } from './visibility-rules/visibility-rules.service';
import { MaterialModule } from './shared/material/material.module';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppRoutingModule } from './app-routing.module';
import { CommonModule } from '@angular/common';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { HttpModule } from '@angular/http';
import { HostConfiguration } from './app.constants';
import { LoginOptions } from './user-management/utilties/LoginOptions';
import { LoginModule } from './user-management/login.module';
import { DataManagementPlanModule } from './dmps/dmps.module';
import { DynamicFormModule } from './form/dynamic-form.module';
import { DatasetModule } from './datasets/dataset.module';
import { ProjectsModule } from './projects/projects.module';
import { SharedModule } from './shared/shared.module';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { FigurecardComponent } from './shared/components/figurecard/figurecard.component';
import { InvitationAcceptedComponent } from './invitation-accepted/invitation-accepted.component';
import { InvitationComponent } from './invitation/invitation.component';
import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
import { PaginationService } from './form/pagination/pagination-service';
import { TableOfContentsFieldComponent } from './form/tableOfContents/table-of-content-field/table-of-content-field.component';
import { ProgressBarComponent } from './form/pprogress-bar/progress-bar.component';
import { TableOfContentsSectionComponent } from './form/tableOfContents/table-of-content-section/table-of-content-section.component';
import { TableOfContentsGroupComponent } from './form/tableOfContents/table-of-content-group/table-of-content-group.component';
import { TableOfContentsFieldSetComponent } from './form/tableOfContents/table-of-content-fieldset/table-of-content-fieldset.component';
import { TableOfContentsComponent } from './form/tableOfContents/table-of-contents.component';
import { DynamicFieldRadioBoxComponent } from './form/dynamic-fields/dynamic-field-radiobox/dynamic-field-radiobox.component';
import { DynamicFieldBooleanDecisionComponent } from './form/dynamic-fields/dynamic-field-boolean-decision/dynamic-field-boolean-decision.component';
import { AutocompleteRemoteComponent } from './form/dynamic-fields/dynamic-field-autocomplete/autocomplete-remote.component';
import { DynamicFieldDropdownComponent } from './form/dynamic-fields/dynamic-field-dropdown/dynamic-field-dropdown';
import { DynamicFieldCheckBoxComponent } from './form/dynamic-fields/dynamic-field-checkbox/dynamic-field-checkbox';
import { VisibilityRulesService } from './visibility-rules/visibility-rules.service';
import { DynamicFormSectionComponent } from './form/dynamic-form-section/dynamic-form-section';
import { DynamicFormCompositeFieldComponent } from './form/dynamic-form-composite-field/dynamic-form-composite-field';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, forwardRef } from '@angular/core';
import { FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
import { HttpClientModule, HttpClient } from '@angular/common/http';
import { HttpModule } from '@angular/http';
import { RouterModule, Routes, Router } from '@angular/router';
import { AppComponent } from './app.component';
import { DynamicFormComponent } from './form/dynamic-form.component';
import { DynamicFormFieldComponent } from './form/dynamic-fields/dynamic-form-field.component';
import { DynamicFormGroupComponent } from './form/dynamic-form-group/dynamic-form-group.component';
import { AppRoutingModule } from './app-routing.module';
import { AuthGuard } from './guards/auth.guard';
import { PageNotFoundComponent } from './not-found.component';
import { HomepageComponent } from './homepage/homepage.component';
import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
import { TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
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 { DashboardService } from './services/dashboard/dashboard.service';
import { DatasetService } from './services/dataset/dataset.service';
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';
import { FigurecardComponent } from './shared/components/figurecard/figurecard.component';
import { DatasetListingComponent } from './datasets/dataset-listing.component';
import { DatasetEditorComponent } from './datasets/editor/dataset-editor.component';
import { DatasetWizardComponent } from './dataset-wizard/dataset-wizard.component';
import { AutocompleteComponent } from './shared/components/autocomplete/autocomplete.component';
import { PageNotFoundComponent } from './not-found.component';
import { AppComponent } from './app.component';
import { NgModule } from "@angular/core";
@NgModule({
declarations: [
AppComponent,
DynamicFormComponent,
DynamicFormFieldComponent,
DynamicFormGroupComponent,
DynamicFormCompositeFieldComponent,
DynamicFieldBooleanDecisionComponent,
DynamicFieldRadioBoxComponent,
TableOfContentsComponent,
TableOfContentsFieldSetComponent,
TableOfContentsGroupComponent,
TableOfContentsSectionComponent,
PageNotFoundComponent,
HomepageComponent,
ProjectListingComponent,
DatasetListingComponent,
DataManagementPlanListingComponent,
AutocompleteRemoteComponent,
DynamicFieldDropdownComponent,
DynamicFormSectionComponent,
TableOfContentsFieldComponent,
ProgressBarComponent,
DynamicFieldCheckBoxComponent,
ProjectEditorComponent,
DataManagementPlanEditorComponent,
InvitationComponent,
InvitationAcceptedComponent,
DatasetWizardComponent,
FigurecardComponent,
DatasetEditorComponent,
AutocompleteComponent
HomepageComponent
],
imports: [
BrowserModule,
@ -132,17 +78,10 @@ import { AutocompleteComponent } from './shared/components/autocomplete/autocomp
MaterialModule
],
providers: [
VisibilityRulesService,
PaginationService,
AuthGuard,
AuthService,
DashboardService,
DatasetService,
BaseHttpService
],
entryComponents: [
InvitationComponent,
],
bootstrap: [AppComponent]
})
export class AppModule {

View File

@ -6,7 +6,6 @@
<!-- .toString() -->
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
(click)="saveFinalize();" type="button">Save and Finalize</button>
<mat-horizontal-stepper [linear]="isLinear" #stepper>
<mat-step [stepControl]="formGroup">
<form *ngIf="formGroup" [formGroup]="formGroup">
@ -93,7 +92,7 @@
</mat-step>
<mat-step>
<ng-template matStepLabel>{{'DATASET-WIZARD.THIRD-STEP.TITLE' | translate}}</ng-template>
<dynamic-form class="full-width" *ngIf="datasetWizardModel && datasetWizardModel.datasetProfileDefinition" [dataModel]="datasetWizardModel"></dynamic-form>
<dynamic-form class="full-width" *ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition" [form]="this.formGroup.get('datasetProfileDefinition')" [dataModel]="datasetWizardModel"></dynamic-form>
<div class="navigation-buttons-container">
<button style="margin-top:10px;" matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK' | translate}}</button>
</div>

View File

@ -1,24 +1,23 @@
import { DatasetProfileDefinitionModel } from '../models/DatasetProfileDefinitionModel';
import { BaseErrorModel } from '../../models/error/BaseErrorModel';
import { SnackBarNotificationComponent } from '../../shared/components/notificaiton/snack-bar-notification.component';
import { DatasetProfileCriteria } from '../../models/criteria/dataset-profile/DatasetProfileCriteria';
import { DataManagementPlanModel } from '../../models/data-managemnt-plans/DataManagementPlanModel';
import { JsonSerializer } from '../../utilities/JsonSerializer';
import { DataManagementPlanCriteria } from '../../models/criteria/data-management-plan/DataManagementPlanCriteria';
import { RequestItem } from '../../models/criteria/RequestItem';
import { DatasetService } from '../../services/dataset/dataset.service';
import { ExternalSourcesItemModel } from '../../models/external-sources/ExternalSourcesItemModel';
import { DatasetProfileModel } from '../../models/datasetprofile/DatasetProfileModel';
import { DatasetProfileDefinitionModel } from '../../models/DatasetProfileDefinitionModel';
import { DatasetWizardModel } from '../../models/datasets/DatasetWizardModel';
import { DataManagementPlanService } from '../../services/data-management-plan/data-management-plan.service';
import { ExternalSourcesService } from '../../services/external-sources/external-sources.service';
import { DatasetWizardService } from '../../services/dataset-wizard/dataset-wizard.service';
import { TranslateService } from '@ngx-translate/core';
import { BaseErrorModel } from '../models/error/BaseErrorModel';
import { ActivatedRoute, Router, Params } from '@angular/router';
import { DatasetService } from '../services/dataset/dataset.service';
import { DatasetWizardModel } from '../models/datasets/DatasetWizardModel';
import { DatasetProfileCriteria } from '../models/criteria/dataset-profile/DatasetProfileCriteria';
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation } from "@angular/core";
import { DataManagementPlanService } from "../services/data-management-plan/data-management-plan.service";
import { FormGroup, Validators, FormBuilder } from "@angular/forms";
import { AutoCompleteConfiguration } from "../shared/components/autocomplete/AutoCompleteConfiguration";
import { DatasetWizardService } from "../services/dataset-wizard/dataset-wizard.service";
import { DataManagementPlanCriteria } from "../models/criteria/data-management-plan/DataManagementPlanCriteria";
import { DataManagementPlanModel } from "../models/data-managemnt-plans/DataManagementPlanModel";
import { JsonSerializer } from "../utilities/JsonSerializer";
import { Observable } from "rxjs/Observable";
import { RequestItem } from "../models/criteria/RequestItem";
import { SnackBarNotificationComponent } from "../shared/components/notificaiton/snack-bar-notification.component";
import { DatasetProfileModel } from '../models/datasetprofile/DatasetProfileModel';
import { ExternalSourcesItemModel } from '../models/external-sources/ExternalSourcesItemModel';
import { ExternalSourcesService } from '../services/external-sources/external-sources.service';
import { MatPaginator, MatSort, MatSnackBar, MatStepper } from "@angular/material";
@Component({
@ -36,7 +35,6 @@ export class DatasetWizardComponent {
datasetWizardModel: DatasetWizardModel;
isNew = true;
formGroup: FormGroup;
form: FormGroup;
datasetProfileDefinitionModel: DatasetProfileDefinitionModel;
availableProfiles: DatasetProfileModel[] = [];
@ -129,9 +127,8 @@ export class DatasetWizardComponent {
if (this.isNew) {
this.datasetWizardService.getDefinition(this.formGroup.get("profile").get("id").value).subscribe(item => {
this.datasetWizardModel.datasetProfileDefinition = JsonSerializer.fromJSONObject(item,DatasetProfileDefinitionModel);
//this.datasetProfileDefinitionModel = this.datasetWizardModel.datasetProfileDefinition;
//this.form = this.datasetProfileDefinitionModel.buildForm();
this.datasetProfileDefinitionModel = this.datasetWizardModel.datasetProfileDefinition;
this.formGroup.addControl("datasetProfileDefinition",this.datasetProfileDefinitionModel.buildForm())
})
}
}
@ -161,8 +158,8 @@ export class DatasetWizardComponent {
}
submit() {
this.datasetWizardService.saveDataset(this.datasetWizardModel, this.formGroup.value).subscribe(data => {
this.router.navigateByUrl("/datasets/" + this.datasetWizardModel.dmp.id);
this.datasetWizardService.saveDataset(this.formGroup.value, this.formGroup.get('datasetProfileDefinition').value).subscribe(data => {
this.router.navigateByUrl("/datasets/dmp/" + this.datasetWizardModel.dmp.id);
});
}

View File

@ -0,0 +1,60 @@
import { RouterModule } from '@angular/router';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { DatasetService } from '../services/dataset/dataset.service';
import { DynamicFormModule } from '../form/dynamic-form.module';
import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
import { DatasetWizardComponent } from './dataset-wizard/dataset-wizard.component';
import { DatasetRoutes } from './dataset.routes';
import { DatasetListingComponent } from './listing/dataset-listing.component';
import { DatasetEditorComponent } from './editor/dataset-editor.component';
import { CommonModule } from '@angular/common';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { SharedModule } from '../shared/shared.module'
@NgModule({
imports: [
CommonModule,
FormsModule,
HttpClientModule,
SharedModule,
RouterModule.forChild(DatasetRoutes),
ReactiveFormsModule,
DynamicFormModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
}),
],
declarations: [
DatasetListingComponent,
DatasetEditorComponent,
DatasetWizardComponent
],
exports: [
DatasetListingComponent,
DatasetEditorComponent,
DatasetWizardComponent,
RouterModule
],
providers: [
DatasetService
]
})
export class DatasetModule {
constructor(private translate: TranslateService) {
translate.setDefaultLang('en');
translate.use('en');
}
}
export function HttpLoaderFactory(httpClient: HttpClient) {
return new TranslateHttpLoader(httpClient, 'assets/lang/', '.json');
}

View File

@ -0,0 +1,12 @@
import { AuthGuard } from '../guards/auth.guard';
import { DatasetWizardComponent } from './dataset-wizard/dataset-wizard.component';
import { DatasetListingComponent } from './listing/dataset-listing.component';
import { RouterModule, Routes } from '@angular/router';
export const DatasetRoutes: Routes = [
{ path: "new/:dmpId", component: DatasetWizardComponent, canActivate: [AuthGuard] },
{ path: "edit/:id", component: DatasetWizardComponent, canActivate: [AuthGuard] },
{ path: "new", component: DatasetWizardComponent, canActivate: [AuthGuard] },
{ path: '', component: DatasetListingComponent, canActivate: [AuthGuard] },
{ path: "dmp/:dmpId", component: DatasetListingComponent, canActivate: [AuthGuard] }
];

View File

@ -88,7 +88,7 @@
</mat-paginator>
</mat-card>
<button *ngIf="dmpId" mat-fab class="mat-fab-bottom-right" color="primary" [routerLink]="['/dataset/new/'+dmpId] ">
<button *ngIf="dmpId" mat-fab class="mat-fab-bottom-right" color="primary" [routerLink]="['/datasets/new/'+dmpId] ">
<mat-icon class="mat-24">add</mat-icon>
</button>
</div>

View File

@ -1,19 +1,18 @@
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria';
import { DatasetService } from '../../services/dataset/dataset.service';
import { Component, ViewChild, OnInit, AfterViewInit } from "@angular/core";
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
import { Router, Params, ActivatedRoute } from "@angular/router";
import { TranslateService } from "@ngx-translate/core";
import { DataSource } from "@angular/cdk/table";
import { DatasetCriteriaComponent } from "../shared/components/criteria/datasets/datasets-criteria.component";
import { DatasetCriteria } from "../models/criteria/dataset/DatasetCriteria";
import { Observable } from "rxjs/Observable";
import { DataTableRequest } from "../models/data-table/DataTableRequest";
import { SnackBarNotificationComponent } from "../shared/components/notificaiton/snack-bar-notification.component";
import { DatasetService } from "../services/dataset/dataset.service";
import { DatasetListingModel } from "../models/datasets/DatasetListingModel";
import { PageEvent } from '@angular/material';
import { DataManagementPlanService } from "@app/services/data-management-plan/data-management-plan.service";
import { DataManagementPlanModel } from "@app/models/data-managemnt-plans/DataManagementPlanModel";
import { DatasetCriteriaComponent } from '@app/shared/components/criteria/datasets/datasets-criteria.component';
@Component({
@ -74,7 +73,7 @@ export class DatasetListingComponent implements OnInit {
}
rowClick(rowId: String) {
this.router.navigate(['/dataset/' + rowId]);
this.router.navigate(['/datasets/edit/' + rowId]);
}
getDefaultCriteria(dmpId: String): DatasetCriteria {
@ -126,7 +125,7 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
request.criteria = this._criteria.criteria;
return this._service.getPaged(request);
})
.catch((error: any) => {
/*.catch((error: any) => {
this._snackBar.openFromComponent(SnackBarNotificationComponent, {
data: { message: 'GENERAL.SNACK-BAR.FORMS-BAD-REQUEST', language: this._languageService },
duration: 3000,
@ -134,7 +133,7 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
});
//this._criteria.criteria.onCallbackError(error);
return Observable.of(null);
})
})*/
.map(result => {
setTimeout(() => {
this.isLoadingResults = false;

View File

@ -0,0 +1,64 @@
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { BaseHttpService } from '../utilities/cite-http-service-module/base-http.service';
import { InvitationAcceptedComponent } from '../invitation-accepted/invitation-accepted.component';
import { InvitationComponent } from '../invitation/invitation.component';
import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
import { DataManagementPlanEditorComponent } from './editor/dmp-editor.component';
import { DataManagementPlanListingComponent } from './listing/dmp-listing.component';
import { DataManagementPlanRoutes } from './dmps.routes';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { SharedModule } from '../shared/shared.module'
import { NgModule } from '@angular/core';
@NgModule({
imports: [
CommonModule,
FormsModule,
HttpClientModule,
SharedModule,
ReactiveFormsModule,
DataManagementPlanRoutes,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
}),
],
declarations: [
DataManagementPlanListingComponent,
DataManagementPlanEditorComponent,
InvitationComponent,
InvitationAcceptedComponent,
],
exports: [
DataManagementPlanListingComponent,
DataManagementPlanEditorComponent,
InvitationComponent,
InvitationAcceptedComponent,
],
entryComponents: [
InvitationComponent
],
providers: [
BaseHttpService
]
})
export class DataManagementPlanModule {
constructor(private translate: TranslateService) {
translate.setDefaultLang('en');
translate.use('en');
}
}
export function HttpLoaderFactory(httpClient: HttpClient) {
return new TranslateHttpLoader(httpClient, 'assets/lang/', '.json');
}

View File

@ -0,0 +1,13 @@
import { DataManagementPlanEditorComponent } from './editor/dmp-editor.component';
import { DataManagementPlanListingComponent } from './listing/dmp-listing.component';
import { DatasetListingComponent } from '../datasets/listing/dataset-listing.component';
import { RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{ path: '', component: DataManagementPlanListingComponent },
{ path: 'edit/:id', component: DataManagementPlanEditorComponent },
{ path: 'new', component: DataManagementPlanEditorComponent },
{ path: 'new_version/:id', component: DataManagementPlanEditorComponent, data: { clone: "clone" } },
];
export const DataManagementPlanRoutes = RouterModule.forChild(routes);

View File

@ -1,16 +1,17 @@
import { InvitationComponent } from '../invitation/invitation.component';
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
import { DataManagementPlanListingModel } from '../../models/data-managemnt-plans/DataManagementPlanListingModel';
import { InvitationComponent } from '../../invitation/invitation.component';
import { DataManagementPlanCriteria } from '../../models/criteria/data-management-plan/DataManagementPlanCriteria';
import {
DataManagementPlanCriteriaComponent,
} from '../../shared/components/criteria/data-management-plan/dmp-criteria.component';
import { DataManagementPlanService } from '../../services/data-management-plan/data-management-plan.service';
import { Component, ViewChild, OnInit, AfterViewInit } from "@angular/core";
import { MatPaginator, MatSort, MatSnackBar, MatDialog } 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 { 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";
import { DataTableRequest } from '../models/data-table/DataTableRequest';
@ -50,19 +51,19 @@ export class DataManagementPlanListingComponent implements OnInit {
}
rowClick(rowId: String) {
this.router.navigate(['/dmp/' + rowId]);
this.router.navigate(['/dmps/edit/' + rowId]);
}
addDataset(rowId: String) {
this.router.navigate(['/dataset/new/' + rowId]);
this.router.navigate(['/datasets/new/' + rowId]);
}
showDatasets(rowId: String) {
this.router.navigate(['/datasets/' + rowId]);
this.router.navigate(['/datasets/dmp/' + rowId]);
}
newVersion(rowId: String) {
this.router.navigate(['/dmp/' + rowId+ '/new_version'],{queryParams:{clone: 'true'}});
this.router.navigate(['/dmps/new_version/' + rowId], { queryParams: { clone: 'true' } });
}
getDefaultCriteria(): DataManagementPlanCriteria {
@ -114,14 +115,14 @@ export class DataManagementPlanDataSource extends DataSource<DataManagementPlanL
request.criteria = this._criteria.criteria;
return this._service.getPaged(request);
})
.catch((error: any) => {
/*.catch((error: any) => {
this._snackBar.openFromComponent(SnackBarNotificationComponent, {
data: { message: 'GENERAL.SNACK-BAR.FORMS-BAD-REQUEST', language: this._languageService },
duration: 3000,
extraClasses: ['snackbar-warning']
});
return Observable.of(null);
})
})*/
.map(result => {
setTimeout(() => {
this.isLoadingResults = false;

View File

@ -0,0 +1,97 @@
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { PaginationService } from '../services/pagination.service';
import { VisibilityRulesService } from '../visibility-rules/visibility-rules.service';
import { DynamicFieldCheckBoxComponent } from './dynamic-fields/dynamic-field-checkbox/dynamic-field-checkbox';
import { ProgressBarComponent } from './pprogress-bar/progress-bar.component';
import { TableOfContentsFieldComponent } from './tableOfContents/table-of-content-field/table-of-content-field.component';
import { DynamicFormSectionComponent } from './dynamic-form-section/dynamic-form-section';
import { DynamicFieldDropdownComponent } from './dynamic-fields/dynamic-field-dropdown/dynamic-field-dropdown';
import { AutocompleteRemoteComponent } from './dynamic-fields/dynamic-field-autocomplete/autocomplete-remote.component';
import {
TableOfContentsSectionComponent,
} from './tableOfContents/table-of-content-section/table-of-content-section.component';
import { TableOfContentsGroupComponent } from './tableOfContents/table-of-content-group/table-of-content-group.component';
import {
TableOfContentsFieldSetComponent,
} from './tableOfContents/table-of-content-fieldset/table-of-content-fieldset.component';
import { DynamicFieldRadioBoxComponent } from './dynamic-fields/dynamic-field-radiobox/dynamic-field-radiobox.component';
import { TableOfContentsComponent } from './tableOfContents/table-of-contents.component';
import {
DynamicFieldBooleanDecisionComponent,
} from './dynamic-fields/dynamic-field-boolean-decision/dynamic-field-boolean-decision.component';
import { DynamicFormGroupComponent } from './dynamic-form-group/dynamic-form-group.component';
import { DynamicFormCompositeFieldComponent } from './dynamic-form-composite-field/dynamic-form-composite-field';
import { DynamicFormFieldComponent } from './dynamic-fields/dynamic-form-field.component';
import { DynamicFormComponent } from './dynamic-form/dynamic-form.component';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { SharedModule } from '../shared/shared.module';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { NgModule } from "@angular/core";
@NgModule({
imports: [
CommonModule,
FormsModule,
HttpClientModule,
SharedModule,
ReactiveFormsModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
}),
],
declarations: [
DynamicFormComponent,
DynamicFormFieldComponent,
DynamicFormGroupComponent,
DynamicFormCompositeFieldComponent,
DynamicFieldBooleanDecisionComponent,
DynamicFieldRadioBoxComponent,
TableOfContentsComponent,
TableOfContentsFieldSetComponent,
TableOfContentsGroupComponent,
TableOfContentsSectionComponent,
AutocompleteRemoteComponent,
DynamicFieldDropdownComponent,
DynamicFormSectionComponent,
TableOfContentsFieldComponent,
ProgressBarComponent,
DynamicFieldCheckBoxComponent,
],
exports: [
DynamicFormComponent,
DynamicFormFieldComponent,
DynamicFormGroupComponent,
DynamicFormCompositeFieldComponent,
DynamicFieldBooleanDecisionComponent,
DynamicFieldRadioBoxComponent,
TableOfContentsComponent,
TableOfContentsFieldSetComponent,
TableOfContentsGroupComponent,
TableOfContentsSectionComponent,
AutocompleteRemoteComponent,
DynamicFieldDropdownComponent,
DynamicFormSectionComponent,
TableOfContentsFieldComponent,
ProgressBarComponent,
DynamicFieldCheckBoxComponent,
],
providers:[
VisibilityRulesService,
PaginationService
]
})
export class DynamicFormModule { }
export function HttpLoaderFactory(httpClient: HttpClient) {
return new TranslateHttpLoader(httpClient, 'assets/lang/', '.json');
}

View File

@ -1,48 +1,48 @@
<div class="dynamic-form-editor">
<!-- <mat-sidenav-container class="ng-sidebar-container"> -->
<!-- <mat-sidenav mode="push" position="right" [(opened)]="visibleSidebar">
<table-of-content class="toc-container full-height" [model]="datasetProfileDefinitionModel"></table-of-content>
</mat-sidenav> -->
<!-- <mat-sidenav-content> -->
<!-- <button mat-raised-button color="primary" style="margin: 15px;" (click)="toggleSidebar()" icon="fa-arrow-left">Table Of Contents</button> -->
<form *ngIf="form" novalidate [formGroup]="form">
<!-- <button mat-raised-button color="primary" *ngIf="dataModel&&dataModel.status.toString() != 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
(click)="save();" type="button">Save</button>
<button mat-raised-button color="primary" *ngIf="dataModel&&dataModel?.status != 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
(click)="saveFinalize();" type="button">Save and Finalize</button> -->
<div>
<div class="alignment-center">
<!-- <ngb-pagination *ngIf="pages" [collectionSize]="pages.length*10" [page]="currentPageIndex" (pageChange)="changePageIndex($event)" aria-label="Default pagination"></ngb-pagination> -->
<progress-bar *ngIf="form" [formGroup]="form"></progress-bar>
</div>
</div>
<div class="col-md-12" id="form-container">
<!-- <form *ngIf="form" novalidate [formGroup]="form" (ngSubmit)="onSubmit()"> -->
<mat-vertical-stepper #stepper [linear]="false">
<div *ngFor="let page of datasetProfileDefinitionModel.pages let z=index;">
<div *ngFor="let section of page.sections; let i = index;">
<mat-step [stepControl]="section">
<ng-template matStepLabel>{{page.title}}</ng-template>
<div *ngIf="stepper.selectedIndex == z">
<df-section [section]="section" [form]="form.get('pages').get(''+z).get('sections').get(''+i)" [path]="z+1" [pathName]="'pages.'+z+'.sections.'+i"></df-section>
<!-- <div>
<button mat-button matStepperNext>Next</button>
</div> -->
</div>
</mat-step>
</div>
</div>
</mat-vertical-stepper>
<!-- <div *ngFor="let section of datasetProfileDefinitionModel.sections; let i = index;">
<df-section *ngIf='this.shouldDisplaySection(section)' [section]="section" [form]="form.get('sections').get(''+i)" [path]="i+1"
[pathName]="'sections.'+i"></df-section>
</div> -->
</div>
</form>
<!-- </mat-sidenav-content>
</mat-sidenav-container> -->
</div>
<div class="dynamic-form-editor">
<!-- <mat-sidenav-container class="ng-sidebar-container"> -->
<!-- <mat-sidenav mode="push" position="right" [(opened)]="visibleSidebar">
<table-of-content class="toc-container full-height" [model]="datasetProfileDefinitionModel"></table-of-content>
</mat-sidenav> -->
<!-- <mat-sidenav-content> -->
<!-- <button mat-raised-button color="primary" style="margin: 15px;" (click)="toggleSidebar()" icon="fa-arrow-left">Table Of Contents</button> -->
<form *ngIf="form" novalidate [formGroup]="form">
<!-- <button mat-raised-button color="primary" *ngIf="dataModel&&dataModel.status.toString() != 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
(click)="save();" type="button">Save</button>
<button mat-raised-button color="primary" *ngIf="dataModel&&dataModel?.status != 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
(click)="saveFinalize();" type="button">Save and Finalize</button> -->
<div>
<div class="alignment-center">
<!-- <ngb-pagination *ngIf="pages" [collectionSize]="pages.length*10" [page]="currentPageIndex" (pageChange)="changePageIndex($event)" aria-label="Default pagination"></ngb-pagination> -->
<progress-bar *ngIf="form" [formGroup]="form"></progress-bar>
</div>
</div>
<div class="col-md-12" id="form-container">
<!-- <form *ngIf="form" novalidate [formGroup]="form" (ngSubmit)="onSubmit()"> -->
<mat-vertical-stepper #stepper [linear]="false">
<div *ngFor="let page of datasetProfileDefinitionModel.pages let z=index;">
<div *ngFor="let section of page.sections; let i = index;">
<mat-step [stepControl]="section">
<ng-template matStepLabel>{{page.title}}</ng-template>
<div *ngIf="stepper.selectedIndex == z">
<df-section [section]="section" [form]="form.get('pages').get(''+z).get('sections').get(''+i)" [path]="z+1" [pathName]="'pages.'+z+'.sections.'+i"></df-section>
<!-- <div>
<button mat-button matStepperNext>Next</button>
</div> -->
</div>
</mat-step>
</div>
</div>
</mat-vertical-stepper>
<!-- <div *ngFor="let section of datasetProfileDefinitionModel.sections; let i = index;">
<df-section *ngIf='this.shouldDisplaySection(section)' [section]="section" [form]="form.get('sections').get(''+i)" [path]="i+1"
[pathName]="'sections.'+i"></df-section>
</div> -->
</div>
</form>
<!-- </mat-sidenav-content>
</mat-sidenav-container> -->
</div>
<!-- <p>Form value: {{ form.value | json }}</p> -->

View File

@ -1,146 +1,143 @@
import { DatasetWizardModel } from '../models/datasets/DatasetWizardModel';
import { DatasetWizardComponent } from '../dataset-wizard/dataset-wizard.component';
import { DatasetProfileDefinitionModel } from '../models/DatasetProfileDefinitionModel';
import { VisibilityRulesService } from '../visibility-rules/visibility-rules.service';
import { Rule } from '../models/Rule';
import { Section } from '../models/Section';
import { JsonSerializer } from '../utilities/JsonSerializer';
import { Component, Input, OnInit, AfterViewChecked, ViewChild, forwardRef, ViewEncapsulation } from '@angular/core';
import { FormGroup, Validators, ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { NgForm } from '@angular/forms';
import { Router, ActivatedRoute, ParamMap, Params } from '@angular/router';
import 'rxjs/add/operator/switchMap';
import { Location } from '@angular/common';
import { MatSidenavModule } from '@angular/material/sidenav';
import { BaseHttpService } from '../utilities/cite-http-service-module/base-http.service';
import { DatasetWizardService } from '../services/dataset-wizard/dataset-wizard.service';
declare function simple_notifier(type: string, title: string, message: string): any;
@Component({
selector: 'dynamic-form',
templateUrl: './dynamic-form.component.html',
styleUrls: [
'./dynamic-form.component.scss'
],
providers: [
],
encapsulation: ViewEncapsulation.None,
})
export class DynamicFormComponent implements OnInit {
@Input() dataModel: DatasetWizardModel = new DatasetWizardModel();
@Input() path: string;
form: FormGroup;
id: string;
// @Input() datasetId: string;
pathName: string;
pages: Array<number>;
activeStepperIndex: number = 1;
visibleSidebar: boolean = false;
datasetProfileDefinitionModel: DatasetProfileDefinitionModel
private progressbar: boolean = false;
private currentPageIndex: number = 0;
private fragment: string;
constructor(private router: Router,
private _location: Location,
private route: ActivatedRoute,
private visibilityRulesService: VisibilityRulesService,
private http: BaseHttpService,
private datasetWizardService: DatasetWizardService,
) {
//this.datasetId = route.snapshot.params['id'];
}
getSubForm(subformName) {
return this.form.controls[subformName];
}
ngOnInit() {
this.datasetProfileDefinitionModel = this.dataModel.datasetProfileDefinition
this.createPagination();
this.form = this.datasetProfileDefinitionModel.buildForm();
this.visibilityRulesService.formGroup = this.form;
let rules: Rule[] = JsonSerializer.fromJSONArray(this.datasetProfileDefinitionModel.rules, Rule);
this.visibilityRulesService.buildVisibilityRules(rules)
this.progressbar = true;
this.route.fragment.subscribe((fragment: string) => {
var self = this;
setTimeout(function () { self.scrollTo(fragment) });
});
this.route.queryParams.subscribe((params) => {
if (params && "page" in params)
this.changeCurrentPage(params["page"]);
});
}
submit() {
this.datasetWizardService.saveDataset(this.dataModel, this.form.value).subscribe(data => {
this.router.navigateByUrl("/datasets/" + this.dataModel.dmp.id);
});
}
save() {
this.dataModel.status = "0";
this.submit();
}
saveFinalize() {
this.dataModel.status = "1";
this.submit();
}
toggleSidebar() {
this.visibleSidebar = !this.visibleSidebar;
}
// getPages(model: DatasetProfileDefinitionModel): Array<number> {
// let pageSet = new Set<number>();
// model.sections.forEach(section => {
// pageSet.add(section.page);
// });
// return Array.from(pageSet).sort((a, b) => a - b);
// }
shouldDisplaySection(section: Section): Boolean {
return (section.page) == this.currentPageIndex;
}
createPagination() {
/*this.pages.forEach(item => {
this.stepperItems.push({
label: '',
})
});*/
}
changePageIndex(index: any) {
this.router.navigate([this.route.snapshot.url[0] + "/" + this.route.snapshot.url[1]], { queryParams: { page: this.pages[index - 1] } });
}
scrollTo(sectionID: string) {
if (!sectionID) return;
var element = document.querySelector('#' + sectionID);
if (!element) return;
element.scrollIntoView();
this.visibleSidebar = true;
var scrollElement = document.querySelector('.scrollableContent');
//scrollElement.scrollTop = topElement.offsetTop;
}
changeCurrentPage(pageString: string) {
if (!pageString) return;
var page = parseInt(pageString);
if (isNaN(page)) return;
var pageIndex = this.pages.indexOf(page);
if (pageIndex === -1) return;
this.currentPageIndex = page;
}
import { Section } from '../../models/Section';
import { JsonSerializer } from '../../utilities/JsonSerializer';
import { Rule } from '../../models/Rule';
import { DatasetWizardService } from '../../services/dataset-wizard/dataset-wizard.service';
import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service';
import { VisibilityRulesService } from '../../visibility-rules/visibility-rules.service';
import { DatasetProfileDefinitionModel } from '../../models/DatasetProfileDefinitionModel';
import { DatasetWizardModel } from '../../models/datasets/DatasetWizardModel';
import { Component, Input, OnInit, AfterViewChecked, ViewChild, forwardRef, ViewEncapsulation } from '@angular/core';
import { FormGroup, Validators, ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { NgForm } from '@angular/forms';
import { Router, ActivatedRoute, ParamMap, Params } from '@angular/router';
import 'rxjs/add/operator/switchMap';
import { Location } from '@angular/common';
import { MatSidenavModule } from '@angular/material/sidenav';
declare function simple_notifier(type: string, title: string, message: string): any;
@Component({
selector: 'dynamic-form',
templateUrl: './dynamic-form.component.html',
styleUrls: [
'./dynamic-form.component.scss'
],
providers: [
],
encapsulation: ViewEncapsulation.None,
})
export class DynamicFormComponent implements OnInit {
@Input() dataModel: DatasetWizardModel = new DatasetWizardModel();
@Input() path: string;
@Input() form: FormGroup;
id: string;
// @Input() datasetId: string;
pathName: string;
pages: Array<number>;
activeStepperIndex: number = 1;
visibleSidebar: boolean = false;
datasetProfileDefinitionModel: DatasetProfileDefinitionModel
private progressbar: boolean = false;
private currentPageIndex: number = 0;
private fragment: string;
constructor(private router: Router,
private _location: Location,
private route: ActivatedRoute,
private visibilityRulesService: VisibilityRulesService,
private http: BaseHttpService,
private datasetWizardService: DatasetWizardService,
) {
//this.datasetId = route.snapshot.params['id'];
}
getSubForm(subformName) {
return this.form.controls[subformName];
}
ngOnInit() {
this.datasetProfileDefinitionModel = this.dataModel.datasetProfileDefinition
this.createPagination();
this.visibilityRulesService.formGroup = this.form;
let rules: Rule[] = JsonSerializer.fromJSONArray(this.datasetProfileDefinitionModel.rules, Rule);
this.visibilityRulesService.buildVisibilityRules(rules)
this.progressbar = true;
this.route.fragment.subscribe((fragment: string) => {
var self = this;
setTimeout(function () { self.scrollTo(fragment) });
});
this.route.queryParams.subscribe((params) => {
if (params && "page" in params)
this.changeCurrentPage(params["page"]);
});
}
submit() {
this.datasetWizardService.saveDataset(this.dataModel, this.form.value).subscribe(data => {
this.router.navigateByUrl("/datasets/dmp/" + this.dataModel.dmp.id);
});
}
save() {
this.dataModel.status = "0";
this.submit();
}
saveFinalize() {
this.dataModel.status = "1";
this.submit();
}
toggleSidebar() {
this.visibleSidebar = !this.visibleSidebar;
}
// getPages(model: DatasetProfileDefinitionModel): Array<number> {
// let pageSet = new Set<number>();
// model.sections.forEach(section => {
// pageSet.add(section.page);
// });
// return Array.from(pageSet).sort((a, b) => a - b);
// }
shouldDisplaySection(section: Section): Boolean {
return (section.page) == this.currentPageIndex;
}
createPagination() {
/*this.pages.forEach(item => {
this.stepperItems.push({
label: '',
})
});*/
}
changePageIndex(index: any) {
this.router.navigate([this.route.snapshot.url[0] + "/" + this.route.snapshot.url[1]], { queryParams: { page: this.pages[index - 1] } });
}
scrollTo(sectionID: string) {
if (!sectionID) return;
var element = document.querySelector('#' + sectionID);
if (!element) return;
element.scrollIntoView();
this.visibleSidebar = true;
var scrollElement = document.querySelector('.scrollableContent');
//scrollElement.scrollTop = topElement.offsetTop;
}
changeCurrentPage(pageString: string) {
if (!pageString) return;
var page = parseInt(pageString);
if (isNaN(page)) return;
var pageIndex = this.pages.indexOf(page);
if (pageIndex === -1) return;
this.currentPageIndex = page;
}
}

View File

@ -9,7 +9,7 @@ import {Router, ActivatedRoute} from '@angular/router'
@Component({
selector: 'table-of-contents-field',
templateUrl: '/table-of-content-field.component.html',
templateUrl: './table-of-content-field.component.html',
providers: []
})
export class TableOfContentsFieldComponent extends BaseTableOfContent{

View File

@ -11,7 +11,7 @@ import { Router, ActivatedRoute } from '@angular/router'
@Component({
selector: 'table-of-contents-fieldset',
templateUrl: '/table-of-content-fieldset.component.html',
templateUrl: './table-of-content-fieldset.component.html',
providers: []
})
export class TableOfContentsFieldSetComponent extends BaseTableOfContent {

View File

@ -9,7 +9,7 @@ import {Router, ActivatedRoute} from '@angular/router'
@Component({
selector: 'table-of-contents-group',
templateUrl: '/table-of-content-group.component.html',
templateUrl: './table-of-content-group.component.html',
providers: []
})
export class TableOfContentsGroupComponent extends BaseTableOfContent {

View File

@ -9,7 +9,7 @@ import { ActivatedRouteSnapshot,Router,ActivatedRoute } from '@angular/router';
@Component({
selector: 'table-of-contents-section',
templateUrl: '/table-of-content-section.component.html',
templateUrl: './table-of-content-section.component.html',
providers: []
})
export class TableOfContentsSectionComponent extends BaseTableOfContent implements OnInit {

View File

@ -7,7 +7,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'table-of-content',
templateUrl: '/table-of-contents.component.html',
templateUrl: './table-of-contents.component.html',
styleUrls: ['./toc.component.css'],
providers: []
})

View File

@ -26,7 +26,7 @@ export class InvitationAcceptedComponent implements OnInit {
this.route.params.subscribe(params => {
let id = params["id"]
this.invitationService.exchange(id).subscribe(id=>{
this.router.navigate(["dmp/"+id])
this.router.navigate(["dmps/edit/"+id])
})
}
)

View File

@ -25,8 +25,8 @@ export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
public dataRepositories: DataRepositoryModel[] = [];
public externalDatasets: ExternalDatasetModel[] = [];
public dmp: DataManagementPlanModel = new DataManagementPlanModel();
public datasetProfileDefinition ;
public properties :any;
public datasetProfileDefinition;
public properties: any;
public errorModel: BaseErrorModel = new BaseErrorModel();
fromJSONObject(item: any): DatasetWizardModel {
@ -47,8 +47,8 @@ export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
if (context == null) { context = this.createValidationContext(); }
const formGroup = new FormBuilder().group({
id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators],
label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators],
uri: [{ value: this.uri, disabled: disabled }, context.getValidation('uri').validators],
status: [{ value: this.status, disabled: disabled }, context.getValidation('status').validators],
@ -57,15 +57,16 @@ export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
registries: [{ value: this.registries, disabled: disabled }, context.getValidation('registries').validators],
dataRepositories: [{ value: this.dataRepositories, disabled: disabled }, context.getValidation('dataRepositories').validators],
externalDatasets: [{ value: this.externalDatasets, disabled: disabled }, context.getValidation('externalDatasets').validators],
dmp: [{ value: this.dmp, disabled: disabled }, context.getValidation('dmp').validators],
dmp: [{ value: this.dmp, disabled: disabled }, context.getValidation('dmp').validators]
});
formGroup.addControl("profile",this.profile.buildForm())
if (this.datasetProfileDefinition) formGroup.addControl("datasetProfileDefinition", this.datasetProfileDefinition.buildForm())
formGroup.addControl("profile", this.profile.buildForm())
return formGroup;
}
createValidationContext(): ValidationContext {
const baseContext: ValidationContext = new ValidationContext();
baseContext.validation.push({ key: 'id', validators: [BackendErrorValidator(this.errorModel, 'id')] });
baseContext.validation.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'label')] });
baseContext.validation.push({ key: 'profile', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'profile')] });
baseContext.validation.push({ key: 'uri', validators: [Validators.required, BackendErrorValidator(this.errorModel, 'uri')] });
@ -76,6 +77,8 @@ export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
baseContext.validation.push({ key: 'dataRepositories', validators: [BackendErrorValidator(this.errorModel, 'dataRepositories')] });
baseContext.validation.push({ key: 'externalDatasets', validators: [BackendErrorValidator(this.errorModel, 'externalDatasets')] });
baseContext.validation.push({ key: 'dmp', validators: [BackendErrorValidator(this.errorModel, 'dmp')] }); //TODO
baseContext.validation.push({ key: 'datasetProfileDefinition', validators: [BackendErrorValidator(this.errorModel, 'datasetProfileDefinition')] }); //TODO
return baseContext;
}
}

View File

@ -1,15 +1,14 @@
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
import { ProjectListingModel } from '../../models/projects/ProjectListingModel';
import { ProjectCriteria } from '../../models/criteria/project/ProjectCriteria';
import { ProjectService } from '../../services/project/project.service';
import { Component, ViewChild, OnInit, AfterViewInit, ViewEncapsulation } 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 { ProjectListingModel } from "../models/projects/ProjectListingModel";
import { ProjectService } from "../services/project/project.service";
import { ProjectCriteriaComponent } from "../shared/components/criteria/projects/projects-criteria.component";
import { ProjectCriteria } from "../models/criteria/project/ProjectCriteria";
import { Observable } from "rxjs/Observable";
import { DataTableRequest } from "../models/data-table/DataTableRequest";
import { SnackBarNotificationComponent } from "../shared/components/notificaiton/snack-bar-notification.component";
import { ProjectCriteriaComponent } from '@app/shared/components/criteria/projects/projects-criteria.component';
@Component({
selector: 'app-project-listing-component',
@ -47,7 +46,7 @@ export class ProjectListingComponent implements OnInit {
}
rowClick(rowId: String) {
this.router.navigate(['/project/' + rowId]);
this.router.navigate(['/projects/edit/' + rowId]);
}
getDefaultCriteria(): ProjectCriteria {
@ -98,7 +97,7 @@ export class ProjectDataSource extends DataSource<ProjectListingModel> {
request.criteria = this._criteria.criteria;
return this._service.getPaged(request);
})
.catch((error: any) => {
/*.catch((error: any) => {
this._snackBar.openFromComponent(SnackBarNotificationComponent, {
data: { message: 'GENERAL.SNACK-BAR.FORMS-BAD-REQUEST', language: this._languageService },
duration: 3000,
@ -106,7 +105,7 @@ export class ProjectDataSource extends DataSource<ProjectListingModel> {
});
this._criteria.onCallbackError(error.error);
return Observable.of(null);
})
})*/
.map(result => {
setTimeout(() => {
this.isLoadingResults = false;

View File

@ -0,0 +1,11 @@
import { ProjectEditorComponent } from './editor/project-editor.component';
import { ProjectListingComponent } from './listing/project-listing.component';
import { RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{ path: '', component: ProjectListingComponent },
{ path: 'edit/:id', component: ProjectEditorComponent },
{ path: 'new', component: ProjectEditorComponent },
];
export const ProjectRoutes = RouterModule.forChild(routes);

View File

@ -0,0 +1,53 @@
import { BaseHttpService } from '../utilities/cite-http-service-module/base-http.service';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
import { ProjectEditorComponent } from './editor/project-editor.component';
import { ProjectListingComponent } from './listing/project-listing.component';
import { ProjectRoutes } from './project.routes';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { SharedModule } from '../shared/shared.module'
import { NgModule } from '@angular/core';
@NgModule({
imports: [
CommonModule,
FormsModule,
HttpClientModule,
SharedModule,
ProjectRoutes,
ReactiveFormsModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
}),
],
declarations: [
ProjectListingComponent,
ProjectEditorComponent
],
exports: [
ProjectListingComponent,
ProjectEditorComponent,
], providers: [
BaseHttpService
]
})
export class ProjectsModule {
constructor(private translate: TranslateService) {
translate.setDefaultLang('en');
translate.use('en');
}
}
export function HttpLoaderFactory(httpClient: HttpClient) {
return new TranslateHttpLoader(httpClient, 'assets/lang/', '.json');
}

View File

@ -1,3 +1,6 @@
import { BaseCriteriaComponent } from './components/criteria/base/base-criteria.component';
import { FigurecardComponent } from './components/figurecard/figurecard.component';
import { AutocompleteComponent } from './components/autocomplete/autocomplete.component';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
@ -7,7 +10,7 @@ import { MaterialModule } from './material/material.module';
import { TranslateModule } from '@ngx-translate/core';
import { ProjectCriteriaComponent } from './components/criteria/projects/projects-criteria.component';
import { DatasetCriteriaComponent } from './components/criteria/datasets/datasets-criteria.component';
import { FormsModule } from '@angular/forms';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { DataManagementPlanCriteriaComponent } from './components/criteria/data-management-plan/dmp-criteria.component';
@NgModule({
@ -16,7 +19,8 @@ import { DataManagementPlanCriteriaComponent } from './components/criteria/data-
RouterModule,
MaterialModule,
TranslateModule,
FormsModule
FormsModule,
ReactiveFormsModule
],
declarations: [
@ -24,7 +28,10 @@ import { DataManagementPlanCriteriaComponent } from './components/criteria/data-
SnackBarNotificationComponent,
ProjectCriteriaComponent,
DatasetCriteriaComponent,
DataManagementPlanCriteriaComponent
DataManagementPlanCriteriaComponent,
AutocompleteComponent,
FigurecardComponent,
BaseCriteriaComponent
],
exports: [
@ -33,7 +40,10 @@ import { DataManagementPlanCriteriaComponent } from './components/criteria/data-
SnackBarNotificationComponent,
ProjectCriteriaComponent,
DatasetCriteriaComponent,
DataManagementPlanCriteriaComponent
DataManagementPlanCriteriaComponent,
AutocompleteComponent,
FigurecardComponent,
BaseCriteriaComponent
],
entryComponents: [
]

View File

@ -17,8 +17,8 @@
"UNSUCCESSFUL-LOGOUT": "Unsuccessful Logout",
"UNSUCCESSFUL-LOGIN": "Unsuccessful Login"
},
"ERROR":{
"HTTP-REQUEST-ERROR":"AN Unexpected Error Has Occured"
"ERRORS":{
"HTTP-REQUEST-ERROR":"An Unexpected Error Has Occured"
}
},
"NAV-BAR": {

View File

@ -1,3 +1,3 @@
export const environment = {
production: true
production: false
};

View File

@ -4,5 +4,5 @@
// The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = {
production: true
production: false
};