From 5e95197d8fad5ae931203fe4c2359af6e1a70b5f Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Wed, 19 Jul 2023 19:31:35 +0200 Subject: [PATCH 1/4] Provide a way to graphically enable logging Signed-off-by: Christian Wolf --- src/components/SettingsDialog.vue | 22 ++++++++++++++++++---- src/js/logging.js | 4 ++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/components/SettingsDialog.vue b/src/components/SettingsDialog.vue index 13c01e19f..f340b5540 100644 --- a/src/components/SettingsDialog.vue +++ b/src/components/SettingsDialog.vue @@ -89,10 +89,8 @@
{{ - t( - "cookbook", - "Control which blocks of information are shown in the recipe view. If you do not use some features and find them distracting, you may hide them.", - ) + // prettier-ignore + t("cookbook", "Control which blocks of information are shown in the recipe view. If you do not use some features and find them distracting, you may hide them.") }}
    @@ -159,6 +157,17 @@
+ + + Enable debugging + + @@ -174,6 +183,8 @@ import ReloadIcon from "icons/Cached.vue" import api from "cookbook/js/api-interface" import { showSimpleAlertModal } from "cookbook/js/modals" +import { enableLogging } from 'cookbook/js/logging' + export const SHOW_SETTINGS_EVENT = "show-settings" const INFO_BLOCK_KEYS = [ @@ -390,6 +401,9 @@ export default { this.$log.error("Library reindexing failed!") }) }, + enableLogger() { + enableLogging() + }, beforeDestroy() { unsubscribe(SHOW_SETTINGS_EVENT, this.handleShowSettings) diff --git a/src/js/logging.js b/src/js/logging.js index 07320e69e..a99d90618 100644 --- a/src/js/logging.js +++ b/src/js/logging.js @@ -66,3 +66,7 @@ export default function setupLogging(Vue) { Vue.$log.info(`Setting up logging with log level ${logLevel}`) } + +export function enableLogging() { + localStorage.setItem(KEY_ENABLED, true) +} From 71df143f082fca446df69350b1d48f745c18ffcc Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Wed, 19 Jul 2023 19:31:57 +0200 Subject: [PATCH 2/4] Fix inception config in axios Signed-off-by: Christian Wolf --- src/js/api-interface.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/api-interface.js b/src/js/api-interface.js index d8723328e..c86c10030 100644 --- a/src/js/api-interface.js +++ b/src/js/api-interface.js @@ -13,8 +13,8 @@ instance.interceptors.request.use((config) => { `[axios] Making "${config.method}" request to "${config.url}"`, config, ) - const contentType = config.headers[config.method]["Content-Type"] - if (!["application/json", "text/json"].includes(contentType)) { + const contentType = config.headers["Content-Type"] + if (contentType && !["application/json", "text/json"].includes(contentType)) { Vue.$log.warn( `[axios] Request to "${config.url}" is using Content-Type "${contentType}", not JSON`, ) From fa44fddf99cc9beb90c9485964081e2263cba7a5 Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Fri, 21 Jul 2023 16:30:01 +0200 Subject: [PATCH 3/4] Added more text to make things more UI friendly and make prettier happy Signed-off-by: Christian Wolf --- src/components/SettingsDialog.vue | 20 +++++++++++--------- src/js/api-interface.js | 5 ++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/components/SettingsDialog.vue b/src/components/SettingsDialog.vue index f340b5540..402b80a05 100644 --- a/src/components/SettingsDialog.vue +++ b/src/components/SettingsDialog.vue @@ -158,15 +158,17 @@ - - Enable debugging - + > + + {{ + // prettier-ignore + t("cookbook", "This allows to temporarily enable logging in the browser console in case of problems. You will not need these settings by default.") + }} + + Enable debugging @@ -183,7 +185,7 @@ import ReloadIcon from "icons/Cached.vue" import api from "cookbook/js/api-interface" import { showSimpleAlertModal } from "cookbook/js/modals" -import { enableLogging } from 'cookbook/js/logging' +import { enableLogging } from "cookbook/js/logging" export const SHOW_SETTINGS_EVENT = "show-settings" diff --git a/src/js/api-interface.js b/src/js/api-interface.js index c86c10030..ecaa1b98f 100644 --- a/src/js/api-interface.js +++ b/src/js/api-interface.js @@ -14,7 +14,10 @@ instance.interceptors.request.use((config) => { config, ) const contentType = config.headers["Content-Type"] - if (contentType && !["application/json", "text/json"].includes(contentType)) { + if ( + contentType && + !["application/json", "text/json"].includes(contentType) + ) { Vue.$log.warn( `[axios] Request to "${config.url}" is using Content-Type "${contentType}", not JSON`, ) From f45179e18aa20f557e8e95b4c1fceb1d0afa9922 Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Fri, 21 Jul 2023 17:14:40 +0200 Subject: [PATCH 4/4] Update changelog Signed-off-by: Christian Wolf --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47a30f086..296a73e68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ [#1582](https://github.com/nextcloud/cookbook/pull/1582) @roliverio - Make time input fields wider to view multiple digits in chrome [#1687](https://github.com/nextcloud/cookbook/pull/1687) @christianlupus +- Prevent popup from falsely showing during loading of the app + [#1764](https://github.com/nextcloud/cookbook/pull/1764) @christianlupus ### Maintenance - Fix URL of Transifex after upstream subdomain change