PeerTube/client/src/app/+admin/follows/shared/redundancy-checkbox.compone...

32 lines
956 B
TypeScript
Raw Normal View History

2018-09-11 16:27:07 +02:00
import { Component, Input } from '@angular/core'
import { Notifier } from '@app/core'
2020-06-23 14:10:17 +02:00
import { RedundancyService } from '@app/shared/shared-main'
2018-09-11 16:27:07 +02:00
@Component({
selector: 'my-redundancy-checkbox',
templateUrl: './redundancy-checkbox.component.html',
styleUrls: [ './redundancy-checkbox.component.scss' ]
})
export class RedundancyCheckboxComponent {
@Input() redundancyAllowed: boolean
@Input() host: string
constructor (
private notifier: Notifier,
private redundancyService: RedundancyService
) { }
2018-09-11 16:27:07 +02:00
updateRedundancyState () {
this.redundancyService.updateRedundancy(this.host, this.redundancyAllowed)
2021-08-17 11:27:47 +02:00
.subscribe({
next: () => {
const stateLabel = this.redundancyAllowed ? $localize`enabled` : $localize`disabled`
2018-09-11 16:27:07 +02:00
this.notifier.success($localize`Redundancy for ${this.host} is ${stateLabel}`)
},
2018-09-11 16:27:07 +02:00
2021-08-17 11:27:47 +02:00
error: err => this.notifier.error(err.message)
})
2018-09-11 16:27:07 +02:00
}
}