Skip to content

Commit

Permalink
Don't show the "Source imported successfully" modal when unpacking ex…
Browse files Browse the repository at this point in the history
…ample projects
  • Loading branch information
ericpgreen2 committed Dec 11, 2024
1 parent c262763 commit 77e5775
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -85,6 +85,7 @@
*/
async function handleAddSource() {
addSourceModal.open();
featureFlags.set(true, "sourceImportedModal");
await behaviourEvent?.fireSourceTriggerEvent(
BehaviourEventAction.SourceAdd,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions web-common/src/features/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type FeatureFlagKey = keyof Omit<FeatureFlags, "set">;
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);
Expand Down
10 changes: 7 additions & 3 deletions web-common/src/features/welcome/ProjectCards.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import AddCircleOutline from "@rilldata/web-common/components/icons/AddCircleOutline.svelte";
import Subheading from "@rilldata/web-common/components/typography/Subheading.svelte";
import Card from "../../components/card/Card.svelte";
import CardDescription from "../../components/card/CardDescription.svelte";
Expand All @@ -9,11 +10,13 @@
BehaviourEventMedium,
} from "../../metrics/service/BehaviourEventTypes";
import { MetricsEventSpace } from "../../metrics/service/MetricsTypes";
import { createRuntimeServiceUnpackExample } from "../../runtime-client";
import {
createRuntimeServiceUnpackEmpty,
createRuntimeServiceUnpackExample,
} from "../../runtime-client";
import { runtime } from "../../runtime-client/runtime-store";
import { featureFlags } from "../feature-flags";
import { EMPTY_PROJECT_TITLE } from "./constants";
import AddCircleOutline from "@rilldata/web-common/components/icons/AddCircleOutline.svelte";
import { createRuntimeServiceUnpackEmpty } from "../../runtime-client";
const unpackExampleProject = createRuntimeServiceUnpackExample();
const unpackEmptyProject = createRuntimeServiceUnpackEmpty();
Expand Down Expand Up @@ -99,6 +102,7 @@
disabled={!!selectedProjectName}
isLoading={selectedProjectName === example.name}
on:click={async () => {
featureFlags.set(false, "sourceImportedModal");
await unpackProject(example);
}}
>
Expand Down

0 comments on commit 77e5775

Please sign in to comment.