]>
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', | |
7 | templateUrl: './redundancy-checkbox.component.html', | |
8 | styleUrls: [ './redundancy-checkbox.component.scss' ] | |
9 | }) | |
10 | export class RedundancyCheckboxComponent { | |
11 | @Input() redundancyAllowed: boolean | |
12 | @Input() host: string | |
13 | ||
14 | constructor ( | |
f8b2c1b4 | 15 | private notifier: Notifier, |
66357162 | 16 | private redundancyService: RedundancyService |
9df52d66 | 17 | ) { } |
c48e82b5 C |
18 | |
19 | updateRedundancyState () { | |
20 | this.redundancyService.updateRedundancy(this.host, this.redundancyAllowed) | |
1378c0d3 C |
21 | .subscribe({ |
22 | next: () => { | |
66357162 | 23 | const stateLabel = this.redundancyAllowed ? $localize`enabled` : $localize`disabled` |
c48e82b5 | 24 | |
66357162 | 25 | this.notifier.success($localize`Redundancy for ${this.host} is ${stateLabel}`) |
f8b2c1b4 | 26 | }, |
c48e82b5 | 27 | |
1378c0d3 C |
28 | error: err => this.notifier.error(err.message) |
29 | }) | |
c48e82b5 C |
30 | } |
31 | } |