Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show the "Source imported successfully" modal when unpacking example projects #6260

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not use FeatureFlags for this. Lets have a separate set of values for such use cases.


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
Loading