-import { Component, OnInit } from '@angular/core'
-import { Notifier, ServerService } from '@app/core'
import { SortMeta } from 'primeng/api'
-import { ConfirmService } from '../../../core/confirm/confirm.service'
-import { RestPagination, RestTable } from '../../../shared'
-import { I18n } from '@ngx-translate/i18n-polyfill'
+import { Component, OnInit } from '@angular/core'
+import { ConfirmService, Notifier, RestPagination, RestTable, ServerService } from '@app/core'
+import { BytesPipe, RedundancyService } from '@app/shared/shared-main'
+import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
import { VideoRedundanciesTarget, VideoRedundancy } from '@shared/models'
-import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage'
import { VideosRedundancyStats } from '@shared/models/server'
-import { BytesPipe } from 'ngx-pipes'
-import { RedundancyService } from '@app/shared/video/redundancy.service'
@Component({
selector: 'my-video-redundancies-list',
templateUrl: './video-redundancies-list.component.html',
- styleUrls: [ './video-redundancies-list.component.scss' ]
+ styleUrls: [ '../follows.component.scss', './video-redundancies-list.component.scss' ]
})
export class VideoRedundanciesListComponent extends RestTable implements OnInit {
private static LOCAL_STORAGE_DISPLAY_TYPE = 'video-redundancies-list-display-type'
videoRedundancies: VideoRedundancy[] = []
totalRecords = 0
- rowsPerPage = 10
sort: SortMeta = { field: 'name', order: 1 }
pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
private notifier: Notifier,
private confirmService: ConfirmService,
private redundancyService: RedundancyService,
- private serverService: ServerService,
- private i18n: I18n
- ) {
+ private serverService: ServerService
+ ) {
super()
this.bytesPipe = new BytesPipe()
}
+ getIdentifier () {
+ return 'VideoRedundanciesListComponent'
+ }
+
ngOnInit () {
this.loadSelectLocalStorage()
})
}
+ getColspan () {
+ if (this.isDisplayingRemoteVideos()) return 5
+
+ return 4
+ }
+
isDisplayingRemoteVideos () {
return this.displayType === 'remote-videos'
}
this.pagination.start = 0
this.saveSelectLocalStorage()
- this.loadData()
+ this.reloadData()
}
getRedundancyStrategy (redundancy: VideoRedundancy) {
this.redundanciesGraphsData.push({
stats,
graphData: {
- labels: [ this.i18n('Used'), this.i18n('Available') ],
+ labels: [ $localize`Used`, $localize`Available` ],
datasets: [
{
data: [ stats.totalUsed, totalSize ],
}
async removeRedundancy (redundancy: VideoRedundancy) {
- const message = this.i18n('Do you really want to remove this video redundancy?')
- const res = await this.confirmService.confirm(message, this.i18n('Remove redundancy'))
+ const message = $localize`Do you really want to remove this video redundancy?`
+ const res = await this.confirmService.confirm(message, $localize`Remove redundancy`)
if (res === false) return
this.redundancyService.removeVideoRedundancies(redundancy)
.subscribe(
() => {
- this.notifier.success(this.i18n('Video redundancies removed!'))
- this.loadData()
+ this.notifier.success($localize`Video redundancies removed!`)
+ this.reloadData()
},
err => this.notifier.error(err.message)
}
- protected loadData () {
+ protected reloadData () {
const options = {
pagination: this.pagination,
sort: this.sort,