]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts
Move to stylelint
[github/Chocobozzz/PeerTube.git] / client / src / app / +admin / follows / shared / redundancy-checkbox.component.ts
CommitLineData
c48e82b5 1import { Component, Input } from '@angular/core'
f8b2c1b4 2import { Notifier } from '@app/core'
67ed6552 3import { 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})
10export class RedundancyCheckboxComponent {
11 @Input() redundancyAllowed: boolean
12 @Input() host: string
13
14 constructor (
f8b2c1b4 15 private notifier: Notifier,
66357162
C
16 private redundancyService: RedundancyService
17 ) { }
c48e82b5
C
18
19 updateRedundancyState () {
20 this.redundancyService.updateRedundancy(this.host, this.redundancyAllowed)
f8b2c1b4
C
21 .subscribe(
22 () => {
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
f8b2c1b4
C
28 err => this.notifier.error(err.message)
29 )
c48e82b5
C
30 }
31}