diff --git a/frontend/src/lib/components/workspaceSettings/DeployToHub.svelte b/frontend/src/lib/components/workspaceSettings/DeployToHub.svelte index 77e2ec0f42..6439f8b870 100644 --- a/frontend/src/lib/components/workspaceSettings/DeployToHub.svelte +++ b/frontend/src/lib/components/workspaceSettings/DeployToHub.svelte @@ -7,7 +7,6 @@ import { Badge, Button, Drawer, DrawerContent } from '$lib/components/common' import WorkspaceDeployLayout from '$lib/components/WorkspaceDeployLayout.svelte' import SchemaForm from '$lib/components/SchemaForm.svelte' - import Toggle from '$lib/components/Toggle.svelte' import Tooltip from '$lib/components/Tooltip.svelte' import { sendUserToast } from '$lib/toast' import { @@ -33,22 +32,10 @@ rec: RecStatus published?: boolean publicUrl?: string - rateLimit?: RateLimitConfig [k: string]: unknown } - interface RateLimitConfig { - enabled: boolean - perMinute: number - burst: number - perIp: boolean - } - const DEFAULT_RATE_LIMIT: RateLimitConfig = { - enabled: true, - perMinute: 60, - burst: 10, - perIp: true - } - const WORKSPACE_DEFAULT_RATE_LIMIT = { perMinute: 120, burst: 20 } + // MOCK: would be fetched via WorkspaceService.getSettings().public_app_execution_limit_per_minute + let workspaceRateLimit = $state(120) const canRecord = (k: Kind) => k === 'script' || k === 'flow' const canPublishApp = (k: Kind) => k === 'app' || k === 'raw_app' @@ -139,7 +126,6 @@ let publishDrawer = $state() let publishTarget = $state() let publishing = $state(false) - let publishRateLimit = $state({ ...DEFAULT_RATE_LIMIT }) const mockPublicUrl = (path: string) => `https://app.windmill.dev/public/${hubSlug}/${path}` @@ -188,7 +174,6 @@ function openPublish(it: DeployItem) { publishTarget = it - publishRateLimit = { ...(it.rateLimit ?? DEFAULT_RATE_LIMIT) } publishDrawer?.openDrawer() } async function confirmPublish() { @@ -197,17 +182,10 @@ publishing = true try { await delay(500) - const rl = { ...publishRateLimit } items = items.map((i) => - i.key === it.key - ? { ...i, published: true, publicUrl: mockPublicUrl(i.path), rateLimit: rl } - : i - ) - sendUserToast( - rl.enabled - ? `${it.path} is now public (${rl.perMinute} req/min, burst ${rl.burst})` - : `${it.path} is now public (no rate limit)` + i.key === it.key ? { ...i, published: true, publicUrl: mockPublicUrl(i.path) } : i ) + sendUserToast(`${it.path} is now public`) publishDrawer?.closeDrawer() } finally { publishing = false @@ -401,61 +379,38 @@

-
-
- - Rate limit - - Caps requests to this public app. Workspace default: {WORKSPACE_DEFAULT_RATE_LIMIT.perMinute} - req/min, burst {WORKSPACE_DEFAULT_RATE_LIMIT.burst}. Override here for this app only. - -
- +
+ + Rate limit (workspace-wide) + + Caps public app executions per minute per server. Applies to all public apps in this + workspace. +
- {#if publishRateLimit.enabled} -
- - -
-
- - Apply per client IP - If off, limit is shared across all callers (global counter). - - -
+ {#if workspaceRateLimit && workspaceRateLimit > 0} + + Currently {workspaceRateLimit} executions / + minute / server. + {:else} - Disabled — anyone with the URL can hit this app at any rate. + No rate limit configured — anyone with the URL can hit this app at any rate. {/if} - - Workspace-wide defaults live in { - e.preventDefault() - publishDrawer?.closeDrawer() - window.location.hash = 'default_app' - }}>Workspace settings → Default app → Rate limiting. - + { + e.preventDefault() + publishDrawer?.closeDrawer() + window.location.hash = 'default_app' + }} + > + Edit in Workspace settings → Apps +
{#if publishTarget}