windmill-components 1.504.6 → 1.511.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package/ata/index.js +1 -1
- package/package/components/AppConnectInner.svelte +184 -29
- package/package/components/ArgInput.svelte +33 -103
- package/package/components/AuthSettings.svelte +45 -1
- package/package/components/Dev.svelte +31 -24
- package/package/components/DisplayResult.svelte +53 -26
- package/package/components/DisplayResult.svelte.d.ts +1 -1
- package/package/components/DynSelect.svelte +3 -3
- package/package/components/Editor.svelte +115 -88
- package/package/components/Editor.svelte.d.ts +30 -55
- package/package/components/EditorBar.svelte +2 -2
- package/package/components/ErrorOrRecoveryHandler.svelte +73 -67
- package/package/components/ErrorOrRecoveryHandler.svelte.d.ts +8 -24
- package/package/components/FlowBuilder.svelte +11 -2
- package/package/components/FlowJobResult.svelte +12 -17
- package/package/components/FlowJobResult.svelte.d.ts +5 -18
- package/package/components/FlowPreviewContent.svelte +13 -10
- package/package/components/FlowPreviewContent.svelte.d.ts +1 -1
- package/package/components/FlowPreviewResult.svelte +14 -6
- package/package/components/FlowStatusViewer.svelte +11 -24
- package/package/components/FlowStatusViewer.svelte.d.ts +19 -18
- package/package/components/FlowStatusViewerInner.svelte +110 -131
- package/package/components/FlowStatusViewerInner.svelte.d.ts +20 -18
- package/package/components/GitDiffPreview.svelte +55 -0
- package/package/components/GitDiffPreview.svelte.d.ts +13 -0
- package/package/components/HistoricInputs.svelte +2 -2
- package/package/components/HttpAgentWorkerDrawer.svelte +1 -1
- package/package/components/InitGitRepoPopover.svelte +410 -0
- package/package/components/InitGitRepoPopover.svelte.d.ts +13 -0
- package/package/components/InstanceSetting.svelte +21 -9
- package/package/components/InstanceSettings.svelte +16 -3
- package/package/components/JobLoader.svelte +567 -0
- package/package/components/JobLoader.svelte.d.ts +53 -0
- package/package/components/JobLogs.svelte +6 -4
- package/package/components/JobLogs.svelte.d.ts +5 -18
- package/package/components/JsonEditor.svelte +11 -11
- package/package/components/JsonEditor.svelte.d.ts +14 -56
- package/package/components/Label.svelte +6 -11
- package/package/components/Label.svelte.d.ts +14 -39
- package/package/components/LightweightResourcePicker.svelte +18 -39
- package/package/components/LightweightResourcePicker.svelte.d.ts +6 -22
- package/package/components/LogViewer.svelte +35 -41
- package/package/components/LogViewer.svelte.d.ts +6 -20
- package/package/components/ModulePreviewResultViewer.svelte +3 -1
- package/package/components/ModulePreviewResultViewer.svelte.d.ts +1 -0
- package/package/components/ModuleTest.svelte +16 -11
- package/package/components/NumberTypeNarrowing.svelte +13 -16
- package/package/components/NumberTypeNarrowing.svelte.d.ts +4 -18
- package/package/components/PullGitRepoPopover.svelte +355 -0
- package/package/components/PullGitRepoPopover.svelte.d.ts +18 -0
- package/package/components/ResourceTypePicker.svelte +20 -17
- package/package/components/ResourceTypePicker.svelte.d.ts +7 -6
- package/package/components/S3FilePicker.svelte +5 -3
- package/package/components/SavedInputs.svelte +2 -2
- package/package/components/ScriptBuilder.svelte +4 -3
- package/package/components/ScriptEditor.svelte +34 -31
- package/package/components/ScriptEditor.svelte.d.ts +3 -3
- package/package/components/Section.svelte +7 -20
- package/package/components/Section.svelte.d.ts +20 -47
- package/package/components/ServiceLogsInner.svelte +2 -1
- package/package/components/ServiceLogsInner.svelte.d.ts +1 -0
- package/package/components/SimpleEditor.svelte +4 -4
- package/package/components/SimpleEditor.svelte.d.ts +1 -0
- package/package/components/SqlRepl.svelte +0 -1
- package/package/components/Subsection.svelte +10 -12
- package/package/components/Subsection.svelte.d.ts +15 -39
- package/package/components/UserSettings.svelte +1 -1
- package/package/components/WorkerGroup.svelte +260 -165
- package/package/components/WorkerGroup.svelte.d.ts +2 -0
- package/package/components/WorkerTagPicker.svelte +3 -3
- package/package/components/WorkerTagSelect.svelte +33 -4
- package/package/components/apps/components/buttons/AppButton.svelte +7 -1
- package/package/components/apps/components/buttons/AppButton.svelte.d.ts +1 -0
- package/package/components/apps/components/display/AppCustomComponent.svelte +1 -1
- package/package/components/apps/components/display/AppDisplayComponentByJobId.svelte +16 -11
- package/package/components/apps/components/display/AppJobIdLogComponent.svelte +13 -10
- package/package/components/apps/components/display/AppMenu.svelte +5 -0
- package/package/components/apps/components/display/dbtable/AppDbExplorer.svelte +3 -3
- package/package/components/apps/components/display/dbtable/DeleteRow.svelte +3 -3
- package/package/components/apps/components/display/dbtable/InsertRowRunnable.svelte +3 -3
- package/package/components/apps/components/display/dbtable/UpdateCell.svelte +3 -3
- package/package/components/apps/components/display/table/AppAggridInfiniteTable.svelte +3 -3
- package/package/components/apps/components/helpers/RunnableComponent.svelte +65 -54
- package/package/components/apps/components/helpers/RunnableComponent.svelte.d.ts +5 -5
- package/package/components/apps/components/inputs/AppUserResource.svelte +26 -8
- package/package/components/apps/editor/AppEditorHeader.svelte +11 -5
- package/package/components/apps/editor/AppJobsDrawer.svelte +5 -5
- package/package/components/apps/editor/RunnableJobPanel.svelte +4 -4
- package/package/components/apps/editor/component/components.d.ts +12 -0
- package/package/components/apps/editor/component/components.js +19 -7
- package/package/components/assets/AssetButtons.svelte +38 -0
- package/package/components/assets/AssetButtons.svelte.d.ts +15 -0
- package/package/components/assets/AssetsDropdownButton.svelte +60 -72
- package/package/components/assets/AssetsDropdownButton.svelte.d.ts +3 -4
- package/package/components/assets/AssetsUsageDrawer.svelte +10 -10
- package/package/components/assets/JobAssetsViewer.svelte +79 -0
- package/package/components/assets/JobAssetsViewer.svelte.d.ts +7 -0
- package/package/components/assets/README_DEV.md +0 -0
- package/package/components/assets/lib.d.ts +9 -1
- package/package/components/assets/lib.js +48 -7
- package/package/components/common/fileUpload/FileUpload.svelte +126 -84
- package/package/components/common/fileUpload/FileUpload.svelte.d.ts +13 -3
- package/package/components/common/fileUpload/S3ArgInput.svelte +111 -0
- package/package/components/common/fileUpload/S3ArgInput.svelte.d.ts +21 -0
- package/package/components/common/table/ScriptRow.svelte +3 -1
- package/package/components/copilot/AIFormSettings.svelte +3 -4
- package/package/components/copilot/AIFormSettings.svelte.d.ts +5 -19
- package/package/components/copilot/autocomplete/Autocompletor.d.ts +3 -1
- package/package/components/copilot/autocomplete/Autocompletor.js +269 -35
- package/package/components/copilot/autocomplete/request.d.ts +3 -0
- package/package/components/copilot/autocomplete/request.js +15 -7
- package/package/components/copilot/chat/AIChatDisplay.svelte +8 -0
- package/package/components/copilot/chat/AIChatManager.svelte.js +13 -8
- package/package/components/copilot/chat/flow/ModuleAcceptReject.svelte +5 -5
- package/package/components/copilot/chat/flow/core.d.ts +1 -1
- package/package/components/copilot/chat/flow/core.js +2 -38
- package/package/components/copilot/chat/navigator/apiTools.d.ts +8 -0
- package/package/components/copilot/chat/navigator/apiTools.js +95 -15
- package/package/components/copilot/chat/navigator/core.d.ts +1 -1
- package/package/components/copilot/chat/navigator/core.js +2 -1
- package/package/components/copilot/chat/script/core.d.ts +11 -2
- package/package/components/copilot/chat/script/core.js +165 -23
- package/package/components/copilot/chat/shared.d.ts +10 -0
- package/package/components/copilot/chat/shared.js +56 -0
- package/package/components/copilot/lib.d.ts +1 -0
- package/package/components/copilot/lib.js +30 -9
- package/package/components/custom_ui.d.ts +1 -0
- package/package/components/flows/FlowAssetsHandler.svelte +133 -0
- package/package/components/flows/FlowAssetsHandler.svelte.d.ts +14 -0
- package/package/components/flows/content/FlowModuleCache.svelte +4 -4
- package/package/components/flows/content/FlowModuleCache.svelte.d.ts +4 -18
- package/package/components/flows/content/FlowModuleComponent.svelte +16 -19
- package/package/components/flows/content/FlowModuleDeleteAfterUse.svelte +3 -4
- package/package/components/flows/content/FlowModuleDeleteAfterUse.svelte.d.ts +4 -18
- package/package/components/flows/content/FlowModuleSleep.svelte +6 -7
- package/package/components/flows/content/FlowModuleSleep.svelte.d.ts +4 -18
- package/package/components/flows/content/FlowModuleSuspend.svelte +19 -17
- package/package/components/flows/content/FlowModuleSuspend.svelte.d.ts +4 -18
- package/package/components/flows/content/FlowModuleTimeout.svelte +4 -4
- package/package/components/flows/content/FlowModuleTimeout.svelte.d.ts +4 -18
- package/package/components/flows/flowStore.d.ts +1 -1
- package/package/components/flows/map/FlowModuleSchemaItem.svelte +1 -0
- package/package/components/flows/propPicker/OutputPicker.svelte +9 -4
- package/package/components/flows/scheduleUtils.js +1 -1
- package/package/components/flows/types.d.ts +2 -1
- package/package/components/graph/FlowGraphV2.svelte +8 -104
- package/package/components/graph/FlowGraphV2.svelte.d.ts +0 -2
- package/package/components/graph/graphBuilder.svelte.d.ts +6 -3
- package/package/components/graph/graphBuilder.svelte.js +35 -9
- package/package/components/graph/renderers/edges/BaseEdge.svelte +2 -5
- package/package/components/graph/renderers/edges/BaseEdge.svelte.d.ts +1 -0
- package/package/components/graph/renderers/nodes/AssetNode.svelte +23 -20
- package/package/components/graph/renderers/nodes/AssetNode.svelte.d.ts +5 -10
- package/package/components/graph/renderers/nodes/AssetsOverflowedNode.svelte +1 -1
- package/package/components/graph/util.js +1 -1
- package/package/components/home/ItemsList.svelte +2 -0
- package/package/components/icons/AssetGenericIcon.svelte +0 -3
- package/package/components/jobs/JobPreview.svelte +10 -6
- package/package/components/raw_apps/RawAppInlineScriptRunnable.svelte +13 -12
- package/package/components/runs/BatchReRunOptionsPane.svelte +5 -1
- package/package/components/runs/JobPreview.svelte +26 -16
- package/package/components/runs/{JobLoader.svelte.d.ts → JobsLoader.svelte.d.ts} +3 -3
- package/package/components/runs/NoWorkerWithTagWarning.svelte +2 -2
- package/package/components/runs/NoWorkerWithTagWarning.svelte.d.ts +1 -0
- package/package/components/runs/RunsFilter.svelte.d.ts +1 -1
- package/package/components/scriptEditor/LogPanel.svelte +3 -2
- package/package/components/script_builder.d.ts +2 -2
- package/package/components/settings/CreateToken.svelte +76 -41
- package/package/components/settings/CreateToken.svelte.d.ts +1 -1
- package/package/components/settings/ScopeSelector.svelte +613 -0
- package/package/components/settings/ScopeSelector.svelte.d.ts +8 -0
- package/package/components/settings/TokenDisplay.svelte +103 -0
- package/package/components/settings/TokenDisplay.svelte.d.ts +10 -0
- package/package/components/settings/TokensTable.svelte +70 -349
- package/package/components/sidebar/CriticalAlertModal.svelte +3 -0
- package/package/components/triggers/DeleteTriggerButton.svelte +1 -1
- package/package/components/triggers/TriggerEditorToolbar.svelte +3 -3
- package/package/components/triggers/TriggerRetriesAndErrorHandler.svelte +55 -0
- package/package/components/triggers/TriggerRetriesAndErrorHandler.svelte.d.ts +13 -0
- package/package/components/triggers/TriggersEditor.svelte +45 -3
- package/package/components/triggers/TriggersWrapper.svelte +2 -2
- package/package/components/triggers/gcp/GcpTriggerEditorInner.svelte +47 -6
- package/package/components/triggers/gcp/utils.js +9 -1
- package/package/components/triggers/http/OpenAPISpecGenerator.svelte +3 -2
- package/package/components/triggers/http/RouteEditorConfigSection.svelte +26 -23
- package/package/components/triggers/http/RouteEditorConfigSection.svelte.d.ts +5 -19
- package/package/components/triggers/http/RouteEditorInner.svelte +219 -175
- package/package/components/triggers/http/RouteEditorInner.svelte.d.ts +6 -2
- package/package/components/triggers/http/utils.js +9 -3
- package/package/components/triggers/kafka/KafkaTriggerEditorInner.svelte +47 -6
- package/package/components/triggers/kafka/utils.js +9 -1
- package/package/components/triggers/mqtt/MqttEditorConfigSection.svelte +4 -132
- package/package/components/triggers/mqtt/MqttEditorConfigSection.svelte.d.ts +2 -5
- package/package/components/triggers/mqtt/MqttTriggerEditorInner.svelte +182 -13
- package/package/components/triggers/mqtt/utils.js +9 -1
- package/package/components/triggers/nats/NatsTriggerEditorInner.svelte +47 -6
- package/package/components/triggers/nats/utils.js +9 -1
- package/package/components/triggers/postgres/PostgresTriggerEditorInner.svelte +41 -2
- package/package/components/triggers/postgres/utils.js +9 -1
- package/package/components/triggers/schedules/ScheduleEditorInner.svelte +38 -92
- package/package/components/triggers/sqs/SqsTriggerEditorInner.svelte +47 -6
- package/package/components/triggers/sqs/utils.js +9 -1
- package/package/components/triggers/utils.js +12 -0
- package/package/components/triggers/websocket/WebsocketTriggerEditorInner.svelte +47 -6
- package/package/components/triggers/websocket/utils.js +11 -1
- package/package/components/workspaceSettings/AISettings.svelte +0 -2
- package/package/components/workspaceSettings/FilterList.svelte +56 -0
- package/package/components/workspaceSettings/FilterList.svelte.d.ts +8 -0
- package/package/components/workspaceSettings/GitSyncFilterSettings.svelte +785 -0
- package/package/components/workspaceSettings/GitSyncFilterSettings.svelte.d.ts +18 -0
- package/package/gen/core/OpenAPI.js +1 -1
- package/package/gen/schemas.gen.d.ts +305 -23
- package/package/gen/schemas.gen.js +305 -23
- package/package/gen/services.gen.d.ts +33 -1
- package/package/gen/services.gen.js +66 -2
- package/package/gen/types.gen.d.ts +216 -11
- package/package/history.svelte.js +0 -2
- package/package/hub.d.ts +1 -0
- package/package/hubPaths.json +5 -2
- package/package/infer.js +16 -10
- package/package/svelte5Utils.svelte.d.ts +1 -0
- package/package/svelte5Utils.svelte.js +25 -18
- package/package/toast.js +10 -0
- package/package/utils.d.ts +3 -2
- package/package/utils.js +20 -5
- package/package.json +11 -11
- package/package/components/ResultJobLoader.svelte +0 -219
- package/package/components/ResultJobLoader.svelte.d.ts +0 -52
- package/package/components/TestJobLoader.svelte +0 -274
- package/package/components/TestJobLoader.svelte.d.ts +0 -43
- package/package/components/icons/AssetVarIcon.svelte +0 -31
- package/package/components/icons/AssetVarIcon.svelte.d.ts +0 -9
- /package/package/components/runs/{JobLoader.svelte → JobsLoader.svelte} +0 -0
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { workspaceStore } from '../stores';
|
|
3
3
|
import { getScriptByPath } from '../scripts';
|
|
4
4
|
import { getContext } from 'svelte';
|
|
5
|
-
import
|
|
5
|
+
import JobLoader, {} from './JobLoader.svelte';
|
|
6
6
|
import { getStepHistoryLoaderContext } from './stepHistoryLoader.svelte';
|
|
7
7
|
let { mod, testJob = $bindable(undefined), testIsLoading = $bindable(false), noEditor = false, scriptProgress = $bindable(undefined) } = $props();
|
|
8
8
|
const { flowStore, flowStateStore, pathStore, testSteps, previewArgs, modulesTestStates } = getContext('FlowEditorContext');
|
|
9
|
-
let
|
|
9
|
+
let jobLoader = $state(undefined);
|
|
10
10
|
let jobProgressReset = () => { };
|
|
11
11
|
let stepHistoryLoader = getStepHistoryLoaderContext();
|
|
12
12
|
export function runTestWithStepArgs() {
|
|
@@ -22,31 +22,36 @@ export async function runTest(args) {
|
|
|
22
22
|
jobProgressReset();
|
|
23
23
|
if (modulesTestStates.states[mod.id]) {
|
|
24
24
|
modulesTestStates.states[mod.id].cancel = async () => {
|
|
25
|
-
await
|
|
25
|
+
await jobLoader?.cancelJob();
|
|
26
26
|
modulesTestStates.states[mod.id].testJob = undefined;
|
|
27
27
|
};
|
|
28
28
|
modulesTestStates.runTestCb?.(mod.id);
|
|
29
29
|
}
|
|
30
30
|
const val = mod.value;
|
|
31
31
|
// let jobId: string | undefined = undefined
|
|
32
|
+
let callbacks = {
|
|
33
|
+
done: (x) => {
|
|
34
|
+
jobDone(x);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
32
37
|
if (val.type == 'rawscript') {
|
|
33
|
-
await
|
|
38
|
+
await jobLoader?.runPreview(val.path ?? ($pathStore ?? '') + '/' + mod.id, val.content, val.language, mod.id === 'preprocessor' ? { _ENTRYPOINT_OVERRIDE: 'preprocessor', ...args } : args, flowStore?.val?.tag ?? val.tag, undefined, undefined, callbacks);
|
|
34
39
|
}
|
|
35
40
|
else if (val.type == 'script') {
|
|
36
41
|
const script = val.hash
|
|
37
42
|
? await ScriptService.getScriptByHash({ workspace: $workspaceStore, hash: val.hash })
|
|
38
43
|
: await getScriptByPath(val.path);
|
|
39
|
-
await
|
|
44
|
+
await jobLoader?.runPreview(val.path, script.content, script.language, mod.id === 'preprocessor' ? { _ENTRYPOINT_OVERRIDE: 'preprocessor', ...args } : args, flowStore?.val?.tag ?? (val.tag_override ? val.tag_override : script.tag), script.lock, val.hash ?? script.hash, callbacks);
|
|
40
45
|
}
|
|
41
46
|
else if (val.type == 'flow') {
|
|
42
|
-
await
|
|
47
|
+
await jobLoader?.runFlowByPath(val.path, args, callbacks);
|
|
43
48
|
}
|
|
44
49
|
else {
|
|
45
50
|
throw Error('Not supported module type');
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
|
-
function jobDone() {
|
|
49
|
-
if (testJob && !testJob.canceled && testJob.type == 'CompletedJob'
|
|
53
|
+
function jobDone(testJob) {
|
|
54
|
+
if (testJob && !testJob.canceled && testJob.type == 'CompletedJob') {
|
|
50
55
|
if ($flowStateStore[mod.id]) {
|
|
51
56
|
$flowStateStore[mod.id].previewResult = testJob.result;
|
|
52
57
|
$flowStateStore[mod.id].previewSuccess = testJob.success;
|
|
@@ -76,11 +81,11 @@ modulesTestStates.states[mod.id] = {
|
|
|
76
81
|
};
|
|
77
82
|
</script>
|
|
78
83
|
|
|
79
|
-
<
|
|
84
|
+
<JobLoader
|
|
85
|
+
noCode={true}
|
|
80
86
|
toastError={noEditor}
|
|
81
|
-
on:done={() => jobDone()}
|
|
82
87
|
bind:scriptProgress
|
|
83
|
-
bind:this={
|
|
88
|
+
bind:this={jobLoader}
|
|
84
89
|
bind:isLoading={
|
|
85
90
|
() => modulesTestStates.states[mod.id]?.loading ?? false,
|
|
86
91
|
(v) => {
|
|
@@ -2,24 +2,21 @@
|
|
|
2
2
|
import Toggle from './Toggle.svelte';
|
|
3
3
|
import Tooltip from './Tooltip.svelte';
|
|
4
4
|
import { selectOptions } from './apps/editor/component';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export let currencyLocale;
|
|
9
|
-
let minChecked = min != undefined;
|
|
10
|
-
let maxChecked = max != undefined;
|
|
5
|
+
let { min = $bindable(), max = $bindable(), currency = $bindable(), currencyLocale = $bindable() } = $props();
|
|
6
|
+
let minChecked = $state(min != undefined);
|
|
7
|
+
let maxChecked = $state(max != undefined);
|
|
11
8
|
</script>
|
|
12
9
|
|
|
13
10
|
<div class="flex flex-col gap-2">
|
|
14
11
|
<div class="grid grid-cols-2 gap-4">
|
|
15
12
|
<Label label="Min" class="w-full col-span-1">
|
|
16
|
-
|
|
13
|
+
{#snippet header()}
|
|
17
14
|
<Tooltip light small>
|
|
18
15
|
Set a minimum value for the number. If both min and max are set, the input will render as
|
|
19
16
|
a range slider.
|
|
20
17
|
</Tooltip>
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
{/snippet}
|
|
19
|
+
{#snippet action()}
|
|
23
20
|
<Toggle
|
|
24
21
|
bind:checked={minChecked}
|
|
25
22
|
on:change={(e) => {
|
|
@@ -32,17 +29,17 @@ let maxChecked = max != undefined;
|
|
|
32
29
|
options={{ right: 'Enabled' }}
|
|
33
30
|
size="xs"
|
|
34
31
|
/>
|
|
35
|
-
|
|
32
|
+
{/snippet} <input type="number" bind:value={min} disabled={!minChecked} />
|
|
36
33
|
</Label>
|
|
37
34
|
|
|
38
35
|
<Label label="Max" class="w-full col-span-1 ">
|
|
39
|
-
|
|
36
|
+
{#snippet header()}
|
|
40
37
|
<Tooltip light small>
|
|
41
38
|
Set a maximum value for the number. If both min and max are set, the input will render as
|
|
42
39
|
a range slider.
|
|
43
40
|
</Tooltip>
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
{/snippet}
|
|
42
|
+
{#snippet action()}
|
|
46
43
|
<Toggle
|
|
47
44
|
bind:checked={maxChecked}
|
|
48
45
|
on:change={(e) => {
|
|
@@ -55,18 +52,18 @@ let maxChecked = max != undefined;
|
|
|
55
52
|
options={{ right: 'Enabled' }}
|
|
56
53
|
size="xs"
|
|
57
54
|
/>
|
|
58
|
-
|
|
55
|
+
{/snippet}
|
|
59
56
|
<input type="number" bind:value={max} disabled={!maxChecked} />
|
|
60
57
|
</Label>
|
|
61
58
|
</div>
|
|
62
59
|
<div class="grid grid-cols-3 gap-4">
|
|
63
60
|
<Label label="Currency" class="w-full col-span-2">
|
|
64
|
-
|
|
61
|
+
{#snippet header()}
|
|
65
62
|
<Tooltip light small>
|
|
66
63
|
Select a currency to display the number in. If a currency is selected, you can also select
|
|
67
64
|
a locale to format the number according to that locale.
|
|
68
65
|
</Tooltip>
|
|
69
|
-
|
|
66
|
+
{/snippet}
|
|
70
67
|
<select bind:value={currency}>
|
|
71
68
|
<option value={undefined}> No currency </option>
|
|
72
69
|
{#each selectOptions.currencyOptions as c}
|
|
@@ -1,23 +1,9 @@
|
|
|
1
|
-
interface
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const NumberTypeNarrowing: $$__sveltets_2_IsomorphicComponent<{
|
|
1
|
+
interface Props {
|
|
15
2
|
min: number | undefined;
|
|
16
3
|
max: number | undefined;
|
|
17
4
|
currency: string | undefined;
|
|
18
5
|
currencyLocale: string | undefined;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
type NumberTypeNarrowing = InstanceType<typeof NumberTypeNarrowing>;
|
|
6
|
+
}
|
|
7
|
+
declare const NumberTypeNarrowing: import("svelte").Component<Props, {}, "currency" | "min" | "max" | "currencyLocale">;
|
|
8
|
+
type NumberTypeNarrowing = ReturnType<typeof NumberTypeNarrowing>;
|
|
23
9
|
export default NumberTypeNarrowing;
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
<script lang="ts">import { Button } from './common';
|
|
2
|
+
import Popover from './meltComponents/Popover.svelte';
|
|
3
|
+
import { Loader2, Eye, Save, CheckCircle2, XCircle, DownloadCloud, AlertTriangle, Terminal, ChevronDown, ChevronUp } from 'lucide-svelte';
|
|
4
|
+
import { workspaceStore } from '../stores';
|
|
5
|
+
import hubPaths from '../hubPaths.json';
|
|
6
|
+
import { JobService } from '../gen';
|
|
7
|
+
import { tryEvery } from '../utils';
|
|
8
|
+
import { sendUserToast } from '../toast';
|
|
9
|
+
import GitDiffPreview from './GitDiffPreview.svelte';
|
|
10
|
+
import { page } from '$app/stores';
|
|
11
|
+
let { gitRepoResourcePath, uiState, onFilterUpdate } = $props();
|
|
12
|
+
let previewResult = $state(undefined);
|
|
13
|
+
let isPreviewLoading = $state(false);
|
|
14
|
+
let isPulling = $state(false);
|
|
15
|
+
let pullGitRepoPopover = $state(null);
|
|
16
|
+
let jobStatus = $state({
|
|
17
|
+
id: null,
|
|
18
|
+
status: undefined,
|
|
19
|
+
type: 'preview'
|
|
20
|
+
});
|
|
21
|
+
let isCliInfoExpanded = $state(false);
|
|
22
|
+
async function handleJobCompletion(jobId, workspace) {
|
|
23
|
+
let success = false;
|
|
24
|
+
await tryEvery({
|
|
25
|
+
tryCode: async () => {
|
|
26
|
+
const result = await JobService.getCompletedJob({
|
|
27
|
+
workspace,
|
|
28
|
+
id: jobId
|
|
29
|
+
});
|
|
30
|
+
success = !!result.success;
|
|
31
|
+
},
|
|
32
|
+
timeoutCode: async () => {
|
|
33
|
+
try {
|
|
34
|
+
await JobService.cancelQueuedJob({
|
|
35
|
+
workspace,
|
|
36
|
+
id: jobId,
|
|
37
|
+
requestBody: {
|
|
38
|
+
reason: 'Job timed out after 5s'
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
console.error(err);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
interval: 500,
|
|
47
|
+
timeout: 10000
|
|
48
|
+
});
|
|
49
|
+
return success;
|
|
50
|
+
}
|
|
51
|
+
async function previewChanges() {
|
|
52
|
+
const workspace = $workspaceStore;
|
|
53
|
+
if (!workspace)
|
|
54
|
+
return;
|
|
55
|
+
console.log('Previewing changes for repo:', gitRepoResourcePath);
|
|
56
|
+
isPreviewLoading = true;
|
|
57
|
+
jobStatus = { id: null, status: undefined, type: 'preview' };
|
|
58
|
+
try {
|
|
59
|
+
// Always use the simplified JSON approach
|
|
60
|
+
const jobId = await JobService.runScriptByPath({
|
|
61
|
+
workspace,
|
|
62
|
+
path: hubPaths.gitInitRepo,
|
|
63
|
+
requestBody: {
|
|
64
|
+
workspace_id: workspace,
|
|
65
|
+
repo_url_resource_path: gitRepoResourcePath,
|
|
66
|
+
dry_run: true,
|
|
67
|
+
pull: true,
|
|
68
|
+
only_wmill_yaml: false,
|
|
69
|
+
settings_json: JSON.stringify(uiState)
|
|
70
|
+
},
|
|
71
|
+
skipPreprocessor: true
|
|
72
|
+
});
|
|
73
|
+
jobStatus = { id: jobId, status: 'running', type: 'preview' };
|
|
74
|
+
const success = await handleJobCompletion(jobId, workspace);
|
|
75
|
+
if (success) {
|
|
76
|
+
const rawResult = await JobService.getCompletedJobResult({ workspace, id: jobId });
|
|
77
|
+
console.log('Preview result:', rawResult);
|
|
78
|
+
// Convert new CLI format to expected format
|
|
79
|
+
const added = [];
|
|
80
|
+
const deleted = [];
|
|
81
|
+
const modified = [];
|
|
82
|
+
if (rawResult &&
|
|
83
|
+
rawResult.changes &&
|
|
84
|
+
Array.isArray(rawResult.changes)) {
|
|
85
|
+
for (const change of rawResult.changes) {
|
|
86
|
+
if (change.type === 'added') {
|
|
87
|
+
added.push(change.path);
|
|
88
|
+
}
|
|
89
|
+
else if (change.type === 'deleted') {
|
|
90
|
+
deleted.push(change.path);
|
|
91
|
+
}
|
|
92
|
+
else if (change.type === 'modified') {
|
|
93
|
+
modified.push(change.path);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// For full sync mode, just use the CLI results directly
|
|
98
|
+
// The CLI already handles wmill.yaml changes with --include-wmill-yaml flag
|
|
99
|
+
previewResult = { added, deleted, modified };
|
|
100
|
+
jobStatus.status = 'success';
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
previewResult = undefined;
|
|
104
|
+
jobStatus.status = 'failure';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
console.error('Failed to preview changes:', error);
|
|
109
|
+
previewResult = undefined;
|
|
110
|
+
jobStatus = {
|
|
111
|
+
...jobStatus,
|
|
112
|
+
status: 'failure',
|
|
113
|
+
error: error instanceof Error ? error.message : String(error)
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
isPreviewLoading = false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async function pullFromRepo() {
|
|
121
|
+
const workspace = $workspaceStore;
|
|
122
|
+
if (!workspace)
|
|
123
|
+
return;
|
|
124
|
+
console.log('Pulling from repo:', gitRepoResourcePath);
|
|
125
|
+
isPulling = true;
|
|
126
|
+
jobStatus = { id: null, status: undefined, type: 'pull' };
|
|
127
|
+
try {
|
|
128
|
+
// Use init git repo script with dry_run: false (actual pull operation)
|
|
129
|
+
// The script will read wmill.yaml directly from the cloned repo, no need to pass settings
|
|
130
|
+
const jobId = await JobService.runScriptByPath({
|
|
131
|
+
workspace,
|
|
132
|
+
path: hubPaths.gitInitRepo,
|
|
133
|
+
requestBody: {
|
|
134
|
+
workspace_id: workspace,
|
|
135
|
+
repo_url_resource_path: gitRepoResourcePath,
|
|
136
|
+
dry_run: false,
|
|
137
|
+
branch_to_push: '',
|
|
138
|
+
only_wmill_yaml: false,
|
|
139
|
+
pull: true,
|
|
140
|
+
settings_json: undefined // Let script use wmill.yaml from repo
|
|
141
|
+
},
|
|
142
|
+
skipPreprocessor: true
|
|
143
|
+
});
|
|
144
|
+
jobStatus = { id: jobId, status: 'running', type: 'pull' };
|
|
145
|
+
const success = await handleJobCompletion(jobId, workspace);
|
|
146
|
+
jobStatus.status = success ? 'success' : 'failure';
|
|
147
|
+
if (success) {
|
|
148
|
+
// Get the result which should contain the local git repo settings as JSON
|
|
149
|
+
const result = (await JobService.getCompletedJobResult({ workspace, id: jobId }));
|
|
150
|
+
console.log('Pull result:', result);
|
|
151
|
+
// Apply the settings from the sync operation result to the UI
|
|
152
|
+
if (result?.settings_json) {
|
|
153
|
+
// Directly update the UI state with the JSON result - no YAML conversion needed!
|
|
154
|
+
const settingsJson = result.settings_json;
|
|
155
|
+
onFilterUpdate({
|
|
156
|
+
include_path: settingsJson.include_path || ['f/**'],
|
|
157
|
+
exclude_path: settingsJson.exclude_path || [],
|
|
158
|
+
extra_include_path: settingsJson.extra_include_path || [],
|
|
159
|
+
include_type: settingsJson.include_type || ['script', 'flow', 'app', 'folder']
|
|
160
|
+
});
|
|
161
|
+
sendUserToast('Successfully pulled workspace content from repository');
|
|
162
|
+
// Reset popover state after successful pull
|
|
163
|
+
previewResult = undefined;
|
|
164
|
+
jobStatus = { id: null, status: undefined, type: 'preview' };
|
|
165
|
+
pullGitRepoPopover?.close();
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
console.warn('No settings_json returned from pull operation');
|
|
169
|
+
sendUserToast('Pull completed but could not update filter settings', true);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
console.error('Failed to pull from repo:', error);
|
|
175
|
+
jobStatus = {
|
|
176
|
+
...jobStatus,
|
|
177
|
+
status: 'failure',
|
|
178
|
+
error: error instanceof Error ? error.message : String(error)
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
finally {
|
|
182
|
+
isPulling = false;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
</script>
|
|
186
|
+
|
|
187
|
+
<Popover
|
|
188
|
+
bind:this={pullGitRepoPopover}
|
|
189
|
+
floatingConfig={{
|
|
190
|
+
placement: 'top-start',
|
|
191
|
+
strategy: 'fixed',
|
|
192
|
+
flip: false,
|
|
193
|
+
shift: true
|
|
194
|
+
}}
|
|
195
|
+
contentClasses="p-4 w-1/3"
|
|
196
|
+
>
|
|
197
|
+
<svelte:fragment slot="trigger">
|
|
198
|
+
<Button
|
|
199
|
+
color="dark"
|
|
200
|
+
size="sm"
|
|
201
|
+
nonCaptureEvent
|
|
202
|
+
onclick={pullGitRepoPopover?.open}
|
|
203
|
+
startIcon={{ icon: DownloadCloud }}
|
|
204
|
+
>
|
|
205
|
+
Pull workspace from Git repo
|
|
206
|
+
</Button>
|
|
207
|
+
</svelte:fragment>
|
|
208
|
+
|
|
209
|
+
<svelte:fragment slot="content" let:close>
|
|
210
|
+
<div class="flex flex-col gap-4">
|
|
211
|
+
<div class="flex flex-col gap-2">
|
|
212
|
+
<h3 class="text-lg font-semibold">Pull workspace from Git repository</h3>
|
|
213
|
+
<div class="prose max-w-none text-2xs text-tertiary">
|
|
214
|
+
This action will pull all workspace objects from your Git repository according to the
|
|
215
|
+
filters set in the Git repository wmill.yaml file and apply those filter settings to the
|
|
216
|
+
workspace.
|
|
217
|
+
<span class="text-orange-600 flex items-center gap-1">
|
|
218
|
+
<AlertTriangle size={14} /> This will overwrite your current workspace content and Git sync
|
|
219
|
+
filter settings with the content from the Git repository.
|
|
220
|
+
</span>
|
|
221
|
+
|
|
222
|
+
<!-- Collapsible CLI Info Section -->
|
|
223
|
+
<div class="mt-2 border rounded-md">
|
|
224
|
+
<button
|
|
225
|
+
class="w-full flex items-center justify-between p-1.5 bg-surface-secondary hover:bg-surface-hover"
|
|
226
|
+
onclick={() => (isCliInfoExpanded = !isCliInfoExpanded)}
|
|
227
|
+
>
|
|
228
|
+
<span class="font-medium flex items-center gap-2">
|
|
229
|
+
<Terminal size={14} />
|
|
230
|
+
Windmill CLI to push local files to Windmill
|
|
231
|
+
</span>
|
|
232
|
+
{#if isCliInfoExpanded}
|
|
233
|
+
<ChevronUp size={16} />
|
|
234
|
+
{:else}
|
|
235
|
+
<ChevronDown size={16} />
|
|
236
|
+
{/if}
|
|
237
|
+
</button>
|
|
238
|
+
|
|
239
|
+
{#if isCliInfoExpanded}
|
|
240
|
+
<div class="p-1 bg-surface-tertiary">
|
|
241
|
+
<div class="text-2xs mb-2">
|
|
242
|
+
Not familiar with Windmill CLI? <a
|
|
243
|
+
href="https://www.windmill.dev/docs/advanced/cli/sync"
|
|
244
|
+
class="text-blue-500 hover:text-blue-600 underline"
|
|
245
|
+
target="_blank"
|
|
246
|
+
rel="noopener noreferrer">Check out the docs</a
|
|
247
|
+
>
|
|
248
|
+
</div>
|
|
249
|
+
<div class="font-mono text-2xs">
|
|
250
|
+
<pre class="overflow-auto max-h-60"
|
|
251
|
+
><code
|
|
252
|
+
>npm install -g windmill-cli
|
|
253
|
+
# Clone your git repository
|
|
254
|
+
git clone $REPO_URL
|
|
255
|
+
cd $REPO_NAME
|
|
256
|
+
# Configure Windmill CLI
|
|
257
|
+
wmill workspace add {$workspaceStore} {$workspaceStore} {`${$page.url.protocol}//${$page.url.hostname}/`}
|
|
258
|
+
# Push the content to Windmill
|
|
259
|
+
wmill sync push --yes
|
|
260
|
+
# Optional: add --skip-secrets --skip-variables --skip-resources flags as needed</code
|
|
261
|
+
></pre
|
|
262
|
+
>
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
{/if}
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
</div>
|
|
269
|
+
|
|
270
|
+
{#if previewResult}
|
|
271
|
+
<GitDiffPreview {previewResult} />
|
|
272
|
+
{/if}
|
|
273
|
+
|
|
274
|
+
{#if jobStatus.id}
|
|
275
|
+
<div class="flex items-center gap-2 text-xs text-tertiary">
|
|
276
|
+
{#if jobStatus.status === 'running'}
|
|
277
|
+
<Loader2 class="animate-spin" size={14} />
|
|
278
|
+
{:else if jobStatus.status === 'success'}
|
|
279
|
+
<CheckCircle2 size={14} class="text-green-600" />
|
|
280
|
+
{:else if jobStatus.status === 'failure'}
|
|
281
|
+
<XCircle size={14} class="text-red-700" />
|
|
282
|
+
{/if}
|
|
283
|
+
{jobStatus.type === 'preview' ? 'Preview' : 'Pull'} job:
|
|
284
|
+
<a
|
|
285
|
+
target="_blank"
|
|
286
|
+
class="underline"
|
|
287
|
+
href={`/run/${jobStatus.id}?workspace=${$workspaceStore}`}
|
|
288
|
+
>
|
|
289
|
+
{jobStatus.id}
|
|
290
|
+
</a>
|
|
291
|
+
</div>
|
|
292
|
+
{#if jobStatus.error}
|
|
293
|
+
<div class="text-xs text-red-600">{jobStatus.error}</div>
|
|
294
|
+
{/if}
|
|
295
|
+
{/if}
|
|
296
|
+
|
|
297
|
+
<div class="flex justify-between items-center mt-4">
|
|
298
|
+
<Button
|
|
299
|
+
color="light"
|
|
300
|
+
size="xs"
|
|
301
|
+
on:click={() => {
|
|
302
|
+
previewResult = undefined
|
|
303
|
+
jobStatus = { id: null, status: undefined, type: 'preview' }
|
|
304
|
+
close()
|
|
305
|
+
}}
|
|
306
|
+
disabled={isPreviewLoading || isPulling}
|
|
307
|
+
>
|
|
308
|
+
Cancel
|
|
309
|
+
</Button>
|
|
310
|
+
<div class="flex gap-2">
|
|
311
|
+
{#if !previewResult}
|
|
312
|
+
<Button
|
|
313
|
+
size="xs"
|
|
314
|
+
on:click={previewChanges}
|
|
315
|
+
disabled={isPreviewLoading || isPulling}
|
|
316
|
+
startIcon={{
|
|
317
|
+
icon: isPreviewLoading ? Loader2 : Eye,
|
|
318
|
+
classes: isPreviewLoading ? 'animate-spin' : ''
|
|
319
|
+
}}
|
|
320
|
+
>
|
|
321
|
+
Preview
|
|
322
|
+
</Button>
|
|
323
|
+
{:else}
|
|
324
|
+
<Button
|
|
325
|
+
size="xs"
|
|
326
|
+
on:click={previewChanges}
|
|
327
|
+
disabled={isPreviewLoading || isPulling}
|
|
328
|
+
startIcon={{
|
|
329
|
+
icon: isPreviewLoading ? Loader2 : Eye,
|
|
330
|
+
classes: isPreviewLoading ? 'animate-spin' : ''
|
|
331
|
+
}}
|
|
332
|
+
title="Preview changes again"
|
|
333
|
+
>
|
|
334
|
+
Preview
|
|
335
|
+
</Button>
|
|
336
|
+
{#if previewResult.added?.length || previewResult.deleted?.length || previewResult.modified?.length}
|
|
337
|
+
<Button
|
|
338
|
+
color="red"
|
|
339
|
+
size="xs"
|
|
340
|
+
on:click={pullFromRepo}
|
|
341
|
+
disabled={isPreviewLoading || isPulling}
|
|
342
|
+
startIcon={{
|
|
343
|
+
icon: isPulling ? Loader2 : Save,
|
|
344
|
+
classes: isPulling ? 'animate-spin' : ''
|
|
345
|
+
}}
|
|
346
|
+
>
|
|
347
|
+
{isPulling ? 'Pulling...' : 'Pull'}
|
|
348
|
+
</Button>
|
|
349
|
+
{/if}
|
|
350
|
+
{/if}
|
|
351
|
+
</div>
|
|
352
|
+
</div>
|
|
353
|
+
</div>
|
|
354
|
+
</svelte:fragment>
|
|
355
|
+
</Popover>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
gitRepoResourcePath: string;
|
|
3
|
+
uiState: {
|
|
4
|
+
include_path: string[];
|
|
5
|
+
exclude_path: string[];
|
|
6
|
+
extra_include_path: string[];
|
|
7
|
+
include_type: string[];
|
|
8
|
+
};
|
|
9
|
+
onFilterUpdate: (filters: {
|
|
10
|
+
include_path: string[];
|
|
11
|
+
exclude_path: string[];
|
|
12
|
+
extra_include_path: string[];
|
|
13
|
+
include_type: string[];
|
|
14
|
+
}) => void;
|
|
15
|
+
};
|
|
16
|
+
declare const PullGitRepoPopover: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
17
|
+
type PullGitRepoPopover = ReturnType<typeof PullGitRepoPopover>;
|
|
18
|
+
export default PullGitRepoPopover;
|
|
@@ -8,10 +8,9 @@ import { offset, flip, shift } from 'svelte-floating-ui/dom';
|
|
|
8
8
|
import Label from './Label.svelte';
|
|
9
9
|
import Tooltip from './Tooltip.svelte';
|
|
10
10
|
import Badge from './common/badge/Badge.svelte';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
let resources = [];
|
|
11
|
+
import { untrack } from 'svelte';
|
|
12
|
+
let { value = $bindable(), notPickable = false, nonePickable = false } = $props();
|
|
13
|
+
let resources = $state([]);
|
|
15
14
|
async function loadResources() {
|
|
16
15
|
resources = await ResourceService.listResourceTypeNames({ workspace: $workspaceStore });
|
|
17
16
|
}
|
|
@@ -20,19 +19,23 @@ function onClick(resource) {
|
|
|
20
19
|
value = resource;
|
|
21
20
|
dispatch('click', resource);
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
$effect(() => {
|
|
23
|
+
if ($workspaceStore) {
|
|
24
|
+
untrack(() => {
|
|
25
|
+
loadResources();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
let search = $state('');
|
|
30
|
+
let filteredResources = $derived(resources.filter((r) => r.toLowerCase().includes(search.toLowerCase())));
|
|
28
31
|
</script>
|
|
29
32
|
|
|
30
33
|
<Label label="Resource type" class="w-full col-span-2">
|
|
31
|
-
|
|
34
|
+
{#snippet header()}
|
|
32
35
|
<Tooltip light small>Select a resource type to narrow down the object type.</Tooltip>
|
|
33
|
-
|
|
36
|
+
{/snippet}
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
{#snippet action()}
|
|
36
39
|
<div class="flex flex-row gap-1">
|
|
37
40
|
<Button
|
|
38
41
|
size="xs"
|
|
@@ -50,10 +53,10 @@ $: filteredResources = resources.filter((r) => r.toLowerCase().includes(search.t
|
|
|
50
53
|
}}
|
|
51
54
|
contentClasses="flex flex-col gap-2 h-full p-4 max-h-[40vh] w-[500px]"
|
|
52
55
|
>
|
|
53
|
-
|
|
56
|
+
{#snippet trigger()}
|
|
54
57
|
<Button nonCaptureEvent size="xs" color="dark">Select resource type</Button>
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
{/snippet}
|
|
59
|
+
{#snippet content({ close })}
|
|
57
60
|
<ClearableInput bind:value={search} placeholder="Search resource..." />
|
|
58
61
|
|
|
59
62
|
<div class="overflow-y-scroll h-full">
|
|
@@ -98,10 +101,10 @@ $: filteredResources = resources.filter((r) => r.toLowerCase().includes(search.t
|
|
|
98
101
|
{/if}
|
|
99
102
|
</div>
|
|
100
103
|
</div>
|
|
101
|
-
|
|
104
|
+
{/snippet}
|
|
102
105
|
</Popover>
|
|
103
106
|
</div>
|
|
104
|
-
|
|
107
|
+
{/snippet}
|
|
105
108
|
<div class="flex flex-row items-center w-full justify-between">
|
|
106
109
|
<Badge color={!value ? 'gray' : 'blue'}>
|
|
107
110
|
{value ?? 'None'}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
value: string | undefined;
|
|
3
|
+
notPickable?: boolean;
|
|
4
|
+
nonePickable?: boolean;
|
|
5
|
+
}
|
|
1
6
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
7
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
8
|
$$bindings?: Bindings;
|
|
@@ -11,14 +16,10 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
11
16
|
};
|
|
12
17
|
z_$$bindings?: Bindings;
|
|
13
18
|
}
|
|
14
|
-
declare const ResourceTypePicker: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
-
value: string | undefined;
|
|
16
|
-
notPickable?: boolean;
|
|
17
|
-
nonePickable?: boolean;
|
|
18
|
-
}, {
|
|
19
|
+
declare const ResourceTypePicker: $$__sveltets_2_IsomorphicComponent<Props, {
|
|
19
20
|
click: CustomEvent<any>;
|
|
20
21
|
} & {
|
|
21
22
|
[evt: string]: CustomEvent<any>;
|
|
22
|
-
}, {}, {},
|
|
23
|
+
}, {}, {}, "value">;
|
|
23
24
|
type ResourceTypePicker = InstanceType<typeof ResourceTypePicker>;
|
|
24
25
|
export default ResourceTypePicker;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
1
|
+
<script lang="ts">import { createBubbler, stopPropagation } from 'svelte/legacy';
|
|
2
2
|
const bubble = createBubbler();
|
|
3
3
|
import { File as FileIcon, FolderClosed, FolderOpen, RotateCw, Loader2, Download, Trash, FileUp, MoveRight } from 'lucide-svelte';
|
|
4
4
|
import { workspaceStore } from '../stores';
|
|
@@ -47,8 +47,9 @@ let filter = $state('');
|
|
|
47
47
|
let timeout = undefined;
|
|
48
48
|
let firstLoad = true;
|
|
49
49
|
let secondaryStorageNames = usePromise(() => SettingService.getSecondaryStorageNames({ workspace: $workspaceStore }), { loadInit: false });
|
|
50
|
+
let wasOpen = $state(false);
|
|
50
51
|
$effect(() => {
|
|
51
|
-
$workspaceStore && untrack(() => secondaryStorageNames.refresh());
|
|
52
|
+
wasOpen && $workspaceStore && untrack(() => secondaryStorageNames.refresh());
|
|
52
53
|
});
|
|
53
54
|
function onFilterChange() {
|
|
54
55
|
if (!firstLoad) {
|
|
@@ -294,6 +295,7 @@ async function moveS3File(srcFileKey, destFileKey) {
|
|
|
294
295
|
}
|
|
295
296
|
let storage = $state(undefined);
|
|
296
297
|
export async function open(_preSelectedFileKey = undefined) {
|
|
298
|
+
wasOpen = true;
|
|
297
299
|
const preSelectedFileKey = _preSelectedFileKey && parseS3Object(_preSelectedFileKey);
|
|
298
300
|
storage = preSelectedFileKey?.storage;
|
|
299
301
|
if (preSelectedFileKey !== undefined) {
|
|
@@ -394,7 +396,7 @@ function selectItem(index, toggleCollapsed = true) {
|
|
|
394
396
|
loadFileMetadataPlusPreviewAsync(selectedFileKey.s3);
|
|
395
397
|
}
|
|
396
398
|
}
|
|
397
|
-
|
|
399
|
+
$effect.pre(() => {
|
|
398
400
|
filter != undefined && untrack(() => onFilterChange());
|
|
399
401
|
});
|
|
400
402
|
</script>
|