Skip to content

Commit 0c3df08

Browse files
committed
Fix test
1 parent 53911d5 commit 0c3df08

File tree

15 files changed

+74
-50
lines changed

15 files changed

+74
-50
lines changed

web-admin/src/features/alerts/selectors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
createRuntimeServiceListResources,
1010
type V1AlertSpec,
1111
} from "@rilldata/web-common/runtime-client";
12-
import { smartRefetchInterval } from "@rilldata/web-admin/lib/refetch-interval-store";
12+
import { smartRefetchIntervalFunc } from "@rilldata/web-admin/lib/refetch-interval-store";
1313
import { derived, type Readable, readable } from "svelte/store";
1414

1515
export function useAlerts(instanceId: string, enabled = true) {
@@ -22,7 +22,7 @@ export function useAlerts(instanceId: string, enabled = true) {
2222
query: {
2323
enabled: enabled && !!instanceId,
2424
refetchOnMount: true,
25-
refetchInterval: smartRefetchInterval,
25+
refetchInterval: smartRefetchIntervalFunc,
2626
},
2727
},
2828
);

web-admin/src/features/dashboards/listing/deploying-dashboards.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import {
55
type V1Resource,
66
} from "@rilldata/web-common/runtime-client";
77
import type { CreateQueryResult } from "@tanstack/svelte-query";
8-
import { isResourceReconciling } from "@rilldata/web-admin/lib/refetch-interval-store.ts";
8+
import {
9+
isResourceReconciling,
10+
smartRefetchIntervalFunc,
11+
} from "@rilldata/web-admin/lib/refetch-interval-store.ts";
912

1013
export function useDeployingDashboards(
1114
instanceId: string,
@@ -72,6 +75,7 @@ export function useDeployingDashboards(
7275
dashboardsErrored: false,
7376
};
7477
},
78+
refetchInterval: smartRefetchIntervalFunc,
7579
},
7680
});
7781
}
@@ -108,10 +112,6 @@ function isDashboard(res: V1Resource) {
108112
return res.canvas || res.explore;
109113
}
110114

111-
function isValidDashboard(res: V1Resource) {
112-
return Boolean(res.canvas?.state?.validSpec || res.explore?.state?.validSpec);
113-
}
114-
115115
function hasErrored(res: V1Resource) {
116116
return (
117117
res.meta?.reconcileStatus === V1ReconcileStatus.RECONCILE_STATUS_IDLE &&

web-admin/src/features/dashboards/listing/selectors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { V1Resource } from "@rilldata/web-common/runtime-client";
44
import { createRuntimeServiceListResources } from "@rilldata/web-common/runtime-client";
55
import type { CreateQueryResult } from "@tanstack/svelte-query";
66
import { derived } from "svelte/store";
7-
import { smartRefetchInterval } from "@rilldata/web-admin/lib/refetch-interval-store";
7+
import { smartRefetchIntervalFunc } from "@rilldata/web-admin/lib/refetch-interval-store";
88

99
export function useDashboardsLastUpdated(
1010
instanceId: string,
@@ -42,7 +42,7 @@ export function useDashboards(
4242
select: (data) => {
4343
return data.resources.filter((res) => res.canvas || res.explore);
4444
},
45-
refetchInterval: smartRefetchInterval,
45+
refetchInterval: smartRefetchIntervalFunc,
4646
},
4747
});
4848
}

web-admin/src/features/projects/status/selectors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
type V1ListResourcesResponse,
88
} from "@rilldata/web-common/runtime-client";
99
import { ResourceKind } from "@rilldata/web-common/features/entity-management/resource-selectors";
10-
import { smartRefetchInterval } from "@rilldata/web-admin/lib/refetch-interval-store";
10+
import { smartRefetchIntervalFunc } from "@rilldata/web-admin/lib/refetch-interval-store";
1111

1212
export function useProjectDeployment(orgName: string, projName: string) {
1313
return createAdminServiceGetProject<V1Deployment | undefined>(
@@ -42,7 +42,7 @@ export function useResources(instanceId: string) {
4242
resources: filtered,
4343
};
4444
},
45-
refetchInterval: smartRefetchInterval,
45+
refetchInterval: smartRefetchIntervalFunc,
4646
},
4747
},
4848
);

web-admin/src/features/scheduled-reports/selectors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
createRuntimeServiceGetResource,
66
createRuntimeServiceListResources,
77
} from "@rilldata/web-common/runtime-client";
8-
import { smartRefetchInterval } from "@rilldata/web-admin/lib/refetch-interval-store";
8+
import { smartRefetchIntervalFunc } from "@rilldata/web-admin/lib/refetch-interval-store";
99

1010
export function useReports(instanceId: string, enabled = true) {
1111
return createRuntimeServiceListResources(
@@ -17,7 +17,7 @@ export function useReports(instanceId: string, enabled = true) {
1717
query: {
1818
enabled: enabled && !!instanceId,
1919
refetchOnMount: true,
20-
refetchInterval: smartRefetchInterval,
20+
refetchInterval: smartRefetchIntervalFunc,
2121
},
2222
},
2323
);

web-admin/src/lib/refetch-interval-store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ const queryRefetchStateMap = new WeakMap<
6464
>();
6565

6666
/**
67-
* Creates a smart refetch interval function that uses a WeakMap to store state.
67+
* A smart refetch interval function that uses a WeakMap to store state.
6868
* This approach keeps refetch state per query without mutating the query object.
6969
*
7070
* @param query The TanStack query object
7171
* @returns The refetch interval (number in ms or false to disable)
7272
*/
73-
export function smartRefetchInterval(
73+
export function smartRefetchIntervalFunc(
7474
query: Query<
7575
V1ListResourcesResponse,
7676
HTTPError,

web-admin/src/routes/[organization]/[project]/-/invite/+page.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
function getDeployLandingPage() {
7070
const u = new URL($page.url);
7171
u.pathname = `/${organization}/${project}/-/deploy-landing-page`;
72+
console.log("Redirecting to deploy landing page: ", u.toString());
7273
return u.toString();
7374
}
7475
</script>

web-common/src/features/dashboards/workspace/DeployProjectCTA.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
$: redirectPageUrl = copyWithAdditionalArguments($page.url, {
6767
deploy: "true",
6868
});
69+
$: console.log("Deploy route:", $deployPageUrl);
6970
7071
async function onDeploy(resumingDeploy = false) {
7172
await waitUntil(() => !get(deploymentState).loading);

web-common/src/features/entity-management/file-artifacts.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import {
88
type V1ResourceName,
99
} from "@rilldata/web-common/runtime-client";
1010
import type { QueryClient } from "@tanstack/svelte-query";
11-
import { derived, get, writable } from "svelte/store";
11+
import { derived, get, writable, type Readable } from "svelte/store";
1212
import { FileArtifact } from "./file-artifact";
13+
import { page } from "$app/stores";
1314

1415
class UnsavedFilesStore {
1516
private unsavedFiles = writable(new Set<string>());
@@ -171,6 +172,14 @@ export class FileArtifacts {
171172
}
172173
return null;
173174
}
175+
176+
public createCurrentResourceStore(): Readable<V1ResourceName | undefined> {
177+
return derived(page, (pageState, set) => {
178+
const filePath = pageState.url.pathname.replace("/files", "");
179+
const fileArtifact = this.getFileArtifact(filePath);
180+
return fileArtifact.resourceName.subscribe(set);
181+
});
182+
}
174183
}
175184

176185
export const fileArtifacts = new FileArtifacts();

web-common/src/features/project/deploy/UpdateProjectPopup.svelte

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import { getManageProjectAccess } from "@rilldata/web-common/features/project/selectors.ts";
1010
import type { Project } from "@rilldata/web-common/proto/gen/rill/admin/v1/api_pb";
1111
import Rocket from "svelte-radix/Rocket.svelte";
12+
import { fileArtifacts } from "@rilldata/web-common/features/entity-management/file-artifacts.ts";
1213
1314
export let open = false;
1415
export let matchingProjects: Project[];
@@ -22,9 +23,11 @@
2223
2324
$: enableUpdate = !!selectedProject;
2425
26+
const currentResource = fileArtifacts.createCurrentResourceStore();
2527
$: deployUrl = selectedProject
2628
? getUpdateProjectRoute(
2729
$page,
30+
$currentResource,
2831
selectedProject.orgName,
2932
selectedProject.name,
3033
)

0 commit comments

Comments
 (0)