From b1303cf05dc04539e9088326519a1264dc7b4599 Mon Sep 17 00:00:00 2001 From: TheMeinerLP Date: Sat, 8 Aug 2026 22:41:43 +0200 Subject: [PATCH] fix(frontend): tell the user what is wrong instead of showing nothing Four places reported failure by not reporting it, and two of them lost the message entirely. The console rendered an empty white rectangle whenever the log stream did not come up. The only signal was a toast, which faded after a few seconds and left no trace, so the panel was indistinguishable from a server that simply had nothing to say. It now carries its own state: connecting, connected but quiet, or disconnected with the reason and a Reconnect button. The command input is disabled while the stream is down instead of silently swallowing what gets typed into it. The three toasts are gone, because the information belongs where the reader is already looking. Toasts appeared in the top right corner, which is where the header keeps the account name and the logout button. While one was up, logging out was not clickable. They come up bottom right now, decided once in helpers/toast.js rather than per call site. Four files reached for `createToast` directly and picked a corner each; one login attempt could put its success message in one corner and its failure in another. The sign-in button was filled light grey on white, the same treatment this interface gives a disabled control, and the fields carried no label beyond a placeholder that disappears as soon as anything is typed. It is a primary button now, in the same blue the token page already uses, with real labels and the failure shown inside the dialog rather than behind it. Upload sat inside the file list as a rounded row the same size and shape as a directory entry, told apart from real content by the colour of a dot. It is a labelled drop area below the listing now, so an action no longer looks like content. Two defects surfaced while reading that code and are fixed here: - Nothing ever closed the log stream. `close()` on unmount was commented out, so every visit to the tab left another EventSource running against the server. Verified: one connection per mount, none left behind after leaving. - Every `.catch` that formatted an error read `error.response.status` and `error.response.data.message` directly. That works for a server that answered and throws for one that did not, and the throw happened inside the catch, taking the handler with it. A refused connection or an unreachable host, the most common failure of all, produced no message at all. There is one `errorMessage` helper now, lifted out of the tokens store where a correct version was already hiding, and the five call sites use it. Verified against the previous state view by view: overview and tokens come out pixel identical, settings differs only in the two bands where the toast moved from one corner to the other, and the dashboard only in its live values. Console is the intended redesign. Also removes five stray semicolons that eslint flagged in the console store, which the rewrite touched anyway. Errors on the branch drop from seven to two; both survivors sit in files this change does not open. Signed-off-by: TheMeinerLP --- .../components/browser/DeleteEntryModal.vue | 6 +- .../src/components/browser/FileList.vue | 6 +- .../src/components/browser/FileUpload.vue | 41 +++-- .../src/components/console/ConsoleView.vue | 152 +++++++++++------- .../src/components/header/LoginModal.vue | 109 +++++++++---- reposilite-frontend/src/helpers/toast.js | 37 ++++- reposilite-frontend/src/pages/IndexPage.vue | 2 +- .../src/store/configuration.js | 10 +- .../src/store/console/connection.js | 61 ++++++- reposilite-frontend/src/store/tokens.js | 5 +- 10 files changed, 294 insertions(+), 135 deletions(-) diff --git a/reposilite-frontend/src/components/browser/DeleteEntryModal.vue b/reposilite-frontend/src/components/browser/DeleteEntryModal.vue index 6e411867f..6c0423c27 100644 --- a/reposilite-frontend/src/components/browser/DeleteEntryModal.vue +++ b/reposilite-frontend/src/components/browser/DeleteEntryModal.vue @@ -19,7 +19,7 @@ import { VueFinalModal } from 'vue-final-modal' import '@vueform/toggle/themes/default.css' import CloseIcon from '../icons/CloseIcon.vue' import { useSession } from '../../store/session' -import { createToast } from 'mosha-vue-toastify' +import { createErrorToast, errorMessage } from '../../helpers/toast' import { computed } from 'vue' import useQualifier from '../../store/qualifier' import { property } from '../../helpers/vue-extensions' @@ -35,9 +35,7 @@ const { refreshQualifier } = useQualifier() const deleteEntry = ({ path, file }) => { client.value.maven.delete(path + '/' + file) .then(() => refreshQualifier()) - .catch(error => createToast(`Cannot delete file - ${error.response.status}: ${error.response.data.message}`, { - type: 'danger' - })) + .catch(error => createErrorToast(`Cannot delete file: ${errorMessage(error)}`)) } const deleteAndClose = () => { diff --git a/reposilite-frontend/src/components/browser/FileList.vue b/reposilite-frontend/src/components/browser/FileList.vue index f5dbeb533..49b4a190d 100644 --- a/reposilite-frontend/src/components/browser/FileList.vue +++ b/reposilite-frontend/src/components/browser/FileList.vue @@ -17,7 +17,7 @@ diff --git a/reposilite-frontend/src/components/header/LoginModal.vue b/reposilite-frontend/src/components/header/LoginModal.vue index 22b1fccf7..6eced3242 100644 --- a/reposilite-frontend/src/components/header/LoginModal.vue +++ b/reposilite-frontend/src/components/header/LoginModal.vue @@ -17,7 +17,7 @@