From: Bill Erickson Date: Wed, 18 Apr 2018 18:04:38 +0000 (-0400) Subject: LP#1626157 sandbox module X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4b1224c8c33a233612ea631720fde0d9823dc635;p=working%2FEvergreen.git LP#1626157 sandbox module Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts index 3ab2ceb5ff..8ae0713afd 100644 --- a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts +++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts @@ -34,18 +34,22 @@ export class FmRecordEditorComponent // customFieldTemplates // list of fields that should not be displayed - @Input() hiddenFields: string[] = []; + @Input() hiddenFieldsList: string[] = []; + @Input() hiddenFields: string; // comma-separated string version // list of fields that should always be read-only - @Input() readonlyFields: string[] = []; + @Input() readonlyFieldsList: string[] = []; + @Input() readonlyFields: string; // comma-separated string version // list of required fields; this supplements what the IDL considers // required - @Input() requiredFields: string[] = []; + @Input() requiredFieldsList: string[] = []; + @Input() requiredFields: string; // comma-separated string version - // list of org_unit fields where the selector should default to the - // workstation OU - @Input() orgDefaultAllowed: string[] = []; + // list of org_unit fields where a default value may be applied by + // the org-select if no value is present. + @Input() orgDefaultAllowedList: string[] = []; + @Input() orgDefaultAllowed: string; // comma-separated string version // hash, keyed by field name, of functions to invoke to check // whether a field is required. Each callback is passed the field @@ -88,10 +92,24 @@ export class FmRecordEditorComponent // Avoid fetching data on init since that may lead to unnecessary // data retrieval. ngOnInit() { + this.listifyInputs(); this.idlDef = this.idl.classes[this.idlClass]; this.recordLabel = this.idlDef.label; } + // Translate comma-separated string versions of various inputs + // to arrays. + listifyInputs() { + if (this.hiddenFields) + this.hiddenFieldsList = this.hiddenFields.split(/,/); + if (this.readonlyFields) + this.readonlyFieldsList = this.readonlyFields.split(/,/); + if (this.requiredFields) + this.requiredFieldsList = this.requiredFields.split(/,/); + if (this.orgDefaultAllowed) + this.orgDefaultAllowedList = this.orgDefaultAllowed.split(/,/); + } + // Opening dialog, fetch data. open(options?: NgbModalOptions): Promise { return this.initRecord().then( @@ -181,14 +199,14 @@ export class FmRecordEditorComponent this.fields = this.idlDef.fields.filter(f => f.virtual != 'true' && - !this.hiddenFields.includes(f.name) + !this.hiddenFieldsList.includes(f.name) ); let promises = []; this.fields.forEach(field => { field.readOnly = this.mode == 'view' - || this.readonlyFields.includes(field.name); + || this.readonlyFieldsList.includes(field.name); if (this.isRequiredOverride && field.name in this.isRequiredOverride) { @@ -198,7 +216,7 @@ export class FmRecordEditorComponent } else { field.isRequired = () => { return field.required || - this.requiredFields.includes(field.name); + this.requiredFieldsList.includes(field.name); } } @@ -212,7 +230,7 @@ export class FmRecordEditorComponent ); } else if (field.datatype == 'org_unit') { field.orgDefaultAllowed = - this.orgDefaultAllowed.includes(field.name); + this.orgDefaultAllowedList.includes(field.name); } // TODO custom field templates diff --git a/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/workstations.component.html b/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/workstations.component.html index 208a152c99..af13288109 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/workstations.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/workstations.component.html @@ -9,16 +9,6 @@ dialogBody='Workstation "{{newName}}" already exists. Use it anyway?'> - - - - -
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/workstations.module.ts b/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/workstations.module.ts index 9692435d2e..064b24dd45 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/workstations.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/workstations.module.ts @@ -3,13 +3,9 @@ import {EgStaffCommonModule} from '@eg/staff/common.module'; import {WorkstationsRoutingModule} from './routing.module'; import {WorkstationsComponent} from './workstations.component'; -// XXX testing -import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component'; - @NgModule({ declarations: [ WorkstationsComponent, - FmRecordEditorComponent // XXX ], imports: [ EgStaffCommonModule, diff --git a/Open-ILS/src/eg2/src/app/staff/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/routing.module.ts index 49a04a35c7..134140af5c 100644 --- a/Open-ILS/src/eg2/src/app/staff/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/routing.module.ts @@ -30,6 +30,9 @@ const routes: Routes = [{ path: 'catalog', loadChildren : '@eg/staff/catalog/catalog.module#EgCatalogModule' }, { + path: 'sandbox', + loadChildren : '@eg/staff/sandbox/sandbox.module#EgSandboxModule' + }, { path: 'admin', loadChildren : '@eg/staff/admin/routing.module#EgAdminRoutingModule' }] diff --git a/Open-ILS/src/eg2/src/app/staff/sandbox/README b/Open-ILS/src/eg2/src/app/staff/sandbox/README new file mode 100644 index 0000000000..66e77dcb4f --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/sandbox/README @@ -0,0 +1 @@ +Place for experimenting with code. diff --git a/Open-ILS/src/eg2/src/app/staff/sandbox/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/sandbox/routing.module.ts new file mode 100644 index 0000000000..0fa4d3e2d1 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/sandbox/routing.module.ts @@ -0,0 +1,16 @@ +import {NgModule} from '@angular/core'; +import {RouterModule, Routes} from '@angular/router'; +import {EgSandboxComponent} from './sandbox.component'; + +const routes: Routes = [{ + path: '', + component: EgSandboxComponent +}]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], + providers: [] +}) + +export class EgSandboxRoutingModule {} diff --git a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html new file mode 100644 index 0000000000..09196cfea8 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts new file mode 100644 index 0000000000..ac00156ba8 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts @@ -0,0 +1,13 @@ +import {Component, OnInit} from '@angular/core'; + +@Component({ + templateUrl: 'sandbox.component.html' +}) +export class EgSandboxComponent implements OnInit { + + constructor() {} + + ngOnInit() { + } +} + diff --git a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.module.ts b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.module.ts new file mode 100644 index 0000000000..aea54bda16 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.module.ts @@ -0,0 +1,22 @@ +import {NgModule} from '@angular/core'; +import {EgStaffCommonModule} from '@eg/staff/common.module'; +import {EgSandboxRoutingModule} from './routing.module'; +import {EgSandboxComponent} from './sandbox.component'; +import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component'; + +@NgModule({ + declarations: [ + EgSandboxComponent, + FmRecordEditorComponent // not globally available + ], + imports: [ + EgStaffCommonModule, + EgSandboxRoutingModule + ], + providers: [ + ] +}) + +export class EgSandboxModule { + +}