diff --git a/client/src/components/Masthead/HelpModeSwitch.vue b/client/src/components/Masthead/HelpModeSwitch.vue index 2d41181a6b27..a1a7b7bbf0b4 100644 --- a/client/src/components/Masthead/HelpModeSwitch.vue +++ b/client/src/components/Masthead/HelpModeSwitch.vue @@ -2,6 +2,7 @@ import { library } from "@fortawesome/fontawesome-svg-core"; import { faQuestionCircle } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; +import { BButton } from "bootstrap-vue"; import { storeToRefs } from "pinia"; import { useHelpModeStore } from "@/stores/helpmode/helpModeStore"; @@ -18,17 +19,18 @@ function toggleEnabledStatus() { @@ -44,8 +46,8 @@ function toggleEnabledStatus() { cursor: pointer; color: inherit; outline: none; -} -.help-mode-button.highlight { - color: var(--masthead-text-hover); + &.highlight { + color: var(--masthead-text-hover); + } } diff --git a/client/src/stores/helpmode/helpModeStore.ts b/client/src/stores/helpmode/helpModeStore.ts index 95e704586a2f..e098d4215b8c 100644 --- a/client/src/stores/helpmode/helpModeStore.ts +++ b/client/src/stores/helpmode/helpModeStore.ts @@ -4,7 +4,7 @@ import type { IconDefinition } from "@fortawesome/fontawesome-svg-core"; import { defineStore } from "pinia"; -import { ref } from "vue"; +import { ref, watch } from "vue"; import { rethrowSimple } from "@/utils/simple-error"; @@ -40,8 +40,26 @@ export const useHelpModeStore = defineStore("helpModeStore", () => { const currentTabs = ref([]); /** Component ids for which fetching the help text was unsuccessful */ const invalidIds = ref([]); + /** The ids of the components for which help text was requested while help mode was disabled */ + const idsToStore = ref([]); + + // when help mode is enabled, store help for the ids requested while help mode was disabled + watch(status, async (newStatus) => { + if (newStatus) { + for (const id of idsToStore.value) { + await storeHelpModeText(id); + } + idsToStore.value = []; + } + }); async function storeHelpModeText(id: string, icon?: IconDefinition) { + // if help mode is disabled, store the id in the temp array and return + if (!status.value) { + idsToStore.value.push(id); + return; + } + loading.value = true; try { // Error handling @@ -78,6 +96,14 @@ export const useHelpModeStore = defineStore("helpModeStore", () => { } function clearHelpModeText(id: string) { + // if help mode is disabled, remove the id from the temp array + if (!status.value) { + const idx = idsToStore.value.indexOf(id); + if (idx !== -1) { + idsToStore.value.splice(idx, 1); + } + } + // remove id from currentTabs const idx = currentTabs.value.indexOf(id); if (idx !== -1) { @@ -105,7 +131,7 @@ export const useHelpModeStore = defineStore("helpModeStore", () => { status, /** Removes the tab from the stack for the given component `id` */ clearHelpModeText, - /** Adds help mode text for the given Galaxy component `id` */ + /** Adds help mode text for the given Galaxy component `id` if help mode is enabled */ storeHelpModeText, }; }); diff --git a/doc/source/admin/galaxy_options.rst b/doc/source/admin/galaxy_options.rst index 342933fe168b..cc45adf27502 100644 --- a/doc/source/admin/galaxy_options.rst +++ b/doc/source/admin/galaxy_options.rst @@ -2346,6 +2346,16 @@ :Type: str +~~~~~~~~~~~~~ +``enable_help_mode`` +~~~~~~~~~~~~~ + +:Description: + Enables the Galaxy Help Mode for this Galaxy Instance. +:Default: ``false`` +:Type: bool + + ~~~~~~~~~~~~~~~~~~ ``static_enabled`` ~~~~~~~~~~~~~~~~~~ diff --git a/lib/galaxy/config/sample/galaxy.yml.sample b/lib/galaxy/config/sample/galaxy.yml.sample index 96c2a84e0bda..5c51ca81cca5 100644 --- a/lib/galaxy/config/sample/galaxy.yml.sample +++ b/lib/galaxy/config/sample/galaxy.yml.sample @@ -1432,6 +1432,9 @@ galaxy: # activation emails. #terms_url: null + # Enables the Galaxy Help Mode for this Galaxy Instance. + #enable_help_mode: false + # Serve static content, which must be enabled if you're not serving it # via a proxy server. These options should be self explanatory and so # are not documented individually. You can use these paths (or ones diff --git a/lib/galaxy/config/schemas/config_schema.yml b/lib/galaxy/config/schemas/config_schema.yml index 823780a856f2..9a3f59cea11a 100644 --- a/lib/galaxy/config/schemas/config_schema.yml +++ b/lib/galaxy/config/schemas/config_schema.yml @@ -1698,6 +1698,13 @@ mapping: The URL linked by the "Terms and Conditions" link in the "Help" menu, as well as on the user registration and login forms and in the activation emails. + enable_help_mode: + type: bool + default: false + required: false + desc: | + Enables the Galaxy Help Mode for this Galaxy Instance. + static_enabled: type: bool default: true diff --git a/lib/galaxy/managers/configuration.py b/lib/galaxy/managers/configuration.py index bb010dfd909d..85e17a068a1d 100644 --- a/lib/galaxy/managers/configuration.py +++ b/lib/galaxy/managers/configuration.py @@ -206,6 +206,7 @@ def _config_is_truthy(item, key, **context): "upload_from_form_button": _use_config, "release_doc_base_url": _use_config, "expose_user_email": _use_config, + "enable_help_mode": _use_config, "enable_tool_source_display": _use_config, "enable_celery_tasks": _use_config, "quota_source_labels": lambda item, key, **context: list(