From: Bill Erickson Date: Fri, 17 Jul 2020 15:03:04 +0000 (-0400) Subject: LPXXX volcopy autsave prefs; lint X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=efe7dd86b0348c47d24401ce6d11b91dbe12b0f0;p=working%2FEvergreen.git LPXXX volcopy autsave prefs; lint Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.html b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.html index 02bc4a1833..22e75b1713 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.html @@ -1,10 +1,9 @@ -
+
+

Holdings Preferences

- +
Changes are saved automatically.
-

Holdings Preferences

-
@@ -200,7 +199,7 @@ from the Item Attributes Form. -
+
@@ -551,9 +550,3 @@
-
-
- -
- - diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.ts index 5716f9e0a0..f5d648f5b0 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.ts @@ -1,53 +1,57 @@ -import {Component, Input, OnInit, AfterViewInit, ViewChild, Renderer2} from '@angular/core'; +import {Component, Input, OnInit, ViewChild, DoCheck} from '@angular/core'; import {Router, ActivatedRoute, ParamMap} from '@angular/router'; import {tap} from 'rxjs/operators'; import {IdlObject, IdlService} from '@eg/core/idl.service'; -import {EventService} from '@eg/core/event.service'; -import {OrgService} from '@eg/core/org.service'; -import {StoreService} from '@eg/core/store.service'; -import {NetService} from '@eg/core/net.service'; -import {AuthService} from '@eg/core/auth.service'; -import {PcrudService} from '@eg/core/pcrud.service'; -import {HoldingsService} from '@eg/staff/share/holdings/holdings.service'; import {VolCopyContext} from './volcopy'; import {VolCopyService} from './volcopy.service'; -import {FormatService} from '@eg/core/format.service'; -import {StringComponent} from '@eg/share/string/string.component'; -import {ComboboxComponent, ComboboxEntry} from '@eg/share/combobox/combobox.component'; @Component({ selector: 'eg-volcopy-config', templateUrl: 'config.component.html' }) -export class VolCopyConfigComponent implements OnInit, AfterViewInit { +export class VolCopyConfigComponent implements OnInit, DoCheck { @Input() context: VolCopyContext; + defaultsCopy: any; + constructor( private router: Router, private route: ActivatedRoute, - private renderer: Renderer2, - private evt: EventService, private idl: IdlService, - private org: OrgService, - private net: NetService, - private auth: AuthService, - private pcrud: PcrudService, - private holdings: HoldingsService, - private format: FormatService, - private store: StoreService, public volcopy: VolCopyService - ) { } + ) {} ngOnInit() { - console.log('DEFAULTS', this.volcopy.defaults); + console.debug('DEFAULTS', this.volcopy.defaults); + + // Not an IDL object, but clones just the same + this.defaultsCopy = this.idl.clone(this.volcopy.defaults); } - ngAfterViewInit() { + // Watch for changes in the form and auto-save them. + ngDoCheck() { + const hidden = this.volcopy.defaults.hidden; + for (const key in hidden) { + if (hidden[key] !== this.defaultsCopy.hidden[key]) { + this.save(); + return; + } + } + + const values = this.volcopy.defaults.values; + for (const key in values) { + if (values[key] !== this.defaultsCopy.values[key]) { + this.save(); + return; + } + } } save() { - this.volcopy.saveDefaults(); + this.volcopy.saveDefaults().then(_ => + this.defaultsCopy = this.idl.clone(this.volcopy.defaults) + ); } } diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts index 91cae6f1b1..25743a9d05 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts @@ -381,7 +381,6 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit { entry = this.idl.create('asce'); entry.stat_cat(catId); copy.stat_cat_entries().push(entry); - console.log('1', entry); } entry.id(entryId); @@ -413,7 +412,6 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit { openCopyTags() { this.copyTagsDialog.inPlaceMode = true; this.copyTagsDialog.copyIds = this.context.copyList().map(c => c.id()); - console.log('IDS', this.copyTagsDialog.copyIds); this.copyTagsDialog.open({size: 'lg'}).subscribe(newTags => { if (!newTags || newTags.length === 0) { return; } diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts index 983cdd4f22..35ee7db417 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts @@ -93,7 +93,6 @@ export class VolEditComponent implements OnInit { // Column width (flex:x) for column by column number. flexAt(column: number): number { - //return this.flexSettings[column]; return this.flexSpan(column, column); } diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts index 3ca7101ff7..1d15c9c2dd 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts @@ -364,7 +364,6 @@ export class VolCopyComponent implements OnInit { let vol = volumes.filter(v => v.id() === copyVol.id())[0]; if (vol) { - console.log('Adding deleted copy to vol deleted=' + vol.isdeleted()); vol.copies().push(cloneCopy); } else { vol = this.idl.clone(copyVol);