diff --git a/frontend/src/lib/components/FlowBuilder.svelte b/frontend/src/lib/components/FlowBuilder.svelte
index a18d93893e..d61996c3db 100644
--- a/frontend/src/lib/components/FlowBuilder.svelte
+++ b/frontend/src/lib/components/FlowBuilder.svelte
@@ -371,6 +371,9 @@
// in the shared /sessions URL under the session's own workspace identity, so
// presence keyed on that URL leaks a phantom self-badge. Hide it here.
const inSessionPane = !!getContext('aiChatManager')
+ // Share and the first-deploy dialog belong to Windmill's own editors: an embedding host (the
+ // SDK, the flow drawer) can lock the path, which the dialog would let the user change.
+ const offersSharing = $derived(ownsPageHeader || inSessionPane)
setFlowPanelPlacementTelemetry(!inSessionPane)
@@ -507,9 +510,9 @@
async function handleSaveFlow(deploymentMsg?: string) {
pendingFirstDeploy = undefined
- if (ownsPageHeader && neverDeployed) {
+ if (neverDeployed && firstDeployDialog) {
// The dialog also asks who the flow runs on behalf of, for the path it chose.
- const choice = await firstDeployDialog?.ask({
+ const choice = await firstDeployDialog.ask({
kind: 'flow',
summary: flowStore.val.summary ?? '',
path: $pathStore,
@@ -1721,7 +1724,7 @@
{@render children?.()}
-{#if ownsPageHeader}
+{#if offersSharing}
{/if}
@@ -1867,6 +1870,14 @@
{@render previewButtons()}
{/if}
+ {#if offersSharing}
+
+ {/if}
await handleSaveFlow(detail)}
diff --git a/frontend/src/lib/components/ScriptBuilder.svelte b/frontend/src/lib/components/ScriptBuilder.svelte
index fdbf402ae1..8b847c7c8b 100644
--- a/frontend/src/lib/components/ScriptBuilder.svelte
+++ b/frontend/src/lib/components/ScriptBuilder.svelte
@@ -697,9 +697,9 @@
// Every deploy path of the full-page editor comes through here, the message popover and
// "Deploy & Stay here" included.
pendingFirstDeploy = undefined
- if (ownsPageHeader && neverDeployed) {
+ if (neverDeployed && firstDeployDialog) {
// The dialog also asks who the script runs on behalf of, for the path it chose.
- const choice = await firstDeployDialog?.ask({
+ const choice = await firstDeployDialog.ask({
kind: 'script',
summary: script.summary,
path: script.path,
@@ -1098,6 +1098,9 @@
// details page itself, so it switches the tab instead of leaving. Diff is exposed
// as a standalone top-bar button (rendered independently of the pane), not here.
const inSessionPane = !!getContext('aiChatManager')
+ // Share and the first-deploy dialog belong to Windmill's own editors: an embedding host (the
+ // SDK) can lock the path, which the dialog would let the user change.
+ const offersSharing = $derived(ownsPageHeader || inSessionPane)
/** Names the version on the deployed side of the diff. Without it the reader is
* shown two panes and told nothing about what the left one is — which matters
@@ -1584,7 +1587,7 @@
onCanceled={() => (perpetualRunsToConfirm = undefined)}
/>
-{#if ownsPageHeader}
+{#if offersSharing}
{/if}
@@ -2327,7 +2330,7 @@
{#if ownsPageHeader}
{/if}
- {#if ownsPageHeader && !phoneTopbar}
+ {#if offersSharing && !phoneTopbar}
initialLabels))
$effect(() => {
@@ -1040,20 +1061,12 @@
bind:pathError
bind:newEditedPath
bind:labels
+ bind:customPath
+ onAppChanged={applyAppAccess}
/>
-{#if ownsPageHeader}
- {
- policy.execution_mode = row.policy.execution_mode
- customPath = row.custom_path ?? undefined
- if (savedApp) {
- savedApp.policy = { ...savedApp.policy, execution_mode: row.policy.execution_mode }
- savedApp.custom_path = row.custom_path ?? undefined
- }
- }}
- />
+{#if offersSharing}
+
{/if}
@@ -1423,7 +1436,7 @@
Settings
- {#if ownsPageHeader}
+ {#if offersSharing}
{/if}
{/if}
diff --git a/frontend/src/lib/components/apps/editor/AppSettingsDrawer.svelte b/frontend/src/lib/components/apps/editor/AppSettingsDrawer.svelte
index 2f6d480f86..dd332a8f93 100644
--- a/frontend/src/lib/components/apps/editor/AppSettingsDrawer.svelte
+++ b/frontend/src/lib/components/apps/editor/AppSettingsDrawer.svelte
@@ -19,6 +19,10 @@
import { FRONTEND_SDK_SCOPES, sdkScopesToConfirm } from '$lib/components/raw_apps/sdkScopes'
import { logFeatureUsage } from '$lib/utils/featureUsage'
import { useOperatingWorkspace } from '$lib/components/operatingWorkspace.svelte'
+ import AppAccessSection from '$lib/components/itemSettings/AppAccessSection.svelte'
+ import DeployedAppAccess from '$lib/components/itemSettings/DeployedAppAccess.svelte'
+ import { accessModeOf } from '$lib/components/itemSettings/appAccess'
+ import { AppService, type AppWithLastVersion } from '$lib/gen'
const operatingWorkspaceStore = useOperatingWorkspace()
const roleCaps = useRoleCapabilities()
@@ -37,7 +41,9 @@
labels = $bindable(),
rawApp = false,
newApp = false,
- operatingWorkspace = undefined
+ operatingWorkspace = undefined,
+ customPath = $bindable(),
+ onAppChanged
}: {
open: boolean
/** Mutated in place; deployed with the app, like every other setting here. */
@@ -57,6 +63,10 @@
/** Workspace the app is deployed to. The path and on-behalf-of lookups target it;
* defaults to the operating workspace. */
operatingWorkspace?: string
+ /** Taken by the first deploy. A deployed app's custom URL is written at once instead. */
+ customPath?: string | undefined
+ /** Called after a write to the deployed app row, with the row as it now is. */
+ onAppChanged?: (row: AppWithLastVersion) => void
} = $props()
let body: HTMLElement | undefined = $state()
@@ -73,6 +83,23 @@
let path: Path | undefined = $state(undefined)
let dirtyPath = $state(false)
+
+ // Who can open a deployed app is not deployed with it: it is read from, and written to, the
+ // deployed row, as in Share.
+ let deployedPath = $derived(newApp ? undefined : savedApp?.path)
+ let deployedApp: AppWithLastVersion | undefined = $state()
+ async function loadDeployedApp() {
+ const asked = deployedPath
+ if (!asked || !opWs) return
+ const row = await AppService.getAppLiteByPath({ workspace: opWs, path: asked })
+ if (deployedPath === asked) deployedApp = row
+ }
+ $effect(() => {
+ if (open && deployedPath) {
+ deployedApp = undefined
+ loadDeployedApp().catch(() => {})
+ }
+ })
{#snippet sandboxHint()}
@@ -149,6 +176,40 @@
+
+
+ {#if deployedPath}
+ {#if deployedApp}
+
+ Changes here apply to the deployed app right away.
+
+
+ {:else}
+ Loading…
+ {/if}
+ {:else}
+ {
+ policy.execution_mode = m
+ }}
+ {customPath}
+ onCustomPathChange={(p) => {
+ customPath = p ?? undefined
+ }}
+ />
+ {/if}
+
+
+
{#snippet labelExtra()}
void | Promise
- /** Links, embedding and the custom URL, which exist only for a deployed app. */
- deployed?: {
- customPath: string | undefined
- onCustomPathChange: (customPath: string | null) => Promise
- }
+ /** The link, the secret URL and embedding, which exist only once the app is deployed. */
+ deployed?: boolean
+ customPath?: string | undefined
+ /** Shows the custom URL. On a deployed app it writes at once; before the first deploy it is
+ * taken by the create. */
+ onCustomPathChange?: (customPath: string | null) => void | Promise
disabled?: boolean
}
@@ -38,7 +39,9 @@
rawApp = false,
mode,
onModeChange,
- deployed,
+ deployed = false,
+ customPath,
+ onCustomPathChange,
disabled = false
}: Props = $props()
@@ -84,10 +87,12 @@
WorkspaceService.getGuestUsage({ workspace })
.then((u) => (guestUsage = u))
.catch(() => (guestUsage = undefined))
+ if (onCustomPathChange) {
+ SettingService.getGlobal({ key: 'app_workspaced_route' })
+ .then((s) => (globalWorkspacedRoute = (s as boolean) ?? false))
+ .catch(() => (globalWorkspacedRoute = false))
+ }
if (!deployed) return
- SettingService.getGlobal({ key: 'app_workspaced_route' })
- .then((s) => (globalWorkspacedRoute = (s as boolean) ?? false))
- .catch(() => (globalWorkspacedRoute = false))
AppService.getPublicSecretOfApp({ workspace, path: appPath })
.then((s) => (secretUrl = s))
.catch(() => (secretUrl = undefined))
@@ -95,9 +100,7 @@
load()
let embedMode = $state(false)
- let secretUrlHref = $derived(
- secretUrl ? `${window.location.origin}/public/${workspace}/${secretUrl}` : undefined
- )
+ let secretUrlHref = $derived(secretUrl ? secretUrlOf(workspace, secretUrl) : undefined)
let appUrl = $derived(
`${window.location.origin}/${rawApp ? 'apps_raw' : 'apps'}/get/${appPath}?workspace=${workspace}`
)
@@ -110,41 +113,35 @@
// Shown to admins on EE; the dialog's own writes disable the controls rather than hide them.
let mayEditCustomPath = $derived(!!$enterpriseLicense && isAdmin)
let canSaveCustomPath = $derived(
- !disabled &&
- !savingCustomPath &&
- customPathInput !== '' &&
- customPathInput !== deployed?.customPath
+ !disabled && !savingCustomPath && customPathInput !== '' && customPathInput !== customPath
)
// The Embed toggle only shows outside Members, so it must not linger on from another mode.
let customUrlEmbed = $derived(embedMode && mode != 'publisher')
- let customUrlBase = $derived(
- `${window.location.origin}/a/${isCloudHosted() || globalWorkspacedRoute ? workspace + '/' : ''}`
- )
- let fullCustomUrl = $derived(customUrlBase + (deployed?.customPath ?? ''))
+ let customUrlBase = $derived(customUrlBaseOf(workspace, globalWorkspacedRoute))
+ let fullCustomUrl = $derived(customUrlBase + (customPath ?? ''))
// The guest JWT rides on the custom URL when set, else on the secret URL.
- let guestJwtBase = $derived(deployed?.customPath ? fullCustomUrl : secretUrlHref)
+ let guestJwtBase = $derived(customPath ? fullCustomUrl : secretUrlHref)
function editCustomPath() {
- customPathInput = deployed?.customPath ?? ''
+ customPathInput = customPath ?? ''
customPathErr = undefined
editingCustomPath = true
}
async function saveCustomPath(next: string | null) {
- if (!deployed || savingCustomPath) return
+ if (!onCustomPathChange || savingCustomPath) return
savingCustomPath = true
try {
- customPathErr =
- next === null ? undefined : await customPathError(workspace, next, deployed.customPath)
+ customPathErr = next === null ? undefined : await customPathError(workspace, next, customPath)
if (customPathErr) return
- await deployed.onCustomPathChange(next)
+ await onCustomPathChange(next)
} catch (err) {
customPathErr = `Could not check whether the path is free: ${err}`
} finally {
savingCustomPath = false
}
// A refused write leaves the deployed path as it was: keep the field open to retry.
- if ((deployed.customPath ?? null) === next) editingCustomPath = false
+ if ((customPath ?? null) === next) editingCustomPath = false
}
function toEmbedSnippet(url: string): string {
@@ -221,7 +218,7 @@
{/if}
{/if}
{:else}
- The people with access above, signed in to Windmill.
+ The people with access to the app, signed in to Windmill.
{/if}
@@ -266,7 +263,16 @@
{/if}
+ {:else if mode != 'publisher'}
+
+ {/if}
+ {#if onCustomPathChange}