mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-10 08:07:03 +00:00
* assets migration * parse assets (duckdb) * iterate on assets * S3 object Preview * remove pagination * filterText * better occurence list * tweak * assets in JobPreview * clone impl * AssetsDetectedBadge * improve DbManagerButton + asset dropdown button * edit resource btn * warning when incorrect resource * +Resource in DuckDB * +S3 Object editor bar * nit fix rename * flow asset badge * More Generic OnChange * Highlight assets used in modules * Show occurence count in flow * Better UX, avoid moving parts * nit * Asset nodes * move to dedicated Asset ctx * fix layoutNodes not handling first assetsMap * explore asset btn in flow asset node * correct offset * single computeAssetNodes function * Fix y positioning of nodes with assets * resource editor * write mode node (ui) * accessType in ctx + fix insert button positioning * right positioning when mixing read and write nodes * right positioning when mixing R and W assets * Better layout fix algorithm * listAssetsByUsage and asset nodes on transitive usages * refactor + remove linkAssets * Refactor to allow for custom R/W modes * AssetsDropdownButton in flow script editor * R/W/RW selection and changes node pos in flow * layoutNodes doesnt need recompute now * fix wrong assumption that nodes recompute when assets change * r/w/rw multi toggle * MultiToggle cool animation + clearable * rename + 1px nit * remove mini toggle button group, use ToggleButtonGroup * Combinator parser that detects R / W asset context * nit fix missing flex-1 * missing order by * better ui indication for access type * special x offset case when only one asset node for clarity * parse getResource in TS with swc ecma parser * support load and write s3 detection in TS * Python asset parser * support wmill api calls without special $res: or s3:// syntax * detect out of context asset uris python * do not use access type override when not ambiguous in flow graph * parse_assets match case in rust * AsRef<str> refactor * From impl * Save flow assets * Save script asset usages + fixes + save fallback access types * asset sub icon * max total asset node width to avoid overlap * small refactor * don't parse comments in duckdb assets * fix assets clearing on parse error * fix script asset save in wrong place * load initial asset fallback access types * support variables * ui fixes * Support S3Object as URI in TS client * support new syntax in python client * Support +S3Object in EditorBar for TS and python * Reduce resource requests in assets page * import windmill client when necessary * update s3Types.d.ts * nit fix * Show input resources and s3 objects as assets * improve asset icons * DarkModeObserver refactor * asset page tabs * Moved resource variables and s3object pages to assets tabs * fetch resource usages * Get variables usages * move assets usage dropdown to component * Revert "move assets usage dropdown to component" This reverts commit622ea4ab12. * Revert "Get variables usages" This reverts commitb11ced4e29. * Revert "fetch resource usages" This reverts commitaa5187ad4b. * Revert "Moved resource variables and s3object pages to assets tabs" This reverts commit4430487be4. * Revert "asset page tabs" This reverts commitdacc2f0da5. * move assets usage dropdown to component * asset icon in asset pages * tooltip * details * Storage selector in S3 File Picker * make edge less opaque * Refactor computeAssetNodes to separate in and out nodes * AssetsOverflowedNode * nits * fix assets not being parsed in flows sometimes * show asset kind and resource_type * ui nits * support res:// in duckdb * add banner for old deployments * Fix permissionning * fix broken disable /enable all * assets page view permission for operators * Disable ExploreAssetButton for operators * asset kind as subtitle * do not spam getResource in assets page. prob. revert fail * update assets page on workspace change * reload storage names on ws change * delete assets on archive / deletion * sqlx prepare * missing update when updating user * add indexes on asset * better message * missing loadInit: false * dead code * use transaction * typo * update package.json * update package.json --------- Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
177 lines
5.6 KiB
Svelte
177 lines
5.6 KiB
Svelte
<script lang="ts">
|
|
import { Button } from '$lib/components/common'
|
|
import ToggleButtonGroup from '$lib/components/common/toggleButton-v2/ToggleButtonGroup.svelte'
|
|
import ToggleButton from '$lib/components/common/toggleButton-v2/ToggleButton.svelte'
|
|
import DataTable from '$lib/components/table/DataTable.svelte'
|
|
import Section from '$lib/components/Section.svelte'
|
|
import Head from '$lib/components/table/Head.svelte'
|
|
import Cell from '$lib/components/table/Cell.svelte'
|
|
import { WorkspaceService } from '$lib/gen'
|
|
import { workspaceStore } from '$lib/stores'
|
|
import { sendUserToast } from '$lib/toast'
|
|
import { SaveIcon, EyeIcon, EyeOffIcon } from 'lucide-svelte'
|
|
import { untrack } from 'svelte'
|
|
|
|
let operatorWorkspaceSettings = $state({
|
|
runs: true,
|
|
schedules: true,
|
|
resources: true,
|
|
variables: true,
|
|
assets: false,
|
|
triggers: true,
|
|
audit_logs: true,
|
|
groups: true,
|
|
folders: true,
|
|
workers: true
|
|
})
|
|
|
|
let originalSettings = $state({ ...untrack(() => operatorWorkspaceSettings) })
|
|
let isChanged = $state(false)
|
|
let currentWorkspace: string | null = $state(null)
|
|
|
|
async function saveSettings() {
|
|
console.log('Saving operator settings:', operatorWorkspaceSettings)
|
|
try {
|
|
await WorkspaceService.updateOperatorSettings({
|
|
workspace: $workspaceStore!,
|
|
requestBody: operatorWorkspaceSettings
|
|
})
|
|
originalSettings = { ...operatorWorkspaceSettings }
|
|
isChanged = false
|
|
sendUserToast('Operator settings saved successfully!', false)
|
|
} catch (error) {
|
|
console.error('Error updating operator settings:', error)
|
|
sendUserToast('Failed to save operator settings.', true)
|
|
}
|
|
}
|
|
|
|
const descriptions = {
|
|
runs: { title: 'Runs', description: 'View runs' },
|
|
schedules: { title: 'Schedules', description: 'View schedules' },
|
|
resources: { title: 'Resources', description: 'View resources' },
|
|
variables: { title: 'Variables', description: 'View variables' },
|
|
assets: { title: 'Assets', description: 'View assets' },
|
|
triggers: { title: 'Triggers', description: 'View all triggers (HTTP, Websocket, Kafka)' },
|
|
audit_logs: { title: 'Audit Logs', description: 'View audit logs' },
|
|
groups: { title: 'Groups', description: 'View groups and group members' },
|
|
folders: { title: 'Folders', description: 'View folders' },
|
|
workers: { title: 'Workers', description: 'View workers and worker groups' }
|
|
}
|
|
|
|
$effect(() => {
|
|
if ($workspaceStore && $workspaceStore !== currentWorkspace) {
|
|
;(async () => {
|
|
currentWorkspace = $workspaceStore
|
|
const settings = await WorkspaceService.getSettings({
|
|
workspace: $workspaceStore
|
|
})
|
|
if (settings.operator_settings !== null) {
|
|
operatorWorkspaceSettings = {
|
|
...operatorWorkspaceSettings,
|
|
...(settings.operator_settings ?? {})
|
|
}
|
|
originalSettings = { ...operatorWorkspaceSettings }
|
|
}
|
|
})()
|
|
}
|
|
})
|
|
|
|
$effect(() => {
|
|
isChanged = JSON.stringify(operatorWorkspaceSettings) !== JSON.stringify(originalSettings)
|
|
})
|
|
|
|
const allDisabled = $derived(
|
|
Object.values(operatorWorkspaceSettings).every((value) => value === false)
|
|
)
|
|
const allEnabled = $derived(
|
|
Object.values(operatorWorkspaceSettings).every((value) => value === true)
|
|
)
|
|
</script>
|
|
|
|
<div class="mt-6">
|
|
<Section
|
|
label="Operator Settings"
|
|
collapsable={true}
|
|
tooltip="Configure the operator visibility settings for your workspace. Toggle the settings you want to enable."
|
|
>
|
|
<div class="flex flex-col gap-4 my-4">
|
|
<div class="flex flex-col gap-1">
|
|
<div class="text-tertiary text-xs">
|
|
Configure the operator visibility settings for your workspace. Toggle the settings you
|
|
want to enable.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex justify-end mb-2">
|
|
<div class="flex justify-end"></div>
|
|
</div>
|
|
|
|
<div class="flex flex-col">
|
|
<DataTable tableFixed={true} size="xs">
|
|
<Head>
|
|
<tr>
|
|
<Cell head first>Section</Cell>
|
|
<Cell head>Description</Cell>
|
|
<Cell head last>
|
|
<ToggleButtonGroup
|
|
bind:selected={
|
|
() => (allDisabled ? 'false' : allEnabled ? 'true' : ''),
|
|
(v) => {
|
|
Object.keys(operatorWorkspaceSettings).forEach((key) => {
|
|
if (v === 'true') operatorWorkspaceSettings[key] = true
|
|
if (v === 'false') operatorWorkspaceSettings[key] = false
|
|
})
|
|
}
|
|
}
|
|
>
|
|
{#snippet children({ item })}
|
|
<ToggleButton
|
|
icon={EyeIcon}
|
|
small={true}
|
|
value={'true'}
|
|
label="Enable All"
|
|
{item}
|
|
/>
|
|
<ToggleButton
|
|
icon={EyeOffIcon}
|
|
small={true}
|
|
value={'false'}
|
|
label="Disable All"
|
|
{item}
|
|
/>
|
|
{/snippet}
|
|
</ToggleButtonGroup>
|
|
</Cell>
|
|
</tr>
|
|
</Head>
|
|
<tbody class="divide-y bg-surface">
|
|
{#each Object.entries(descriptions) as [key, { title, description }]}
|
|
<tr>
|
|
<Cell first>{title}</Cell>
|
|
<Cell>{description}</Cell>
|
|
<Cell last class="pl-8">
|
|
<ToggleButtonGroup
|
|
selected={operatorWorkspaceSettings[key] ? 'on' : 'off'}
|
|
on:selected={({ detail }) => (operatorWorkspaceSettings[key] = detail === 'on')}
|
|
>
|
|
{#snippet children({ item })}
|
|
<ToggleButton icon={EyeIcon} small={true} value={'on'} label="On" {item} />
|
|
<ToggleButton icon={EyeOffIcon} small={true} value={'off'} label="Off" {item} />
|
|
{/snippet}
|
|
</ToggleButtonGroup>
|
|
</Cell>
|
|
</tr>
|
|
{/each}
|
|
</tbody>
|
|
</DataTable>
|
|
</div>
|
|
|
|
<div class="flex justify-end mt-4">
|
|
<Button on:click={saveSettings} startIcon={{ icon: SaveIcon }} disabled={!isChanged}>
|
|
Save
|
|
</Button>
|
|
</div>
|
|
</Section>
|
|
</div>
|