1 import {Component, Input, OnInit, ViewChild, DoCheck} from '@angular/core';
2 import {Router, ActivatedRoute, ParamMap} from '@angular/router';
3 import {tap} from 'rxjs/operators';
4 import {IdlObject, IdlService} from '@eg/core/idl.service';
5 import {VolCopyContext} from './volcopy';
6 import {VolCopyService} from './volcopy.service';
9 selector: 'eg-volcopy-config',
10 templateUrl: 'config.component.html'
12 export class VolCopyConfigComponent implements OnInit, DoCheck {
14 @Input() context: VolCopyContext;
19 private router: Router,
20 private route: ActivatedRoute,
21 private idl: IdlService,
22 public volcopy: VolCopyService
26 console.debug('DEFAULTS', this.volcopy.defaults);
28 // Not an IDL object, but clones just the same
29 this.defaultsCopy = this.idl.clone(this.volcopy.defaults);
32 // Watch for changes in the form and auto-save them.
34 const hidden = this.volcopy.defaults.hidden;
35 for (const key in hidden) {
36 if (hidden[key] !== this.defaultsCopy.hidden[key]) {
42 const values = this.volcopy.defaults.values;
43 for (const key in values) {
44 if (values[key] !== this.defaultsCopy.values[key]) {
52 this.volcopy.saveDefaults().then(_ =>
53 this.defaultsCopy = this.idl.clone(this.volcopy.defaults)