From fa4b75753a1b27151ca279198b0fb36cae4c9b16 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Thu, 13 Jul 2023 05:51:34 +0000 Subject: [PATCH] feat: copy user token in admin --- server/locales/en.json | 2 ++ ux/src/components/PageTags.vue | 2 +- ux/src/pages/AdminFlags.vue | 44 +++++++++++++++++++++++++++++++++- ux/src/pages/AdminSystem.vue | 2 +- ux/src/pages/Search.vue | 2 +- 5 files changed, 48 insertions(+), 4 deletions(-) diff --git a/server/locales/en.json b/server/locales/en.json index 1ae4e08f..0fe2135f 100644 --- a/server/locales/en.json +++ b/server/locales/en.json @@ -195,6 +195,8 @@ "admin.flags.authDebug.label": "Auth Debug", "admin.flags.experimental.hint": "Enable unstable / unfinished features. DO NOT enable in a production environment!", "admin.flags.experimental.label": "Experimental Features", + "admin.flags.getTokenHint": "Copy your current authentication token for use in GraphQL API testing.", + "admin.flags.getTokenLabel": "Get Current Token", "admin.flags.saveSuccess": "Flags have been updated successfully.", "admin.flags.sqlLog.hint": "Log all queries made to the database to console.", "admin.flags.sqlLog.label": "SQL Query Logging", diff --git a/ux/src/components/PageTags.vue b/ux/src/components/PageTags.vue index 88838d8a..c2ad42e5 100644 --- a/ux/src/components/PageTags.vue +++ b/ux/src/components/PageTags.vue @@ -6,7 +6,7 @@ color='secondary' text-color='white' dense - clickable + :clickable='!props.edit' :removable='props.edit' @remove='removeTag(tag)' v-for='tag of pageStore.tags' diff --git a/ux/src/pages/AdminFlags.vue b/ux/src/pages/AdminFlags.vue index 52cdfe0f..8b265281 100644 --- a/ux/src/pages/AdminFlags.vue +++ b/ux/src/pages/AdminFlags.vue @@ -105,6 +105,22 @@ q-page.admin-flags disabled ) + q-card.q-py-sm.q-mt-md + q-item + blueprint-icon(icon='key') + q-item-section + q-item-label {{t(`admin.flags.getTokenLabel`)}} + q-item-label(caption) {{t(`admin.flags.getTokenHint`)}} + q-item-section(avatar) + q-btn( + ref='copyTokenBtn' + :label='t(`common.actions.copy`)' + unelevated + icon='las la-clipboard' + color='primary' + text-color='white' + ) + .col-12.col-lg-5.gt-md .q-pa-md.text-center img(src='/_assets/illustrations/undraw_settings.svg', style='width: 80%;') @@ -112,13 +128,15 @@ q-page.admin-flags diff --git a/ux/src/pages/AdminSystem.vue b/ux/src/pages/AdminSystem.vue index 265f7691..01245409 100644 --- a/ux/src/pages/AdminSystem.vue +++ b/ux/src/pages/AdminSystem.vue @@ -355,7 +355,7 @@ Total RAM: ${state.info.ramTotal}` clip.on('error', () => { $q.notify({ type: 'negative', - message: 'Failed to copy to system info' + message: 'Failed to copy system info' }) }) }) diff --git a/ux/src/pages/Search.vue b/ux/src/pages/Search.vue index ab293f1e..7cca92f7 100644 --- a/ux/src/pages/Search.vue +++ b/ux/src/pages/Search.vue @@ -401,7 +401,7 @@ async function performSearch () { if (!resp?.data?.searchPages) { throw new Error('Unexpected error') } - state.results = cloneDeep(resp.data.searchPages.results) + state.results = cloneDeep(resp.data.searchPages.results).map(r => { r.tags.sort(); return r }) state.total = resp.data.searchPages.totalHits siteStore.searchLastQuery = siteStore.search } catch (err) {