mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-25 16:02:11 +00:00
adapt websocket triggers to multi-tenant cloud
This commit is contained in:
@@ -39,7 +39,7 @@ use tower_http::{
|
||||
trace::TraceLayer,
|
||||
};
|
||||
use windmill_common::db::UserDB;
|
||||
use windmill_common::worker::ALL_TAGS;
|
||||
use windmill_common::worker::{ALL_TAGS, CLOUD_HOSTED};
|
||||
use windmill_common::{BASE_URL, INSTANCE_NAME};
|
||||
|
||||
use crate::scim_ee::has_scim_token;
|
||||
@@ -246,7 +246,9 @@ pub async fn run_server(
|
||||
}
|
||||
};
|
||||
|
||||
websocket_triggers::start_websockets(db.clone(), rsmq).await;
|
||||
if !*CLOUD_HOSTED {
|
||||
websocket_triggers::start_websockets(db.clone(), rsmq).await;
|
||||
}
|
||||
|
||||
// build our application with a route
|
||||
let app = Router::new()
|
||||
|
||||
@@ -21,7 +21,7 @@ use windmill_common::{
|
||||
db::UserDB,
|
||||
error::{self, JsonResult},
|
||||
utils::{not_found_if_none, paginate, require_admin, Pagination, StripPath},
|
||||
worker::to_raw_value,
|
||||
worker::{to_raw_value, CLOUD_HOSTED},
|
||||
INSTANCE_NAME,
|
||||
};
|
||||
use windmill_queue::PushArgsOwned;
|
||||
@@ -156,6 +156,11 @@ async fn create_websocket_trigger(
|
||||
Path(w_id): Path<String>,
|
||||
Json(ct): Json<NewWebsocketTrigger>,
|
||||
) -> error::Result<(StatusCode, String)> {
|
||||
if *CLOUD_HOSTED {
|
||||
return Err(error::Error::BadRequest(
|
||||
"Websocket triggers are not supported on multi-tenant cloud, use dedicated cloud or self-host".to_string(),
|
||||
));
|
||||
}
|
||||
require_admin(authed.is_admin, &authed.username)?;
|
||||
|
||||
let mut tx = user_db.begin(&authed).await?;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
import type { TriggerContext } from '../triggers'
|
||||
import { getContext } from 'svelte'
|
||||
import WebsocketTriggerEditor from './WebsocketTriggerEditor.svelte'
|
||||
import { isCloudHosted } from '$lib/cloud'
|
||||
|
||||
export let isFlow: boolean
|
||||
export let path: string
|
||||
@@ -49,7 +50,11 @@
|
||||
|
||||
<div class="flex flex-col gap-4">
|
||||
{#if !newItem}
|
||||
{#if $userStore?.is_admin || $userStore?.is_super_admin}
|
||||
{#if isCloudHosted()}
|
||||
<Alert title="Not compatible with multi-tenant cloud" type="warning">
|
||||
Websocket triggers are disabled in the multi-tenant cloud.
|
||||
</Alert>
|
||||
{:else if $userStore?.is_admin || $userStore?.is_super_admin}
|
||||
<Button
|
||||
on:click={() => wsTriggerEditor?.openNew(isFlow, path)}
|
||||
variant="border"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
} from '$lib/utils'
|
||||
import { base } from '$app/paths'
|
||||
import CenteredPage from '$lib/components/CenteredPage.svelte'
|
||||
import { Button, Skeleton } from '$lib/components/common'
|
||||
import { Alert, Button, Skeleton } from '$lib/components/common'
|
||||
import Dropdown from '$lib/components/DropdownV2.svelte'
|
||||
import PageHeader from '$lib/components/PageHeader.svelte'
|
||||
import SharedBadge from '$lib/components/SharedBadge.svelte'
|
||||
@@ -28,6 +28,7 @@
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
import WebsocketTriggerEditor from '$lib/components/triggers/WebsocketTriggerEditor.svelte'
|
||||
import Popover from '$lib/components/Popover.svelte'
|
||||
import { isCloudHosted } from '$lib/cloud'
|
||||
|
||||
type TriggerW = WebsocketTrigger & { canWrite: boolean }
|
||||
|
||||
@@ -216,6 +217,13 @@
|
||||
New WS trigger
|
||||
</Button>
|
||||
</PageHeader>
|
||||
|
||||
{#if isCloudHosted()}
|
||||
<Alert title="Not compatible with multi-tenant cloud" type="warning">
|
||||
Websocket triggers are disabled in the multi-tenant cloud.
|
||||
</Alert>
|
||||
<div class="py-4" />
|
||||
{/if}
|
||||
<div class="w-full h-full flex flex-col">
|
||||
<div class="w-full pb-4 pt-6">
|
||||
<input type="text" placeholder="Search WS triggers" bind:value={filter} class="search-item" />
|
||||
|
||||
Reference in New Issue
Block a user