Don't show send notifications box if config doesn't enable notifications

This commit is contained in:
mvdbeek
2026-01-21 12:21:11 +01:00
parent cb082e952e
commit 36eea66d42
4 changed files with 74 additions and 37 deletions
@@ -2,6 +2,7 @@
import { BButton, BFormCheckbox, BFormGroup, BModal } from "bootstrap-vue";
import { computed, reactive, ref, watch } from "vue";
import { useConfig } from "@/composables/config";
import { useFileSources } from "@/composables/fileSources";
import ExportOnCompleteWizard from "./ExportOnCompleteWizard.vue";
@@ -30,8 +31,13 @@ const emit = defineEmits<{
(e: "input", value: OnCompleteAction[]): void;
}>();
const { config, isConfigLoaded } = useConfig(true);
const { hasWritable: hasWritableFileSources } = useFileSources({ exclude: ["rdm"] });
const notificationSystemEnabled = computed(
() => isConfigLoaded.value && config.value?.enable_notification_system === true,
);
const showExportWizard = ref(false);
const state = reactive({
@@ -116,7 +122,7 @@ const exportSummary = computed(() => {
<template v-slot:body>
<p class="text-muted">Configure actions to run automatically when this workflow invocation completes.</p>
<BFormGroup>
<BFormGroup v-if="notificationSystemEnabled">
<BFormCheckbox v-model="state.sendNotification" switch data-test-id="send-notification-checkbox">
<span class="font-weight-bold">Send notification</span>
<br />
@@ -521,7 +521,7 @@ onBeforeMount(() => {
</div>
<!-- Send notification -->
<div class="settings-row">
<div v-if="isConfigLoaded && config.enable_notification_system" class="settings-row">
<GCheckbox
v-model="sendNotificationOnComplete"
toggle
@@ -919,38 +919,3 @@ steps: {}
history_id = self.current_history_id()
self.workflow_populator.wait_for_history_workflows(history_id, expected_invocation_count=1)
return self.workflow_populator.history_invocations(history_id)[0]
@selenium_only("Not yet migrated to support Playwright backend")
@selenium_test
@managed_history
def test_on_complete_notification_action(self):
"""Test configuring the send notification completion action."""
self.perform_upload(self.get_filename("1.fasta"))
self.wait_for_history()
self.workflow_run_open_workflow(WORKFLOW_SIMPLE_CAT_TWICE)
self.sleep_for(self.wait_types.UX_RENDER)
# Open the runtime settings panel by clicking the gear button
settings_button = self.driver.find_element(By.CSS_SELECTOR, "[data-test-id='workflow-run-settings-button']")
settings_button.click()
self.sleep_for(self.wait_types.UX_RENDER)
self.screenshot("workflow_run_settings_panel_open")
# Find and click the send notification checkbox
# GCheckbox root element is a clickable label
notification_checkbox = self.driver.find_element(By.CSS_SELECTOR, "[data-test-id='send-notification-checkbox']")
notification_checkbox.click()
self.sleep_for(self.wait_types.UX_RENDER)
self.screenshot("workflow_run_on_complete_notification_enabled")
self.workflow_run_submit()
self.sleep_for(self.wait_types.UX_TRANSITION)
# Verify the invocation has the on_complete action
history_id = self.current_history_id()
self.workflow_populator.wait_for_history_workflows(history_id, expected_invocation_count=1)
invocations = self.workflow_populator.history_invocations(history_id)
invocation = self.workflow_populator.get_invocation(invocations[0]["id"])
on_complete = invocation.get("on_complete") or []
assert len(on_complete) == 1, f"Expected 1 on_complete action, got {on_complete}"
assert "send_notification" in on_complete[0], f"Expected send_notification in {on_complete[0]}"
@@ -0,0 +1,66 @@
from typing import TYPE_CHECKING
from selenium.webdriver.common.by import By
from galaxy_test.base.workflow_fixtures import WORKFLOW_SIMPLE_CAT_TWICE
from galaxy_test.selenium.framework import (
managed_history,
RunsWorkflows,
selenium_only,
UsesHistoryItemAssertions,
)
from .framework import (
selenium_test,
SeleniumIntegrationTestCase,
)
if TYPE_CHECKING:
from galaxy_test.selenium.framework import SeleniumSessionDatasetPopulator
class BaseWorkflowRunTargetTestCase(SeleniumIntegrationTestCase, RunsWorkflows, UsesHistoryItemAssertions):
dataset_populator: "SeleniumSessionDatasetPopulator"
ensure_registered = True
class TestWorkflowRunNotificationSeleniumIntegration(BaseWorkflowRunTargetTestCase):
@classmethod
def handle_galaxy_config_kwds(cls, config):
super().handle_galaxy_config_kwds(config)
config["enable_notification_system"] = True
@selenium_only("Not yet migrated to support Playwright backend")
@selenium_test
@managed_history
def test_on_complete_notification_action(self):
"""Test configuring the send notification completion action."""
filename = self.test_data_resolver.get_filename("1.fasta")
self.perform_upload(filename)
self.wait_for_history()
self.workflow_run_open_workflow(WORKFLOW_SIMPLE_CAT_TWICE)
self.sleep_for(self.wait_types.UX_RENDER)
# Open the runtime settings panel by clicking the gear button
settings_button = self.driver.find_element(By.CSS_SELECTOR, "[data-test-id='workflow-run-settings-button']")
settings_button.click()
self.sleep_for(self.wait_types.UX_RENDER)
self.screenshot("workflow_run_settings_panel_open")
# Find and click the send notification checkbox
# GCheckbox root element is a clickable label
notification_checkbox = self.driver.find_element(By.CSS_SELECTOR, "[data-test-id='send-notification-checkbox']")
notification_checkbox.click()
self.sleep_for(self.wait_types.UX_RENDER)
self.screenshot("workflow_run_on_complete_notification_enabled")
self.workflow_run_submit()
self.sleep_for(self.wait_types.UX_TRANSITION)
# Verify the invocation has the on_complete action
history_id = self.current_history_id()
self.workflow_populator.wait_for_history_workflows(history_id, expected_invocation_count=1)
invocations = self.workflow_populator.history_invocations(history_id)
invocation = self.workflow_populator.get_invocation(invocations[0]["id"])
on_complete = invocation.get("on_complete") or []
assert len(on_complete) == 1, f"Expected 1 on_complete action, got {on_complete}"
assert "send_notification" in on_complete[0], f"Expected send_notification in {on_complete[0]}"