diff --git a/core/src/main/java/com/vml/es/aem/acm/core/mock/MockHttpFilter.java b/core/src/main/java/com/vml/es/aem/acm/core/mock/MockHttpFilter.java index 8d816bd0..328abaae 100644 --- a/core/src/main/java/com/vml/es/aem/acm/core/mock/MockHttpFilter.java +++ b/core/src/main/java/com/vml/es/aem/acm/core/mock/MockHttpFilter.java @@ -140,8 +140,11 @@ public void destroy() { "Dedicated for dynamic response generation for mocking purposes, ideal for simulating 3rd-party system responses when their base URL is redirected to this service.") public @interface Config { - @AttributeDefinition(name = "Enabled") - boolean enabled() default true; + @AttributeDefinition( + name = "Enabled", + description = + "When disabled, the filter will not process any requests. Also GUI no longer will display the mock scripts.") + boolean enabled() default false; @AttributeDefinition( name = "Whiteboard Filter Regex", diff --git a/ui.content.example/src/main/content/jcr_root/conf/acm/settings/script/extension/example/ACME-300_extension.groovy b/ui.content.example/src/main/content/jcr_root/conf/acm/settings/script/extension/example/ACME-300_extension.groovy index 9f5bad53..ee6f057e 100644 --- a/ui.content.example/src/main/content/jcr_root/conf/acm/settings/script/extension/example/ACME-300_extension.groovy +++ b/ui.content.example/src/main/content/jcr_root/conf/acm/settings/script/extension/example/ACME-300_extension.groovy @@ -1,6 +1,5 @@ import com.vml.es.aem.acm.core.code.ExecutionContext import com.vml.es.aem.acm.core.code.Execution -import com.vml.es.aem.acm.core.mock.MockContext void prepareRun(ExecutionContext context) { context.variable("acme", new AcmeFacade()) @@ -13,10 +12,6 @@ void completeRun(Execution execution) { } } -void prepareMock(MockContext context) { - context.variable("acme", new AcmeFacade()) -} - class AcmeFacade { def now() { return new Date() diff --git a/ui.frontend/src/pages/ScriptsPage.tsx b/ui.frontend/src/pages/ScriptsPage.tsx index 99e58917..16e84bb8 100644 --- a/ui.frontend/src/pages/ScriptsPage.tsx +++ b/ui.frontend/src/pages/ScriptsPage.tsx @@ -6,11 +6,13 @@ import FlashOn from '@spectrum-icons/workflow/FlashOn'; import Hand from '@spectrum-icons/workflow/Hand'; import ScriptListRich from '../components/ScriptListRich.tsx'; import ScriptListSimple from '../components/ScriptListSimple.tsx'; +import { useAppState } from '../hooks/app.ts'; import { useNavigationTab } from '../hooks/navigation'; import { ScriptType } from '../utils/api.types'; import styles from './ScriptsPage.module.css'; const ScriptsPage = () => { + const appState = useAppState(); const [selectedTab, handleTabChange] = useNavigationTab('manual'); return ( @@ -29,10 +31,12 @@ const ScriptsPage = () => { Disabled - - - Mock - + {appState.mockStatus.enabled ? ( + + + Mock + + ) : null} Extension @@ -48,9 +52,11 @@ const ScriptsPage = () => { - - - + {appState.mockStatus.enabled ? ( + + + + ) : null}