]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts
729b7f5991350876e186bc0fd00efb6a93a592d3
[github/Chocobozzz/PeerTube.git] / client / src / app / +admin / follows / shared / redundancy-checkbox.component.ts
1 import { Component, Input } from '@angular/core'
2 import { Notifier } from '@app/core'
3 import { RedundancyService } from '@app/shared/shared-main'
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 (
15 private notifier: Notifier,
16 private redundancyService: RedundancyService
17 ) { }
18
19 updateRedundancyState () {
20 this.redundancyService.updateRedundancy(this.host, this.redundancyAllowed)
21 .subscribe(
22 () => {
23 const stateLabel = this.redundancyAllowed ? $localize`enabled` : $localize`disabled`
24
25 this.notifier.success($localize`Redundancy for ${this.host} is ${stateLabel}`)
26 },
27
28 err => this.notifier.error(err.message)
29 )
30 }
31 }