diff --git a/web-admin/src/features/alerts/CreateAlert.svelte b/web-admin/src/features/alerts/CreateAlert.svelte index 3d428cf33bb..7930e32908d 100644 --- a/web-admin/src/features/alerts/CreateAlert.svelte +++ b/web-admin/src/features/alerts/CreateAlert.svelte @@ -11,19 +11,18 @@ import { useMetricsViewValidSpec } from "@rilldata/web-common/features/dashboards/selectors"; import { getStateManagers } from "@rilldata/web-common/features/dashboards/state-managers/state-managers"; import { BellPlusIcon } from "lucide-svelte"; + import { runtime } from "@rilldata/web-common/runtime-client/runtime-store"; const { selectors: { timeRangeSelectors: { isCustomTimeRange }, }, - runtime, metricsViewName, } = getStateManagers(); - $: metricsView = useMetricsViewValidSpec( - $runtime?.instanceId, - $metricsViewName, - ); + $: ({ instanceId } = $runtime); + + $: metricsView = useMetricsViewValidSpec(instanceId, $metricsViewName); $: hasTimeDimension = !!$metricsView?.data?.timeDimension; let open = false; diff --git a/web-admin/src/features/alerts/history/AlertHistoryTable.svelte b/web-admin/src/features/alerts/history/AlertHistoryTable.svelte index 2c7dd8f9c51..15d8493d17d 100644 --- a/web-admin/src/features/alerts/history/AlertHistoryTable.svelte +++ b/web-admin/src/features/alerts/history/AlertHistoryTable.svelte @@ -11,7 +11,9 @@ export let alert: string; - $: alertQuery = useAlert($runtime.instanceId, alert); + $: ({ instanceId } = $runtime); + + $: alertQuery = useAlert(instanceId, alert); /** * Table column definitions. diff --git a/web-admin/src/features/alerts/listing/AlertsTable.svelte b/web-admin/src/features/alerts/listing/AlertsTable.svelte index c2d41e089c2..d0ba8edcf7f 100644 --- a/web-admin/src/features/alerts/listing/AlertsTable.svelte +++ b/web-admin/src/features/alerts/listing/AlertsTable.svelte @@ -16,7 +16,9 @@ export let organization: string; export let project: string; - $: alerts = useAlerts($runtime.instanceId); + $: ({ instanceId } = $runtime); + + $: alerts = useAlerts(instanceId); /** * Table column definitions. diff --git a/web-admin/src/features/alerts/metadata/AlertFilters.svelte b/web-admin/src/features/alerts/metadata/AlertFilters.svelte index 864a15e8ff7..09d7be87a95 100644 --- a/web-admin/src/features/alerts/metadata/AlertFilters.svelte +++ b/web-admin/src/features/alerts/metadata/AlertFilters.svelte @@ -35,8 +35,9 @@ whereFilter = dimensionFilters; havingFilter = dimensionThresholdFilters; } + $: ({ instanceId } = $runtime); - $: metricsView = useMetricsView($runtime.instanceId, metricsViewName); + $: metricsView = useMetricsView(instanceId, metricsViewName); $: dimensionIdMap = getMapFromArray( $metricsView.data?.metricsView?.state?.validSpec?.dimensions ?? [], (dimension) => dimension.name, diff --git a/web-admin/src/features/alerts/metadata/AlertMetadata.svelte b/web-admin/src/features/alerts/metadata/AlertMetadata.svelte index 109dd064e18..448a3e9bc75 100644 --- a/web-admin/src/features/alerts/metadata/AlertMetadata.svelte +++ b/web-admin/src/features/alerts/metadata/AlertMetadata.svelte @@ -34,12 +34,14 @@ export let project: string; export let alert: string; - $: alertQuery = useAlert($runtime.instanceId, alert); - $: isAlertCreatedByCode = useIsAlertCreatedByCode($runtime.instanceId, alert); + $: ({ instanceId } = $runtime); + + $: alertQuery = useAlert(instanceId, alert); + $: isAlertCreatedByCode = useIsAlertCreatedByCode(instanceId, alert); // Get dashboard - $: dashboardName = useAlertDashboardName($runtime.instanceId, alert); - $: dashboard = useExploreValidSpec($runtime.instanceId, $dashboardName.data); + $: dashboardName = useAlertDashboardName(instanceId, alert); + $: dashboard = useExploreValidSpec(instanceId, $dashboardName.data); $: metricsViewName = $dashboard.data?.explore?.metricsView; $: dashboardTitle = $dashboard.data?.explore?.displayName || $dashboardName.data; @@ -69,7 +71,7 @@ name: $alertQuery.data.resource.meta.name.name, }); await queryClient.invalidateQueries( - getRuntimeServiceListResourcesQueryKey($runtime.instanceId), + getRuntimeServiceListResourcesQueryKey(instanceId), ); // goto only after invalidate is complete goto(`/${organization}/${project}/-/alerts`); diff --git a/web-admin/src/features/bookmarks/BaseBookmarkForm.svelte b/web-admin/src/features/bookmarks/BaseBookmarkForm.svelte index 8ab436deed1..6fa053eaa78 100644 --- a/web-admin/src/features/bookmarks/BaseBookmarkForm.svelte +++ b/web-admin/src/features/bookmarks/BaseBookmarkForm.svelte @@ -21,6 +21,8 @@ export let exploreName: string; export let formState: ReturnType>; + $: ({ instanceId } = $runtime); + $: exploreState = useExploreState(exploreName); let timeRange: V1TimeRange; @@ -32,7 +34,7 @@ $: selectedTimeRange = getPrettySelectedTimeRange( queryClient, - $runtime?.instanceId, + instanceId, metricsViewName, exploreName, ); diff --git a/web-admin/src/features/bookmarks/BookmarkTimeRangeSwitch.svelte b/web-admin/src/features/bookmarks/BookmarkTimeRangeSwitch.svelte index 86d2686f49e..5a59dc46803 100644 --- a/web-admin/src/features/bookmarks/BookmarkTimeRangeSwitch.svelte +++ b/web-admin/src/features/bookmarks/BookmarkTimeRangeSwitch.svelte @@ -1,18 +1,18 @@
diff --git a/web-common/src/features/canvas-components/ComponentsHeader.svelte b/web-common/src/features/canvas-components/ComponentsHeader.svelte index e2d4037da83..f41978fa9e9 100644 --- a/web-common/src/features/canvas-components/ComponentsHeader.svelte +++ b/web-common/src/features/canvas-components/ComponentsHeader.svelte @@ -17,12 +17,12 @@ let fileName: string; $: [, fileName] = splitFolderAndFileName(filePath); - $: runtimeInstanceId = $runtime.instanceId; + $: ({ instanceId } = $runtime); $: componentName = extractFileName(filePath); async function handleNameChange(newTitle: string) { const newRoute = await handleEntityRename( - runtimeInstanceId, + instanceId, newTitle, filePath, componentName, diff --git a/web-common/src/features/canvas-components/editor/ComponentsEditor.svelte b/web-common/src/features/canvas-components/editor/ComponentsEditor.svelte index 7599511774e..94c8a0b9edc 100644 --- a/web-common/src/features/canvas-components/editor/ComponentsEditor.svelte +++ b/web-common/src/features/canvas-components/editor/ComponentsEditor.svelte @@ -12,11 +12,13 @@ let editor: EditorView; + $: ({ instanceId } = $runtime); + $: fileArtifact = fileArtifacts.getFileArtifact(filePath); $: ({ autoSave, remoteContent } = fileArtifact); - $: allErrors = fileArtifact.getAllErrors(queryClient, $runtime.instanceId); + $: allErrors = fileArtifact.getAllErrors(queryClient, instanceId); $: lineBasedRuntimeErrors = mapParseErrorsToLines( $allErrors, diff --git a/web-common/src/features/canvas-components/prompt/GenerateChartYAMLPrompt.svelte b/web-common/src/features/canvas-components/prompt/GenerateChartYAMLPrompt.svelte index 20c1ddcbb9a..e00a9af5abd 100644 --- a/web-common/src/features/canvas-components/prompt/GenerateChartYAMLPrompt.svelte +++ b/web-common/src/features/canvas-components/prompt/GenerateChartYAMLPrompt.svelte @@ -7,19 +7,19 @@ import { useAllFileNames } from "@rilldata/web-common/features/entity-management/file-selectors"; import { getName } from "@rilldata/web-common/features/entity-management/name-utils"; import { runtime } from "@rilldata/web-common/runtime-client/runtime-store"; - import { useQueryClient } from "@tanstack/svelte-query"; + import { queryClient } from "@rilldata/web-common/lib/svelte-query/globalQueryClient"; export let open: boolean; export let table: string = ""; export let connector: string = ""; export let metricsView: string = ""; - const queryClient = useQueryClient(); + $: ({ instanceId } = $runtime); let prompt: string; - $: chartFileNames = useAllFileNames(queryClient, $runtime.instanceId); - $: generateVegaConfig = createFullChartGenerator($runtime.instanceId); + $: chartFileNames = useAllFileNames(queryClient, instanceId); + $: generateVegaConfig = createFullChartGenerator(instanceId); async function createVegaConfig() { open = false; diff --git a/web-common/src/features/canvas-components/prompt/GenerateVegaSpecPrompt.svelte b/web-common/src/features/canvas-components/prompt/GenerateVegaSpecPrompt.svelte index 33dade58aff..4da16ab0db9 100644 --- a/web-common/src/features/canvas-components/prompt/GenerateVegaSpecPrompt.svelte +++ b/web-common/src/features/canvas-components/prompt/GenerateVegaSpecPrompt.svelte @@ -12,11 +12,9 @@ let prompt: string; - $: generateVegaConfig = createChartGenerator( - $runtime.instanceId, - chart, - filePath, - ); + $: ({ instanceId } = $runtime); + + $: generateVegaConfig = createChartGenerator(instanceId, chart, filePath); async function createVegaConfig() { open = false; diff --git a/web-common/src/features/canvas/AddComponentMenu.svelte b/web-common/src/features/canvas/AddComponentMenu.svelte index 86428dfa402..1f692c63ca2 100644 --- a/web-common/src/features/canvas/AddComponentMenu.svelte +++ b/web-common/src/features/canvas/AddComponentMenu.svelte @@ -19,9 +19,11 @@ let open = false; let value = ""; + $: ({ instanceId } = $runtime); + // We want to get only valid components here. Hence using ListResources API $: componentsQuery = useClientFilteredResources( - $runtime.instanceId, + instanceId, ResourceKind.Component, ); $: componentFileNames = diff --git a/web-common/src/features/canvas/CanvasDashboardEmbed.svelte b/web-common/src/features/canvas/CanvasDashboardEmbed.svelte index 558b9785eeb..d8bb50345d1 100644 --- a/web-common/src/features/canvas/CanvasDashboardEmbed.svelte +++ b/web-common/src/features/canvas/CanvasDashboardEmbed.svelte @@ -20,7 +20,7 @@ let contentRect: DOMRectReadOnly = new DOMRectReadOnly(0, 0, 0, 0); setContext("rill::canvas:name", canvasName); - $: instanceId = $runtime.instanceId; + $: ({ instanceId } = $runtime); const dashboardWidth = chartView ? defaults.DASHBOARD_WIDTH / 2 diff --git a/web-common/src/features/canvas/CanvasDashboardPreview.svelte b/web-common/src/features/canvas/CanvasDashboardPreview.svelte index e135d7d43c5..cb819254cfc 100644 --- a/web-common/src/features/canvas/CanvasDashboardPreview.svelte +++ b/web-common/src/features/canvas/CanvasDashboardPreview.svelte @@ -35,7 +35,7 @@ let dimensionChange: [0 | 1 | -1, 0 | 1 | -1] = [0, 0]; let positionChange: [0 | 1, 0 | 1] = [0, 0]; - $: instanceId = $runtime.instanceId; + $: ({ instanceId } = $runtime); $: gridWidth = contentRect.width; $: scale = gridWidth / defaults.DASHBOARD_WIDTH; diff --git a/web-common/src/features/canvas/Chart.svelte b/web-common/src/features/canvas/Chart.svelte index 480fb40b6bd..19a6b871dea 100644 --- a/web-common/src/features/canvas/Chart.svelte +++ b/web-common/src/features/canvas/Chart.svelte @@ -17,11 +17,13 @@ let error: string | null = null; let parsedVegaSpec: VisualizationSpec | null = null; + $: ({ instanceId } = $runtime); + $: canvasName = getContext("rill::canvas:name") as string; $: inputVariableParams = useVariableInputParams(canvasName, input); $: componentDataQuery = createQueryServiceResolveComponent( - $runtime.instanceId, + instanceId, componentName, { args: $inputVariableParams }, ); diff --git a/web-common/src/features/column-profile/ColumnProfile.svelte b/web-common/src/features/column-profile/ColumnProfile.svelte index 9ba720a6d69..d27eefff942 100644 --- a/web-common/src/features/column-profile/ColumnProfile.svelte +++ b/web-common/src/features/column-profile/ColumnProfile.svelte @@ -18,9 +18,10 @@ export let indentLevel = 0; let mode = "summaries"; - let container; + $: ({ instanceId } = $runtime); + onMount(() => { const observer = new ResizeObserver(() => { containerWidth = container?.clientWidth ?? 0; @@ -30,7 +31,7 @@ }); $: profileColumns = createQueryServiceTableColumns( - $runtime?.instanceId, + instanceId, objectName, { connector, @@ -41,19 +42,15 @@ ); /** get single example */ - $: exampleValue = createQueryServiceTableRows( - $runtime?.instanceId, - objectName, - { - connector, - database, - databaseSchema, - limit: 1, - }, - ); + $: exampleValue = createQueryServiceTableRows(instanceId, objectName, { + connector, + database, + databaseSchema, + limit: 1, + }); $: nestedColumnProfileQuery = getSummaries( - $runtime?.instanceId, + instanceId, connector, database, databaseSchema, diff --git a/web-common/src/features/column-profile/column-types/NestedProfile.svelte b/web-common/src/features/column-profile/column-types/NestedProfile.svelte index 535d4f9e906..49eb8005518 100644 --- a/web-common/src/features/column-profile/column-types/NestedProfile.svelte +++ b/web-common/src/features/column-profile/column-types/NestedProfile.svelte @@ -37,8 +37,10 @@ let active = false; + $: ({ instanceId } = $runtime); + $: nulls = getNullPercentage( - $runtime?.instanceId, + instanceId, connector, database, databaseSchema, @@ -48,7 +50,7 @@ ); $: columnCardinality = getCountDistinct( - $runtime?.instanceId, + instanceId, connector, database, databaseSchema, @@ -58,7 +60,7 @@ ); $: topK = getTopK( - $runtime?.instanceId, + instanceId, connector, database, databaseSchema, diff --git a/web-common/src/features/column-profile/column-types/NumericProfile.svelte b/web-common/src/features/column-profile/column-types/NumericProfile.svelte index 9e8d1468b30..59a999795ff 100644 --- a/web-common/src/features/column-profile/column-types/NumericProfile.svelte +++ b/web-common/src/features/column-profile/column-types/NumericProfile.svelte @@ -35,7 +35,6 @@ export let type: string; export let mode = "summaries"; export let example: any; - export let hideRight = false; export let compact = false; export let hideNullPercentage = false; @@ -44,8 +43,10 @@ let active = false; + $: ({ instanceId } = $runtime); + $: nulls = getNullPercentage( - $runtime?.instanceId, + instanceId, connector, database, databaseSchema, @@ -55,7 +56,7 @@ ); $: diagnosticHistogram = getNumericHistogram( - $runtime?.instanceId, + instanceId, connector, database, databaseSchema, @@ -68,7 +69,7 @@ let fdHistogram; $: if (isFloat(type)) { fdHistogram = getNumericHistogram( - $runtime?.instanceId, + instanceId, connector, database, databaseSchema, @@ -94,7 +95,7 @@ : $diagnosticHistogram?.data; $: rug = createQueryServiceColumnRugHistogram( - $runtime?.instanceId, + instanceId, objectName, { connector, @@ -113,7 +114,7 @@ }, ); $: topK = getTopK( - $runtime?.instanceId, + instanceId, connector, database, databaseSchema, @@ -124,7 +125,7 @@ $: summary = derived( createQueryServiceColumnDescriptiveStatistics( - $runtime?.instanceId, + instanceId, objectName, { connector, diff --git a/web-common/src/features/column-profile/column-types/TimestampProfile.svelte b/web-common/src/features/column-profile/column-types/TimestampProfile.svelte index 99923c90161..df8a07c8d6d 100644 --- a/web-common/src/features/column-profile/column-types/TimestampProfile.svelte +++ b/web-common/src/features/column-profile/column-types/TimestampProfile.svelte @@ -23,20 +23,19 @@ export let type: string; export let mode = "summaries"; export let example: any; - export let hideRight = false; export let compact = false; export let hideNullPercentage = false; - export let enableProfiling = true; - let timestampDetailHeight = 160; + $: ({ instanceId } = $runtime); + let timestampDetailHeight = 160; let active = false; /** queries used to power the different plots */ $: nullPercentage = getNullPercentage( - $runtime?.instanceId, + instanceId, connector, database, databaseSchema, @@ -46,7 +45,7 @@ ); $: timeSeries = getTimeSeriesAndSpark( - $runtime?.instanceId, + instanceId, connector, database, databaseSchema, diff --git a/web-common/src/features/column-profile/column-types/VarcharProfile.svelte b/web-common/src/features/column-profile/column-types/VarcharProfile.svelte index ca619204837..25d2d785668 100644 --- a/web-common/src/features/column-profile/column-types/VarcharProfile.svelte +++ b/web-common/src/features/column-profile/column-types/VarcharProfile.svelte @@ -21,20 +21,19 @@ export let columnName: string; export let example: any; export let type: string; - export let hideRight = false; export let compact = false; export let hideNullPercentage = false; export let mode: "example" | "summaries" = "summaries"; - export let enableProfiling = true; let active = false; - let topKLimit = 15; + $: ({ instanceId } = $runtime); + $: nulls = getNullPercentage( - $runtime?.instanceId, + instanceId, connector, database, databaseSchema, @@ -44,7 +43,7 @@ ); $: columnCardinality = getCountDistinct( - $runtime?.instanceId, + instanceId, connector, database, databaseSchema, @@ -54,7 +53,7 @@ ); $: topK = getTopK( - $runtime?.instanceId, + instanceId, connector, database, databaseSchema, diff --git a/web-common/src/features/connectors/ConnectorExplorer.svelte b/web-common/src/features/connectors/ConnectorExplorer.svelte index 772969190a6..8524f1f1a79 100644 --- a/web-common/src/features/connectors/ConnectorExplorer.svelte +++ b/web-common/src/features/connectors/ConnectorExplorer.svelte @@ -8,7 +8,9 @@ export let store: ConnectorExplorerStore; - $: connectors = createRuntimeServiceAnalyzeConnectors($runtime.instanceId, { + $: ({ instanceId } = $runtime); + + $: connectors = createRuntimeServiceAnalyzeConnectors(instanceId, { query: { // sort alphabetically select: (data) => { diff --git a/web-common/src/features/connectors/olap/TableMenuItems.svelte b/web-common/src/features/connectors/olap/TableMenuItems.svelte index c47a089668e..cac103dc39f 100644 --- a/web-common/src/features/connectors/olap/TableMenuItems.svelte +++ b/web-common/src/features/connectors/olap/TableMenuItems.svelte @@ -26,12 +26,14 @@ export let databaseSchema: string = ""; export let table: string; + $: ({ instanceId } = $runtime); + $: isModelingSupportedForOlapDriver = useIsModelingSupportedForOlapDriver( - $runtime.instanceId, + instanceId, connector, ); $: createMetricsViewFromTable = useCreateMetricsViewFromTableUIAction( - $runtime.instanceId, + instanceId, connector, database, databaseSchema, @@ -41,7 +43,7 @@ MetricsEventSpace.LeftPanel, ); $: createExploreFromTable = useCreateMetricsViewFromTableUIAction( - $runtime.instanceId, + instanceId, connector, database, databaseSchema, diff --git a/web-common/src/features/connectors/olap/TableSchema.svelte b/web-common/src/features/connectors/olap/TableSchema.svelte index 87a273d33ec..2507a7f398f 100644 --- a/web-common/src/features/connectors/olap/TableSchema.svelte +++ b/web-common/src/features/connectors/olap/TableSchema.svelte @@ -9,15 +9,13 @@ export let databaseSchema: string = ""; // The backend interprets an empty string as the default schema export let table: string; - $: columnsQuery = createQueryServiceTableColumns( - $runtime?.instanceId, - table, - { - connector, - database, - databaseSchema, - }, - ); + $: ({ instanceId } = $runtime); + + $: columnsQuery = createQueryServiceTableColumns(instanceId, table, { + connector, + database, + databaseSchema, + }); $: ({ data, error, isError } = $columnsQuery); function prettyPrintType(type: string) { diff --git a/web-common/src/features/connectors/olap/TableWorkspaceHeader.svelte b/web-common/src/features/connectors/olap/TableWorkspaceHeader.svelte index 90aa5da6223..22a2db0ed2c 100644 --- a/web-common/src/features/connectors/olap/TableWorkspaceHeader.svelte +++ b/web-common/src/features/connectors/olap/TableWorkspaceHeader.svelte @@ -21,8 +21,10 @@ const { ai } = featureFlags; + $: ({ instanceId } = $runtime); + $: createMetricsViewFromTable = useCreateMetricsViewFromTableUIAction( - $runtime.instanceId, + instanceId, connector, database, databaseSchema, diff --git a/web-common/src/features/dashboards/DashboardThemeProvider.svelte b/web-common/src/features/dashboards/DashboardThemeProvider.svelte index b5c7b0090f6..8582b2c1eb8 100644 --- a/web-common/src/features/dashboards/DashboardThemeProvider.svelte +++ b/web-common/src/features/dashboards/DashboardThemeProvider.svelte @@ -10,8 +10,9 @@ $: themeFromUrl = $page.url.searchParams.get("theme"); let theme: ReturnType; + $: ({ instanceId } = $runtime); $: themeName = themeFromUrl ?? $validSpecStore.data?.explore?.theme; - $: if (themeName) theme = useTheme($runtime.instanceId, themeName); + $: if (themeName) theme = useTheme(instanceId, themeName); $: setTheme( $theme?.data?.theme?.spec ?? $validSpecStore?.data?.explore?.embeddedTheme, diff --git a/web-common/src/features/dashboards/dimension-search/GlobalDimensionSearchResults.svelte b/web-common/src/features/dashboards/dimension-search/GlobalDimensionSearchResults.svelte index b7768e3db03..7b3a78e64b5 100644 --- a/web-common/src/features/dashboards/dimension-search/GlobalDimensionSearchResults.svelte +++ b/web-common/src/features/dashboards/dimension-search/GlobalDimensionSearchResults.svelte @@ -26,7 +26,7 @@ validSpecStore, } = getStateManagers(); - $: instanceId = $runtime.instanceId; + $: ({ instanceId } = $runtime); let results: ReturnType; $: if ( diff --git a/web-common/src/features/dashboards/filters/FilterChipsReadOnly.svelte b/web-common/src/features/dashboards/filters/FilterChipsReadOnly.svelte index 3a0ce4f3cdd..7ecf481a592 100644 --- a/web-common/src/features/dashboards/filters/FilterChipsReadOnly.svelte +++ b/web-common/src/features/dashboards/filters/FilterChipsReadOnly.svelte @@ -25,7 +25,9 @@ The main feature-set component for dashboard filters export let timeRange: V1TimeRange | undefined; export let comparisonTimeRange: V1TimeRange | undefined = undefined; - $: validExploreSpecs = useExploreValidSpec($runtime.instanceId, exploreName); + $: ({ instanceId } = $runtime); + + $: validExploreSpecs = useExploreValidSpec(instanceId, exploreName); // Get dimension filters $: dimensions = allDimensions({ diff --git a/web-common/src/features/dashboards/rows-viewer/RowsViewer.svelte b/web-common/src/features/dashboards/rows-viewer/RowsViewer.svelte index 31451929244..2032e3357ca 100644 --- a/web-common/src/features/dashboards/rows-viewer/RowsViewer.svelte +++ b/web-common/src/features/dashboards/rows-viewer/RowsViewer.svelte @@ -19,6 +19,8 @@ export let filters: V1Expression | undefined; export let timeRange: TimeRangeString; + $: ({ instanceId } = $runtime); + const SAMPLE_SIZE = 10000; const FALLBACK_SAMPLE_SIZE = 1000; @@ -28,7 +30,7 @@ let limit = writable(SAMPLE_SIZE); $: tableQuery = createQueryServiceMetricsViewRows( - $runtime?.instanceId, + instanceId, metricsViewName, { limit: $limit, diff --git a/web-common/src/features/dashboards/rows-viewer/RowsViewerAccordion.svelte b/web-common/src/features/dashboards/rows-viewer/RowsViewerAccordion.svelte index c5953e13187..6e0dfb72826 100644 --- a/web-common/src/features/dashboards/rows-viewer/RowsViewerAccordion.svelte +++ b/web-common/src/features/dashboards/rows-viewer/RowsViewerAccordion.svelte @@ -44,6 +44,8 @@ const stateManagers = getStateManagers(); + $: ({ instanceId } = $runtime); + $: exploreState = useExploreState(exploreName); $: pivotDataStore = usePivotDataStore(stateManagers); $: showPivot = $exploreState.pivot.active; @@ -73,7 +75,7 @@ } $: filteredTotalsQuery = createQueryServiceMetricsViewAggregation( - $runtime.instanceId, + instanceId, metricsViewName, { measures: [{ name: "count", builtinMeasure: "BUILTIN_MEASURE_COUNT" }], @@ -98,7 +100,7 @@ ); $: totalsQuery = createQueryServiceMetricsViewAggregation( - $runtime.instanceId, + instanceId, metricsViewName, { measures: [{ name: "count", builtinMeasure: "BUILTIN_MEASURE_COUNT" }], diff --git a/web-common/src/features/dashboards/url-state/DashboardURLStateSync.svelte b/web-common/src/features/dashboards/url-state/DashboardURLStateSync.svelte index 4a0d7d775da..077c0bb1946 100644 --- a/web-common/src/features/dashboards/url-state/DashboardURLStateSync.svelte +++ b/web-common/src/features/dashboards/url-state/DashboardURLStateSync.svelte @@ -45,8 +45,10 @@ $: exploreSpec = $validSpecStore.data?.explore; $: metricsSpec = $validSpecStore.data?.metricsView; + $: ({ instanceId } = $runtime); + const metricsViewSchema = createQueryServiceMetricsViewSchema( - $runtime.instanceId, + instanceId, metricsViewName, ); $: ({ error: schemaError } = $metricsViewSchema); diff --git a/web-common/src/features/dashboards/url-state/DashboardURLStateSyncWrapper.svelte b/web-common/src/features/dashboards/url-state/DashboardURLStateSyncWrapper.svelte index 67158a4cc72..e393aef5a71 100644 --- a/web-common/src/features/dashboards/url-state/DashboardURLStateSyncWrapper.svelte +++ b/web-common/src/features/dashboards/url-state/DashboardURLStateSyncWrapper.svelte @@ -23,10 +23,11 @@ const storeKeyPrefix = orgName && projectName ? `__${orgName}__${projectName}` : ""; + $: ({ instanceId } = $runtime); $: exploreSpec = $validSpecStore.data?.explore ?? {}; $: metricsViewSpec = $validSpecStore.data?.metricsView ?? {}; $: metricsViewTimeRange = useMetricsViewTimeRange( - $runtime.instanceId, + instanceId, $metricsViewName, ); $: defaultExplorePreset = getDefaultExplorePreset( diff --git a/web-common/src/features/editor/FileWorkspaceHeader.svelte b/web-common/src/features/editor/FileWorkspaceHeader.svelte index 18fa50003ee..74544c99511 100644 --- a/web-common/src/features/editor/FileWorkspaceHeader.svelte +++ b/web-common/src/features/editor/FileWorkspaceHeader.svelte @@ -18,9 +18,11 @@ $: [, fileName] = splitFolderAndFileName(filePath); $: isProtectedFile = PROTECTED_FILES.includes(filePath); + $: ({ instanceId } = $runtime); + const onChangeCallback = async (newTitle: string) => { const route = await handleEntityRename( - $runtime.instanceId, + instanceId, newTitle, filePath, fileName, diff --git a/web-common/src/features/entity-management/AddAssetButton.svelte b/web-common/src/features/entity-management/AddAssetButton.svelte index 49630a071f3..c7ecaa53dd0 100644 --- a/web-common/src/features/entity-management/AddAssetButton.svelte +++ b/web-common/src/features/entity-management/AddAssetButton.svelte @@ -43,7 +43,7 @@ const createFolder = createRuntimeServiceCreateDirectory(); const { customDashboards } = featureFlags; - $: instanceId = $runtime.instanceId; + $: ({ instanceId } = $runtime); $: currentFile = $page.params.file; $: currentDirectory = currentFile ? currentFile.split("/").slice(0, -1).join("/") @@ -59,7 +59,7 @@ ); $: isModelingSupportedForDefaultOlapDriver = - useIsModelingSupportedForDefaultOlapDriver($runtime.instanceId); + useIsModelingSupportedForDefaultOlapDriver(instanceId); $: metricsViewQuery = useFilteredResources( instanceId, diff --git a/web-common/src/features/entity-management/RenameAssetModal.svelte b/web-common/src/features/entity-management/RenameAssetModal.svelte index 3e1a7b072dc..e264c583efa 100644 --- a/web-common/src/features/entity-management/RenameAssetModal.svelte +++ b/web-common/src/features/entity-management/RenameAssetModal.svelte @@ -112,15 +112,9 @@ }, }); - $: runtimeInstanceId = $runtime.instanceId; - $: existingDirectories = useDirectoryNamesInDirectory( - runtimeInstanceId, - folderName, - ); - $: fileNamesInDirectory = useFileNamesInDirectory( - runtimeInstanceId, - folderName, - ); + $: ({ instanceId } = $runtime); + $: existingDirectories = useDirectoryNamesInDirectory(instanceId, folderName); + $: fileNamesInDirectory = useFileNamesInDirectory(instanceId, folderName); { diff --git a/web-common/src/features/file-explorer/NavDirectoryEntry.svelte b/web-common/src/features/file-explorer/NavDirectoryEntry.svelte index 3e702363a60..2f0ad7e12ff 100644 --- a/web-common/src/features/file-explorer/NavDirectoryEntry.svelte +++ b/web-common/src/features/file-explorer/NavDirectoryEntry.svelte @@ -35,7 +35,7 @@ $: id = `${dir.path}-nav-entry`; $: expanded = $directoryState[dir.path]; $: padding = getPaddingFromPath(dir.path); - $: instanceId = $runtime.instanceId; + $: ({ instanceId } = $runtime); $: topLevelFolder = getTopLevelFolder(dir.path); $: isProtectedDirectory = PROTECTED_DIRECTORIES.includes(topLevelFolder); diff --git a/web-common/src/features/file-explorer/NavFile.svelte b/web-common/src/features/file-explorer/NavFile.svelte index e4d4ab69377..30ef5409373 100644 --- a/web-common/src/features/file-explorer/NavFile.svelte +++ b/web-common/src/features/file-explorer/NavFile.svelte @@ -68,6 +68,8 @@ saveState: { saving, error }, } = fileArtifact); + $: ({ instanceId } = $runtime); + $: resourceKind = ($resourceName?.kind ?? $inferredResourceKind) as ResourceKind; $: padding = getPaddingFromPath(filePath); @@ -76,7 +78,7 @@ $: isDotFile = fileName && fileName.startsWith("."); $: isProtectedFile = PROTECTED_FILES.includes(filePath); - $: hasErrors = fileArtifact.getHasErrors(queryClient, $runtime.instanceId); + $: hasErrors = fileArtifact.getHasErrors(queryClient, instanceId); function fireTelemetry() { const previousScreenName = getScreenNameFromPage(); diff --git a/web-common/src/features/metrics-views/GoToDashboardButton.svelte b/web-common/src/features/metrics-views/GoToDashboardButton.svelte index 210650db2a2..660d13fd760 100644 --- a/web-common/src/features/metrics-views/GoToDashboardButton.svelte +++ b/web-common/src/features/metrics-views/GoToDashboardButton.svelte @@ -16,7 +16,7 @@ export let resource: V1Resource | undefined; - $: instanceId = $runtime.instanceId; + $: ({ instanceId } = $runtime); $: dashboardsQuery = useGetExploresForMetricsView( instanceId, resource?.meta?.name?.name ?? "", diff --git a/web-common/src/features/metrics-views/MetricsInspector.svelte b/web-common/src/features/metrics-views/MetricsInspector.svelte index 55325315b45..6cc65247af4 100644 --- a/web-common/src/features/metrics-views/MetricsInspector.svelte +++ b/web-common/src/features/metrics-views/MetricsInspector.svelte @@ -16,10 +16,12 @@ export let databaseSchema: string; export let table: string; + $: ({ instanceId } = $runtime); + $: fileArtifact = fileArtifacts.getFileArtifact(filePath); $: ({ remoteContent } = fileArtifact); - $: parseError = fileArtifact.getParseError(queryClient, $runtime.instanceId); - $: resource = fileArtifact.getResource(queryClient, $runtime.instanceId); + $: parseError = fileArtifact.getParseError(queryClient, instanceId); + $: resource = fileArtifact.getResource(queryClient, instanceId); $: ({ isLoading: isResourceLoading, error: resourceError, @@ -29,7 +31,7 @@ $: tableQuery = createConnectorServiceOLAPGetTable( { - instanceId: $runtime.instanceId, + instanceId, connector, database, databaseSchema, diff --git a/web-common/src/features/metrics-views/MetricsViewMenuItems.svelte b/web-common/src/features/metrics-views/MetricsViewMenuItems.svelte index c1f7fac8958..2c2d6181220 100644 --- a/web-common/src/features/metrics-views/MetricsViewMenuItems.svelte +++ b/web-common/src/features/metrics-views/MetricsViewMenuItems.svelte @@ -30,7 +30,7 @@ const queryClient = useQueryClient(); const { customDashboards, ai } = featureFlags; - $: instanceId = $runtime.instanceId; + $: ({ instanceId } = $runtime); $: resourceQuery = fileArtifact.getResource(queryClient, instanceId); $: resource = $resourceQuery.data; $: hasErrors = fileArtifact.getHasErrors(queryClient, instanceId); diff --git a/web-common/src/features/metrics-views/editor/Placeholder.svelte b/web-common/src/features/metrics-views/editor/Placeholder.svelte index f28effc7b9d..fd7cf2920ac 100644 --- a/web-common/src/features/metrics-views/editor/Placeholder.svelte +++ b/web-common/src/features/metrics-views/editor/Placeholder.svelte @@ -15,16 +15,18 @@ export let filePath: string; export let view: EditorView | undefined = undefined; + $: ({ instanceId } = $runtime); + $: isModelingSupportedForDefaultOlapDriver = - useIsModelingSupportedForDefaultOlapDriver($runtime.instanceId); - $: models = useModels($runtime.instanceId); + useIsModelingSupportedForDefaultOlapDriver(instanceId); + $: models = useModels(instanceId); const buttonClasses = "inline hover:font-semibold underline underline-offset-2"; async function onAutogenerateConfigFromModel(modelRes: V1Resource) { await createDashboardFromTableInMetricsEditor( - $runtime.instanceId, + instanceId, modelRes?.model?.state?.resultTable ?? "", filePath, ); @@ -34,7 +36,7 @@ async function onCreateSkeletonMetricsConfig() { const yaml = initBlankDashboardYAML(metricsName); - await runtimeServicePutFile($runtime.instanceId, { + await runtimeServicePutFile(instanceId, { path: filePath, blob: yaml, create: true, diff --git a/web-common/src/features/models/incremental/ModelRefreshButton.svelte b/web-common/src/features/models/incremental/ModelRefreshButton.svelte index c72b495d886..9dfbd022ae2 100644 --- a/web-common/src/features/models/incremental/ModelRefreshButton.svelte +++ b/web-common/src/features/models/incremental/ModelRefreshButton.svelte @@ -16,13 +16,14 @@ const triggerMutation = createRuntimeServiceCreateTrigger(); + $: ({ instanceId } = $runtime); $: isIncrementalModel = resource?.model?.spec?.incremental; $: isModelIdle = resource?.meta?.reconcileStatus === V1ReconcileStatus.RECONCILE_STATUS_IDLE; function refreshModel(full: boolean) { void $triggerMutation.mutateAsync({ - instanceId: $runtime.instanceId, + instanceId, data: { models: [{ model: resource?.meta?.name?.name, full: full }], }, diff --git a/web-common/src/features/models/inspector/References.svelte b/web-common/src/features/models/inspector/References.svelte index e929994bad3..e05bc78cc8c 100644 --- a/web-common/src/features/models/inspector/References.svelte +++ b/web-common/src/features/models/inspector/References.svelte @@ -18,6 +18,8 @@ export let referencedThings: [V1Resource, Reference][]; export let modelHasError: boolean; + $: ({ instanceId } = $runtime); + let showSourceTables = true; /** classes for elements that trigger the highlight in a model query */ @@ -31,7 +33,7 @@ writable(resource), writable(ref), createQueryServiceTableCardinality( - $runtime?.instanceId, + instanceId, resource?.meta?.name?.name ?? "", ), ], diff --git a/web-common/src/features/models/inspector/WorkspaceInspector.svelte b/web-common/src/features/models/inspector/WorkspaceInspector.svelte index 4a157b2a1eb..953e8f13393 100644 --- a/web-common/src/features/models/inspector/WorkspaceInspector.svelte +++ b/web-common/src/features/models/inspector/WorkspaceInspector.svelte @@ -48,7 +48,7 @@ let showColumns = true; - $: instanceId = $runtime.instanceId; + $: ({ instanceId } = $runtime); $: source = resource?.source; $: model = resource?.model; diff --git a/web-common/src/features/models/navigation/ModelMenuItems.svelte b/web-common/src/features/models/navigation/ModelMenuItems.svelte index 77bc9688e9e..304228d3796 100644 --- a/web-common/src/features/models/navigation/ModelMenuItems.svelte +++ b/web-common/src/features/models/navigation/ModelMenuItems.svelte @@ -17,13 +17,12 @@ export let filePath: string; + $: ({ instanceId } = $runtime); + $: fileArtifact = fileArtifacts.getFileArtifact(filePath); - $: modelHasError = fileArtifact.getHasErrors( - queryClient, - $runtime.instanceId, - ); - $: modelQuery = fileArtifact.getResource(queryClient, $runtime.instanceId); + $: modelHasError = fileArtifact.getHasErrors(queryClient, instanceId); + $: modelQuery = fileArtifact.getResource(queryClient, instanceId); $: connector = $modelQuery.data?.model?.spec?.outputConnector; $: modelIsIdle = $modelQuery.data?.meta?.reconcileStatus === @@ -32,7 +31,7 @@ $: tableName = $modelQuery.data?.model?.state?.resultTable ?? ""; $: createMetricsViewFromTable = useCreateMetricsViewFromTableUIAction( - $runtime.instanceId, + instanceId, connector as string, "", "", @@ -43,7 +42,7 @@ ); $: createExploreFromTable = useCreateMetricsViewFromTableUIAction( - $runtime.instanceId, + instanceId, connector as string, "", "", diff --git a/web-common/src/features/models/partitions/PartitionsTable.svelte b/web-common/src/features/models/partitions/PartitionsTable.svelte index d75787b9d43..d590d0833fe 100644 --- a/web-common/src/features/models/partitions/PartitionsTable.svelte +++ b/web-common/src/features/models/partitions/PartitionsTable.svelte @@ -30,6 +30,7 @@ export let wherePending: boolean; $: modelName = resource?.meta?.name?.name as string; + $: ({ instanceId } = $runtime); // ========================== // Infinite Query @@ -43,7 +44,7 @@ ErrorType >({ queryKey: getRuntimeServiceGetModelPartitionsQueryKey( - $runtime.instanceId, + instanceId, modelName, baseParams, ), @@ -57,7 +58,7 @@ : {}), }; return runtimeServiceGetModelPartitions( - $runtime.instanceId, + instanceId, modelName, getModelPartitionsParams, ); diff --git a/web-common/src/features/models/workspace/CreateDashboardButton.svelte b/web-common/src/features/models/workspace/CreateDashboardButton.svelte index dd620c5ce57..8d21fc3cb2b 100644 --- a/web-common/src/features/models/workspace/CreateDashboardButton.svelte +++ b/web-common/src/features/models/workspace/CreateDashboardButton.svelte @@ -20,14 +20,16 @@ const { ai } = featureFlags; - $: modelQuery = useModel($runtime.instanceId, modelName); + $: ({ instanceId } = $runtime); + + $: modelQuery = useModel(instanceId, modelName); $: connector = $modelQuery.data?.model?.spec?.outputConnector; $: modelIsIdle = $modelQuery.data?.meta?.reconcileStatus === V1ReconcileStatus.RECONCILE_STATUS_IDLE; $: createMetricsViewFromModel = useCreateMetricsViewFromTableUIAction( - $runtime.instanceId, + instanceId, connector as string, "", "", diff --git a/web-common/src/features/models/workspace/ModelEditor.svelte b/web-common/src/features/models/workspace/ModelEditor.svelte index 49be6241eb7..f8bb0e07d03 100644 --- a/web-common/src/features/models/workspace/ModelEditor.svelte +++ b/web-common/src/features/models/workspace/ModelEditor.svelte @@ -21,13 +21,15 @@ export let fileArtifact: FileArtifact; export let onSave: (content: string) => void = () => {}; + $: ({ instanceId } = $runtime); + $: ({ remoteContent } = fileArtifact); let editor: EditorView; let autocompleteCompartment = new Compartment(); // Autocomplete: source tables - $: allSourceColumns = useAllSourceColumns(queryClient, $runtime?.instanceId); + $: allSourceColumns = useAllSourceColumns(queryClient, instanceId); $: if ($allSourceColumns?.length) { for (const sourceTable of $allSourceColumns) { const sourceIdentifier = sourceTable?.tableName; @@ -39,7 +41,7 @@ } //Auto complete: model tables - $: allModelColumns = useAllModelColumns(queryClient, $runtime?.instanceId); + $: allModelColumns = useAllModelColumns(queryClient, instanceId); $: if ($allModelColumns?.length) { for (const modelTable of $allModelColumns) { const modelIdentifier = modelTable?.tableName; diff --git a/web-common/src/features/models/workspace/ModelWorkspaceCTAs.svelte b/web-common/src/features/models/workspace/ModelWorkspaceCTAs.svelte index 552d849e811..89a5f7b2806 100644 --- a/web-common/src/features/models/workspace/ModelWorkspaceCTAs.svelte +++ b/web-common/src/features/models/workspace/ModelWorkspaceCTAs.svelte @@ -32,18 +32,16 @@ const exportModelMutation = createExportTableMutation(); + $: ({ instanceId } = $runtime); $: isModelIdle = resource?.meta?.reconcileStatus === V1ReconcileStatus.RECONCILE_STATUS_IDLE; - $: metricsViewsQuery = useGetMetricsViewsForModel( - $runtime.instanceId, - modelName, - ); + $: metricsViewsQuery = useGetMetricsViewsForModel(instanceId, modelName); $: availableMetricsViews = $metricsViewsQuery.data ?? []; $: createMetricsViewFromTable = useCreateMetricsViewFromTableUIAction( - $runtime.instanceId, + instanceId, connector, "", "", @@ -56,7 +54,7 @@ const onExport = async (format: V1ExportFormat) => { return $exportModelMutation.mutateAsync({ data: { - instanceId: $runtime.instanceId, + instanceId, format, tableName: modelName, }, diff --git a/web-common/src/features/onboarding/OnboardingWorkspace.svelte b/web-common/src/features/onboarding/OnboardingWorkspace.svelte index c9101ec0f1d..36c46e5b167 100644 --- a/web-common/src/features/onboarding/OnboardingWorkspace.svelte +++ b/web-common/src/features/onboarding/OnboardingWorkspace.svelte @@ -6,8 +6,10 @@ import { runtime } from "../../runtime-client/runtime-store"; import { addSourceModal } from "../sources/modal/add-source-visibility"; + $: ({ instanceId } = $runtime); + let steps: OnboardingStep[]; - $: instance = createRuntimeServiceGetInstance($runtime.instanceId, { + $: instance = createRuntimeServiceGetInstance(instanceId, { sensitive: true, }); $: olapConnector = $instance.data?.instance?.olapConnector; diff --git a/web-common/src/features/scheduled-reports/BaseScheduledReportForm.svelte b/web-common/src/features/scheduled-reports/BaseScheduledReportForm.svelte index 106b8b0e1a2..347ea7bb1f7 100644 --- a/web-common/src/features/scheduled-reports/BaseScheduledReportForm.svelte +++ b/web-common/src/features/scheduled-reports/BaseScheduledReportForm.svelte @@ -20,11 +20,13 @@ export let enhance; export let exploreName: string; + $: ({ instanceId } = $runtime); + // Pull the time zone options from the dashboard's spec - $: exploreSpec = useExploreValidSpec($runtime.instanceId, exploreName); + $: exploreSpec = useExploreValidSpec(instanceId, exploreName); $: availableTimeZones = $exploreSpec.data?.explore?.timeZones; $: timeZoneOptions = makeTimeZoneOptions(availableTimeZones); - $: hasSlackNotifier = getHasSlackConnection($runtime.instanceId); + $: hasSlackNotifier = getHasSlackConnection(instanceId);
diff --git a/web-common/src/features/templates/TemplateRenderer.svelte b/web-common/src/features/templates/TemplateRenderer.svelte index b1558660a86..7ae61d055c5 100644 --- a/web-common/src/features/templates/TemplateRenderer.svelte +++ b/web-common/src/features/templates/TemplateRenderer.svelte @@ -26,9 +26,11 @@ const canvasName = getContext("rill::canvas:name") as string; + $: ({ instanceId } = $runtime); + $: inputVariableParams = useVariableInputParams(canvasName, input); $: componentQuery = createQueryServiceResolveComponent( - $runtime.instanceId, + instanceId, componentName, { args: $inputVariableParams }, ); diff --git a/web-common/src/features/templates/kpi/KPITemplate.svelte b/web-common/src/features/templates/kpi/KPITemplate.svelte index fe45c14aa71..e784d6e5ba8 100644 --- a/web-common/src/features/templates/kpi/KPITemplate.svelte +++ b/web-common/src/features/templates/kpi/KPITemplate.svelte @@ -19,14 +19,13 @@ import { humaniseISODuration } from "@rilldata/web-common/lib/time/ranges/iso-ranges"; import type { V1ComponentSpecRendererProperties } from "@rilldata/web-common/runtime-client"; import { runtime } from "@rilldata/web-common/runtime-client/runtime-store"; - import { useQueryClient } from "@tanstack/svelte-query"; + import { queryClient } from "@rilldata/web-common/lib/svelte-query/globalQueryClient"; export let rendererProperties: V1ComponentSpecRendererProperties; - const queryClient = useQueryClient(); let containerWidth: number; - $: instanceId = $runtime?.instanceId; + $: ({ instanceId } = $runtime); $: kpiProperties = rendererProperties as KPIProperties; $: ({ diff --git a/web-common/src/features/templates/table/TableTemplate.svelte b/web-common/src/features/templates/table/TableTemplate.svelte index 90e674e5f2e..adf831da84e 100644 --- a/web-common/src/features/templates/table/TableTemplate.svelte +++ b/web-common/src/features/templates/table/TableTemplate.svelte @@ -20,7 +20,7 @@ const queryClient = useQueryClient(); const TABLE_PREFIX = "_custom-table"; - $: instanceId = $runtime.instanceId; + $: ({ instanceId } = $runtime); $: tableProperties = rendererProperties as TableProperties; diff --git a/web-common/src/features/workspaces/CanvasDashboardWorkspace.svelte b/web-common/src/features/workspaces/CanvasDashboardWorkspace.svelte index 7f9d2fd004f..ec4311dc2ce 100644 --- a/web-common/src/features/workspaces/CanvasDashboardWorkspace.svelte +++ b/web-common/src/features/workspaces/CanvasDashboardWorkspace.svelte @@ -97,7 +97,7 @@ async function onChangeCallback(newTitle: string) { const newRoute = await handleEntityRename( - $runtime.instanceId, + instanceId, newTitle, filePath, fileName, diff --git a/web-common/src/features/workspaces/ModelWorkspace.svelte b/web-common/src/features/workspaces/ModelWorkspace.svelte index 94fe37ac1c3..9c06c666994 100644 --- a/web-common/src/features/workspaces/ModelWorkspace.svelte +++ b/web-common/src/features/workspaces/ModelWorkspace.svelte @@ -38,7 +38,7 @@ $: workspace = workspaces.get(filePath); $: tableVisible = workspace.table.visible; - $: instanceId = $runtime.instanceId; + $: ({ instanceId } = $runtime); $: allErrorsStore = fileArtifact.getAllErrors(queryClient, instanceId); $: hasErrors = fileArtifact.getHasErrors(queryClient, instanceId); diff --git a/web-common/src/runtime-client/RuntimeProvider.svelte b/web-common/src/runtime-client/RuntimeProvider.svelte index f7b94a52741..52b50611c61 100644 --- a/web-common/src/runtime-client/RuntimeProvider.svelte +++ b/web-common/src/runtime-client/RuntimeProvider.svelte @@ -12,8 +12,10 @@ $: runtime .setRuntime(queryClient, host, instanceId, jwt, authContext) .catch(console.error); + + $: ({ instanceId, host } = $runtime); -{#if $runtime.host && $runtime.instanceId} +{#if host && instanceId} {/if}