From adce75ab8f93d52a4e15ec3a279a6261741b8c98 Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Tue, 13 Jun 2023 15:53:18 +1200 Subject: [PATCH 1/3] UI: Display message tags below subject in message overview --- server/ui-src/App.vue | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/server/ui-src/App.vue b/server/ui-src/App.vue index 16e9b2f..dd1ec39 100644 --- a/server/ui-src/App.vue +++ b/server/ui-src/App.vue @@ -100,6 +100,27 @@ export default { fallback: false }); + moment.updateLocale('en', { + relativeTime: { + future: "in %s", + past: "%s ago", + s: 'seconds', + ss: '%d secs', + m: "a minute", + mm: "%d mins", + h: "an hour", + hh: "%d hours", + d: "a day", + dd: "%d days", + w: "a week", + ww: "%d weeks", + M: "a month", + MM: "%d months", + y: "a year", + yy: "%d years" + } + }); + this.connect(); this.getUISettings(); this.loadMessages(); @@ -906,13 +927,13 @@ export default { -
+
@@ -938,18 +959,20 @@ export default {
-
- - {{ t }} - - {{ message.Subject != "" ? message.Subject : "[ no subject ]" }} +
+
{{ message.Subject != "" ? message.Subject : "[ no subject ]" }}
+
+ + {{ t }} + +
{{ getFileSize(message.Size) }}
-
+
{{ getRelativeCreated(message) }}
From ff9a6ff49159e0f6c26498aff4665e31739fa546 Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Tue, 13 Jun 2023 16:57:42 +1200 Subject: [PATCH 2/3] API: Sort tags before saving Tags should be alphabetically sorted before saving. Whilst this was the behavior with automated tagging, it did not apply to manually set tags via the API. --- storage/tags.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storage/tags.go b/storage/tags.go index 4c47506..7b06407 100644 --- a/storage/tags.go +++ b/storage/tags.go @@ -22,6 +22,8 @@ func SetTags(id string, tags []string) error { } } + sort.Strings(applyTags) + tagJSON, err := json.Marshal(applyTags) if err != nil { logger.Log().Errorf("[db] setting tags for message %s", id) From fc89655b7fe073d8991d68455826ca7c801d663f Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Wed, 14 Jun 2023 22:18:51 +1200 Subject: [PATCH 3/3] UI: Add option to enable tag colors based on tag name hash An experimental option to add tag colors (see #127). This will generate a random color for each unique tag --- package-lock.json | 6 +++ package.json | 1 + server/ui-src/App.vue | 41 +++++++++++------ .../ui-src/assets/_bootstrap_variables.scss | 1 + server/ui-src/mixins.js | 45 ++++++++++++++++--- 5 files changed, 74 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5549f6f..f01e66e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "bootstrap": "^5.2.0", "bootstrap-icons": "^1.9.1", "bootstrap5-tags": "^1.4.41", + "color-hash": "^2.0.2", "moment": "^2.29.4", "prismjs": "^1.29.0", "rapidoc": "^9.3.4", @@ -1163,6 +1164,11 @@ "node": ">=0.10.0" } }, + "node_modules/color-hash": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/color-hash/-/color-hash-2.0.2.tgz", + "integrity": "sha512-6exeENAqBTuIR1wIo36mR8xVVBv6l1hSLd7Qmvf6158Ld1L15/dbahR9VUOiX7GmGJBCnQyS0EY+I8x+wa7egg==" + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", diff --git a/package.json b/package.json index d213a45..869b943 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "bootstrap": "^5.2.0", "bootstrap-icons": "^1.9.1", "bootstrap5-tags": "^1.4.41", + "color-hash": "^2.0.2", "moment": "^2.29.4", "prismjs": "^1.29.0", "rapidoc": "^9.3.4", diff --git a/server/ui-src/App.vue b/server/ui-src/App.vue index dd1ec39..1695c32 100644 --- a/server/ui-src/App.vue +++ b/server/ui-src/App.vue @@ -1,11 +1,11 @@