windmill-components 1.613.1 → 1.613.3
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/components/FlowRestartButton.svelte +9 -3
- package/package/components/FlowRestartButton.svelte.d.ts +3 -0
- package/package/components/RunsPage.svelte +2 -1
- package/package/components/sidebar/OperatorMenu.svelte +1 -1
- package/package/components/sidebar/UserMenu.svelte +1 -1
- package/package/components/workspaceSettings/CreateWorkspace.svelte +1 -1
- package/package/logout.d.ts +0 -2
- package/package/logout.js +2 -23
- package/package/logoutKit.d.ts +2 -0
- package/package/logoutKit.js +26 -0
- package/package/navigation.d.ts +1 -1
- package/package/svelte5Utils.svelte.d.ts +1 -4
- package/package/svelte5Utils.svelte.js +0 -29
- package/package/svelte5UtilsKit.svelte.d.ts +3 -0
- package/package/svelte5UtilsKit.svelte.js +30 -0
- package/package.json +1 -1
|
@@ -4,8 +4,7 @@ import { Play, RefreshCw } from 'lucide-svelte';
|
|
|
4
4
|
import { FlowService, JobService } from '../gen';
|
|
5
5
|
import { workspaceStore } from '../stores';
|
|
6
6
|
import { emptyString, sendUserToast } from '../utils';
|
|
7
|
-
|
|
8
|
-
let { jobId, selectedJobStep, selectedJobStepType, restartBranchNames = [], flowPath = undefined, disabled = false, enterpriseOnly = false, variant = 'default', unifiedSize = 'md', onRestart } = $props();
|
|
7
|
+
let { jobId, selectedJobStep, selectedJobStepType, restartBranchNames = [], flowPath = undefined, disabled = false, enterpriseOnly = false, variant = 'default', unifiedSize = 'md', onRestart, onRestartComplete } = $props();
|
|
9
8
|
let branchOrIterationN = $state(0);
|
|
10
9
|
let selectedVersionMode = $state('run');
|
|
11
10
|
let customFlowVersion = $state(undefined);
|
|
@@ -21,7 +20,14 @@ async function restartFlow(stepId, branchOrIterationN, flowVersion) {
|
|
|
21
20
|
flow_version: flowVersion
|
|
22
21
|
}
|
|
23
22
|
});
|
|
24
|
-
|
|
23
|
+
if (onRestartComplete) {
|
|
24
|
+
onRestartComplete(run);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
// Lazy load navigation for SvelteKit contexts
|
|
28
|
+
const { goto } = await import('../navigation');
|
|
29
|
+
await goto('/run/' + run + '?workspace=' + $workspaceStore);
|
|
30
|
+
}
|
|
25
31
|
}
|
|
26
32
|
async function loadFlowVersions() {
|
|
27
33
|
if (!flowPath || loadingVersions)
|
|
@@ -8,7 +8,10 @@ interface Props {
|
|
|
8
8
|
enterpriseOnly?: boolean;
|
|
9
9
|
variant?: 'default' | 'accent';
|
|
10
10
|
unifiedSize?: 'xs' | 'sm' | 'md' | 'lg';
|
|
11
|
+
/** Called when flow is restarted. If not provided, will navigate to the new run using goto (requires SvelteKit) */
|
|
11
12
|
onRestart?: (stepId: string, branchOrIterationN: number, flowVersion?: number) => void;
|
|
13
|
+
/** Called when flow restart completes with the new job ID. Used for navigation in non-SvelteKit contexts */
|
|
14
|
+
onRestartComplete?: (newJobId: string) => void;
|
|
12
15
|
}
|
|
13
16
|
declare const FlowRestartButton: import("svelte").Component<Props, {}, "">;
|
|
14
17
|
type FlowRestartButton = ReturnType<typeof FlowRestartButton>;
|
|
@@ -30,7 +30,8 @@ import ToggleButtonGroup from './common/toggleButton-v2/ToggleButtonGroup.svelte
|
|
|
30
30
|
import ToggleButton from './common/toggleButton-v2/ToggleButton.svelte';
|
|
31
31
|
import Select from './select/Select.svelte';
|
|
32
32
|
import AnimatedPane from './splitPanes/AnimatedPane.svelte';
|
|
33
|
-
import { useSearchParams
|
|
33
|
+
import { useSearchParams } from '../svelte5UtilsKit.svelte';
|
|
34
|
+
import { StaleWhileLoading } from '../svelte5Utils.svelte';
|
|
34
35
|
let { initialPath } = $props();
|
|
35
36
|
let filters = useSearchParams(runsFiltersSchema);
|
|
36
37
|
// Initialize path filter from route param if provided and not already set via query params
|
|
@@ -4,7 +4,7 @@ import MultiplayerMenu from './MultiplayerMenu.svelte';
|
|
|
4
4
|
import { clearWorkspaceFromStorage, enterpriseLicense, superadmin, userWorkspaces, workspaceStore, tutorialsToDo, skippedAll } from '../../stores';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
6
|
import { USER_SETTINGS_HASH } from './settings';
|
|
7
|
-
import { logout } from '../../
|
|
7
|
+
import { logout } from '../../logoutKit';
|
|
8
8
|
import DarkModeObserver from '../DarkModeObserver.svelte';
|
|
9
9
|
import BarsStaggered from '../icons/BarsStaggered.svelte';
|
|
10
10
|
import { Menu, Menubar, MenuItem } from '../meltComponents';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">import { goto } from '../../navigation';
|
|
2
|
-
import { logout } from '../../
|
|
2
|
+
import { logout } from '../../logoutKit';
|
|
3
3
|
import { userStore, usageStore, workspaceUsageStore, isPremiumStore, workspaceStore } from '../../stores';
|
|
4
4
|
import { USER_SETTINGS_HASH } from './settings';
|
|
5
5
|
import { isCloudHosted } from '../../cloud';
|
|
@@ -3,7 +3,7 @@ import { goto } from '../../navigation';
|
|
|
3
3
|
import { base } from '../../base';
|
|
4
4
|
import { JobService, ResourceService, SettingService, UserService, VariableService, WorkspaceService } from '../../gen';
|
|
5
5
|
import { validateUsername } from '../../utils';
|
|
6
|
-
import { logoutWithRedirect } from '../../
|
|
6
|
+
import { logoutWithRedirect } from '../../logoutKit';
|
|
7
7
|
import { page } from '$app/stores';
|
|
8
8
|
import { usersWorkspaceStore, workspaceStore } from '../../stores';
|
|
9
9
|
import CenteredModal from '../CenteredModal.svelte';
|
package/package/logout.d.ts
CHANGED
package/package/logout.js
CHANGED
|
@@ -1,28 +1,7 @@
|
|
|
1
|
-
import { goto } from './navigation';
|
|
2
1
|
import { UserService } from './gen';
|
|
3
2
|
import { clearStores } from './storeUtils';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
console.log('logoutWithRedirect', rd);
|
|
7
|
-
await clearUser();
|
|
8
|
-
const splitted = rd?.split('?')[0];
|
|
9
|
-
if (rd && rd != '/' && splitted != '/user/login' && splitted != '/user/logout') {
|
|
10
|
-
const error = document.cookie.includes('token')
|
|
11
|
-
? `error=${encodeURIComponent('You have been logged out because your session has expired.')}&`
|
|
12
|
-
: '';
|
|
13
|
-
console.log('login redirect with error', error, rd);
|
|
14
|
-
goto(`/user/login?${error}${rd ? 'rd=' + encodeURIComponent(rd) : ''}`, { replaceState: true });
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
console.log('login redirect vanilla');
|
|
18
|
-
goto('/user/login', { replaceState: true });
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export async function logout() {
|
|
22
|
-
await clearUser();
|
|
23
|
-
goto(`/user/login`);
|
|
24
|
-
sendUserToast('you have been logged out');
|
|
25
|
-
}
|
|
3
|
+
// Note: logout and logoutWithRedirect have been moved to logoutKit.ts
|
|
4
|
+
// as they depend on SvelteKit navigation
|
|
26
5
|
export async function clearUser() {
|
|
27
6
|
try {
|
|
28
7
|
clearStores();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// SvelteKit-specific logout utilities
|
|
2
|
+
// These functions depend on $lib/navigation which requires SvelteKit
|
|
3
|
+
import { goto } from './navigation';
|
|
4
|
+
import { clearUser } from './logout';
|
|
5
|
+
import { sendUserToast } from './toast';
|
|
6
|
+
export async function logoutWithRedirect(rd) {
|
|
7
|
+
console.log('logoutWithRedirect', rd);
|
|
8
|
+
await clearUser();
|
|
9
|
+
const splitted = rd?.split('?')[0];
|
|
10
|
+
if (rd && rd != '/' && splitted != '/user/login' && splitted != '/user/logout') {
|
|
11
|
+
const error = document.cookie.includes('token')
|
|
12
|
+
? `error=${encodeURIComponent('You have been logged out because your session has expired.')}&`
|
|
13
|
+
: '';
|
|
14
|
+
console.log('login redirect with error', error, rd);
|
|
15
|
+
goto(`/user/login?${error}${rd ? 'rd=' + encodeURIComponent(rd) : ''}`, { replaceState: true });
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
console.log('login redirect vanilla');
|
|
19
|
+
goto('/user/login', { replaceState: true });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export async function logout() {
|
|
23
|
+
await clearUser();
|
|
24
|
+
goto(`/user/login`);
|
|
25
|
+
sendUserToast('you have been logged out');
|
|
26
|
+
}
|
package/package/navigation.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function goto(path:
|
|
1
|
+
export declare function goto(path: string, options?: {}): any;
|
|
2
2
|
export declare function setQuery(url: URL, key: string, value: string | undefined, currentHash?: string | undefined): Promise<void>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as runed from 'runed/kit';
|
|
3
|
-
import type z from 'zod';
|
|
1
|
+
import type { StateStore } from './utils';
|
|
4
2
|
export declare function withProps<Component, Props>(component: Component, props: Props): {
|
|
5
3
|
component: Component;
|
|
6
4
|
props: Props;
|
|
@@ -71,7 +69,6 @@ export declare class ChangeOnDeepInequality<T> {
|
|
|
71
69
|
constructor(compute: () => T);
|
|
72
70
|
get value(): T;
|
|
73
71
|
}
|
|
74
|
-
export declare function useSearchParams<S extends z.ZodType>(schema: S, options?: runed.SearchParamsOptions): runed.ReturnUseSearchParams<S>;
|
|
75
72
|
export declare class StaleWhileLoading<T> {
|
|
76
73
|
private _current;
|
|
77
74
|
private _currentTimeout;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
// https://github.com/sveltejs/svelte/issues/14600
|
|
2
2
|
import { untrack } from 'svelte';
|
|
3
3
|
import { deepEqual } from 'fast-equals';
|
|
4
|
-
import {} from './utils';
|
|
5
4
|
import { resource, watch } from 'runed';
|
|
6
|
-
import * as runed from 'runed/kit';
|
|
7
5
|
export function withProps(component, props) {
|
|
8
6
|
const ret = $state({
|
|
9
7
|
component,
|
|
@@ -148,33 +146,6 @@ export class ChangeOnDeepInequality {
|
|
|
148
146
|
return this._cached;
|
|
149
147
|
}
|
|
150
148
|
}
|
|
151
|
-
// The original from runed has a weird behavior with dedup reads causing duplicate effect runs
|
|
152
|
-
// (Every field has to be derived to avoid it : https://runed.dev/docs/utilities/use-search-params)
|
|
153
|
-
export function useSearchParams(schema, options) {
|
|
154
|
-
let params = runed.useSearchParams(schema, options);
|
|
155
|
-
let keys = Object.keys(schema.shape ?? {});
|
|
156
|
-
let obj = { ...params };
|
|
157
|
-
for (const key of keys) {
|
|
158
|
-
// Somehow using $derived does not trigger reactivity sometimes ...
|
|
159
|
-
// (e.g: filters.arg in RunsPage.svelte updates in the URL but does not trigger reactivity)
|
|
160
|
-
let derivedVal = $state(params[key]);
|
|
161
|
-
Object.defineProperty(obj, key, {
|
|
162
|
-
get: () => {
|
|
163
|
-
if (typeof derivedVal === 'string')
|
|
164
|
-
return decodeURIComponent(derivedVal);
|
|
165
|
-
return derivedVal;
|
|
166
|
-
},
|
|
167
|
-
set: (v) => {
|
|
168
|
-
const val = typeof v === 'string' ? encodeURIComponent(v) : v;
|
|
169
|
-
params[key] = val;
|
|
170
|
-
derivedVal = val;
|
|
171
|
-
},
|
|
172
|
-
enumerable: true,
|
|
173
|
-
configurable: true
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
return obj;
|
|
177
|
-
}
|
|
178
149
|
// Prevents flickering when data is unloaded (undefined) then reloaded quickly
|
|
179
150
|
// But still becomes undefined if data is not reloaded within the timeout
|
|
180
151
|
// so the user has feedback that the data is not available anymore.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// SvelteKit-specific utilities
|
|
2
|
+
// This file should only be imported in SvelteKit apps as it depends on $app/environment
|
|
3
|
+
import * as runed from 'runed/kit';
|
|
4
|
+
// The original from runed has a weird behavior with dedup reads causing duplicate effect runs
|
|
5
|
+
// (Every field has to be derived to avoid it : https://runed.dev/docs/utilities/use-search-params)
|
|
6
|
+
export function useSearchParams(schema, options) {
|
|
7
|
+
let params = runed.useSearchParams(schema, options);
|
|
8
|
+
let keys = Object.keys(schema.shape ?? {});
|
|
9
|
+
let obj = { ...params };
|
|
10
|
+
for (const key of keys) {
|
|
11
|
+
// Somehow using $derived does not trigger reactivity sometimes ...
|
|
12
|
+
// (e.g: filters.arg in RunsPage.svelte updates in the URL but does not trigger reactivity)
|
|
13
|
+
let derivedVal = $state(params[key]);
|
|
14
|
+
Object.defineProperty(obj, key, {
|
|
15
|
+
get: () => {
|
|
16
|
+
if (typeof derivedVal === 'string')
|
|
17
|
+
return decodeURIComponent(derivedVal);
|
|
18
|
+
return derivedVal;
|
|
19
|
+
},
|
|
20
|
+
set: (v) => {
|
|
21
|
+
const val = typeof v === 'string' ? encodeURIComponent(v) : v;
|
|
22
|
+
params[key] = val;
|
|
23
|
+
derivedVal = val;
|
|
24
|
+
},
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return obj;
|
|
30
|
+
}
|