From 77e5775f02ae2b487bd481ec19f4f4a331c3393f Mon Sep 17 00:00:00 2001 From: Eric P Green Date: Wed, 11 Dec 2024 09:51:34 -0500 Subject: [PATCH] Don't show the "Source imported successfully" modal when unpacking example projects --- .../features/entity-management/AddAssetButton.svelte | 3 ++- .../features/entity-management/WatchResourcesClient.ts | 6 +++++- web-common/src/features/feature-flags.ts | 1 + web-common/src/features/welcome/ProjectCards.svelte | 10 +++++++--- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/web-common/src/features/entity-management/AddAssetButton.svelte b/web-common/src/features/entity-management/AddAssetButton.svelte index 6feb6693af7..e31119eaeff 100644 --- a/web-common/src/features/entity-management/AddAssetButton.svelte +++ b/web-common/src/features/entity-management/AddAssetButton.svelte @@ -23,6 +23,7 @@ import { directoryState } from "../file-explorer/directory-store"; import { createResourceFile } from "../file-explorer/new-files"; import { addSourceModal } from "../sources/modal/add-source-visibility"; + import CreateExploreDialog from "./CreateExploreDialog.svelte"; import { removeLeadingSlash } from "./entity-mappers"; import { useDirectoryNamesInDirectory, @@ -34,7 +35,6 @@ resourceIconMapping, } from "./resource-icon-mapping"; import { ResourceKind, useFilteredResources } from "./resource-selectors"; - import CreateExploreDialog from "./CreateExploreDialog.svelte"; let active = false; let showExploreDialog = false; @@ -85,6 +85,7 @@ */ async function handleAddSource() { addSourceModal.open(); + featureFlags.set(true, "sourceImportedModal"); await behaviourEvent?.fireSourceTriggerEvent( BehaviourEventAction.SourceAdd, diff --git a/web-common/src/features/entity-management/WatchResourcesClient.ts b/web-common/src/features/entity-management/WatchResourcesClient.ts index 3c2337834de..3815c7892d9 100644 --- a/web-common/src/features/entity-management/WatchResourcesClient.ts +++ b/web-common/src/features/entity-management/WatchResourcesClient.ts @@ -21,6 +21,7 @@ import { runtime } from "@rilldata/web-common/runtime-client/runtime-store"; import { WatchRequestClient } from "@rilldata/web-common/runtime-client/watch-request-client"; import { get } from "svelte/store"; import { connectorExplorerStore } from "../connectors/connector-explorer-store"; +import { featureFlags } from "../feature-flags"; import { sourceImportedPath } from "../sources/sources-store"; export class WatchResourcesClient { @@ -186,7 +187,10 @@ export class WatchResourcesClient { const isNewSource = res.name.kind === ResourceKind.Source && res.resource.meta.specVersion === "1"; - if (isNewSource) { + const showSourceImportedModal = get( + featureFlags.sourceImportedModal, + ); // This will be false when unpacking example projects + if (isNewSource && showSourceImportedModal) { const filePath = res.resource?.meta?.filePaths?.[0] as string; sourceImportedPath.set(filePath); } diff --git a/web-common/src/features/feature-flags.ts b/web-common/src/features/feature-flags.ts index fca78de3634..9fda4a50fb7 100644 --- a/web-common/src/features/feature-flags.ts +++ b/web-common/src/features/feature-flags.ts @@ -30,6 +30,7 @@ type FeatureFlagKey = keyof Omit; class FeatureFlags { adminServer = new FeatureFlag("rill", false); readOnly = new FeatureFlag("rill", false); + sourceImportedModal = new FeatureFlag("rill", true); ai = new FeatureFlag("user", !import.meta.env.VITE_PLAYWRIGHT_TEST); exports = new FeatureFlag("user", true); diff --git a/web-common/src/features/welcome/ProjectCards.svelte b/web-common/src/features/welcome/ProjectCards.svelte index 8b8b76fc263..77412a58f27 100644 --- a/web-common/src/features/welcome/ProjectCards.svelte +++ b/web-common/src/features/welcome/ProjectCards.svelte @@ -1,4 +1,5 @@