windmill-components 1.613.2 → 1.613.4

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.
@@ -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
- import { goto } from '../navigation';
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,7 @@ async function restartFlow(stepId, branchOrIterationN, flowVersion) {
21
20
  flow_version: flowVersion
22
21
  }
23
22
  });
24
- await goto('/run/' + run + '?workspace=' + $workspaceStore);
23
+ onRestartComplete?.(run);
25
24
  }
26
25
  async function loadFlowVersions() {
27
26
  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>;
@@ -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 '../../logout';
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 '../../logout';
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 '../../logout';
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';
@@ -1,3 +1 @@
1
- export declare function logoutWithRedirect(rd?: string): Promise<void>;
2
- export declare function logout(): Promise<void>;
3
1
  export declare function clearUser(): Promise<void>;
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
- import { sendUserToast } from './toast';
5
- export async function logoutWithRedirect(rd) {
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,2 @@
1
+ export declare function logoutWithRedirect(rd?: string): Promise<void>;
2
+ export declare function logout(): Promise<void>;
@@ -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
+ }
@@ -1,2 +1,2 @@
1
- export declare function goto(path: any, options?: {}): any;
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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-components",
3
- "version": "1.613.2",
3
+ "version": "1.613.4",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build",