transfer dataset profile form from admin to front-end (models + services) , dataset profile form became a module.
This commit is contained in:
parent
86db30e5f3
commit
6b5390b09a
|
@ -42,7 +42,7 @@
|
|||
<!-- <form-comp></form-comp>-->
|
||||
<main-window [ngClass]="{false:'invisible'}[tokenService.isLoggedIn() == true]"></main-window>
|
||||
|
||||
<app-main-sign-in [ngClass]="{true:'invisible'}[tokenService.isLoggedIn() == true]"></app-main-sign-in>
|
||||
<!-- <app-main-sign-in [ngClass]="{true:'invisible'}[tokenService.isLoggedIn() == true]"></app-main-sign-in> -->
|
||||
|
||||
|
||||
</div>
|
|
@ -67,6 +67,7 @@ import { DatasetprofileEditorComponent } from './managers/datasetprofile-editor/
|
|||
import { DatasetProfileGUIEditorComponent } from './dataset-profile-gui-editor/dataset-profile-gui-editor.component';
|
||||
|
||||
import { DatasetProfileModule } from './dataset-profile-form/dataset-profile.module';
|
||||
import { UnauthorizedModule } from './unauthorized/unauthorized.module';
|
||||
|
||||
// import { FieldFormComponent } from './dataset-profile-form/field-form/field-form.component';
|
||||
// import { FormComponent } from './dataset-profile-form/form/form.component';
|
||||
|
|
|
@ -11,7 +11,9 @@ import { DatasetprofileEditorComponent } from './managers/datasetprofile-editor/
|
|||
import { MainWindowComponent } from './main-window/main-window.component';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { AuthGuard } from './guards/auth.guard';
|
||||
|
||||
import { AppComponent } from 'app/app.component';
|
||||
import { MainSignInComponent } from 'app/login/main-sign-in/main-sign-in.component';
|
||||
import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
|
||||
|
||||
|
||||
// Route Configuration
|
||||
|
@ -19,9 +21,14 @@ const routes: Routes = [
|
|||
|
||||
{
|
||||
path: '',
|
||||
redirectTo: 'app-root',
|
||||
redirectTo: '/main',
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'app-root',
|
||||
component: AppComponent,
|
||||
canActivate: [AuthGuard]
|
||||
},
|
||||
{
|
||||
path: 'datasets',
|
||||
component: DatasetsViewerComponent,
|
||||
|
@ -43,7 +50,9 @@ const routes: Routes = [
|
|||
component: MainWindowComponent,
|
||||
canActivate: [AuthGuard]
|
||||
},
|
||||
{ path: 'form', loadChildren: './dataset-profile-form/dataset-profile.module#DatasetProfileModule', canActivate: [AuthGuard]}
|
||||
{ path: 'form', loadChildren: './dataset-profile-form/dataset-profile.module#DatasetProfileModule', canActivate: [AuthGuard]},
|
||||
{ path: "unauthorized", loadChildren: './unauthorized/unauthorized.module#UnauthorizedModule' } ,
|
||||
{ path: "login", component: MainSignInComponent }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
@ -56,7 +65,7 @@ const routes: Routes = [
|
|||
RouterModule
|
||||
],
|
||||
providers: [
|
||||
|
||||
AuthGuard
|
||||
]
|
||||
})
|
||||
|
||||
|
|
|
@ -30,7 +30,10 @@ export class AuthService {
|
|||
this.headers = this.headers.set('Accept', 'application/json');
|
||||
}
|
||||
|
||||
|
||||
private clear(): void {
|
||||
localStorage.removeItem('principal');
|
||||
}
|
||||
|
||||
public current(principal?: Principal): Principal {
|
||||
if (principal) {
|
||||
localStorage.setItem('principal', JSON.stringify(principal));
|
||||
|
@ -40,7 +43,30 @@ export class AuthService {
|
|||
if (!principalJson) { return null; }
|
||||
const principalObj = JSON.parse(principalJson) as Principal;
|
||||
return principalObj;
|
||||
}
|
||||
}
|
||||
|
||||
public me(): Observable<Principal> {
|
||||
const url = this.actionUrl + '/me';
|
||||
const principal = this.current();
|
||||
if (!principal) {
|
||||
this.clear();
|
||||
return Observable.of<Principal>();
|
||||
}
|
||||
let headers = this.headers;
|
||||
headers = headers.set('AuthToken', principal.token)
|
||||
return this.http.post(url, null, { headers: headers })
|
||||
.map((res: any) => {
|
||||
const princ = this.current(JsonSerializer.fromJSONObject(res.payload, Principal));
|
||||
return princ;
|
||||
})
|
||||
.catch((error: any) => {
|
||||
console.warn('could not retrieve me info:\n', error);
|
||||
this.clear();
|
||||
const princ = this.current();
|
||||
this.router.navigate(['/login']);
|
||||
return Observable.of<Principal>(princ);
|
||||
});
|
||||
}
|
||||
|
||||
public nativeLogin(credentials: Credential): Observable<Principal> { debugger;
|
||||
const url = this.actionUrl + 'nativelogin';
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<h2>{{message}}</h2>
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"unauthorized.component.js","sourceRoot":"","sources":["unauthorized.component.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAMzD,IAAa,qBAAqB;IAG9B,+BACY,WAAwB,EACxB,KAAqB,EACrB,MAAc;QAFd,gBAAW,GAAX,WAAW,CAAa;QACxB,UAAK,GAAL,KAAK,CAAgB;QACrB,WAAM,GAAN,MAAM,CAAQ;IACtB,CAAC;IAEL,+CAAe,GAAf;QAAA,iBAaC;QAZG,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC;QACpE,IAAI,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAC3C,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;QAChF,CAAC;QACD,IAAI,CAAC,CAAC;YACF,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,SAAS,CAC3B,UAAA,SAAS;gBACL,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;oBAAC,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;YAChG,CAAC,EACD,UAAA,GAAG,IAAI,OAAA,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,GAAG,CAAC,EAAvC,CAAuC,CAAC,CAAC;QACxD,CAAC;IACL,CAAC;IACL,4BAAC;AAAD,CAAC,AAvBD,IAuBC;AArBG;IADC,KAAK,EAAE;;sDACe;AAFd,qBAAqB;IAJjC,SAAS,CAAC;QACP,QAAQ,EAAE,wBAAwB;QAClC,WAAW,EAAE,+BAA+B;KAC/C,CAAC;qCAK2B,WAAW;QACjB,cAAc;QACb,MAAM;GANjB,qBAAqB,CAuBjC;SAvBY,qBAAqB"}
|
|
@ -0,0 +1,33 @@
|
|||
import { AuthService } from '../services/auth/auth.service';
|
||||
import { Component, Input } from "@angular/core";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
|
||||
@Component({
|
||||
selector: 'unauthorized-component',
|
||||
templateUrl: './unauthorized.component.html'
|
||||
})
|
||||
export class UnauthorizedComponent {
|
||||
@Input()
|
||||
public message: string;
|
||||
constructor(
|
||||
private authService: AuthService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
) { }
|
||||
|
||||
ngAfterViewInit() {
|
||||
let returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
|
||||
let principal = this.authService.current();
|
||||
if (!principal) {
|
||||
this.router.navigate(['/login'], { queryParams: { returnUrl: returnUrl } });
|
||||
}
|
||||
else {
|
||||
this.authService.me().subscribe(
|
||||
principal => {
|
||||
if (!principal) this.router.navigate(['/login'], { queryParams: { returnUrl: returnUrl } });
|
||||
else this.router.navigate(["/"])
|
||||
},
|
||||
err => console.error('An error occurred', err));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"unauthorized.module.js","sourceRoot":"","sources":["unauthorized.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAmBtD,IAAa,kBAAkB;IAA/B;IAAkC,CAAC;IAAD,yBAAC;AAAD,CAAC,AAAnC,IAAmC;AAAtB,kBAAkB;IAlB9B,QAAQ,CAAC;QACN,OAAO,EAAE;YACL,YAAY;YACZ,WAAW;YACX,gBAAgB;YAChB,kBAAkB;YAClB,YAAY;SACf;QAED,YAAY,EAAE;YACV,qBAAqB;SACxB;QAED,OAAO,EAAE;YACL,qBAAqB;SACxB;KACJ,CAAC;GAEW,kBAAkB,CAAI;SAAtB,kBAAkB"}
|
|
@ -0,0 +1,29 @@
|
|||
import { CommonModule } from '@angular/common';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { UnauthorizedComponent } from './unauthorized.component';
|
||||
import { UnauthorizedRoutes } from './unauthorized.routes';
|
||||
//import { SharedModule } from '../shared/shared.module'
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
HttpClientModule,
|
||||
UnauthorizedRoutes
|
||||
// SharedModule
|
||||
],
|
||||
|
||||
declarations: [
|
||||
UnauthorizedComponent
|
||||
],
|
||||
|
||||
exports: [
|
||||
UnauthorizedComponent
|
||||
]
|
||||
})
|
||||
|
||||
export class UnauthorizedModule { }
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"unauthorized.routes.js","sourceRoot":"","sources":["unauthorized.routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAU,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,IAAM,MAAM,GAAW;IACnB,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE;CACjD,CAAC;AAEF,MAAM,CAAC,IAAM,kBAAkB,GAAG,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC"}
|
|
@ -0,0 +1,9 @@
|
|||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
import { UnauthorizedComponent } from './unauthorized.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', component: UnauthorizedComponent }
|
||||
];
|
||||
|
||||
export const UnauthorizedRoutes = RouterModule.forChild(routes);
|
|
@ -1234,6 +1234,7 @@
|
|||
"requires": {
|
||||
"anymatch": "1.3.2",
|
||||
"async-each": "1.0.1",
|
||||
"fsevents": "1.1.3",
|
||||
"glob-parent": "2.0.0",
|
||||
"inherits": "2.0.3",
|
||||
"is-binary-path": "1.0.1",
|
||||
|
@ -2829,6 +2830,910 @@
|
|||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
||||
"dev": true
|
||||
},
|
||||
"fsevents": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.3.tgz",
|
||||
"integrity": "sha512-WIr7iDkdmdbxu/Gh6eKEZJL6KPE74/5MEsf2whTOFNxbIoIixogroLdKYqB6FDav4Wavh/lZdzzd3b2KxIXC5Q==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"nan": "2.8.0",
|
||||
"node-pre-gyp": "0.6.39"
|
||||
},
|
||||
"dependencies": {
|
||||
"abbrev": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"ajv": {
|
||||
"version": "4.11.8",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"co": "4.6.0",
|
||||
"json-stable-stringify": "1.0.1"
|
||||
}
|
||||
},
|
||||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"aproba": {
|
||||
"version": "1.1.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"are-we-there-yet": {
|
||||
"version": "1.1.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"delegates": "1.0.0",
|
||||
"readable-stream": "2.2.9"
|
||||
}
|
||||
},
|
||||
"asn1": {
|
||||
"version": "0.2.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"assert-plus": {
|
||||
"version": "0.2.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"asynckit": {
|
||||
"version": "0.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"aws-sign2": {
|
||||
"version": "0.6.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"aws4": {
|
||||
"version": "1.6.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "0.4.2",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"bcrypt-pbkdf": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"tweetnacl": "0.14.5"
|
||||
}
|
||||
},
|
||||
"block-stream": {
|
||||
"version": "0.0.9",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"inherits": "2.0.3"
|
||||
}
|
||||
},
|
||||
"boom": {
|
||||
"version": "2.10.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"hoek": "2.16.3"
|
||||
}
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.7",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"balanced-match": "0.4.2",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"buffer-shims": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"caseless": {
|
||||
"version": "0.12.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"co": {
|
||||
"version": "4.6.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"combined-stream": {
|
||||
"version": "1.0.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"delayed-stream": "1.0.0"
|
||||
}
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"cryptiles": {
|
||||
"version": "2.0.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"boom": "2.10.1"
|
||||
}
|
||||
},
|
||||
"dashdash": {
|
||||
"version": "1.14.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"assert-plus": "1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"assert-plus": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "2.6.8",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"deep-extend": {
|
||||
"version": "0.4.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"delegates": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"detect-libc": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"ecc-jsbn": {
|
||||
"version": "0.1.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"jsbn": "0.1.1"
|
||||
}
|
||||
},
|
||||
"extend": {
|
||||
"version": "3.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"extsprintf": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"forever-agent": {
|
||||
"version": "0.6.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"form-data": {
|
||||
"version": "2.1.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"asynckit": "0.4.0",
|
||||
"combined-stream": "1.0.5",
|
||||
"mime-types": "2.1.15"
|
||||
}
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"fstream": {
|
||||
"version": "1.0.11",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "4.1.11",
|
||||
"inherits": "2.0.3",
|
||||
"mkdirp": "0.5.1",
|
||||
"rimraf": "2.6.1"
|
||||
}
|
||||
},
|
||||
"fstream-ignore": {
|
||||
"version": "1.0.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"fstream": "1.0.11",
|
||||
"inherits": "2.0.3",
|
||||
"minimatch": "3.0.4"
|
||||
}
|
||||
},
|
||||
"gauge": {
|
||||
"version": "2.7.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"aproba": "1.1.1",
|
||||
"console-control-strings": "1.1.0",
|
||||
"has-unicode": "2.0.1",
|
||||
"object-assign": "4.1.1",
|
||||
"signal-exit": "3.0.2",
|
||||
"string-width": "1.0.2",
|
||||
"strip-ansi": "3.0.1",
|
||||
"wide-align": "1.1.2"
|
||||
}
|
||||
},
|
||||
"getpass": {
|
||||
"version": "0.1.7",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"assert-plus": "1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"assert-plus": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.1.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fs.realpath": "1.0.0",
|
||||
"inflight": "1.0.6",
|
||||
"inherits": "2.0.3",
|
||||
"minimatch": "3.0.4",
|
||||
"once": "1.4.0",
|
||||
"path-is-absolute": "1.0.1"
|
||||
}
|
||||
},
|
||||
"graceful-fs": {
|
||||
"version": "4.1.11",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"har-schema": {
|
||||
"version": "1.0.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"har-validator": {
|
||||
"version": "4.2.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ajv": "4.11.8",
|
||||
"har-schema": "1.0.5"
|
||||
}
|
||||
},
|
||||
"has-unicode": {
|
||||
"version": "2.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"hawk": {
|
||||
"version": "3.1.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"boom": "2.10.1",
|
||||
"cryptiles": "2.0.5",
|
||||
"hoek": "2.16.3",
|
||||
"sntp": "1.0.9"
|
||||
}
|
||||
},
|
||||
"hoek": {
|
||||
"version": "2.16.3",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"http-signature": {
|
||||
"version": "1.1.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"assert-plus": "0.2.0",
|
||||
"jsprim": "1.4.0",
|
||||
"sshpk": "1.13.0"
|
||||
}
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"once": "1.4.0",
|
||||
"wrappy": "1.0.2"
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"is-fullwidth-code-point": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"number-is-nan": "1.0.1"
|
||||
}
|
||||
},
|
||||
"is-typedarray": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"isarray": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"isstream": {
|
||||
"version": "0.1.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"jodid25519": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"jsbn": "0.1.1"
|
||||
}
|
||||
},
|
||||
"jsbn": {
|
||||
"version": "0.1.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"json-schema": {
|
||||
"version": "0.2.3",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"json-stable-stringify": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"jsonify": "0.0.0"
|
||||
}
|
||||
},
|
||||
"json-stringify-safe": {
|
||||
"version": "5.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"jsonify": {
|
||||
"version": "0.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"jsprim": {
|
||||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"assert-plus": "1.0.0",
|
||||
"extsprintf": "1.0.2",
|
||||
"json-schema": "0.2.3",
|
||||
"verror": "1.3.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"assert-plus": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.27.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.15",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mime-db": "1.27.0"
|
||||
}
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"brace-expansion": "1.1.7"
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node-pre-gyp": {
|
||||
"version": "0.6.39",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"detect-libc": "1.0.2",
|
||||
"hawk": "3.1.3",
|
||||
"mkdirp": "0.5.1",
|
||||
"nopt": "4.0.1",
|
||||
"npmlog": "4.1.0",
|
||||
"rc": "1.2.1",
|
||||
"request": "2.81.0",
|
||||
"rimraf": "2.6.1",
|
||||
"semver": "5.3.0",
|
||||
"tar": "2.2.1",
|
||||
"tar-pack": "3.4.0"
|
||||
}
|
||||
},
|
||||
"nopt": {
|
||||
"version": "4.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"abbrev": "1.1.0",
|
||||
"osenv": "0.1.4"
|
||||
}
|
||||
},
|
||||
"npmlog": {
|
||||
"version": "4.1.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"are-we-there-yet": "1.1.4",
|
||||
"console-control-strings": "1.1.0",
|
||||
"gauge": "2.7.4",
|
||||
"set-blocking": "2.0.0"
|
||||
}
|
||||
},
|
||||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"oauth-sign": {
|
||||
"version": "0.8.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"wrappy": "1.0.2"
|
||||
}
|
||||
},
|
||||
"os-homedir": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"os-tmpdir": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"osenv": {
|
||||
"version": "0.1.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"os-homedir": "1.0.2",
|
||||
"os-tmpdir": "1.0.2"
|
||||
}
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"performance-now": {
|
||||
"version": "0.2.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"process-nextick-args": {
|
||||
"version": "1.0.7",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"punycode": {
|
||||
"version": "1.4.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"qs": {
|
||||
"version": "6.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"rc": {
|
||||
"version": "1.2.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"deep-extend": "0.4.2",
|
||||
"ini": "1.3.4",
|
||||
"minimist": "1.2.0",
|
||||
"strip-json-comments": "2.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "2.2.9",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"buffer-shims": "1.0.0",
|
||||
"core-util-is": "1.0.2",
|
||||
"inherits": "2.0.3",
|
||||
"isarray": "1.0.0",
|
||||
"process-nextick-args": "1.0.7",
|
||||
"string_decoder": "1.0.1",
|
||||
"util-deprecate": "1.0.2"
|
||||
}
|
||||
},
|
||||
"request": {
|
||||
"version": "2.81.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"aws-sign2": "0.6.0",
|
||||
"aws4": "1.6.0",
|
||||
"caseless": "0.12.0",
|
||||
"combined-stream": "1.0.5",
|
||||
"extend": "3.0.1",
|
||||
"forever-agent": "0.6.1",
|
||||
"form-data": "2.1.4",
|
||||
"har-validator": "4.2.1",
|
||||
"hawk": "3.1.3",
|
||||
"http-signature": "1.1.1",
|
||||
"is-typedarray": "1.0.0",
|
||||
"isstream": "0.1.2",
|
||||
"json-stringify-safe": "5.0.1",
|
||||
"mime-types": "2.1.15",
|
||||
"oauth-sign": "0.8.2",
|
||||
"performance-now": "0.2.0",
|
||||
"qs": "6.4.0",
|
||||
"safe-buffer": "5.0.1",
|
||||
"stringstream": "0.0.5",
|
||||
"tough-cookie": "2.3.2",
|
||||
"tunnel-agent": "0.6.0",
|
||||
"uuid": "3.0.1"
|
||||
}
|
||||
},
|
||||
"rimraf": {
|
||||
"version": "2.6.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"glob": "7.1.2"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.3.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"set-blocking": {
|
||||
"version": "2.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "3.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"sntp": {
|
||||
"version": "1.0.9",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"hoek": "2.16.3"
|
||||
}
|
||||
},
|
||||
"sshpk": {
|
||||
"version": "1.13.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"asn1": "0.2.3",
|
||||
"assert-plus": "1.0.0",
|
||||
"bcrypt-pbkdf": "1.0.1",
|
||||
"dashdash": "1.14.1",
|
||||
"ecc-jsbn": "0.1.1",
|
||||
"getpass": "0.1.7",
|
||||
"jodid25519": "1.0.2",
|
||||
"jsbn": "0.1.1",
|
||||
"tweetnacl": "0.14.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"assert-plus": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"string-width": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"code-point-at": "1.1.0",
|
||||
"is-fullwidth-code-point": "1.0.0",
|
||||
"strip-ansi": "3.0.1"
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.0.1"
|
||||
}
|
||||
},
|
||||
"stringstream": {
|
||||
"version": "0.0.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "3.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-regex": "2.1.1"
|
||||
}
|
||||
},
|
||||
"strip-json-comments": {
|
||||
"version": "2.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"tar": {
|
||||
"version": "2.2.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"block-stream": "0.0.9",
|
||||
"fstream": "1.0.11",
|
||||
"inherits": "2.0.3"
|
||||
}
|
||||
},
|
||||
"tar-pack": {
|
||||
"version": "3.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"debug": "2.6.8",
|
||||
"fstream": "1.0.11",
|
||||
"fstream-ignore": "1.0.5",
|
||||
"once": "1.4.0",
|
||||
"readable-stream": "2.2.9",
|
||||
"rimraf": "2.6.1",
|
||||
"tar": "2.2.1",
|
||||
"uid-number": "0.0.6"
|
||||
}
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "2.3.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"punycode": "1.4.1"
|
||||
}
|
||||
},
|
||||
"tunnel-agent": {
|
||||
"version": "0.6.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.0.1"
|
||||
}
|
||||
},
|
||||
"tweetnacl": {
|
||||
"version": "0.14.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"uid-number": {
|
||||
"version": "0.0.6",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
},
|
||||
"uuid": {
|
||||
"version": "3.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"verror": {
|
||||
"version": "1.3.6",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"extsprintf": "1.0.2"
|
||||
}
|
||||
},
|
||||
"wide-align": {
|
||||
"version": "1.1.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"string-width": "1.0.2"
|
||||
}
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"fstream": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz",
|
||||
|
@ -6456,11 +7361,11 @@
|
|||
}
|
||||
},
|
||||
"rxjs": {
|
||||
"version": "5.4.3",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.4.3.tgz",
|
||||
"integrity": "sha512-fSNi+y+P9ss+EZuV0GcIIqPUK07DEaMRUtLJvdcvMyFjc9dizuDjere+A4V7JrLGnm9iCc+nagV/4QdMTkqC4A==",
|
||||
"version": "5.5.6",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.6.tgz",
|
||||
"integrity": "sha512-v4Q5HDC0FHAQ7zcBX7T2IL6O5ltl1a2GX4ENjPXg6SjDY69Cmx9v4113C99a4wGF16ClPv5Z8mghuYorVkg/kg==",
|
||||
"requires": {
|
||||
"symbol-observable": "1.0.4"
|
||||
"symbol-observable": "1.0.1"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
|
@ -7136,9 +8041,9 @@
|
|||
}
|
||||
},
|
||||
"symbol-observable": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.4.tgz",
|
||||
"integrity": "sha1-Kb9hXUqnEhvdiYsi1LP5vE4qoD0="
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.1.tgz",
|
||||
"integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ="
|
||||
},
|
||||
"tapable": {
|
||||
"version": "0.2.8",
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
"@ngx-translate/core": "^9.0.1",
|
||||
"@ngx-translate/http-loader": "^2.0.0",
|
||||
"core-js": "^2.4.1",
|
||||
"rxjs": "^5.4.2",
|
||||
"rxjs": "5.5.6",
|
||||
"zone.js": "^0.8.17"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -10,6 +10,7 @@ const appRoutes: Routes = [
|
|||
{ 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: 'form', loadChildren: './dataset-profile-form/dataset-profile.module#DatasetProfileModule', canActivate: [AuthGuard]},
|
||||
{ path: 'welcome', component: HomepageComponent, canActivate: [AuthGuard] },
|
||||
{ path: '', redirectTo: '/welcome', pathMatch: 'full' },
|
||||
{ path: "unauthorized", loadChildren: './unauthorized/unauthorized.module#UnauthorizedModule' }
|
||||
|
|
|
@ -30,6 +30,7 @@ import { HomepageComponent } from './homepage/homepage.component';
|
|||
import { PageNotFoundComponent } from './not-found.component';
|
||||
import { AppComponent } from './app.component';
|
||||
import { NgModule } from "@angular/core";
|
||||
import { DatasetProfileModule } from './dataset-profile-form/dataset-profile.module';
|
||||
|
||||
|
||||
@NgModule({
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
<div>
|
||||
<label>
|
||||
<input type="checkbox" [(ngModel)]="isComposite" (ngModelChange)="onIsCompositeChange(isComposite)" /> Composite Field</label>
|
||||
<label>
|
||||
<input type="checkbox" [(ngModel)]="isMultiplicityEnabled" (ngModelChange)="onIsMultiplicityEnabledChange(isMultiplicityEnabled)"
|
||||
/> Multiplicity</label>
|
||||
<div [formGroup]="form">
|
||||
<label>
|
||||
<input type="checkbox" formControlName="hasCommentField" /> Comment</label>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<label>FieldSet Label</label>
|
||||
<input data-toggle="tooltip" title="tooltip on second input!" type="text" class="form-control" formControlName="title">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label>Description</label>
|
||||
<input type="text" class="form-control" formControlName="description">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label>ExtendedDescription</label>
|
||||
<input type="text" class="form-control" formControlName="extendedDescription">
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="isMultiplicityEnabled" formGroupName="multiplicity">
|
||||
<div>
|
||||
<h5 style="margin-left:15px; font-weight:bold;">Multiplicity</h5>
|
||||
<div class="col-md-2">
|
||||
<label>Min</label>
|
||||
<input type="number" class="form-control" formControlName="min">
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<label>Max</label>
|
||||
<input type="number" class="form-control" formControlName="max">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="isComposite" class="col-md-4">
|
||||
<label>Ordinal</label>
|
||||
<input type="number" class="form-control" formControlName="ordinal">
|
||||
</div>
|
||||
<div *ngIf="isComposite" class="col-md-4">
|
||||
<label>Id</label>
|
||||
<input type="string" class="form-control" formControlName="id">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<field-form *ngIf="!isComposite" [form]="form.get('fields').get(''+0)" [dataModel]="dataModel.fields[0]" [showMultiplicity]="false"
|
||||
[indexPath]="indexPath + 'f' + 0"></field-form>
|
||||
|
||||
<div *ngIf="isComposite" class="panel-group" style="margin-top:10px;">
|
||||
<div *ngFor="let field of dataModel.fields let i=index;" class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
<a *ngIf="form.get('fields').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 'f' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}. {{form.get('fields').get(''+i).get('title').value}}</a>
|
||||
<a *ngIf="!form.get('fields').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 'f' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}. Child Field {{i + 1}}</a>
|
||||
<div class="btn-group pull-right">
|
||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteField(i);">
|
||||
<span class="glyphicon glyphicon-erase"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="{{indexPath + 'f' + i}}" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<field-form [form]="form.get('fields').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'f' + i"></field-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="isComposite">
|
||||
<a (click)="addNewField()" style="cursor: pointer">
|
||||
Add Child Field +
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,57 @@
|
|||
import { Component, Input } from '@angular/core';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { FieldSet } from 'app/models/datasetProfileAdmin/FieldSet';
|
||||
import { Field } from 'app/models/datasetProfileAdmin/Field';
|
||||
import { FormArray, FormControl } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'compositefield-form',
|
||||
templateUrl: './compositefield-form.component.html',
|
||||
styleUrls: []
|
||||
})
|
||||
|
||||
export class CompositeFieldFormComponent {
|
||||
@Input() form: FormGroup;
|
||||
@Input() dataModel: FieldSet;
|
||||
@Input() indexPath: string;
|
||||
|
||||
isComposite: boolean = false;
|
||||
isMultiplicityEnabled: boolean = false;
|
||||
|
||||
constructon() { }
|
||||
|
||||
ngOnInit() {
|
||||
//this.addNewField();
|
||||
if(this.form.get("multiplicity"))
|
||||
if (this.form.get("multiplicity").value.min >1 || this.form.get("multiplicity").value.max >1 )
|
||||
this.isMultiplicityEnabled= true;
|
||||
this.isComposite = this.dataModel.fields.length > 1;
|
||||
}
|
||||
|
||||
onIsCompositeChange(isComposite: boolean) {
|
||||
if (!isComposite && (<FormArray>this.form.get("fields")).length > 1) {
|
||||
for(let i = 0; i < (<FormArray>this.form.get("fields")).length - 1; i++) {
|
||||
(<FormArray>this.form.get("fields")).removeAt(1);
|
||||
}
|
||||
this.dataModel.fields.splice(1);
|
||||
}
|
||||
}
|
||||
|
||||
onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) {
|
||||
if (!isMultiplicityEnabled) {
|
||||
(<FormControl>this.form.get('multiplicity').get("min")).setValue(0);
|
||||
(<FormControl>this.form.get('multiplicity').get("max")).setValue(0);
|
||||
}
|
||||
}
|
||||
|
||||
addNewField() {
|
||||
let field: Field = new Field();
|
||||
this.dataModel.fields.push(field);
|
||||
(<FormArray>this.form.get("fields")).push(field.buildForm());
|
||||
}
|
||||
|
||||
DeleteField(index) {
|
||||
this.dataModel.fields.splice(index, 1);
|
||||
(<FormArray>this.form.get("fields")).removeAt(index);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
import { NgModule } from "@angular/core";
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule,ReactiveFormsModule } from '@angular/forms';
|
||||
|
||||
import { DatasetProfileRoutes } from "./dataset-profile.router";
|
||||
import { RouterModule } from "@angular/router";
|
||||
|
||||
import { FormComponent } from './form/form.component';
|
||||
//import { GroupFieldFormComponent } from './groupfield-form/groupfield-form.component';
|
||||
import { RuleFormComponent } from './rule-component/rule.component';
|
||||
import { SectionFormComponent } from './section-form/section-form.component';
|
||||
import { PageFormComponent } from './page-form/page-component';
|
||||
import { CompositeFieldFormComponent } from './compositefield-form/compositefield-form.component';
|
||||
import { FieldFormComponent } from './field-form/field-form.component';
|
||||
import { HttpClientModule, HttpClient } from "@angular/common/http";
|
||||
|
||||
import { CheckBoxComponent } from '../shared/componentsAdmin/checkbox/checkbox-component';
|
||||
import { FreeTextData } from '../models/DataField/FreeTextData';
|
||||
import { BooleanDecisionComponent } from '../shared/componentsAdmin/booleanDecision/booleanDecision-component';
|
||||
import { FreeTextComponent } from '../shared/componentsAdmin/freetext/freetext-component';
|
||||
import { TextAreaComponent } from '../shared/componentsAdmin/textarea/textarea-component';
|
||||
import { RadioBoxComponent } from '../shared/componentsAdmin/radiobox/radiobox-component';
|
||||
import { WordlistComponent } from '../shared/componentsAdmin/wordlist/wordlist-component';
|
||||
import { AutocompleteComponent } from '../shared/componentsAdmin/autocomplete/autocomplete-component';
|
||||
import { ComboboxComponent } from '../shared/componentsAdmin/combobox/combobox-component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
HttpClientModule,
|
||||
ReactiveFormsModule,
|
||||
RouterModule,
|
||||
RouterModule.forChild(DatasetProfileRoutes)
|
||||
],
|
||||
|
||||
declarations: [
|
||||
FormComponent,
|
||||
//GroupFieldFormComponent,
|
||||
RuleFormComponent,
|
||||
SectionFormComponent,
|
||||
PageFormComponent,
|
||||
CompositeFieldFormComponent,
|
||||
FieldFormComponent,
|
||||
TextAreaComponent,
|
||||
CheckBoxComponent,
|
||||
BooleanDecisionComponent,
|
||||
FreeTextComponent,
|
||||
ComboboxComponent,
|
||||
AutocompleteComponent,
|
||||
WordlistComponent,
|
||||
RadioBoxComponent
|
||||
],
|
||||
|
||||
exports: [
|
||||
FormComponent,
|
||||
//GroupFieldFormComponent,
|
||||
RuleFormComponent,
|
||||
SectionFormComponent,
|
||||
PageFormComponent,
|
||||
CompositeFieldFormComponent,
|
||||
FieldFormComponent,
|
||||
TextAreaComponent,
|
||||
CheckBoxComponent,
|
||||
BooleanDecisionComponent,
|
||||
FreeTextComponent,
|
||||
ComboboxComponent,
|
||||
AutocompleteComponent,
|
||||
WordlistComponent,
|
||||
RadioBoxComponent
|
||||
],
|
||||
providers:[
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
export class DatasetProfileModule { }
|
|
@ -0,0 +1,15 @@
|
|||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { FormComponent } from 'app/dataset-profile-form/form/form.component';
|
||||
|
||||
export const DatasetProfileRoutes: Routes = [
|
||||
//{ path: "new/:dmpId", component: DatasetWizardComponent, canActivate: [AuthGuard] }
|
||||
{
|
||||
path: ':id',
|
||||
component: FormComponent
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
component: FormComponent
|
||||
}
|
||||
|
||||
];
|
|
@ -0,0 +1,120 @@
|
|||
<div>
|
||||
<div [formGroup]="form">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<label>Id</label>
|
||||
<input type="text" class="form-control" formControlName="id">
|
||||
</div>
|
||||
<div class="form-row col-md-6">
|
||||
<div formGroupName="viewStyle">
|
||||
<div class="form-group">
|
||||
<label>View style</label>
|
||||
<select class="form-control" formControlName="renderStyle" (change)= "onchangeCombo($event)">
|
||||
<option value="textarea">textarea</option>
|
||||
<option value="booleanDecision">booleanDecision</option>
|
||||
<option value='combobox'>combobox</option>
|
||||
<option value="checkBox">checkBox</option>
|
||||
<option value="freetext">freetext</option>
|
||||
<option value="radiobox">radiobox</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form" [ngSwitch]="form.get('viewStyle').get('renderStyle').value">
|
||||
<div *ngSwitchCase="'combobox'">
|
||||
<combobox-component [form]="form" [dataModel]="dataModel"></combobox-component>
|
||||
</div>
|
||||
<div *ngSwitchCase="'radiobox'">
|
||||
<radiobox-component [form]="form" [dataModel]="dataModel"></radiobox-component>
|
||||
</div>
|
||||
<div *ngSwitchCase="'freetext'">
|
||||
<freetext-component [form]="form" [dataModel]="dataModel"></freetext-component>
|
||||
</div>
|
||||
<div *ngSwitchCase="'textarea'">
|
||||
<textarea-component [form]="form" [dataModel]="dataModel"></textarea-component>
|
||||
</div>
|
||||
<div *ngSwitchCase="'booleanDecision'">
|
||||
<booleanDecision-component [form]="form" [dataModel]="dataModel"></booleanDecision-component>
|
||||
</div>
|
||||
<div *ngSwitchCase="'checkBox'">
|
||||
<checkbox-component [form]="form" [dataModel]="dataModel"></checkbox-component>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<label>description</label>
|
||||
<input type="text" class="form-control" formControlName="description">
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>extendedDescription</label>
|
||||
<input type="text" class="form-control" formControlName="extendedDescription">
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="row">
|
||||
<div *ngIf="isFieldMultiplicityEnabled" formGroupName="multiplicity">
|
||||
<div class="form-group">
|
||||
<h5 style="margin-left:15px; font-weight:bold;">Multiplicity</h5>
|
||||
<div class="col-md-2">
|
||||
<label>Min</label>
|
||||
<input type="number" class="form-control" formControlName="min">
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<label>Max</label>
|
||||
<input type="number" class="form-control" formControlName="max">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label>Ordinal</label>
|
||||
<input type="number" class="form-control" formControlName="ordinal">
|
||||
</div>
|
||||
<div formGroupName="defaultValue">
|
||||
<div class="form-group col-md-5">
|
||||
<label>Default Value</label>
|
||||
<input type="text" class="form-control" formControlName="value">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<label>Validation</label>
|
||||
<div formArrayName="validations">
|
||||
<div *ngFor="let validation of form.controls.validations.controls; let i=index">
|
||||
<select class="form-control" [formControlName]="i">
|
||||
<option *ngFor= "let option of validationsOptions" [value]="option.key">{{option.value}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<label *ngIf="showMultiplicity">
|
||||
<input type="checkbox" [(ngModel)]="isFieldMultiplicityEnabled" (ngModelChange)="onIsFieldMultiplicityEnabledChange(isFieldMultiplicityEnabled)"
|
||||
/> Multiplicity</label>
|
||||
|
||||
<div class="panel-group" style="margin-top:10px;">
|
||||
<div *ngFor="let rule of dataModel.visible.rules let i=index;" class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
<a data-toggle="collapse" href="#{{indexPath + 'r' + i}}" class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. Rule {{i + 1}}</a>
|
||||
|
||||
<div class="btn-group pull-right">
|
||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteRule(i);">
|
||||
<span class="glyphicon glyphicon-erase"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="{{indexPath + 'r' + i}}" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<rule-form [form]="form.get('visible').get('rules').get(''+i)" [dataModel]="rule"></rule-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<a (click)="addNewRule()" style="cursor: pointer">
|
||||
Add Rule +
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { FormGroup, FormControl, FormArray } from '@angular/forms';
|
||||
import { ValidationTypes } from '@app/models/common/ValidationTypes';
|
||||
import { Field } from '@app/models/datasetProfileAdmin/Field';
|
||||
import { Rule } from '@app/models/datasetProfileAdmin/Rule';
|
||||
|
||||
@Component({
|
||||
selector: 'field-form',
|
||||
templateUrl: './field-form.component.html',
|
||||
styleUrls: []
|
||||
})
|
||||
|
||||
export class FieldFormComponent {
|
||||
@Input() form: FormGroup;
|
||||
@Input() dataModel: Field;
|
||||
@Input() showMultiplicity: boolean = true;
|
||||
@Input() indexPath: string;
|
||||
validationsOptions: Array<any>;
|
||||
isFieldMultiplicityEnabled: boolean = false;
|
||||
|
||||
constructon() {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.form.get("multiplicity"))
|
||||
if (this.form.get("multiplicity").value.min > 1 || this.form.get("multiplicity").value.max > 1)
|
||||
this.isFieldMultiplicityEnabled = true;
|
||||
this.validationsOptions = [{ key: 0, value: ValidationTypes[0] }, { key: 1, value: ValidationTypes[1] }]
|
||||
// this.addNewRule();
|
||||
}
|
||||
|
||||
onIsFieldMultiplicityEnabledChange(isFieldMultiplicityEnabled: boolean) {
|
||||
if (!isFieldMultiplicityEnabled) {
|
||||
(<FormControl>this.form.get('multiplicity').get("min")).setValue(0);
|
||||
(<FormControl>this.form.get('multiplicity').get("max")).setValue(0);
|
||||
}
|
||||
}
|
||||
|
||||
addNewRule() {
|
||||
let rule: Rule = new Rule();
|
||||
this.dataModel.visible.rules.push(rule);
|
||||
(<FormArray>this.form.get("visible").get("rules")).push(rule.buildForm());
|
||||
}
|
||||
|
||||
DeleteRule(index) {
|
||||
this.dataModel.visible.rules.splice(index, 1);
|
||||
(<FormArray>this.form.get("visible").get("rules")).removeAt(index);
|
||||
}
|
||||
|
||||
onchangeCombo() {
|
||||
if (this.form.get("data")) this.form.removeControl("data");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
<div class="container">
|
||||
<div style="background-color: #f5f5f5;border: 1px solid #e3e3e3;padding: 24px;">
|
||||
<form *ngIf="form" novalidate [formGroup]="form" (ngSubmit)="onSubmit()">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-12">
|
||||
<label>Label</label>
|
||||
<input type="text" class="form-control" formControlName="label">
|
||||
<div *ngIf="form.get('label').invalid && (form.get('label').dirty || form.get('label').touched)">
|
||||
<div *ngIf="form.get('label').errors.required" class="alert alert-danger">
|
||||
Label is required.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-group" style="margin-top:10px;">
|
||||
<div *ngFor="let section of dataModel.sections; let i=index;" class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
<a *ngIf="form.get('sections').get(''+i).get('title').value" data-toggle="collapse" href="#{{'s' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</a>
|
||||
<a *ngIf="!form.get('sections').get(''+i).get('title').value" data-toggle="collapse" href="#{{'s' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}. Section {{i + 1}}</a>
|
||||
<div class="btn-group pull-right">
|
||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteSection(i);">
|
||||
<span class="glyphicon glyphicon-erase"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="{{'s' + i}}" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="'s' + i"></section-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-group" style="margin-top:10px;">
|
||||
<div *ngFor="let page of dataModel.pages; let i=index;" class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
<a *ngIf="form.get('pages').at(i).get('title').value" data-toggle="collapse" href="#{{'p' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}.{{form.get('pages').at(i).get('title').value}}</a>
|
||||
<a *ngIf="!form.get('pages').at(i).get('title').value" data-toggle="collapse" href="#{{'p' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}. Page{{i + 1}}</a>
|
||||
<div class="btn-group pull-right">
|
||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeletePage(i);">
|
||||
<span class="glyphicon glyphicon-erase"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="{{'p' + i}}" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<page-form [form]="form.get('pages').at(i)" [dataModel]="page"></page-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-top:20px; padding-left: 15px;" class="row">
|
||||
<a (click)="addSection()" style="cursor: pointer">
|
||||
Add Section +
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div style="margin-top:20px; padding-left: 15px;" class="row">
|
||||
<a (click)="addPage()" style="cursor: pointer">
|
||||
Add Page +
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary" style="margin-top:20px;" type="submit" [disabled]="!form.valid">Save</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,89 @@
|
|||
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
||||
import { DatasetProfileService } from '../../services/dataset-profile.service';
|
||||
import { DatasetProfileModelAdmin } from '../../models/datasetProfileAdmin/DatasetProfileModelAdmin';
|
||||
import { Page } from '../../models/datasetProfileAdmin/Page';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormGroup, FormControl } from '@angular/forms';
|
||||
import { SectionFormComponent } from '../section-form/section-form.component';
|
||||
import { FormArray } from '@angular/forms';
|
||||
import { Router, ActivatedRoute, ParamMap, Params } from '@angular/router';
|
||||
import { PageFormComponent } from '../page-form/page-component'
|
||||
import { DatasetProfileAdmin } from '@app/services/datasetProfileAdmin/datasetProfileAfmin.service';
|
||||
import { Section } from '@app/models/datasetProfileAdmin/Section';
|
||||
|
||||
@Component({
|
||||
selector: 'form-comp',
|
||||
templateUrl: './form.component.html',
|
||||
providers:[DatasetProfileAdmin, DatasetProfileService],
|
||||
styleUrls: []
|
||||
})
|
||||
|
||||
export class FormComponent {
|
||||
|
||||
dataModel: DatasetProfileModelAdmin;
|
||||
form: FormGroup;
|
||||
private profileID: string;
|
||||
|
||||
constructor(public datasetprofileAdmin: DatasetProfileAdmin, private datasetProfileService: DatasetProfileService, private route: ActivatedRoute) {
|
||||
this.profileID = route.snapshot.params['id'];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.dataModel = JsonSerializer.fromJSONObject(new DatasetProfileModelAdmin(), DatasetProfileModelAdmin);
|
||||
this.form = this.dataModel.buildForm();
|
||||
if (this.profileID) {
|
||||
this.datasetProfileService.getDatasetProfileById(this.profileID).subscribe((data) => {
|
||||
this.dataModel = JsonSerializer.fromJSONObject(data, DatasetProfileModelAdmin);
|
||||
this.form = this.dataModel.buildForm();
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.addSection();
|
||||
this.addPage(0);
|
||||
}
|
||||
}
|
||||
|
||||
onIsMultiplicityEnabledChange(isMultiplicityEnabled: boolean) {
|
||||
if (!isMultiplicityEnabled) {
|
||||
(<FormControl>this.form.get('multiplicity').get("min")).setValue(0);
|
||||
(<FormControl>this.form.get('multiplicity').get("max")).setValue(0);
|
||||
}
|
||||
}
|
||||
|
||||
addSection() {
|
||||
let section: Section = new Section();
|
||||
this.dataModel.sections.push(section);
|
||||
(<FormArray>this.form.get("sections")).push(section.buildForm());
|
||||
}
|
||||
|
||||
addPage(number) {
|
||||
let page: Page = new Page(this.dataModel.pages.length);
|
||||
this.dataModel.pages.push(page);
|
||||
(<FormArray>this.form.get("pages")).push(page.buildForm());
|
||||
}
|
||||
|
||||
DeleteSection(index) {
|
||||
this.dataModel.sections.splice(index, 1);
|
||||
(<FormArray>this.form.get("sections")).removeAt(index)
|
||||
}
|
||||
|
||||
DeletePage(index) {
|
||||
this.dataModel.pages.splice(index, 1);
|
||||
(<FormArray>this.form.get("pages")).removeAt(index)
|
||||
}
|
||||
|
||||
createForm(data) {
|
||||
return this.datasetprofileAdmin.createForm(data);
|
||||
}
|
||||
updateForm(id, data) {
|
||||
return this.datasetprofileAdmin.updateForm(id, data);
|
||||
}
|
||||
onSubmit() {
|
||||
let data = this.form.value;
|
||||
|
||||
if (this.profileID) this.updateForm(this.profileID, data).subscribe();
|
||||
else this.createForm(data).subscribe();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<div>
|
||||
<div [formGroup]="form" class="row">
|
||||
<div class="col-md-4">
|
||||
<label>Title</label>
|
||||
<input type="text" class="form-control" formControlName="title">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,19 @@
|
|||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { FormGroup } from '@angular/forms'
|
||||
import { Page } from '@app/models/datasetProfileAdmin/Page';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'page-form',
|
||||
templateUrl: './page-component.html',
|
||||
styleUrls: []
|
||||
})
|
||||
|
||||
export class PageFormComponent {
|
||||
@Input() form: FormGroup;
|
||||
@Input() dataModel: Page;
|
||||
|
||||
TargetValidation() {
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<div>
|
||||
<div [formGroup]="form">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label>Rule Type</label>
|
||||
<select class="form-control" formControlName="ruleType">
|
||||
<option>field value</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>Target</label>
|
||||
<input type="text" class="form-control" placeholder="field id" formControlName="target" (change)="TargetValidation()">
|
||||
</div>
|
||||
<!-- <div class="form-group col-md-4">
|
||||
<label>Rule style</label>
|
||||
<select class="form-control">
|
||||
<option>boolean</option>
|
||||
<option>checked</option>
|
||||
<option>unchecked</option>
|
||||
<option>dropdown value</option>
|
||||
</select>
|
||||
</div> -->
|
||||
<!-- <div class="form-group col-md-6">
|
||||
<label>Value Type</label>
|
||||
<input type="text" class="form-control" formControlName="valueType">
|
||||
</div> -->
|
||||
<div class="form-group col-md-12">
|
||||
<label>Value</label>
|
||||
<input type="text" class="form-control" formControlName="value">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,18 @@
|
|||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { FormGroup } from '@angular/forms'
|
||||
import { Rule } from 'app/models/datasetProfileAdmin/Rule'
|
||||
|
||||
@Component({
|
||||
selector: 'rule-form',
|
||||
templateUrl: './rule.component.html',
|
||||
styleUrls: []
|
||||
})
|
||||
|
||||
export class RuleFormComponent {
|
||||
@Input() form: FormGroup;
|
||||
@Input() dataModel: FormGroup;
|
||||
|
||||
TargetValidation(){
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
.section-container {
|
||||
background-color: #f5f5f5;
|
||||
border: 1px solid #e3e3e3;
|
||||
padding: 24px;
|
||||
}
|
|
@ -0,0 +1,124 @@
|
|||
<div class="section-container">
|
||||
<div class="row" [formGroup]="form">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<label>Title</label>
|
||||
<input type="text" class="form-control" formControlName="title">
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label>Id</label>
|
||||
<input type="text" class="form-control" formControlName="id">
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label>Ordinal</label>
|
||||
<input type="number" class="form-control" formControlName="ordinal">
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label>Page</label>
|
||||
<select class="form-control" formControlName="page">
|
||||
<option *ngFor="let pageGroup of form.root.get('pages').controls;" [value]="pageGroup.get('id').value">{{pageGroup.get('title').value}}</option>
|
||||
</select>
|
||||
<div *ngIf="form.get('page').invalid && (form.get('page').dirty || form.get('page').touched)" class="alert alert-danger">Page is required</div>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label class="radio control-label">Default Visibility</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" [value]="true" formControlName="defaultVisibility"> true
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" [value]="false" formControlName="defaultVisibility"> false
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="dataModel.sections.length > 0" class="panel-group" style="margin-top:10px;">
|
||||
<div *ngFor="let section of dataModel.sections; let i=index;" class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
<a *ngIf="form.get('sections').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 's' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</a>
|
||||
<a *ngIf="!form.get('sections').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 's' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}. Section {{i + 1}}</a>
|
||||
<div class="btn-group pull-right">
|
||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteSectionInSection(i);">
|
||||
<span class="glyphicon glyphicon-erase"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="{{indexPath + 's' + i}}" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="indexPath + 's' + i"></section-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <div *ngFor="let fieldGroup of dataModel.fieldGroups let i=index;">
|
||||
<groupfield-form [form]="form.get('fieldGroups').get(''+i)" [dataModel]="fieldGroup" [indexPath]="indexPath + 'g' + i"></groupfield-form>
|
||||
</div> -->
|
||||
|
||||
<div class="panel-group" style="margin-top:10px;">
|
||||
<div *ngFor="let field of dataModel.fieldSets let i=index;" class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
<!-- <a *ngIf="form.get('compositeFields').get(''+i).get('title').value" data-toggle="collapse" href="#{{'compositeFieldCollapse' + i}}"
|
||||
class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. {{form.get('compositeFields').get(''+i).get('title').value}}</a>
|
||||
<a *ngIf="!form.get('compositeFields').get(''+i).get('title').value" data-toggle="collapse" href="#{{'compositeFieldCollapse' + i}}"
|
||||
class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. Field {{i + 1}}</a> -->
|
||||
<a data-toggle="collapse" href="#{{indexPath + 'cf' + i}}"
|
||||
class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. Field {{i + 1}}</a>
|
||||
|
||||
<div class="btn-group pull-right">
|
||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteFieldSet(i);">
|
||||
<span class="glyphicon glyphicon-erase"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="{{indexPath + 'cf' + i}}" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<compositefield-form [form]="form.get('fieldSets').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'cf' + i"></compositefield-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div *ngIf="dataModel.fieldGroups" class="panel-group" style="margin-top:10px;">
|
||||
<div *ngFor="let fieldGroup of dataModel.fieldGroups let i=index;" class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
<a *ngIf="form.get('fieldGroups').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 'g' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}. {{form.get('fieldGroups').get(''+i).get('title').value}}</a>
|
||||
<a *ngIf="!form.get('fieldGroups').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 'g' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}. Group {{i + 1}}</a>
|
||||
<div class="btn-group pull-right">
|
||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteFieldGroup(i);">
|
||||
<span class="glyphicon glyphicon-erase"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="{{indexPath + 'g' + i}}" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<groupfield-form [form]="form.get('fieldGroups').get(''+i)" [dataModel]="fieldGroup" [indexPath]="indexPath + 'g' + i"></groupfield-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- <div>
|
||||
<a (click)="addGroupField()" style="cursor: pointer">
|
||||
Add Group +
|
||||
</a>
|
||||
</div> -->
|
||||
<div>
|
||||
<a (click)="addField()" style="cursor: pointer">
|
||||
Add Field +
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<a (click)="addSectioninSection()" style="cursor: pointer">
|
||||
Add Section +
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,63 @@
|
|||
import { Component, OnInit, Input, ViewEncapsulation } from '@angular/core';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { Section } from 'app/models/datasetProfileAdmin/Section';
|
||||
import { FormArray } from '@angular/forms';
|
||||
import { DatasetProfileModel } from 'app/models/DataSetProfile/DatasetProfileModel';
|
||||
import { FieldSet } from 'app/models/datasetProfileAdmin/FieldSet';
|
||||
import { Field } from 'app/models/datasetProfileAdmin/Field';
|
||||
import { Page } from 'app/models/datasetProfileAdmin/Page';
|
||||
import { JsonSerializer } from 'app/utilities/JsonSerializer';
|
||||
|
||||
@Component({
|
||||
selector: 'section-form',
|
||||
templateUrl: './section-form.component.html',
|
||||
styleUrls: ['./section-form.component.css'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
|
||||
export class SectionFormComponent {
|
||||
@Input() form: FormGroup;
|
||||
@Input() dataModel: Section;
|
||||
@Input() indexPath: string;
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
var self = this;
|
||||
this.form.root.get("pages").valueChanges.subscribe(function (value) {
|
||||
self.keepPageSelectionValid(value);
|
||||
});
|
||||
}
|
||||
|
||||
addField() {
|
||||
let fieldSet: FieldSet = new FieldSet();
|
||||
let field: Field = new Field();
|
||||
fieldSet.fields.push(field);
|
||||
if (this.dataModel.fieldSets)
|
||||
this.dataModel.fieldSets.push(fieldSet);
|
||||
(<FormArray>this.form.get("fieldSets")).push(fieldSet.buildForm());
|
||||
}
|
||||
|
||||
addSectioninSection() {
|
||||
let section: Section = new Section();
|
||||
this.dataModel.sections.push(section);
|
||||
(<FormArray>this.form.get("sections")).push(section.buildForm());
|
||||
}
|
||||
|
||||
DeleteSectionInSection(index) {
|
||||
this.dataModel.sections.splice(index);
|
||||
(<FormArray>this.form.get("sections")).removeAt(index);
|
||||
}
|
||||
|
||||
DeleteFieldSet(index) {
|
||||
this.dataModel.fieldSets.splice(index, 1);
|
||||
(<FormArray>this.form.get("fieldSets")).removeAt(index);
|
||||
}
|
||||
|
||||
keepPageSelectionValid(pagesJson: Array<any>) {
|
||||
let selectedPage = this.form.get("page").value as String;
|
||||
let pages: Array<Page> = JsonSerializer.fromJSONArray(pagesJson, Page);
|
||||
if (pages.find(elem => elem.id === selectedPage) === undefined)
|
||||
this.form.get("page").reset();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
import { DataField } from './DataField';
|
||||
import { FormGroup } from '@angular/forms'
|
||||
|
||||
export class AutocompleteData extends DataField<AutocompleteData>{
|
||||
|
||||
public type:string;
|
||||
public url:string;
|
||||
|
||||
buildForm():FormGroup{
|
||||
return this.formBuilder.group({
|
||||
label:[this.label],
|
||||
type:[this.type],
|
||||
url:[this.url]
|
||||
})
|
||||
}
|
||||
|
||||
fromJSONObject(item:any):AutocompleteData{
|
||||
this.type = item.type;
|
||||
this.url = item.url;
|
||||
this.label = item.label;
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
import { DataField } from './DataField';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
export class BooleanDecisionData extends DataField<BooleanDecisionData>{
|
||||
|
||||
buildForm():FormGroup{
|
||||
let formGroup = this.formBuilder.group({
|
||||
label:this.label
|
||||
});
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
fromJSONObject(item:any):BooleanDecisionData{
|
||||
this.label = item.label
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
import { DataField } from './DataField';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
export class CheckBoxData extends DataField<CheckBoxData>{
|
||||
|
||||
buildForm():FormGroup{
|
||||
let formGroup = this.formBuilder.group({
|
||||
label:this.label
|
||||
});
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
fromJSONObject(item:any):CheckBoxData{
|
||||
this.label = item.label
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
import { BaseModel } from '../BaseModel';
|
||||
import { FormGenerator } from '../interfaces/FormGenerator';
|
||||
import { Serializable } from '../interfaces/Serializable';
|
||||
import { FormGroup } from '@angular/forms'
|
||||
export abstract class DataField<T> extends BaseModel implements Serializable<T>,FormGenerator<FormGroup>{
|
||||
public label:string;
|
||||
|
||||
buildForm():FormGroup{
|
||||
throw new Error("Build Form Is not not correctly overriden");
|
||||
}
|
||||
|
||||
fromJSONObject(item:any):T{
|
||||
throw new Error("From Json Object is not correctly overriden")
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
import { DataField } from './DataField';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
export class FreeTextData extends DataField<FreeTextData>{
|
||||
|
||||
buildForm():FormGroup{
|
||||
let formGroup = this.formBuilder.group({
|
||||
label:this.label
|
||||
});
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
fromJSONObject(item:any):FreeTextData{
|
||||
this.label = item.label
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
||||
import { DataField } from './DataField';
|
||||
import { ListingItem } from '../Common/ListingItem';
|
||||
import { FormGroup } from '@angular/forms'
|
||||
|
||||
export class RadioBoxData extends DataField<RadioBoxData>{
|
||||
public options:Array<ListingItem>;
|
||||
|
||||
buildForm():FormGroup{
|
||||
let formGroup = this.formBuilder.group({
|
||||
label:[this.label]
|
||||
});
|
||||
let optionsFormArray = new Array<FormGroup>();
|
||||
if (this.options) {
|
||||
this.options.forEach(item => {
|
||||
let form: FormGroup = item.buildForm();
|
||||
optionsFormArray.push(form)
|
||||
})
|
||||
}
|
||||
formGroup.addControl('options', this.formBuilder.array(optionsFormArray));
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
fromJSONObject(item:any):RadioBoxData{
|
||||
this.options = JsonSerializer.fromJSONArray(item.options,ListingItem);
|
||||
this.label = item.label
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
import { DataField } from './DataField';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
export class TextArea extends DataField<TextArea>{
|
||||
|
||||
buildForm(): FormGroup {
|
||||
let formGroup = this.formBuilder.group({
|
||||
label: this.label
|
||||
});
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
fromJSONObject(item: any): TextArea {
|
||||
this.label = item.label
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
||||
import { ListingItem } from '../Common/ListingItem';
|
||||
import { DataField } from './DataField';
|
||||
import { FormGroup } from '@angular/forms'
|
||||
|
||||
export class WordListData extends DataField<WordListData>{
|
||||
public type:string;
|
||||
public options:Array<ListingItem>;
|
||||
buildForm():FormGroup{
|
||||
let formGroup = this.formBuilder.group({
|
||||
type:[this.type],
|
||||
label:[this.label]
|
||||
});
|
||||
let optionsFormArray = new Array<FormGroup>();
|
||||
if (this.options) {
|
||||
this.options.forEach(item => {
|
||||
let form: FormGroup = item.buildForm();
|
||||
optionsFormArray.push(form)
|
||||
})
|
||||
}
|
||||
formGroup.addControl('options', this.formBuilder.array(optionsFormArray));
|
||||
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
fromJSONObject(item:any):WordListData{
|
||||
this.type = item.type;
|
||||
this.options = JsonSerializer.fromJSONArray(item.options,ListingItem);
|
||||
this.label = item.label;
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
import { FormGenerator } from '../interfaces/FormGenerator';
|
||||
import { Serializable } from '../interfaces/Serializable';
|
||||
import { FormGroup, FormBuilder } from '@angular/forms'
|
||||
export class ListingItem implements Serializable<ListingItem>, FormGenerator<FormGroup>{
|
||||
public label: string;
|
||||
public value: string;
|
||||
|
||||
fromJSONObject(item: any): ListingItem {
|
||||
this.label = item.label;
|
||||
this.value = item.value;
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm(): FormGroup {
|
||||
return new FormBuilder().group({
|
||||
label: [this.label],
|
||||
value: [this.value]
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
import { BaseModel } from '../BaseModel';
|
||||
import { FormBuilder, FormGroup, FormControl, Validators } from '@angular/forms';
|
||||
import { FormGenerator } from '../interfaces/FormGenerator';
|
||||
import { JsonSerializer } from 'app/utilities/JsonSerializer';
|
||||
import { Section } from './Section';
|
||||
import { Serializable } from '../interfaces/Serializable';
|
||||
import { Page } from "./Page";
|
||||
|
||||
export class DatasetProfileModelAdmin extends BaseModel implements Serializable<DatasetProfileModelAdmin>,FormGenerator<FormGroup>{
|
||||
|
||||
public sections: Array<Section> = new Array<Section>();
|
||||
public pages: Array<Page> = new Array<Page>();
|
||||
public label: string;
|
||||
|
||||
fromJSONObject(item:any):DatasetProfileModelAdmin{
|
||||
this.sections = JsonSerializer.fromJSONArray(item.sections, Section);
|
||||
this.pages = JsonSerializer.fromJSONArray(item.pages, Page);
|
||||
this.label = item.label;
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm():FormGroup{
|
||||
let formGroup: FormGroup = new FormBuilder().group({});
|
||||
|
||||
let sectionsFormArray = new Array<FormGroup>();
|
||||
this.sections.forEach(item => {
|
||||
let form: FormGroup = item.buildForm();
|
||||
sectionsFormArray.push(form)
|
||||
})
|
||||
formGroup.addControl('sections', this.formBuilder.array(sectionsFormArray));
|
||||
|
||||
let pagesFormArray = new Array<FormGroup>();
|
||||
this.pages.forEach(item => {
|
||||
let form: FormGroup = item.buildForm();
|
||||
pagesFormArray.push(form)
|
||||
})
|
||||
formGroup.addControl('pages', this.formBuilder.array(pagesFormArray));
|
||||
|
||||
formGroup.addControl('label', new FormControl(this.label, Validators.required));
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
import { BaseModel } from '../BaseModel';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { FormGenerator } from '../interfaces/FormGenerator';
|
||||
import { Serializable } from '../interfaces/Serializable';
|
||||
|
||||
export class DefaultValue extends BaseModel implements Serializable<DefaultValue>,FormGenerator<FormGroup>{
|
||||
public type:string;
|
||||
public value:string;
|
||||
|
||||
fromJSONObject(item:any):DefaultValue{
|
||||
this.type = item.type;
|
||||
this.value = item.value;
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm():FormGroup{
|
||||
let formGroup = this.formBuilder.group({
|
||||
type: [this.type],
|
||||
value: [this.value]
|
||||
|
||||
});
|
||||
return formGroup;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
import { BooleanDecisionData } from '../DataField/BooleanDecisionData';
|
||||
import { FreeTextData } from '../DataField/FreeTextData';
|
||||
import { TextArea } from '../DataField/TextArea';
|
||||
import { CheckBoxData } from '../DataField/CheckBoxData';
|
||||
import { RadioBoxData } from '../DataField/RadioBoxData';
|
||||
import { WordListData } from '../DataField/WordListData';
|
||||
import { AutocompleteData } from '../DataField/AutocompleteData';
|
||||
import { DataField } from '../DataField/DataField';
|
||||
import { BaseModel } from '../BaseModel';
|
||||
import { FormGroup, FormArray, FormControl } from '@angular/forms';
|
||||
import { FormGenerator } from '../interfaces/FormGenerator';
|
||||
import { JsonSerializer } from 'app/utilities/JsonSerializer';
|
||||
import { Serializable } from '../interfaces/Serializable';
|
||||
import { Rule } from './Rule';
|
||||
import { Multiplicity } from './Multiplicity';
|
||||
import { DefaultValue } from './DefaultValue';
|
||||
import { ViewStyle } from './ViewStyle';
|
||||
import { Visibility } from './Visibility';
|
||||
import { ValidationTypes } from '@app/models/common/ValidationTypes';
|
||||
|
||||
export class Field extends BaseModel implements Serializable<Field>, FormGenerator<FormGroup>{
|
||||
|
||||
public id: string;
|
||||
public title: string;
|
||||
public defaultValue: DefaultValue = new DefaultValue;
|
||||
public viewStyle: ViewStyle = new ViewStyle();
|
||||
public page: number;
|
||||
//public multiplicity: Multiplicity = new Multiplicity();
|
||||
public ordinal: number;
|
||||
public visible: Visibility = new Visibility();
|
||||
public data: DataField<any>;
|
||||
public validations: Array<ValidationTypes>;
|
||||
|
||||
fromJSONObject(item: any): Field {
|
||||
this.id = item.id;
|
||||
this.title = item.title;
|
||||
this.defaultValue = JsonSerializer.fromJSONObject(item.defaultValue, DefaultValue);
|
||||
this.page = item.page;
|
||||
// this.multiplicity = new JsonSerializer<Multiplicity>().fromJSONObject(item.multiplicity, Multiplicity);
|
||||
this.ordinal = item.ordinal;
|
||||
this.validations = item.validations;
|
||||
this.viewStyle = JsonSerializer.fromJSONObject(item.viewStyle, ViewStyle);
|
||||
this.visible = JsonSerializer.fromJSONObject(item.visible, Visibility);
|
||||
if (item.data) {
|
||||
if (this.viewStyle.renderStyle === "combobox") {
|
||||
if (item.data.type === "autocomplete") this.data = JsonSerializer.fromJSONObject(item.data, AutocompleteData);
|
||||
if (item.data.type === "wordlist") this.data = JsonSerializer.fromJSONObject(item.data, WordListData);
|
||||
} else {
|
||||
if (this.viewStyle.renderStyle === "radiobox") this.data = JsonSerializer.fromJSONObject(item.data, RadioBoxData);
|
||||
if (this.viewStyle.renderStyle === "checkBox") this.data = JsonSerializer.fromJSONObject(item.data, CheckBoxData);
|
||||
if (this.viewStyle.renderStyle === "textarea") this.data = JsonSerializer.fromJSONObject(item.data, TextArea);
|
||||
if (this.viewStyle.renderStyle === "freetext") this.data = JsonSerializer.fromJSONObject(item.data, FreeTextData);
|
||||
if (this.viewStyle.renderStyle === "booleanDecision") this.data = JsonSerializer.fromJSONObject(item.data, BooleanDecisionData);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm(): FormGroup {
|
||||
let formGroup = this.formBuilder.group({
|
||||
id: [this.id],
|
||||
title: [this.title],
|
||||
page: [this.page],
|
||||
ordinal: [this.ordinal]
|
||||
});
|
||||
let valid = ValidationTypes.None
|
||||
if (this.validations && this.validations[0]==1) valid = ValidationTypes.Required
|
||||
const arr = new FormArray([
|
||||
new FormControl(valid)
|
||||
]);
|
||||
|
||||
//formGroup.addControl("multiplicity", this.multiplicity.buildForm());
|
||||
formGroup.addControl("validations", arr);
|
||||
formGroup.addControl("defaultValue", this.defaultValue.buildForm());
|
||||
formGroup.addControl("viewStyle", this.viewStyle.buildForm());
|
||||
formGroup.addControl("visible", this.visible.buildForm());
|
||||
//formGroup.addControl("data",this.data? this.data.buildForm():this.formBuilder.group({}));
|
||||
if (this.data) formGroup.addControl("data", this.data.buildForm());
|
||||
|
||||
return formGroup;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { Serializable } from '../interfaces/Serializable';
|
||||
import { BaseModel } from '../BaseModel';
|
||||
import {Field} from './Field'
|
||||
import {Multiplicity} from './Multiplicity'
|
||||
|
||||
export class FieldSet extends BaseModel implements Serializable<FieldSet> {
|
||||
public fields:Array<Field> = new Array<Field>();
|
||||
public id:string;
|
||||
public ordinal:number;
|
||||
public multiplicity: Multiplicity = new Multiplicity();
|
||||
public title:string;
|
||||
public description:string;
|
||||
public extendedDescription:string;
|
||||
public hasCommentField:boolean;
|
||||
|
||||
fromJSONObject(item:any):FieldSet{
|
||||
|
||||
this.fields = JsonSerializer.fromJSONArray(item.fields,Field);
|
||||
this.multiplicity = JsonSerializer.fromJSONObject(item.multiplicity, Multiplicity);
|
||||
this.id = item.id;
|
||||
this.ordinal = item.ordinal;
|
||||
this.title = item.title;
|
||||
this.description = item.description;
|
||||
this.extendedDescription = item.extendedDescription;
|
||||
this.hasCommentField = item.hasCommentField;
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm():FormGroup{
|
||||
let formGroup = this.formBuilder.group({
|
||||
id:[this.id],
|
||||
ordinal:[this.ordinal],
|
||||
title:[this.title],
|
||||
description: [this.description],
|
||||
extendedDescription:[this.extendedDescription],
|
||||
hasCommentField:[this.hasCommentField]
|
||||
});
|
||||
|
||||
let fieldsFormArray = new Array<FormGroup>();
|
||||
this.fields.forEach(item => {
|
||||
let form: FormGroup = item.buildForm();
|
||||
fieldsFormArray.push(form)
|
||||
})
|
||||
formGroup.addControl('fields', this.formBuilder.array(fieldsFormArray));
|
||||
formGroup.addControl("multiplicity", this.multiplicity.buildForm());
|
||||
|
||||
return formGroup;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
import { BaseModel } from '../BaseModel';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { FormGenerator } from '../interfaces/FormGenerator';
|
||||
import { Serializable } from '../interfaces/Serializable';
|
||||
export class Multiplicity extends BaseModel implements Serializable<Multiplicity>,FormGenerator<FormGroup>{
|
||||
public min:number;
|
||||
public max:string;
|
||||
|
||||
fromJSONObject(item:any):Multiplicity{
|
||||
this.min = item.min;
|
||||
this.max = item.max;
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm():FormGroup{
|
||||
let formGroup = this.formBuilder.group({
|
||||
min: [this.min],
|
||||
max: [this.max]
|
||||
|
||||
});
|
||||
return formGroup;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
import { BaseModel } from '../BaseModel';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { FormGenerator } from '../interfaces/FormGenerator';
|
||||
import { Serializable } from '../interfaces/Serializable';
|
||||
|
||||
export class Page extends BaseModel implements Serializable<Page>, FormGenerator<FormGroup>{
|
||||
public title: string;
|
||||
public id: string;
|
||||
public ordinal: number;
|
||||
|
||||
constructor(ordinal?: number) {
|
||||
super();
|
||||
if (isNaN(ordinal)) this.ordinal = 0;
|
||||
else this.ordinal = ordinal;
|
||||
this.id = "page_" + this.ordinal;
|
||||
}
|
||||
|
||||
fromJSONObject(item: any): Page {
|
||||
this.title = item.title;
|
||||
this.id = item.id;
|
||||
this.ordinal = item.ordinal;
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm(): FormGroup {
|
||||
let formGroup = this.formBuilder.group({
|
||||
title: [this.title],
|
||||
id: [this.id],
|
||||
ordinal: [this.ordinal]
|
||||
});
|
||||
return formGroup;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
import { BaseModel } from '../BaseModel';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { FormGenerator } from '../interfaces/FormGenerator';
|
||||
import { Serializable } from '../interfaces/Serializable';
|
||||
export class Rule extends BaseModel implements Serializable<Rule>,FormGenerator<FormGroup>{
|
||||
public sourceField:string;
|
||||
public target:string;
|
||||
public value: string;
|
||||
public ruleType: string;
|
||||
public ruleStyle: string;
|
||||
public valueType: string;
|
||||
|
||||
fromJSONObject(item:any):Rule{
|
||||
this.sourceField = item.sourceField;
|
||||
this.target = item.target;
|
||||
this.value = item.value;
|
||||
this.ruleType = item.ruleType;
|
||||
this.ruleStyle = item.ruleStyle;
|
||||
this.valueType = item.valueType;
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm():FormGroup{
|
||||
let formGroup = this.formBuilder.group({
|
||||
sourceField: [this.sourceField],
|
||||
target: [this.target],
|
||||
ruleStyle: [this.ruleStyle],
|
||||
value: [this.value],
|
||||
ruleType: [this.ruleType],
|
||||
valueType: [this.valueType]
|
||||
});
|
||||
return formGroup;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
import { JsonSerializer } from '../../utilities/JsonSerializer';
|
||||
import { FieldSet } from './FieldSet';
|
||||
import { BaseModel } from '../BaseModel';
|
||||
import { FormGenerator } from '../interfaces/FormGenerator';
|
||||
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { Serializable } from '../interfaces/Serializable';
|
||||
|
||||
export class Section extends BaseModel implements Serializable<Section>, FormGenerator<FormGroup>{
|
||||
public sections: Array<Section> = new Array<Section>();
|
||||
//public fieldGroups: Array<FieldGroup> = new Array<FieldGroup>();
|
||||
public defaultVisibility: boolean;
|
||||
public page: number;
|
||||
public id: string
|
||||
public title: string
|
||||
public description: string;
|
||||
public ordinal: number;
|
||||
public fieldSets: Array<FieldSet> = new Array<FieldSet>();
|
||||
|
||||
fromJSONObject(item: any): Section {
|
||||
this.sections = JsonSerializer.fromJSONArray(item.sections, Section);
|
||||
//this.fieldGroups = new JsonSerializer<FieldGroup>().fromJSONArray(item.fieldGroups, FieldGroup);
|
||||
this.page = item.page;
|
||||
this.defaultVisibility = item.defaultVisibility;
|
||||
this.id = item.id;
|
||||
this.title = item.title;
|
||||
this.description = item.description;
|
||||
this.ordinal = item.ordinal;
|
||||
this.fieldSets = JsonSerializer.fromJSONArray(item.fieldSets, FieldSet);
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm(): FormGroup {
|
||||
let formGroup: FormGroup = new FormBuilder().group({});
|
||||
let sectionsFormArray = new Array<FormGroup>();
|
||||
if (this.sections) {
|
||||
this.sections.forEach(item => {
|
||||
let form: FormGroup = item.buildForm();
|
||||
sectionsFormArray.push(form)
|
||||
})
|
||||
}
|
||||
// let fieldGroupsFormArray = new Array<FormGroup>();
|
||||
// if (this.fieldGroups) {
|
||||
// this.fieldGroups.forEach(item => {
|
||||
// let form: FormGroup = item.buildForm();
|
||||
// fieldGroupsFormArray.push(form)
|
||||
// })
|
||||
// }
|
||||
let compositeFieldsFormArray = new Array<FormGroup>();
|
||||
if (this.fieldSets) {
|
||||
this.fieldSets.forEach(item => {
|
||||
let form: FormGroup = item.buildForm();
|
||||
compositeFieldsFormArray.push(form)
|
||||
})
|
||||
}
|
||||
|
||||
formGroup.addControl('sections', this.formBuilder.array(sectionsFormArray));
|
||||
// formGroup.addControl('fieldGroups', this.formBuilder.array(fieldGroupsFormArray));
|
||||
formGroup.addControl('fieldSets', this.formBuilder.array(compositeFieldsFormArray));
|
||||
formGroup.addControl('defaultVisibility', new FormControl(this.defaultVisibility));
|
||||
formGroup.addControl('page', new FormControl(this.page, [Validators.required]));
|
||||
formGroup.addControl('id', new FormControl(this.id));
|
||||
formGroup.addControl('title', new FormControl(this.title));
|
||||
formGroup.addControl('description', new FormControl(this.description));
|
||||
formGroup.addControl('ordinal', new FormControl(this.ordinal));
|
||||
|
||||
if( !formGroup.controls["defaultVisibility"].value) formGroup.controls["defaultVisibility"].setValue(true);
|
||||
|
||||
return formGroup;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
import { BaseModel } from '../BaseModel';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { FormGenerator } from '../interfaces/FormGenerator';
|
||||
import { Serializable } from '../interfaces/Serializable';
|
||||
|
||||
export class ViewStyle extends BaseModel implements Serializable<ViewStyle>,FormGenerator<FormGroup>{
|
||||
public cssClass:string;
|
||||
public renderStyle:string;
|
||||
|
||||
fromJSONObject(item:any):ViewStyle{
|
||||
this.cssClass = item.cssClass;
|
||||
this.renderStyle = item.renderStyle;
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm():FormGroup{
|
||||
let formGroup = this.formBuilder.group({
|
||||
cssClass: [this.cssClass],
|
||||
renderStyle: [this.renderStyle]
|
||||
|
||||
});
|
||||
return formGroup;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
import { BaseModel } from '../BaseModel';
|
||||
import { Rule } from "./Rule";
|
||||
import { FormGenerator } from "../interfaces/FormGenerator";
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { Serializable } from '../interfaces/Serializable';
|
||||
import { JsonSerializer } from 'app/utilities/JsonSerializer';
|
||||
|
||||
export class Visibility extends BaseModel implements Serializable<Visibility>, FormGenerator<FormGroup>{
|
||||
public rules: Array<Rule> = new Array<Rule>();
|
||||
public style:string;
|
||||
|
||||
fromJSONObject(item:any):Visibility{
|
||||
this.rules = JsonSerializer.fromJSONArray(item.rules, Rule);
|
||||
this.style = item.style;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm():FormGroup{
|
||||
let formGroup = this.formBuilder.group({
|
||||
style:[this.style]
|
||||
})
|
||||
|
||||
let rulesFormArray = new Array<FormGroup>();
|
||||
if (this.rules){
|
||||
this.rules.forEach(rule =>{
|
||||
let form:FormGroup = rule.buildForm();
|
||||
rulesFormArray.push(form);
|
||||
});
|
||||
}
|
||||
|
||||
formGroup.addControl("rules", this.formBuilder.array(rulesFormArray));
|
||||
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
import { Component, Input, OnInit, AfterViewChecked, ViewChild } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { DatasetProfileAdmin } from '@app/services/datasetProfileAdmin/datasetProfileAfmin.service';
|
||||
|
||||
@Injectable()
|
||||
export class DatasetProfileService implements OnInit {
|
||||
|
||||
constructor(public datasetProfileAdmin: DatasetProfileAdmin) {
|
||||
}
|
||||
|
||||
|
||||
ngOnInit(){
|
||||
|
||||
}
|
||||
|
||||
fetchAllDatasetProfiles(){
|
||||
// return this.restBase.get("datasetprofiles/getAll");
|
||||
}
|
||||
|
||||
getDatasetProfileById(datasetProfileID){
|
||||
return this.datasetProfileAdmin.getDatasetProfileById(datasetProfileID);
|
||||
}
|
||||
|
||||
createDatasetProfile(datasetProfile){
|
||||
// return this.restBase.post("datasetprofile/create", datasetProfile);
|
||||
}
|
||||
|
||||
updateDatasetProfile(datasetProfile){
|
||||
// return this.restBase.post("datasetprofile/update", datasetProfile);
|
||||
}
|
||||
|
||||
delete(datasetProfile){
|
||||
// return this.restBase.post("datasetprofile/delete", datasetProfile);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HostConfiguration } from './../../app.constants';
|
||||
import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { DataTableRequest } from '../../models/data-table/DataTableRequest';
|
||||
import { DataTableData } from '../../models/data-table/DataTableData';
|
||||
import { DatasetModel } from '../../models/datasets/DatasetModel';
|
||||
import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria';
|
||||
|
||||
import { DatasetProfileModelAdmin } from '../../models/datasetProfileAdmin/DatasetProfileModelAdmin';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class DatasetProfileAdmin {
|
||||
|
||||
private actionUrl: string;
|
||||
private headers: HttpHeaders;
|
||||
|
||||
constructor(private http: BaseHttpService) {
|
||||
|
||||
this.actionUrl = HostConfiguration.Server + 'admin/';
|
||||
|
||||
this.headers = new HttpHeaders();
|
||||
this.headers = this.headers.set('Content-Type', 'application/json');
|
||||
this.headers = this.headers.set('Accept', 'application/json');
|
||||
}
|
||||
createForm(data) {
|
||||
return this.http.post<DatasetProfileModelAdmin>(this.actionUrl + 'addDmp', data, { headers: this.headers });
|
||||
}
|
||||
|
||||
updateForm(id, data) {
|
||||
return this.http.post<DatasetProfileModelAdmin>(this.actionUrl + 'addDmp/' + id, data, { headers: this.headers })
|
||||
}
|
||||
|
||||
getDatasetProfileById(datasetProfileID){
|
||||
return this.http.get<DatasetProfileModelAdmin>(this.actionUrl + 'get/' + datasetProfileID, { headers: this.headers })
|
||||
}
|
||||
// getPaged(dataTableRequest: DataTableRequest<DatasetCriteria>): Observable<DataTableData<DatasetListingModel>> {
|
||||
// return this.http.post<DataTableData<DatasetListingModel>>(this.actionUrl + 'getPaged', dataTableRequest, { headers: this.headers });
|
||||
// }
|
||||
|
||||
// makeDatasetPublic(id: String){
|
||||
// return this.http.get(this.actionUrl + 'makepublic/' + id, { headers: this.headers })
|
||||
// }
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<div [formGroup]="form">
|
||||
<div formGroupName="data" class="form-row">
|
||||
<div class="form-group col-md-12" >
|
||||
<label>Label</label>
|
||||
<input type="string" class="form-control" formControlName="label">
|
||||
</div>
|
||||
<div class="form-group col-md-12" >
|
||||
<label>Url</label>
|
||||
<input type="string" class="form-control" formControlName="url">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,23 @@
|
|||
import { AutocompleteData } from '../../../models/DataField/AutocompleteData';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { FormArray } from '@angular/forms';
|
||||
import { Field } from '@app/models/datasetProfileAdmin/Field';
|
||||
|
||||
@Component({
|
||||
selector: 'autocomplete-component',
|
||||
templateUrl: './autocomplete-component.html'
|
||||
})
|
||||
export class AutocompleteComponent implements OnInit{
|
||||
@Input() dataModel: Field;
|
||||
@Input() form: FormGroup;
|
||||
private data:AutocompleteData = new AutocompleteData();
|
||||
|
||||
ngOnInit(){
|
||||
this.data.type= "autocomplete";
|
||||
let autocomplete: AutocompleteData = new AutocompleteData();
|
||||
//this.dataModel.data = new JsonSerializer<AutocompleteData>().fromJSONObject(this.data,AutocompleteData);
|
||||
//(<FormArray>this.form.get("data")).push(autocomplete.buildForm());
|
||||
this.form.addControl("data", this.data.buildForm());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<div [formGroup]="form">
|
||||
<div formGroupName="data" class="form-row">
|
||||
<div class="form-group col-md-12" >
|
||||
<label>Label</label>
|
||||
<input type="string" class="form-control" formControlName="label">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
import { BooleanDecisionData } from '../../../models/DataField/BooleanDecisionData';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { FormArray } from '@angular/forms';
|
||||
import { Field } from '@app/models/datasetProfileAdmin/Field';
|
||||
|
||||
@Component({
|
||||
selector: 'booleanDecision-component',
|
||||
templateUrl: './booleanDecision-component.html'
|
||||
})
|
||||
export class BooleanDecisionComponent implements OnInit{
|
||||
@Input() dataModel: Field;
|
||||
@Input() form: FormGroup;
|
||||
private data:BooleanDecisionData = new BooleanDecisionData();
|
||||
|
||||
ngOnInit(){
|
||||
this.form.addControl("data", this.data.buildForm());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<div [formGroup]="form">
|
||||
<div formGroupName="data" class="form-row">
|
||||
<div class="form-group col-md-12" >
|
||||
<label>Label</label>
|
||||
<input type="string" class="form-control" formControlName="label">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,20 @@
|
|||
import { CheckBoxData } from '../../../models/DataField/CheckBoxData';
|
||||
import { BooleanDecisionData } from '../../../models/DataField/BooleanDecisionData';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { FormArray } from '@angular/forms';
|
||||
import { Field } from '@app/models/datasetProfileAdmin/Field';
|
||||
|
||||
@Component({
|
||||
selector: 'checkbox-component',
|
||||
templateUrl: './checkbox-component.html'
|
||||
})
|
||||
export class CheckBoxComponent implements OnInit{
|
||||
@Input() dataModel: Field;
|
||||
@Input() form: FormGroup;
|
||||
private data:CheckBoxData = new CheckBoxData();
|
||||
|
||||
ngOnInit(){
|
||||
this.form.addControl("data", this.data.buildForm());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<div class="form-group col-md-12">
|
||||
<label>Type of Combobox</label>
|
||||
<select class="form-control" [(ngModel)]="type" (change)= "onchangeCombo($event)">
|
||||
<option *ngFor="let option of options" [value]="option.value">{{option.value}}</option>
|
||||
</select>
|
||||
<div class="form-row" [ngSwitch]="type">
|
||||
<div *ngSwitchCase="'autocomplete'">
|
||||
<autocomplete-component [form]="form" [dataModel]="dataModel"></autocomplete-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row" [ngSwitch]="type">
|
||||
<div *ngSwitchCase="'wordlist'">
|
||||
<wordlist-component [form]="form" [dataModel]="dataModel"></wordlist-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,25 @@
|
|||
import { FormGroup } from '@angular/forms';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Field } from '@app/models/datasetProfileAdmin/Field';
|
||||
|
||||
@Component({
|
||||
selector: 'combobox-component',
|
||||
templateUrl: './combobox-component.html'
|
||||
})
|
||||
export class ComboboxComponent implements OnInit{
|
||||
@Input() dataModel: Field;
|
||||
@Input() form: FormGroup;
|
||||
type: string;
|
||||
options = [{id:"autocomplete", value: "autocomplete"}, {id:"wordlist", value: "wordlist"}];
|
||||
|
||||
ngOnInit(){
|
||||
if (this.dataModel.data && this.form.get("data")){
|
||||
this.type = this.form.get("data").get("type").value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
onchangeCombo(){
|
||||
if (this.form.get("data")) this.form.removeControl("data");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<div [formGroup]="form">
|
||||
<div formGroupName="data" class="form-row">
|
||||
<div class="form-group col-md-12" >
|
||||
<label>Label</label>
|
||||
<input type="string" class="form-control" formControlName="label">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,21 @@
|
|||
import { FreeTextData } from '../../../models/DataField/FreeTextData';
|
||||
import { CheckBoxData } from '../../../models/DataField/CheckBoxData';
|
||||
import { BooleanDecisionData } from '../../../models/DataField/BooleanDecisionData';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { FormArray } from '@angular/forms';
|
||||
import { Field } from '@app/models/datasetProfileAdmin/Field';
|
||||
|
||||
@Component({
|
||||
selector: 'freetext-component',
|
||||
templateUrl: './freetext-component.html'
|
||||
})
|
||||
export class FreeTextComponent implements OnInit{
|
||||
@Input() dataModel: Field;
|
||||
@Input() form: FormGroup;
|
||||
private data:FreeTextData = new FreeTextData();
|
||||
|
||||
ngOnInit(){
|
||||
this.form.addControl("data", this.data.buildForm());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<div [formGroup]="form" class="form-row">
|
||||
<div formGroupName="data">
|
||||
<div class="form-group col-md-12">
|
||||
<label>Label</label>
|
||||
<input type="string" class="form-control" formControlName="label">
|
||||
</div>
|
||||
|
||||
<div formArrayName="options">
|
||||
<div *ngFor="let option of form.get('data').get('options').controls index as i">
|
||||
<div [formGroupName]="i">
|
||||
<div class="form-group col-md-6">
|
||||
<label>Label</label>
|
||||
<input type="text" class="form-control" formControlName="label">
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>Value</label>
|
||||
<input type="text" class="form-control" formControlName="value">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<a (click)="addNewRow(form)" style="cursor: pointer">
|
||||
Add +
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,33 @@
|
|||
import { FormGroup } from '@angular/forms';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { RadioBoxData } from '../../../models/DataField/RadioBoxData';
|
||||
import { FormArray } from '@angular/forms';
|
||||
import { ListingItem } from '../../../models/Common/ListingItem';
|
||||
import { JsonSerializer } from '../../../utilities/JsonSerializer';
|
||||
import { Field } from '@app/models/datasetProfileAdmin/Field';
|
||||
|
||||
@Component({
|
||||
selector: 'radiobox-component',
|
||||
templateUrl: './radiobox-component.html'
|
||||
})
|
||||
export class RadioBoxComponent implements OnInit{
|
||||
@Input() dataModel: Field;
|
||||
@Input() form: FormGroup;
|
||||
private data: RadioBoxData = new RadioBoxData();
|
||||
private options = new Array<ListingItem>();
|
||||
|
||||
ngOnInit(){
|
||||
//if (this.form.get("data")) this.form.removeControl("data");
|
||||
if (!this.form.get("data"))
|
||||
this.form.addControl("data", this.data.buildForm());
|
||||
if(!this.dataModel.data) this.addNewRow();
|
||||
}
|
||||
|
||||
addNewRow(){
|
||||
let radioListOptions:ListingItem = new ListingItem();
|
||||
(<FormArray>this.form.get("data").get("options")).push(radioListOptions.buildForm());
|
||||
this.data.options = [];
|
||||
this.data.options.push(radioListOptions);
|
||||
this.dataModel.data = JsonSerializer.fromJSONObject(this.data,RadioBoxData);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<div [formGroup]="form">
|
||||
<div formGroupName="data" class="form-row">
|
||||
<div class="form-group col-md-12" >
|
||||
<label>Label</label>
|
||||
<input type="string" class="form-control" formControlName="label">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,22 @@
|
|||
import { TextArea } from '../../../models/DataField/TextArea';
|
||||
import { FreeTextData } from '../../../models/DataField/FreeTextData';
|
||||
import { CheckBoxData } from '../../../models/DataField/CheckBoxData';
|
||||
import { BooleanDecisionData } from '../../../models/DataField/BooleanDecisionData';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { FormArray } from '@angular/forms';
|
||||
import { Field } from '@app/models/datasetProfileAdmin/Field';
|
||||
|
||||
@Component({
|
||||
selector: 'textarea-component',
|
||||
templateUrl: './textarea-component.html'
|
||||
})
|
||||
export class TextAreaComponent implements OnInit{
|
||||
@Input() dataModel: Field;
|
||||
@Input() form: FormGroup;
|
||||
private data:TextArea = new TextArea();
|
||||
|
||||
ngOnInit(){
|
||||
this.form.addControl("data", this.data.buildForm());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<div [formGroup]="form" class="form-row">
|
||||
<div formGroupName="data">
|
||||
<div class="form-group col-md-12" >
|
||||
<label>Label</label>
|
||||
<input type="string" class="form-control" formControlName="label">
|
||||
</div>
|
||||
<div formArrayName="options">
|
||||
<div *ngFor="let option of form.get('data').get('options').controls index as i">
|
||||
<div [formGroupName]="i">
|
||||
<div class="form-group col-md-6">
|
||||
<label>Label</label>
|
||||
<input type="text" class="form-control" formControlName="label">
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>Value</label>
|
||||
<input type="text" class="form-control" formControlName="value">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<a (click)="addNewRow(form)" style="cursor: pointer">
|
||||
Add +
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,34 @@
|
|||
import { FormGroup } from '@angular/forms';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { WordListData } from '../../../models/DataField/WordListData';
|
||||
import { FormArray } from '@angular/forms';
|
||||
import { ListingItem } from '../../../models/Common/ListingItem';
|
||||
import { JsonSerializer } from '../../../utilities/JsonSerializer';
|
||||
import { Field } from '@app/models/datasetProfileAdmin/Field';
|
||||
|
||||
@Component({
|
||||
selector: 'wordlist-component',
|
||||
templateUrl: './wordlist-component.html'
|
||||
})
|
||||
export class WordlistComponent implements OnInit{
|
||||
@Input() dataModel: Field;
|
||||
@Input() form: FormGroup;
|
||||
private data: WordListData = new WordListData();
|
||||
private options = new Array<ListingItem>();
|
||||
|
||||
ngOnInit(){
|
||||
this.data.type = "wordlist";
|
||||
// if (this.form.get("data")) this.form.removeControl("data");
|
||||
this.form.addControl("data", this.data.buildForm());
|
||||
if(!this.dataModel.data)
|
||||
this.addNewRow();
|
||||
}
|
||||
|
||||
addNewRow(){
|
||||
let wordListOptions:ListingItem = new ListingItem();
|
||||
(<FormArray>this.form.get("data").get("options")).push(wordListOptions.buildForm());
|
||||
this.data.options = [];
|
||||
this.data.options.push(wordListOptions);
|
||||
this.dataModel.data = JsonSerializer.fromJSONObject(this.data,WordListData);
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
import { Component, Input } from "@angular/core";
|
||||
import { AuthService } from "../core/services/auth.service";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
var UnauthorizedComponent = (function () {
|
||||
function UnauthorizedComponent(authService, route, router) {
|
||||
this.authService = authService;
|
||||
this.route = route;
|
||||
this.router = router;
|
||||
}
|
||||
UnauthorizedComponent.prototype.ngAfterViewInit = function () {
|
||||
var _this = this;
|
||||
var returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
|
||||
var principal = this.authService.current();
|
||||
if (!principal) {
|
||||
this.router.navigate(['/login'], { queryParams: { returnUrl: returnUrl } });
|
||||
}
|
||||
else {
|
||||
this.authService.me().subscribe(function (principal) {
|
||||
if (!principal)
|
||||
_this.router.navigate(['/login'], { queryParams: { returnUrl: returnUrl } });
|
||||
}, function (err) { return console.error('An error occurred', err); });
|
||||
}
|
||||
};
|
||||
return UnauthorizedComponent;
|
||||
}());
|
||||
__decorate([
|
||||
Input(),
|
||||
__metadata("design:type", String)
|
||||
], UnauthorizedComponent.prototype, "message", void 0);
|
||||
UnauthorizedComponent = __decorate([
|
||||
Component({
|
||||
selector: 'unauthorized-component',
|
||||
templateUrl: './unauthorized.component.html'
|
||||
}),
|
||||
__metadata("design:paramtypes", [AuthService,
|
||||
ActivatedRoute,
|
||||
Router])
|
||||
], UnauthorizedComponent);
|
||||
export { UnauthorizedComponent };
|
||||
//# sourceMappingURL=unauthorized.component.js.map
|
|
@ -1,37 +0,0 @@
|
|||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { UnauthorizedComponent } from './unauthorized.component';
|
||||
import { UnauthorizedRoutes } from './unauthorized.routes';
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
var UnauthorizedModule = (function () {
|
||||
function UnauthorizedModule() {
|
||||
}
|
||||
return UnauthorizedModule;
|
||||
}());
|
||||
UnauthorizedModule = __decorate([
|
||||
NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
HttpClientModule,
|
||||
UnauthorizedRoutes,
|
||||
SharedModule
|
||||
],
|
||||
declarations: [
|
||||
UnauthorizedComponent
|
||||
],
|
||||
exports: [
|
||||
UnauthorizedComponent
|
||||
]
|
||||
})
|
||||
], UnauthorizedModule);
|
||||
export { UnauthorizedModule };
|
||||
//# sourceMappingURL=unauthorized.module.js.map
|
|
@ -1,7 +0,0 @@
|
|||
import { RouterModule } from '@angular/router';
|
||||
import { UnauthorizedComponent } from './unauthorized.component';
|
||||
var routes = [
|
||||
{ path: '', component: UnauthorizedComponent }
|
||||
];
|
||||
export var UnauthorizedRoutes = RouterModule.forChild(routes);
|
||||
//# sourceMappingURL=unauthorized.routes.js.map
|
Loading…
Reference in New Issue