feat: invalidate result cache on flow or script change

This commit is contained in:
Ruben Fiszel
2023-10-31 12:49:31 +01:00
parent c98ebf92e5
commit cf9669c18d
6 changed files with 122 additions and 57 deletions
@@ -39,6 +39,7 @@
faPen,
faPlus,
faRefresh,
faRotateRight,
faSave,
faShare,
faTrash
@@ -111,7 +112,9 @@
typeFilter == undefined
? preFilteredItemsOwners?.filter((x) =>
tab === 'workspace'
? x.resource_type !== 'app_theme' && x.resource_type !== 'state'
? x.resource_type !== 'app_theme' &&
x.resource_type !== 'state' &&
x.resource_type !== 'cache'
: tab === 'states'
? x.resource_type === 'state'
: tab === 'cache'
@@ -124,7 +127,9 @@
(x) =>
x.resource_type === typeFilter &&
(tab === 'workspace'
? x.resource_type !== 'app_theme' && x.resource_type !== 'state'
? x.resource_type !== 'app_theme' &&
x.resource_type !== 'state' &&
x.resource_type !== 'cache'
: true)
)
@@ -440,53 +445,78 @@
</Button>
</div>
</PageHeader>
<Tabs bind:selected={tab}>
<Tab size="md" value="workspace">
<div class="flex gap-2 items-center my-1">
<Building size={18} />
Workspace
</div>
</Tab>
<Tab size="md" value="types">
<div class="flex gap-2 items-center my-1">
Resource Types
<Tooltip
documentationLink="https://www.windmill.dev/docs/core_concepts/resources_and_types"
>
Every resources have Resource Types attached to them which contains its schema and make it
easy in scripts and flows to accept only resources of a specific resource type
</Tooltip>
</div>
</Tab>
<Tab size="md" value="states">
<div class="flex gap-2 items-center my-1">
States
<Tooltip>
States are actually resources (but excluded from the Workspace tab for clarity). States
are used by scripts to keep data persistent between runs of the same script by the same
trigger (schedule or user)
</Tooltip>
</div>
</Tab>
<Tab size="md" value="cache">
<div class="flex gap-2 items-center my-1">
Cache
<Tooltip>
Cached results are actually resources (but excluded from the Workspace tab for clarity).
Cache are used by flows's step to cache result to avoid recomputing unnecessarily
</Tooltip>
</div>
</Tab>
<Tab size="md" value="theme">
<div class="flex gap-2 items-center my-1">
Theme
<Tooltip>
Theme are actually resources (but excluded from the Workspace tab for clarity). Theme are
used by the apps to customize their look and feel.
</Tooltip>
</div>
</Tab>
</Tabs>
<div class="flex justify-between">
<Tabs class="w-full" bind:selected={tab}>
<Tab size="md" value="workspace">
<div class="flex gap-2 items-center my-1">
<Building size={18} />
Workspace
</div>
</Tab>
<Tab size="md" value="types">
<div class="flex gap-2 items-center my-1">
Resource Types
<Tooltip
documentationLink="https://www.windmill.dev/docs/core_concepts/resources_and_types"
>
Every resources have Resource Types attached to them which contains its schema and make
it easy in scripts and flows to accept only resources of a specific resource type
</Tooltip>
</div>
</Tab>
<Tab size="md" value="states">
<div class="flex gap-2 items-center my-1">
States
<Tooltip>
States are actually resources (but excluded from the Workspace tab for clarity). States
are used by scripts to keep data persistent between runs of the same script by the same
trigger (schedule or user)
</Tooltip>
</div>
</Tab>
<Tab size="md" value="cache">
<div class="flex gap-2 items-center my-1">
Cache
<Tooltip>
Cached results are actually resources (but excluded from the Workspace tab for clarity).
Cache are used by flows's step to cache result to avoid recomputing unnecessarily
</Tooltip>
</div>
</Tab>
<Tab size="md" value="theme">
<div class="flex gap-2 items-center my-1">
Theme
<Tooltip>
Theme are actually resources (but excluded from the Workspace tab for clarity). Theme
are used by the apps to customize their look and feel.
</Tooltip>
</div>
</Tab>
</Tabs>
<div class="flex">
<Button
variant="border"
color="light"
on:click={async () => {
loading = {
resources: true,
types: true
}
await loadResources()
await loadResourceTypes()
loading = {
resources: false,
types: false
}
}}
><Icon
scale={0.8}
data={faRotateRight}
class={loading.resources || loading.types ? 'animate-spin' : ''}
/></Button
>
</div>
</div>
{#if tab == 'workspace' || tab == 'states' || tab == 'cache' || tab == 'theme'}
<div class="pt-2">
<input placeholder="Search Resource" bind:value={filter} class="input mt-1" />
@@ -499,6 +529,8 @@
filters={types}
resourceType
/>
{:else}
<div class="h-4" />
{/if}
<div class="overflow-x-auto pb-40">