aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/components/services/Immich.vue
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/services/Immich.vue')
-rw-r--r--src/components/services/Immich.vue30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/components/services/Immich.vue b/src/components/services/Immich.vue
index e86ecd6..7cde306 100644
--- a/src/components/services/Immich.vue
+++ b/src/components/services/Immich.vue
@@ -40,7 +40,7 @@ export default {
40 }, 40 },
41 data: () => { 41 data: () => {
42 return { 42 return {
43 users: null, 43 users: null,
44 photos: null, 44 photos: null,
45 videos: null, 45 videos: null,
46 usage: null, 46 usage: null,
@@ -56,25 +56,27 @@ export default {
56 }, 56 },
57 computed: { 57 computed: {
58 humanizeSize: function () { 58 humanizeSize: function () {
59 let bytes = this.usage; 59 let bytes = this.usage;
60 if (Math.abs(bytes) < 1024) 60 if (Math.abs(bytes) < 1024) return bytes + " B";
61 return bytes + ' B';
62 61
63 const units = ['KiB', 'MiB', 'GiB', 'TiB']; 62 const units = ["KiB", "MiB", "GiB", "TiB"];
64 let u = -1; 63 let u = -1;
65 do { 64 do {
66 bytes /= 1024; 65 bytes /= 1024;
67 ++u; 66 ++u;
68 } while (Math.round(Math.abs(bytes) * 100) / 100 >= 1024 && u < units.length - 1); 67 } while (
68 Math.round(Math.abs(bytes) * 100) / 100 >= 1024 &&
69 u < units.length - 1
70 );
69 71
70 return bytes.toFixed(2) + ' ' + units[u]; 72 return bytes.toFixed(2) + " " + units[u];
71 }, 73 },
72 }, 74 },
73 methods: { 75 methods: {
74 fetchConfig: function () { 76 fetchConfig: function () {
75 const headers = { 77 const headers = {
76 "x-api-key": this.item.apikey, 78 "x-api-key": this.item.apikey,
77 }; 79 };
78 80
79 this.fetch(`/api/server-info/stats`, { headers }) 81 this.fetch(`/api/server-info/stats`, { headers })
80 .then((stats) => { 82 .then((stats) => {
@@ -82,7 +84,7 @@ export default {
82 this.videos = stats.videos; 84 this.videos = stats.videos;
83 this.usage = stats.usage; 85 this.usage = stats.usage;
84 this.users = stats.usageByUser.length; 86 this.users = stats.usageByUser.length;
85 }) 87 })
86 .catch((e) => { 88 .catch((e) => {
87 console.error(e); 89 console.error(e);
88 this.serverError = true; 90 this.serverError = true;
@@ -123,4 +125,4 @@ export default {
123 } 125 }
124 } 126 }
125} 127}
126</style> \ No newline at end of file 128</style>