Skip to content

Commit

Permalink
Move code to features/view-as-user
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpgreen2 committed Sep 13, 2023
1 parent 9475286 commit 0126cbe
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion web-admin/src/components/authentication/UserButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import { createPopperActions } from "svelte-popperjs";
import { createAdminServiceGetCurrentUser } from "../../client";
import { ADMIN_URL } from "../../client/http-client";
import ViewAsUserPopover from "../../features/view-as-user/ViewAsUserPopover.svelte";
import ProjectAccessControls from "../projects/ProjectAccessControls.svelte";
import ViewAsUserPopover from "./ViewAsUserPopover.svelte";
const user = createAdminServiceGetCurrentUser();
Expand Down
4 changes: 2 additions & 2 deletions web-admin/src/components/navigation/TopNavigationBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import Tooltip from "@rilldata/web-common/components/tooltip/Tooltip.svelte";
import TooltipContent from "@rilldata/web-common/components/tooltip/TooltipContent.svelte";
import { createAdminServiceGetCurrentUser } from "../../client";
import ViewAsUserChip from "../../features/view-as-user/ViewAsUserChip.svelte";
import { viewAsUserStore } from "../../features/view-as-user/viewAsUserStore";
import SignIn from "../authentication/SignIn.svelte";
import UserButton from "../authentication/UserButton.svelte";
import ViewAsUserChip from "../authentication/ViewAsUserChip.svelte";
import { viewAsUserStore } from "../authentication/viewAsUserStore";
import { isErrorStoreEmpty } from "../errors/error-store";
import Breadcrumbs from "./Breadcrumbs.svelte";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import { updateMimickedJWT } from "@rilldata/web-common/features/dashboards/granular-access-policies/updateMimickedJWT";
import { useQueryClient } from "@tanstack/svelte-query";
import { createPopperActions } from "svelte-popperjs";
import { errorStore } from "../errors/error-store";
import { errorStore } from "../../components/errors/error-store";
import ViewAsUserPopover from "./ViewAsUserPopover.svelte";
import { viewAsUserStore } from "./viewAsUserStore";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { matchSorter } from "match-sorter";
import { createEventDispatcher } from "svelte";
import { createAdminServiceSearchProjectUsers, V1User } from "../../client";
import { errorStore } from "../errors/error-store";
import { errorStore } from "../../components/errors/error-store";
import { viewAsUserStore } from "./viewAsUserStore";
export let organization: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { get } from "svelte/store";
import { viewAsUserStore } from "./viewAsUserStore";

/**
* Remove the mimicked user (if any) when navigating away from the Dashboard page
* Remove the viewed as user (if any) when navigating away from the Dashboard page
*/
export function clearMimickedUserAfterNavigate(queryClient: QueryClient) {
export function clearViewedAsUserAfterNavigate(queryClient: QueryClient) {
afterNavigate((nav) => {
// Only applies if mimicking a user on the Dashboard page
if (!get(viewAsUserStore) || !nav.from?.params?.dashboard) return;
Expand Down
4 changes: 2 additions & 2 deletions web-admin/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
QueryClient,
QueryClientProvider,
} from "@tanstack/svelte-query";
import { clearMimickedUserAfterNavigate } from "../components/authentication/clearMimickedUserAfterNavigate";
import { globalErrorCallback } from "../components/errors/error-utils";
import ErrorBoundary from "../components/errors/ErrorBoundary.svelte";
import TopNavigationBar from "../components/navigation/TopNavigationBar.svelte";
import { clearViewedAsUserAfterNavigate } from "../features/view-as-user/clearViewedAsUserAfterNavigate";
const queryClient = new QueryClient({
queryCache: new QueryCache({
Expand All @@ -39,7 +39,7 @@
});
beforeNavigate(retainFeaturesFlags);
clearMimickedUserAfterNavigate(queryClient);
clearViewedAsUserAfterNavigate(queryClient);
</script>

<svelte:head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { page } from "$app/stores";
import RuntimeProvider from "@rilldata/web-common/runtime-client/RuntimeProvider.svelte";
import { createAdminServiceGetDeploymentCredentials } from "../../../client";
import { viewAsUserStore } from "../../../components/authentication/viewAsUserStore";
import { useProjectRuntime } from "../../../components/projects/selectors";
import { viewAsUserStore } from "../../../features/view-as-user/viewAsUserStore";
$: projRuntime = useProjectRuntime(
$page.params.organization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
V1GetProjectResponse,
type V1User,
} from "@rilldata/web-admin/client";
import { viewAsUserStore } from "@rilldata/web-admin/components/authentication/viewAsUserStore";
import { viewAsUserStore } from "@rilldata/web-admin/features/view-as-user/viewAsUserStore";
import { invalidateAllMetricsViews } from "@rilldata/web-common/runtime-client/invalidation";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import type { QueryClient } from "@tanstack/svelte-query";
Expand Down

0 comments on commit 0126cbe

Please sign in to comment.