Skip to content
Merged
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
2 changes: 2 additions & 0 deletions runtime/feature_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ var defaultFeatureFlags = map[string]string{
"generate_canvas": "false",
// Controls if the developer agent tool is available.
"developer_agent": "true",
// Controls if the dashboard state is persisted when navigating to a different dashboard.
"sticky_dashboard_state": "false",
}

// ResolveFeatureFlags resolves feature flags for the given instance and the provided user attributes.
Expand Down
140 changes: 72 additions & 68 deletions runtime/feature_flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,24 @@ func Test_ResolveFeatureFlags(t *testing.T) {
"domain": "rilldata.com",
},
featureFlags: map[string]bool{
"exports": true,
"cloudDataViewer": false,
"dimensionSearch": true,
"twoTieredNavigation": false,
"rillTime": true,
"hidePublicUrl": false,
"exportHeader": false,
"alerts": true,
"reports": true,
"darkMode": true,
"chat": true,
"dashboardChat": false,
"developerChat": false,
"chatCharts": true,
"deploy": true,
"generateCanvas": false,
"developerAgent": true,
"exports": true,
"cloudDataViewer": false,
"dimensionSearch": true,
"twoTieredNavigation": false,
"rillTime": true,
"hidePublicUrl": false,
"exportHeader": false,
"alerts": true,
"reports": true,
"darkMode": true,
"chat": true,
"dashboardChat": false,
"developerChat": false,
"chatCharts": true,
"deploy": true,
"generateCanvas": false,
"developerAgent": true,
"stickyDashboardState": false,
},
},
{
Expand All @@ -52,23 +53,24 @@ func Test_ResolveFeatureFlags(t *testing.T) {
"domain": "gmail.com",
},
featureFlags: map[string]bool{
"exports": true,
"cloudDataViewer": false,
"dimensionSearch": false,
"twoTieredNavigation": false,
"rillTime": true,
"hidePublicUrl": false,
"exportHeader": false,
"alerts": false,
"reports": true,
"darkMode": true,
"chat": true,
"dashboardChat": false,
"developerChat": false,
"chatCharts": true,
"deploy": true,
"generateCanvas": false,
"developerAgent": true,
"exports": true,
"cloudDataViewer": false,
"dimensionSearch": false,
"twoTieredNavigation": false,
"rillTime": true,
"hidePublicUrl": false,
"exportHeader": false,
"alerts": false,
"reports": true,
"darkMode": true,
"chat": true,
"dashboardChat": false,
"developerChat": false,
"chatCharts": true,
"deploy": true,
"generateCanvas": false,
"developerAgent": true,
"stickyDashboardState": false,
},
},
{
Expand All @@ -77,23 +79,24 @@ func Test_ResolveFeatureFlags(t *testing.T) {
"domain": "yahoo.com",
},
featureFlags: map[string]bool{
"exports": true,
"cloudDataViewer": false,
"dimensionSearch": false,
"twoTieredNavigation": false,
"rillTime": true,
"hidePublicUrl": false,
"exportHeader": false,
"alerts": false,
"reports": false,
"darkMode": true,
"chat": true,
"dashboardChat": false,
"developerChat": false,
"chatCharts": true,
"deploy": true,
"generateCanvas": false,
"developerAgent": true,
"exports": true,
"cloudDataViewer": false,
"dimensionSearch": false,
"twoTieredNavigation": false,
"rillTime": true,
"hidePublicUrl": false,
"exportHeader": false,
"alerts": false,
"reports": false,
"darkMode": true,
"chat": true,
"dashboardChat": false,
"developerChat": false,
"chatCharts": true,
"deploy": true,
"generateCanvas": false,
"developerAgent": true,
"stickyDashboardState": false,
},
},
{
Expand All @@ -102,23 +105,24 @@ func Test_ResolveFeatureFlags(t *testing.T) {
"embed": true,
},
featureFlags: map[string]bool{
"exports": true,
"cloudDataViewer": false,
"dimensionSearch": false,
"twoTieredNavigation": false,
"rillTime": true,
"hidePublicUrl": true,
"exportHeader": false,
"alerts": false,
"reports": false,
"darkMode": true,
"chat": false,
"dashboardChat": false, // forced false because chat is false
"developerChat": false,
"chatCharts": true,
"deploy": true,
"generateCanvas": false,
"developerAgent": true,
"exports": true,
"cloudDataViewer": false,
"dimensionSearch": false,
"twoTieredNavigation": false,
"rillTime": true,
"hidePublicUrl": true,
"exportHeader": false,
"alerts": false,
"reports": false,
"darkMode": true,
"chat": false,
"dashboardChat": false, // forced false because chat is false
"developerChat": false,
"chatCharts": true,
"deploy": true,
"generateCanvas": false,
"developerAgent": true,
"stickyDashboardState": false,
},
},
}
Expand Down
17 changes: 8 additions & 9 deletions web-admin/src/features/embeds/TopNavigationBarEmbed.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

$: shouldRender =
navigationEnabled ||
(dashboardChat &&
($dashboardChat &&
(activeResource?.kind === ResourceKind.Explore.toString() ||
activeResource?.kind === ResourceKind.MetricsView.toString()));

Expand All @@ -35,8 +35,8 @@
);
$: currentResourceName = currentResource?.meta?.name?.name;

$: breadcrumbOptions = dashboards?.reduce(
(map, { meta, explore, canvas }) => {
$: breadcrumbOptions = {
options: dashboards?.reduce((map, { meta, explore, canvas }) => {
const name = meta.name.name;
const isExplore = !!explore;
return map.set(name.toLowerCase(), {
Expand All @@ -47,9 +47,8 @@
href: `/-/embed/${isExplore ? "explore" : "canvas"}/${name}`,
preloadData: false,
});
},
new Map(),
);
}, new Map()),
};
</script>

{#if $isErrorStoreEmpty && shouldRender}
Expand All @@ -69,13 +68,13 @@
{#if currentResource}
{#if $twoTieredNavigation}
<TwoTieredBreadcrumbItem
options={breadcrumbOptions}
pathOptions={breadcrumbOptions}
current={currentResourceName}
isCurrentPage
/>
{:else}
<BreadcrumbItem
options={breadcrumbOptions}
pathOptions={breadcrumbOptions}
current={currentResourceName}
isCurrentPage
isEmbedded
Expand All @@ -88,7 +87,7 @@
<div class="flex-1" />
{/if}

{#if dashboardChat && (activeResource?.kind === ResourceKind.Explore.toString() || activeResource?.kind === ResourceKind.MetricsView.toString())}
{#if $dashboardChat && (activeResource?.kind === ResourceKind.Explore.toString() || activeResource?.kind === ResourceKind.MetricsView.toString())}
<div class="flex gap-x-4 items-center">
<LastRefreshedDate dashboard={activeResource?.name} />
<ChatToggle />
Expand Down
84 changes: 48 additions & 36 deletions web-admin/src/features/navigation/TopNavigationBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@
export let planDisplayName: string | undefined;

const user = createAdminServiceGetCurrentUser();
const { alerts: alertsFlag, dimensionSearch, dashboardChat } = featureFlags;
const {
alerts: alertsFlag,
dimensionSearch,
dashboardChat,
stickyDashboardState,
} = featureFlags;

$: ({ instanceId } = $runtime);

Expand Down Expand Up @@ -103,11 +108,9 @@
$: alerts = $alertsQuery.data?.resources ?? [];
$: reports = $reportsQuery.data?.resources ?? [];

$: organizationPaths = createOrgPaths(
organizations,
organization,
planDisplayName,
);
$: organizationPaths = {
options: createOrgPaths(organizations, organization, planDisplayName),
};

function createOrgPaths(
organizations: V1Organization[],
Expand Down Expand Up @@ -135,39 +138,48 @@
return pathMap;
}

$: projectPaths = projects.reduce(
(map, { name }) =>
map.set(name.toLowerCase(), { label: name, preloadData: false }),
new Map<string, PathOption>(),
);
$: projectPaths = {
options: projects.reduce(
(map, { name }) =>
map.set(name.toLowerCase(), { label: name, preloadData: false }),
new Map<string, PathOption>(),
),
};

$: visualizationPaths = visualizations.reduce((map, resource) => {
const name = resource.meta.name.name;
const isMetricsExplorer = !!resource?.explore;
return map.set(name.toLowerCase(), {
label:
(isMetricsExplorer
? resource?.explore?.spec?.displayName
: resource?.canvas?.spec?.displayName) || name,
section: isMetricsExplorer ? "explore" : "canvas",
});
}, new Map<string, PathOption>());
$: visualizationPaths = {
options: visualizations.reduce((map, resource) => {
const name = resource.meta.name.name;
const isMetricsExplorer = !!resource?.explore;
return map.set(name.toLowerCase(), {
label:
(isMetricsExplorer
? resource?.explore?.spec?.displayName
: resource?.canvas?.spec?.displayName) || name,
section: isMetricsExplorer ? "explore" : "canvas",
});
}, new Map<string, PathOption>()),
carryOverSearchParams: $stickyDashboardState,
};

$: alertPaths = alerts.reduce((map, alert) => {
const name = alert.meta.name.name;
return map.set(name.toLowerCase(), {
label: alert.alert.spec.displayName || name,
section: "-/alerts",
});
}, new Map<string, PathOption>());
$: alertPaths = {
options: alerts.reduce((map, alert) => {
const name = alert.meta.name.name;
return map.set(name.toLowerCase(), {
label: alert.alert.spec.displayName || name,
section: "-/alerts",
});
}, new Map<string, PathOption>()),
};

$: reportPaths = reports.reduce((map, report) => {
const name = report.meta.name.name;
return map.set(name.toLowerCase(), {
label: report.report.spec.displayName || name,
section: "-/reports",
});
}, new Map<string, PathOption>());
$: reportPaths = {
options: reports.reduce((map, report) => {
const name = report.meta.name.name;
return map.set(name.toLowerCase(), {
label: report.report.spec.displayName || name,
section: "-/reports",
});
}, new Map<string, PathOption>()),
};

$: pathParts = [
organizationPaths,
Expand Down
Loading
Loading