mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 16:02:28 +00:00
fix: fix hub schedule not set at on-boarding
This commit is contained in:
@@ -121,14 +121,6 @@ mod workspace_dependencies {
|
||||
);
|
||||
|
||||
// Verify built-in fixtures exist
|
||||
// Check that the setup_app exists
|
||||
let app_exists =
|
||||
sqlx::query_scalar!("SELECT EXISTS(SELECT 1 FROM app WHERE path = 'g/all/setup_app')")
|
||||
.fetch_one(db)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(app_exists.unwrap(), "Expected g/all/setup_app to exist");
|
||||
|
||||
// Check that hub_sync script exists and is a Bun script
|
||||
let hub_sync_lang = sqlx::query_scalar!(
|
||||
r#"SELECT language AS "language: ScriptLang" FROM script WHERE path = 'u/admin/hub_sync'"#
|
||||
|
||||
@@ -18,8 +18,6 @@ use phf::phf_set;
|
||||
|
||||
pub static BLACKLIST: phf::Set<&'static str> = phf_set! {
|
||||
"u/admin/hub_sync",
|
||||
"g/all/setup_app/app",
|
||||
"g/all/setup_app"
|
||||
};
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
import Breadcrumb from '$lib/components/common/breadcrumb/Breadcrumb.svelte'
|
||||
import { ChevronRight, ArrowLeft } from 'lucide-svelte'
|
||||
import { superadmin } from '$lib/stores'
|
||||
import { UserService, ScheduleService, JobService } from '$lib/gen'
|
||||
import { UserService, JobService } from '$lib/gen'
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import TextInput from '$lib/components/text_input/TextInput.svelte'
|
||||
import Toggle from '$lib/components/Toggle.svelte'
|
||||
@@ -189,18 +189,27 @@
|
||||
|
||||
if (enableHubSync) {
|
||||
try {
|
||||
await ScheduleService.createSchedule({
|
||||
workspace: 'admins',
|
||||
requestBody: {
|
||||
path: 'g/all/hub_sync',
|
||||
schedule: '0 0 0 * * *',
|
||||
script_path: 'u/admin/hub_sync',
|
||||
is_flow: false,
|
||||
args: {},
|
||||
enabled: true,
|
||||
timezone: 'Etc/UTC'
|
||||
// Use direct fetch with token as query param to avoid the old session cookie
|
||||
// overriding the Authorization header
|
||||
const resp = await fetch(
|
||||
`/api/w/admins/schedules/create?token=${encodeURIComponent(token)}`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
path: 'g/all/hub_sync',
|
||||
schedule: '0 0 0 * * *',
|
||||
script_path: 'u/admin/hub_sync',
|
||||
is_flow: false,
|
||||
args: {},
|
||||
enabled: true,
|
||||
timezone: 'Etc/UTC'
|
||||
})
|
||||
}
|
||||
})
|
||||
)
|
||||
if (!resp.ok) {
|
||||
console.warn('Schedule creation failed:', await resp.text())
|
||||
}
|
||||
} catch (e: any) {
|
||||
console.warn('Schedule creation failed:', e?.body ?? e)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user