]>
Commit | Line | Data |
---|---|---|
c48e82b5 | 1 | import { Component, Input } from '@angular/core' |
f8b2c1b4 | 2 | import { Notifier } from '@app/core' |
67ed6552 | 3 | import { RedundancyService } from '@app/shared/shared-main' |
c48e82b5 C |
4 | |
5 | @Component({ | |
6 | selector: 'my-redundancy-checkbox', | |
5995a28f | 7 | templateUrl: './redundancy-checkbox.component.html' |
c48e82b5 C |
8 | }) |
9 | export class RedundancyCheckboxComponent { | |
10 | @Input() redundancyAllowed: boolean | |
11 | @Input() host: string | |
12 | ||
13 | constructor ( | |
f8b2c1b4 | 14 | private notifier: Notifier, |
66357162 | 15 | private redundancyService: RedundancyService |
9df52d66 | 16 | ) { } |
c48e82b5 C |
17 | |
18 | updateRedundancyState () { | |
19 | this.redundancyService.updateRedundancy(this.host, this.redundancyAllowed) | |
1378c0d3 C |
20 | .subscribe({ |
21 | next: () => { | |
66357162 | 22 | const stateLabel = this.redundancyAllowed ? $localize`enabled` : $localize`disabled` |
c48e82b5 | 23 | |
66357162 | 24 | this.notifier.success($localize`Redundancy for ${this.host} is ${stateLabel}`) |
f8b2c1b4 | 25 | }, |
c48e82b5 | 26 | |
1378c0d3 C |
27 | error: err => this.notifier.error(err.message) |
28 | }) | |
c48e82b5 C |
29 | } |
30 | } |