mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-12 16:02:56 +00:00
fix: refresh resource type names and the resources tab after the chat creates a type
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8e10a28742
commit
0a6b18743f
@@ -416,6 +416,7 @@ import {
|
||||
import { devopsRole, superadmin, userStore, usersWorkspaceStore } from '$lib/stores'
|
||||
import { processSecretArgs } from '$lib/components/secretArgUtils'
|
||||
import { clearWorkspaceRoleCache } from '$lib/user'
|
||||
import { resourceTypesStore } from '$lib/components/resourceTypesStore'
|
||||
import { get } from 'svelte/store'
|
||||
import type { Tool, ToolCallbacks } from '../shared'
|
||||
|
||||
@@ -8157,6 +8158,7 @@ describe('create_resource_type', () => {
|
||||
['c_acme_billing', 'c_acme_billing']
|
||||
])('creates %s as %s', async (given, created) => {
|
||||
vi.mocked(ResourceService.createResourceType).mockClear()
|
||||
resourceTypesStore.set(['postgresql'])
|
||||
|
||||
const result = await callGlobalTool('create_resource_type', {
|
||||
name: given,
|
||||
@@ -8168,5 +8170,6 @@ describe('create_resource_type', () => {
|
||||
created
|
||||
)
|
||||
expect(result).toContain(created)
|
||||
expect(get(resourceTypesStore)).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -199,6 +199,7 @@ import {
|
||||
} from '$lib/stores'
|
||||
import { getWorkspaceRole, type RoleLookup } from '$lib/user'
|
||||
import { refreshSuperadmin } from '$lib/refreshUser'
|
||||
import { resourceTypesStore } from '$lib/components/resourceTypesStore'
|
||||
import { get } from 'svelte/store'
|
||||
import {
|
||||
canonicalDraftSideValue,
|
||||
@@ -4454,6 +4455,9 @@ export const globalTools: SessionTool<{}>[] = [
|
||||
schema: parsed.schema
|
||||
}
|
||||
})
|
||||
// Forms show a resource picker only for a type in this cached list, so a script
|
||||
// written against the new type would otherwise get a plain object input.
|
||||
resourceTypesStore.set(undefined)
|
||||
toolCallbacks.setToolStatus(toolId, { content: `Created resource type ${name}` })
|
||||
return JSON.stringify({
|
||||
success: true,
|
||||
|
||||
@@ -9,6 +9,7 @@ describe('toolReloadEffect', () => {
|
||||
expect(toolReloadEffect('write_resource', {}).pages).toEqual(['/resources'])
|
||||
expect(toolReloadEffect('write_variable', {}).pages).toEqual(['/variables'])
|
||||
expect(toolReloadEffect('create_folder', { name: 'f' }).pages).toEqual(['/folders'])
|
||||
expect(toolReloadEffect('create_resource_type', { name: 'c_x' }).pages).toEqual(['/resources'])
|
||||
})
|
||||
|
||||
it('maps a trigger write to its kind-specific page', () => {
|
||||
|
||||
@@ -49,6 +49,8 @@ export function toolReloadEffect(name: string, args: any): ToolReloadEffect {
|
||||
return withItem(['/variables'], itemRef('variable', args))
|
||||
case 'create_folder':
|
||||
return { pages: ['/folders'], items: [], deployed: [] }
|
||||
case 'create_resource_type':
|
||||
return { pages: ['/resources'], items: [], deployed: [] }
|
||||
// These two change what is deployed at a path, so a tab on that item's View side
|
||||
// is showing a version that no longer exists.
|
||||
case 'delete_workspace_item':
|
||||
|
||||
Reference in New Issue
Block a user