Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
300 changes: 102 additions & 198 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web-admin/src/client/gen/default/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ import type {
V1UpdateUserPreferencesResponse,
} from "../index.schemas";

import { httpClient } from "../../http-client";
import httpClient from "../../http-client";

type AwaitedInput<T> = PromiseLike<T> | T;

Expand Down
4 changes: 1 addition & 3 deletions web-admin/src/features/alerts/CreateAlert.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import AlertForm from "@rilldata/web-common/features/alerts/AlertForm.svelte";
import { useMetricsViewValidSpec } from "@rilldata/web-common/features/dashboards/selectors";
import { getStateManagers } from "@rilldata/web-common/features/dashboards/state-managers/state-managers";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import { BellPlusIcon } from "lucide-svelte";

const {
instanceId,
selectors: {
timeRangeSelectors: { isCustomTimeRange },
},
Expand All @@ -22,8 +22,6 @@
dashboardStore,
} = getStateManagers();

$: ({ instanceId } = $runtime);

$: metricsView = useMetricsViewValidSpec(instanceId, $metricsViewName);
$: hasTimeDimension = !!$metricsView?.data?.timeDimension;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import { useAlert } from "@rilldata/web-admin/features/alerts/selectors";
import ResourceList from "@rilldata/web-admin/features/resources/ResourceList.svelte";
import type { V1AlertExecution } from "@rilldata/web-common/runtime-client";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import httpClient from "@rilldata/web-common/runtime-client/http-client";
import type { ColumnDef } from "@tanstack/svelte-table";
import { flexRender } from "@tanstack/svelte-table";

export let alert: string;

$: ({ instanceId } = $runtime);
const instanceId = httpClient.getInstanceId();

$: alertQuery = useAlert(instanceId, alert);

Expand Down
5 changes: 3 additions & 2 deletions web-admin/src/features/alerts/metadata/AlertFilters.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
V1Expression,
V1TimeRange,
} from "@rilldata/web-common/runtime-client";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import httpClient from "@rilldata/web-common/runtime-client/http-client";
import { flip } from "svelte/animate";
import { fly } from "svelte/transition";

const instanceId = httpClient.getInstanceId();

export let metricsViewName: string;
export let filters: V1Expression | undefined;
export let dimensionsWithInlistFilter: string[];
Expand All @@ -36,7 +38,6 @@
whereFilter = dimensionFilters;
havingFilter = dimensionThresholdFilters;
}
$: ({ instanceId } = $runtime);

$: metricsView = useMetricsView(instanceId, metricsViewName);
$: dimensionIdMap = getMapFromArray(
Expand Down
4 changes: 2 additions & 2 deletions web-admin/src/features/alerts/metadata/AlertMetadata.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
getRuntimeServiceListResourcesQueryKey,
type V1MetricsViewAggregationRequest,
} from "@rilldata/web-common/runtime-client";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import httpClient from "@rilldata/web-common/runtime-client/http-client";
import { useQueryClient } from "@tanstack/svelte-query";

export let organization: string;
export let project: string;
export let alert: string;

$: ({ instanceId } = $runtime);
const instanceId = httpClient.getInstanceId();

$: alertQuery = useAlert(instanceId, alert);
$: isAlertCreatedByCode = useIsAlertCreatedByCode(instanceId, alert);
Expand Down
4 changes: 2 additions & 2 deletions web-admin/src/features/bookmarks/BookmarksFormDialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import { createForm } from "svelte-forms-lib";
import * as yup from "yup";
import type { Interval } from "luxon";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import httpClient from "@rilldata/web-common/runtime-client/http-client";
import { getCanvasStore } from "@rilldata/web-common/features/canvas/state-managers/state-managers";
import CanvasFilterChipsReadOnly from "@rilldata/web-common/features/dashboards/filters/CanvasFilterChipsReadOnly.svelte";

Expand All @@ -53,7 +53,7 @@
let filterState: undefined | Awaited<ReturnType<typeof processUrl>> =
undefined;

$: ({ instanceId } = $runtime);
const instanceId = httpClient.getInstanceId();

$: ({ name: resourceName, kind: resourceKind } = resource);

Expand Down
4 changes: 2 additions & 2 deletions web-admin/src/features/bookmarks/CanvasBookmarks.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import { getCanvasCategorisedBookmarks } from "@rilldata/web-admin/features/bookmarks/selectors.ts";
import { useCanvas } from "@rilldata/web-common/features/canvas/selector";
import { ResourceKind } from "@rilldata/web-common/features/entity-management/resource-selectors.ts";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store.ts";
import httpClient from "@rilldata/web-common/runtime-client/http-client";
import { writable } from "svelte/store";

export let organization: string;
export let project: string;
export let canvasName: string;

$: ({ instanceId } = $runtime);
const instanceId = httpClient.getInstanceId();

const orgAndProjectNameStore = writable({ organization, project });
$: orgAndProjectNameStore.set({ organization, project });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { resourceColorMapping } from "@rilldata/web-common/features/entity-management/resource-icon-mapping";
import { ResourceKind } from "@rilldata/web-common/features/entity-management/resource-selectors";
import type { V1Resource } from "@rilldata/web-common/runtime-client";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import httpClient from "@rilldata/web-common/runtime-client/http-client";
import { flexRender } from "@tanstack/svelte-table";
import DashboardsTableCompositeCell from "./DashboardsTableCompositeCell.svelte";
import { useDashboards } from "./selectors";
Expand All @@ -19,7 +19,7 @@

const exploreColor = resourceColorMapping[ResourceKind.Explore];

$: ({ instanceId } = $runtime);
const instanceId = httpClient.getInstanceId();
$: ({
params: { organization, project },
} = $page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import Tooltip from "@rilldata/web-common/components/tooltip/Tooltip.svelte";
import TooltipContent from "@rilldata/web-common/components/tooltip/TooltipContent.svelte";
import { createRuntimeServiceGetExplore } from "@rilldata/web-common/runtime-client";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import httpClient from "@rilldata/web-common/runtime-client/http-client";
import { timeAgo } from "./utils";

export let dashboard: string;

$: ({ instanceId } = $runtime);
const instanceId = httpClient.getInstanceId();

$: lastRefreshedQuery = createRuntimeServiceGetExplore(
instanceId,
Expand Down
1 change: 1 addition & 0 deletions web-admin/src/features/dashboards/listing/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export function useDashboards(
select: (data) => {
return data.resources.filter((res) => res.canvas || res.explore);
},
enabled: !!instanceId,
refetchInterval: createSmartRefetchInterval,
},
});
Expand Down
4 changes: 2 additions & 2 deletions web-admin/src/features/navigation/TopNavigationBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import StateManagersProvider from "@rilldata/web-common/features/dashboards/state-managers/StateManagersProvider.svelte";
import { useExplore } from "@rilldata/web-common/features/explores/selectors";
import { featureFlags } from "@rilldata/web-common/features/feature-flags";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import httpClient from "@rilldata/web-common/runtime-client/http-client";
import {
createAdminServiceGetCurrentUser,
createAdminServiceListOrganizations as listOrgs,
Expand Down Expand Up @@ -49,7 +49,7 @@
const user = createAdminServiceGetCurrentUser();
const { alerts: alertsFlag, dimensionSearch, dashboardChat } = featureFlags;

$: ({ instanceId } = $runtime);
const instanceId = httpClient.getInstanceId();

// These can be undefined
$: ({
Expand Down
14 changes: 11 additions & 3 deletions web-admin/src/features/organizations/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import type { FetchQueryOptions } from "@tanstack/query-core";
export function areAllProjectsHibernating(organization: string) {
return createAdminServiceListProjectsForOrganization(
organization,
undefined,
{
pageSize: 100,
},
{
query: {
enabled: !!organization,
Expand All @@ -26,8 +28,14 @@ export function areAllProjectsHibernating(organization: string) {

export async function fetchAllProjectsHibernating(organization: string) {
const projectsResp = await queryClient.fetchQuery({
queryKey: getAdminServiceListProjectsForOrganizationQueryKey(organization),
queryFn: () => adminServiceListProjectsForOrganization(organization),
queryKey: getAdminServiceListProjectsForOrganizationQueryKey(organization, {
pageSize: 100,
}),
queryFn: () =>
adminServiceListProjectsForOrganization(organization, {
pageSize: 100,
}),

staleTime: Infinity,
});
return projectsResp.projects?.every((p) => !p.primaryDeploymentId) ?? false;
Expand Down
4 changes: 2 additions & 2 deletions web-admin/src/features/projects/download-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import {
createQueryServiceExportReport,
type RpcStatus,
} from "@rilldata/web-common/runtime-client";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import {
createMutation,
type CreateMutationOptions,
} from "@tanstack/svelte-query";
import type { MutationFunction } from "@tanstack/svelte-query";
import { get } from "svelte/store";
import httpClient from "@rilldata/web-common/runtime-client/http-client";

export type DownloadReportRequest = {
instanceId: string;
Expand Down Expand Up @@ -48,7 +48,7 @@ export function createDownloadReportMutation<
originBaseUrl: data.originBaseUrl,
},
});
const downloadUrl = `${get(runtime).host}${exportResp.downloadUrlPath}`;
const downloadUrl = `${httpClient.getHost()}${exportResp.downloadUrlPath}`;
window.open(downloadUrl, "_self");
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
getRepoNameFromGitRemote,
getGitUrlFromRemote,
} from "@rilldata/web-common/features/project/deploy/github-utils";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import httpClient from "@rilldata/web-common/runtime-client/http-client";

export let organization: string;
export let project: string;

$: ({ instanceId } = $runtime);
const instanceId = httpClient.getInstanceId();

$: proj = createAdminServiceGetProject(organization, project);
$: ({
Expand Down
14 changes: 1 addition & 13 deletions web-admin/src/features/projects/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
useResourceV2,
} from "@rilldata/web-common/features/entity-management/resource-selectors";
import { queryClient } from "@rilldata/web-common/lib/svelte-query/globalQueryClient";
import type { Runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import { derived, type Readable } from "svelte/store";

export function getProjectPermissions(orgName: string, projName: string) {
Expand Down Expand Up @@ -134,18 +133,7 @@ export async function fetchProjectDeploymentDetails(
queryFn,
});

return {
projectPermissions: projResp.projectPermissions,
project: projResp.project,
runtime: <Runtime>{
host: projResp.prodDeployment?.runtimeHost,
instanceId: projResp.prodDeployment?.runtimeInstanceId,
jwt: {
token: projResp.jwt,
authContext: token ? "magic" : "user",
},
},
};
return projResp;
}

export function useGithubLastSynced(instanceId: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@
import LoadingSpinner from "@rilldata/web-common/components/icons/LoadingSpinner.svelte";
import { useProjectParser } from "@rilldata/web-common/features/entity-management/resource-selectors";
import { createRuntimeServiceListResources } from "@rilldata/web-common/runtime-client";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import { useQueryClient } from "@tanstack/svelte-query";
import httpClient from "@rilldata/web-common/runtime-client/http-client";
import { queryClient } from "@rilldata/web-common/lib/svelte-query/globalQueryClient";
import { useProjectDeployment } from "./selectors";

const queryClient = useQueryClient();

export let organization: string;
export let project: string;

$: ({ instanceId } = $runtime);
const instanceId = httpClient.getInstanceId();

$: projectDeployment = useProjectDeployment(organization, project);
$: ({ data: deployment } = $projectDeployment);
Expand All @@ -34,6 +32,7 @@
},
refetchOnMount: true,
refetchOnWindowFocus: true,
enabled: !!instanceId,
},
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
} from "@rilldata/web-common/features/entity-management/resource-selectors";
import { EntityStatus } from "@rilldata/web-common/features/entity-management/types";
import { createRuntimeServiceGetResource } from "@rilldata/web-common/runtime-client";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import httpClient from "@rilldata/web-common/runtime-client/http-client";

$: ({ instanceId } = $runtime);
const instanceId = httpClient.getInstanceId();

$: projectParserQuery = createRuntimeServiceGetResource(
instanceId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
createRuntimeServiceCreateTrigger,
getRuntimeServiceListResourcesQueryKey,
} from "@rilldata/web-common/runtime-client";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import httpClient from "@rilldata/web-common/runtime-client/http-client";
import { useQueryClient } from "@tanstack/svelte-query";
import Button from "web-common/src/components/button/Button.svelte";
import ProjectResourcesTable from "./ProjectResourcesTable.svelte";
Expand All @@ -17,7 +17,7 @@

let isConfirmDialogOpen = false;

$: ({ instanceId } = $runtime);
const instanceId = httpClient.getInstanceId();

$: resources = useResources(instanceId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
V1ReconcileStatus,
type V1Resource,
} from "@rilldata/web-common/runtime-client";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import httpClient from "@rilldata/web-common/runtime-client/http-client";
import { useQueryClient } from "@tanstack/svelte-query";
import type { ColumnDef } from "@tanstack/svelte-table";
import { flexRender } from "@tanstack/svelte-table";
Expand All @@ -25,6 +25,8 @@
let dialogResourceKind = "";
let dialogRefreshType: "full" | "incremental" = "full";

const instanceId = httpClient.getInstanceId();

let openDropdownResourceKey = "";

const createTrigger = createRuntimeServiceCreateTrigger();
Expand Down Expand Up @@ -56,7 +58,7 @@
const handleRefresh = async () => {
if (dialogResourceKind === ResourceKind.Model) {
await $createTrigger.mutateAsync({
instanceId: $runtime.instanceId,
instanceId: instanceId,
data: {
models: [
{
Expand All @@ -68,18 +70,15 @@
});
} else {
await $createTrigger.mutateAsync({
instanceId: $runtime.instanceId,
instanceId: instanceId,
data: {
resources: [{ kind: dialogResourceKind, name: dialogResourceName }],
},
});
}

await queryClient.invalidateQueries({
queryKey: getRuntimeServiceListResourcesQueryKey(
$runtime.instanceId,
undefined,
),
queryKey: getRuntimeServiceListResourcesQueryKey(instanceId, undefined),
});

closeRefreshDialog();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import ResourceList from "@rilldata/web-admin/features/resources/ResourceList.svelte";
import type { V1ReportExecution } from "@rilldata/web-common/runtime-client";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import httpClient from "@rilldata/web-common/runtime-client/http-client";
import type { ColumnDef } from "@tanstack/svelte-table";
import { flexRender } from "@tanstack/svelte-table";
import { useReport } from "../selectors";
Expand All @@ -10,7 +10,7 @@

export let report: string;

$: ({ instanceId } = $runtime);
const instanceId = httpClient.getInstanceId();

$: reportQuery = useReport(instanceId, report);

Expand Down
Loading
Loading