From d323bf9ee93893d981da2204b06775a7b65b7dc8 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sun, 17 Mar 2024 16:03:40 +0100 Subject: [PATCH] admin: Improve file readability --- admin/static/js/app.js | 5 ++++- admin/static/js/common.js | 12 ++++++++++++ admin/static/views/file-list.html | 12 ++++++++++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/admin/static/js/app.js b/admin/static/js/app.js index d6ba8965..ce2860e7 100644 --- a/admin/static/js/app.js +++ b/admin/static/js/app.js @@ -1352,7 +1352,7 @@ angular.module("FICApp") $scope.files = File.query(); $scope.errfnd = null; $scope.errzip = null; - $scope.fields = ["id", "path", "name", "checksum", "size"]; + $scope.fields = ["id", "path", "name", "size"]; $scope.clearFiles = function(id) { File.delete(function() { @@ -1376,12 +1376,15 @@ angular.module("FICApp") }) }; $scope.checksum = function(f) { + f.checkWIP = true; $http({ url: "api/files/" + f.id + "/check", method: "POST" }).then(function(response) { + f.checkWIP = false; f.err = true; }, function(response) { + f.checkWIP = false; $scope.inSync = false; $scope.errfnd += 1; f.err = response.data.errmsg; diff --git a/admin/static/js/common.js b/admin/static/js/common.js index 05574e36..e1c2f8d8 100644 --- a/admin/static/js/common.js +++ b/admin/static/js/common.js @@ -200,6 +200,18 @@ angular.module("FICApp") else return ""; } + }) + + .filter("bto16", function() { + return function(input) { + const raw = atob(input); + let result = ''; + for (let i = 0; i < raw.length; i++) { + const hex = raw.charCodeAt(i).toString(16); + result += (hex.length === 2 ? hex : '0' + hex); + } + return result; + } }); angular.module("FICApp") diff --git a/admin/static/views/file-list.html b/admin/static/views/file-list.html index 81dba785..4153378f 100644 --- a/admin/static/views/file-list.html +++ b/admin/static/views/file-list.html @@ -14,13 +14,17 @@ {{ field }} + checksum - - + @@ -29,6 +33,10 @@ {{ file[field] }} + + {{ file.checksum | bto16 }} +
{{ file.checksum_shown | bto16 }}
+