]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts
Remove unnecessary onPage event on admin tables
[github/Chocobozzz/PeerTube.git] / client / src / app / +admin / follows / shared / redundancy-checkbox.component.ts
... / ...
CommitLineData
1import { Component, Input } from '@angular/core'
2import { Notifier } from '@app/core'
3import { 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})
10export 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 next: () => {
23 const stateLabel = this.redundancyAllowed ? $localize`enabled` : $localize`disabled`
24
25 this.notifier.success($localize`Redundancy for ${this.host} is ${stateLabel}`)
26 },
27
28 error: err => this.notifier.error(err.message)
29 })
30 }
31}