1
0
Fork 0

Add object storage info badge

This commit is contained in:
Chocobozzz 2022-10-10 14:42:51 +02:00
parent 3e74c22dcb
commit 4624283054
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 11 additions and 1 deletions

View file

@ -85,7 +85,8 @@
<td>
<span *ngIf="isHLS(video)" class="pt-badge badge-blue">HLS</span>
<span *ngIf="isWebTorrent(video)" class="pt-badge badge-blue">WebTorrent ({{ video.files.length }})</span>
<span *ngIf="video.isLive" class="pt-badge badge-blue">Live</span>
<span i18n *ngIf="video.isLive" class="pt-badge badge-blue">Live</span>
<span i18n *ngIf="hasObjectStorage(video)" class="pt-badge badge-purple">Object storage</span>
<span *ngIf="!isImport(video) && !video.isLive && video.isLocal">{{ getFilesSize(video) | bytes: 1 }}</span>
</td>

View file

@ -8,6 +8,7 @@ import { AdvancedInputFilter } from '@app/shared/shared-forms'
import { DropdownAction, Video, VideoService } from '@app/shared/shared-main'
import { VideoBlockComponent, VideoBlockService } from '@app/shared/shared-moderation'
import { VideoActionsDisplayType } from '@app/shared/shared-video-miniature'
import { getAllFiles } from '@shared/core-utils'
import { UserRight, VideoFile, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models'
import { VideoAdminService } from './video-admin.service'
@ -166,6 +167,14 @@ export class VideoListComponent extends RestTable implements OnInit {
return video.files.length !== 0
}
hasObjectStorage (video: Video) {
if (!video.isLocal) return false
const files = getAllFiles(video)
return files.some(f => !f.fileUrl.startsWith(window.location.origin))
}
canRemoveOneFile (video: Video) {
return video.canRemoveOneFile(this.authUser)
}