refactor(frontend): rename schedule_* UserDraft kinds to trigger_*

The schedule_ prefix grouped all the trigger editors under what looked
like a "scheduler" namespace; trigger_ is what these actually are
(triggers — including the cron-style schedule). Mechanical rename
across UserDraftItemKind, every trigger editor's UserDraft.save/get/
remove calls, and the one test that asserted on the localStorage key.

Behaviour-only impact: existing localStorage keys under
userdraft/w/{ws}/schedule_{kind}/{path} from older builds will be
ignored on next open (no schema migration). Users will lose any
unsaved trigger drafts persisted before this change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Diego Imbert
2026-05-12 21:25:40 +02:00
parent 03a5e98609
commit fd2e243795
13 changed files with 53 additions and 53 deletions
@@ -129,7 +129,7 @@
initialConfig = structuredClone($state.snapshot(getAzureConfig()))
}
originalConfig = structuredClone($state.snapshot(getAzureConfig()))
const localCfg = UserDraft.get<Record<string, any>>('schedule_azure', ePath)
const localCfg = UserDraft.get<Record<string, any>>('trigger_azure', ePath)
if (localCfg && !deepEqual(localCfg, getAzureConfig())) {
await loadTriggerConfig(localCfg)
}
@@ -226,7 +226,7 @@
usedTriggerKinds
)
if (isSaved) {
UserDraft.remove('schedule_azure', previousPath)
UserDraft.remove('trigger_azure', previousPath)
onUpdate?.(cfg.path)
originalConfig = structuredClone($state.snapshot(getAzureConfig()))
initialPath = cfg.path
@@ -306,7 +306,7 @@
$effect(() => {
if (drawerLoading || !initialPath) return
azureConfig && UserDraft.save('schedule_azure', initialPath, azureConfig)
azureConfig && UserDraft.save('trigger_azure', initialPath, azureConfig)
})
</script>
@@ -126,7 +126,7 @@
initialConfig = structuredClone($state.snapshot(getEmailTriggerConfig()))
}
originalConfig = structuredClone($state.snapshot(getEmailTriggerConfig()))
const localCfg = UserDraft.get<Record<string, any>>('schedule_email', ePath)
const localCfg = UserDraft.get<Record<string, any>>('trigger_email', ePath)
if (localCfg && !deepEqual(localCfg, getEmailTriggerConfig())) {
loadTriggerConfig(localCfg as Partial<EmailTrigger>)
}
@@ -229,7 +229,7 @@
usedTriggerKinds
)
if (isSaved) {
UserDraft.remove('schedule_email', previousPath)
UserDraft.remove('trigger_email', previousPath)
onUpdate(saveCfg.path)
originalConfig = structuredClone($state.snapshot(getEmailTriggerConfig()))
initialPath = saveCfg.path
@@ -303,7 +303,7 @@
$effect(() => {
if (drawerLoading || !initialPath) return
UserDraft.save('schedule_email', initialPath, emailConfig)
UserDraft.save('trigger_email', initialPath, emailConfig)
})
</script>
@@ -131,7 +131,7 @@
initialConfig = structuredClone($state.snapshot(getGcpConfig()))
}
originalConfig = structuredClone($state.snapshot(getGcpConfig()))
const localCfg = UserDraft.get<Record<string, any>>('schedule_gcp', ePath)
const localCfg = UserDraft.get<Record<string, any>>('trigger_gcp', ePath)
if (localCfg && !deepEqual(localCfg, getGcpConfig())) {
await loadTriggerConfig(localCfg)
}
@@ -235,7 +235,7 @@
usedTriggerKinds
)
if (isSaved) {
UserDraft.remove('schedule_gcp', previousPath)
UserDraft.remove('trigger_gcp', previousPath)
onUpdate?.(cfg.path)
originalConfig = structuredClone($state.snapshot(getGcpConfig()))
initialPath = cfg.path
@@ -323,7 +323,7 @@
$effect(() => {
if (drawerLoading || !initialPath) return
gcpConfig && UserDraft.save('schedule_gcp', initialPath, gcpConfig)
gcpConfig && UserDraft.save('trigger_gcp', initialPath, gcpConfig)
})
</script>
@@ -225,7 +225,7 @@
initialConfig = structuredClone($state.snapshot(getRouteConfig()))
}
originalConfig = structuredClone($state.snapshot(getRouteConfig()))
const localCfg = UserDraft.get<Record<string, any>>('schedule_http', ePath)
const localCfg = UserDraft.get<Record<string, any>>('trigger_http', ePath)
if (localCfg && !deepEqual(localCfg, getRouteConfig())) {
loadTriggerConfig(localCfg as Partial<HttpTrigger>)
}
@@ -362,7 +362,7 @@
usedTriggerKinds
)
if (isSaved) {
UserDraft.remove('schedule_http', previousPath)
UserDraft.remove('trigger_http', previousPath)
onUpdate(saveCfg.path)
originalConfig = structuredClone($state.snapshot(getRouteConfig()))
initialPath = saveCfg.path
@@ -457,7 +457,7 @@
$effect(() => {
if (drawerLoading || !initialPath) return
UserDraft.save('schedule_http', initialPath, routeConfig)
UserDraft.save('trigger_http', initialPath, routeConfig)
})
</script>
@@ -153,7 +153,7 @@
initialConfig = structuredClone($state.snapshot(getSaveCfg()))
}
originalConfig = structuredClone($state.snapshot(getSaveCfg()))
const localCfg = UserDraft.get<Record<string, any>>('schedule_kafka', ePath)
const localCfg = UserDraft.get<Record<string, any>>('trigger_kafka', ePath)
if (localCfg && !deepEqual(localCfg, getSaveCfg())) {
loadTriggerConfig(localCfg)
}
@@ -284,7 +284,7 @@
usedTriggerKinds
)
if (isSaved) {
UserDraft.remove('schedule_kafka', previousPath)
UserDraft.remove('trigger_kafka', previousPath)
onUpdate?.(cfg.path)
originalConfig = structuredClone($state.snapshot(getSaveCfg()))
initialPath = cfg.path
@@ -361,7 +361,7 @@
$effect(() => {
if (drawerLoading || !initialPath) return
UserDraft.save('schedule_kafka', initialPath, kafkaConfig)
UserDraft.save('trigger_kafka', initialPath, kafkaConfig)
})
</script>
@@ -149,7 +149,7 @@
initialConfig = structuredClone($state.snapshot(getSaveCfg()))
}
originalConfig = structuredClone($state.snapshot(getSaveCfg()))
const localCfg = UserDraft.get<Record<string, any>>('schedule_mqtt', ePath)
const localCfg = UserDraft.get<Record<string, any>>('trigger_mqtt', ePath)
if (localCfg && !deepEqual(localCfg, getSaveCfg())) {
await loadTriggerConfig(localCfg)
}
@@ -297,7 +297,7 @@
usedTriggerKinds
)
if (isSaved) {
UserDraft.remove('schedule_mqtt', previousPath)
UserDraft.remove('trigger_mqtt', previousPath)
onUpdate?.(cfg.path)
originalConfig = structuredClone($state.snapshot(getSaveCfg()))
initialPath = cfg.path
@@ -347,7 +347,7 @@
$effect(() => {
if (drawerLoading || !initialPath) return
UserDraft.save('schedule_mqtt', initialPath, mqttConfig)
UserDraft.save('trigger_mqtt', initialPath, mqttConfig)
})
</script>
@@ -137,7 +137,7 @@
initialConfig = structuredClone($state.snapshot(getSaveCfg()))
}
originalConfig = structuredClone($state.snapshot(getSaveCfg()))
const localCfg = UserDraft.get<Record<string, any>>('schedule_nats', ePath)
const localCfg = UserDraft.get<Record<string, any>>('trigger_nats', ePath)
if (localCfg && !deepEqual(localCfg, getSaveCfg())) {
await loadTriggerConfig(localCfg)
}
@@ -263,7 +263,7 @@
usedTriggerKinds
)
if (isSaved) {
UserDraft.remove('schedule_nats', previousPath)
UserDraft.remove('trigger_nats', previousPath)
onUpdate?.(cfg.path)
originalConfig = structuredClone($state.snapshot(getSaveCfg()))
initialPath = cfg.path
@@ -331,7 +331,7 @@
$effect(() => {
if (drawerLoading || !initialPath) return
UserDraft.save('schedule_nats', initialPath, natsConfig)
UserDraft.save('trigger_nats', initialPath, natsConfig)
})
</script>
@@ -244,7 +244,7 @@
initialConfig = structuredClone($state.snapshot(getSaveCfg()))
}
originalConfig = structuredClone($state.snapshot(getSaveCfg()))
const localCfg = UserDraft.get<Record<string, any>>('schedule_postgres', ePath)
const localCfg = UserDraft.get<Record<string, any>>('trigger_postgres', ePath)
if (localCfg && !deepEqual(localCfg, getSaveCfg())) {
await loadTriggerConfig(localCfg)
}
@@ -415,7 +415,7 @@
usedTriggerKinds
)
if (isSaved) {
UserDraft.remove('schedule_postgres', previousPath)
UserDraft.remove('trigger_postgres', previousPath)
onUpdate?.(path)
originalConfig = structuredClone($state.snapshot(getSaveCfg()))
initialPath = cfg.path
@@ -488,7 +488,7 @@
$effect(() => {
if (drawerLoading || !initialPath) return
postgresConfig && UserDraft.save('schedule_postgres', initialPath, postgresConfig)
postgresConfig && UserDraft.save('trigger_postgres', initialPath, postgresConfig)
})
$effect(() => {
@@ -147,7 +147,7 @@
if (!defaultCfg) {
initialConfig = structuredClone($state.snapshot(getScheduleCfg()))
}
const localCfg = UserDraft.get<Record<string, any>>('schedule_schedule', ePath)
const localCfg = UserDraft.get<Record<string, any>>('trigger_schedule', ePath)
if (localCfg && !deepEqual(localCfg, getScheduleCfg())) {
await loadScheduleCfg(localCfg)
}
@@ -538,7 +538,7 @@
deploymentLoading = true
const isSaved = await saveScheduleFromCfg(scheduleCfg, edit, $workspaceStore!)
if (isSaved) {
UserDraft.remove('schedule_schedule', previousPath)
UserDraft.remove('trigger_schedule', previousPath)
onUpdate?.(scheduleCfg.path)
drawer?.closeDrawer()
}
@@ -665,7 +665,7 @@
$effect(() => {
if (drawerLoading || !initialPath) return
UserDraft.save('schedule_schedule', initialPath, scheduleCfg)
UserDraft.save('trigger_schedule', initialPath, scheduleCfg)
})
</script>
@@ -135,7 +135,7 @@
initialConfig = structuredClone($state.snapshot(getSaveCfg()))
}
originalConfig = structuredClone($state.snapshot(getSaveCfg()))
const localCfg = UserDraft.get<Record<string, any>>('schedule_sqs', ePath)
const localCfg = UserDraft.get<Record<string, any>>('trigger_sqs', ePath)
if (localCfg && !deepEqual(localCfg, getSaveCfg())) {
loadTriggerConfig(localCfg)
}
@@ -285,7 +285,7 @@
usedTriggerKinds
)
if (isSaved) {
UserDraft.remove('schedule_sqs', previousPath)
UserDraft.remove('trigger_sqs', previousPath)
onUpdate?.(cfg.path)
originalConfig = structuredClone($state.snapshot(getSaveCfg()))
initialPath = cfg.path
@@ -324,7 +324,7 @@
// a path (no localStorage write would happen anyway).
$effect(() => {
if (drawerLoading || !initialPath) return
UserDraft.save('schedule_sqs', initialPath, sqsConfig)
UserDraft.save('trigger_sqs', initialPath, sqsConfig)
})
</script>
@@ -181,7 +181,7 @@
initialConfig = structuredClone($state.snapshot(getSaveCfg()))
}
originalConfig = structuredClone($state.snapshot(getSaveCfg()))
const localCfg = UserDraft.get<Record<string, any>>('schedule_websocket', ePath)
const localCfg = UserDraft.get<Record<string, any>>('trigger_websocket', ePath)
if (localCfg && !deepEqual(localCfg, getSaveCfg())) {
loadTriggerConfig(localCfg)
}
@@ -357,7 +357,7 @@
usedTriggerKinds
)
if (isSaved) {
UserDraft.remove('schedule_websocket', previousPath)
UserDraft.remove('trigger_websocket', previousPath)
onUpdate?.(saveCfg.path)
originalConfig = structuredClone($state.snapshot(getSaveCfg()))
initialPath = saveCfg.path
@@ -415,7 +415,7 @@
$effect(() => {
if (drawerLoading || !initialPath) return
UserDraft.save('schedule_websocket', initialPath, websocketCfg)
UserDraft.save('trigger_websocket', initialPath, websocketCfg)
})
</script>
+18 -18
View File
@@ -10,24 +10,24 @@ export type UserDraftItemKind =
| 'raw_app'
| 'resource'
| 'variable'
| 'schedule_schedule'
| 'schedule_webhook'
| 'schedule_default_email'
| 'schedule_email'
| 'schedule_http'
| 'schedule_websocket'
| 'schedule_postgres'
| 'schedule_kafka'
| 'schedule_nats'
| 'schedule_mqtt'
| 'schedule_sqs'
| 'schedule_gcp'
| 'schedule_azure'
| 'schedule_poll'
| 'schedule_cli'
| 'schedule_nextcloud'
| 'schedule_google'
| 'schedule_github'
| 'trigger_schedule'
| 'trigger_webhook'
| 'trigger_default_email'
| 'trigger_email'
| 'trigger_http'
| 'trigger_websocket'
| 'trigger_postgres'
| 'trigger_kafka'
| 'trigger_nats'
| 'trigger_mqtt'
| 'trigger_sqs'
| 'trigger_gcp'
| 'trigger_azure'
| 'trigger_poll'
| 'trigger_cli'
| 'trigger_nextcloud'
| 'trigger_google'
| 'trigger_github'
export type UserDraftOptions = {
workspace?: string
+2 -2
View File
@@ -75,9 +75,9 @@ describe('UserDraft.save / get / remove (no observers)', () => {
})
it('supports trigger kinds as item kinds', () => {
UserDraft.save('schedule_kafka', 'u/me/topic1', { value: { brokers: ['localhost:9092'] } })
UserDraft.save('trigger_kafka', 'u/me/topic1', { value: { brokers: ['localhost:9092'] } })
const raw = localStorage.getItem('userdraft/w/test_ws/schedule_kafka/u/me/topic1')
const raw = localStorage.getItem('userdraft/w/test_ws/trigger_kafka/u/me/topic1')
expect(raw).toBe(JSON.stringify({ value: { brokers: ['localhost:9092'] } }))
})