aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-02-08 16:15:00 +0100
committerChocobozzz <me@florianbigard.com>2022-02-09 11:54:18 +0100
commitba8a8367e7fde7915ae6633445bf46ebf4a9fe94 (patch)
tree7aee97d67bc13acec5d428b3eb59285b92a02225 /client/src/app/+admin
parent15a0e5f3b3b34762be820635434eb11a430ae0c4 (diff)
downloadPeerTube-ba8a8367e7fde7915ae6633445bf46ebf4a9fe94.tar.gz
PeerTube-ba8a8367e7fde7915ae6633445bf46ebf4a9fe94.tar.zst
PeerTube-ba8a8367e7fde7915ae6633445bf46ebf4a9fe94.zip
Better display redundancy pies
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts33
1 files changed, 22 insertions, 11 deletions
diff --git a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts
index c862cd250..a89603048 100644
--- a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts
+++ b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts
@@ -90,19 +90,31 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit
90 } 90 }
91 91
92 buildPieData (stats: VideosRedundancyStats) { 92 buildPieData (stats: VideosRedundancyStats) {
93 const totalSize = stats.totalSize 93 if (stats.totalSize === 0) return
94
95 const totalAvailable = stats.totalSize
94 ? stats.totalSize - stats.totalUsed 96 ? stats.totalSize - stats.totalUsed
95 : stats.totalUsed 97 : null
98
99 const labels = [ $localize`Used (${this.bytesToHuman(stats.totalUsed)})` ]
100 const data = [ stats.totalUsed ]
96 101
97 if (totalSize === 0) return 102 // Not in manual strategy
103 if (totalAvailable) {
104 labels.push(
105 $localize`Available (${this.bytesToHuman(totalAvailable)})`
106 )
107
108 data.push(totalAvailable)
109 }
98 110
99 this.redundanciesGraphsData.push({ 111 this.redundanciesGraphsData.push({
100 stats, 112 stats,
101 graphData: { 113 graphData: {
102 labels: [ $localize`Used`, $localize`Available` ], 114 labels,
103 datasets: [ 115 datasets: [
104 { 116 {
105 data: [ stats.totalUsed, totalSize ], 117 data,
106 backgroundColor: [ 118 backgroundColor: [
107 '#FF6384', 119 '#FF6384',
108 '#36A2EB' 120 '#36A2EB'
@@ -124,12 +136,7 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit
124 tooltip: { 136 tooltip: {
125 callbacks: { 137 callbacks: {
126 label: (tooltip: TooltipItem<any>) => { 138 label: (tooltip: TooltipItem<any>) => {
127 let label = tooltip.label || '' 139 return tooltip.label
128 if (label) label += ': '
129
130 label += this.bytesPipe.transform(tooltip.raw as number, 1)
131
132 return label
133 } 140 }
134 } 141 }
135 } 142 }
@@ -181,4 +188,8 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit
181 private saveSelectLocalStorage () { 188 private saveSelectLocalStorage () {
182 peertubeLocalStorage.setItem(VideoRedundanciesListComponent.LOCAL_STORAGE_DISPLAY_TYPE, this.displayType) 189 peertubeLocalStorage.setItem(VideoRedundanciesListComponent.LOCAL_STORAGE_DISPLAY_TYPE, this.displayType)
183 } 190 }
191
192 private bytesToHuman (bytes: number) {
193 return this.bytesPipe.transform(bytes, 1)
194 }
184} 195}