diff --git a/frontend/src/lib/components/FlowBuilder.svelte b/frontend/src/lib/components/FlowBuilder.svelte index 95e659bdf4..5266f4f169 100644 --- a/frontend/src/lib/components/FlowBuilder.svelte +++ b/frontend/src/lib/components/FlowBuilder.svelte @@ -96,6 +96,8 @@ import type { FlowBuilderProps } from './flow_builder' import { ModulesTestStates } from './modulesTest.svelte' import FlowAssetsHandler, { initFlowGraphAssetsCtx } from './flows/FlowAssetsHandler.svelte' + import { isRuleActive } from '$lib/workspaceProtectionRules.svelte' + import { buildForkEditUrl } from '$lib/utils/editInFork' let { initialPath = $bindable(''), @@ -810,6 +812,13 @@ onClick: () => window.open(`/flows/add?template=${initialPath}`) }) } + + if (!newFlow && !isRuleActive('DisableWorkspaceForking')) { + dropdownItems.push({ + label: 'Edit in workspace fork', + onClick: () => window.open(buildForkEditUrl('flow', initialPath)) + }) + } } let flowCopilotContext: FlowCopilotContext = $state({ diff --git a/frontend/src/lib/components/ScriptBuilder.svelte b/frontend/src/lib/components/ScriptBuilder.svelte index 9b634fd921..40c4c2b896 100644 --- a/frontend/src/lib/components/ScriptBuilder.svelte +++ b/frontend/src/lib/components/ScriptBuilder.svelte @@ -103,6 +103,8 @@ import { inputSizeClasses } from './text_input/TextInput.svelte' import type { ButtonType } from './common/button/model' import DebounceLimit from './flows/DebounceLimit.svelte' + import { isRuleActive } from '$lib/workspaceProtectionRules.svelte' + import { buildForkEditUrl } from '$lib/utils/editInFork' import OnBehalfOfSelector, { type OnBehalfOfChoice } from './OnBehalfOfSelector.svelte' let { @@ -769,6 +771,16 @@ window.open(`/scripts/add?template=${initialPath}`) } }, + ...(!isRuleActive('DisableWorkspaceForking') + ? [ + { + label: 'Edit in workspace fork', + onClick: () => { + window.open(buildForkEditUrl('script', initialPath)) + } + } + ] + : []), ...(customUi?.topBar?.diff !== false && savedScript && diffDrawer ? [ { diff --git a/frontend/src/lib/components/apps/editor/AppEditorHeader.svelte b/frontend/src/lib/components/apps/editor/AppEditorHeader.svelte index a85602ddfa..f194bc1df7 100644 --- a/frontend/src/lib/components/apps/editor/AppEditorHeader.svelte +++ b/frontend/src/lib/components/apps/editor/AppEditorHeader.svelte @@ -63,6 +63,8 @@ import AppEditorHeaderDeployInitialDraft from './AppEditorHeaderDeployInitialDraft.svelte' import { computeSecretUrl } from './appDeploy.svelte' import { updatePolicy } from './appPolicy' + import { isRuleActive } from '$lib/workspaceProtectionRules.svelte' + import { buildForkEditUrl } from '$lib/utils/editInFork' interface Props { policy: Policy @@ -1118,7 +1120,17 @@ onClick: () => { window.open(`/apps/add?template=${appPath}`) } - } + }, + ...(!isRuleActive('DisableWorkspaceForking') + ? [ + { + label: 'Edit in workspace fork', + onClick: () => { + window.open(buildForkEditUrl('app', $appPath)) + } + } + ] + : []) ] : undefined} > diff --git a/frontend/src/lib/components/common/table/AppRow.svelte b/frontend/src/lib/components/common/table/AppRow.svelte index 529b50ea0b..3998b15af5 100644 --- a/frontend/src/lib/components/common/table/AppRow.svelte +++ b/frontend/src/lib/components/common/table/AppRow.svelte @@ -32,6 +32,8 @@ import AppDeploymentHistory from '$lib/components/apps/editor/AppDeploymentHistory.svelte' import { isDeployable } from '$lib/utils_deployable' import { getDeployUiSettings } from '$lib/components/home/deploy_ui' + import { isRuleActive } from '$lib/workspaceProtectionRules.svelte' + import { buildForkEditUrl } from '$lib/utils/editInFork' interface Props { app: ListableApp & { has_draft?: boolean; draft_only?: boolean; canWrite: boolean } @@ -97,8 +99,8 @@ {/snippet} {#snippet actions()}