1 import {Component, Input, OnInit, DoCheck} from '@angular/core';
2 import {Router, ActivatedRoute} from '@angular/router';
3 import {IdlService} from '@eg/core/idl.service';
4 import {VolCopyContext} from './volcopy';
5 import {VolCopyService} from './volcopy.service';
8 selector: 'eg-volcopy-config',
9 templateUrl: 'config.component.html'
11 export class VolCopyConfigComponent implements OnInit, DoCheck {
13 @Input() context: VolCopyContext;
18 private router: Router,
19 private route: ActivatedRoute,
20 private idl: IdlService,
21 public volcopy: VolCopyService
25 console.debug('DEFAULTS', this.volcopy.defaults);
27 // Not an IDL object, but clones just the same
28 this.defaultsCopy = this.idl.clone(this.volcopy.defaults);
31 // Watch for changes in the form and auto-save them.
33 const hidden = this.volcopy.defaults.hidden;
34 for (const key in hidden) {
35 if (hidden[key] !== this.defaultsCopy.hidden[key]) {
41 const values = this.volcopy.defaults.values;
42 for (const key in values) {
43 if (values[key] !== this.defaultsCopy.values[key]) {
51 this.volcopy.saveDefaults().then(_ =>
52 this.defaultsCopy = this.idl.clone(this.volcopy.defaults)