Skip to content

Commit

Permalink
refactor: rename metabase_link to analytics_link
Browse files Browse the repository at this point in the history
- As per: #2387 (comment)
- Best practice not to tie the variable name to a single provider
  • Loading branch information
Mike-Heneghan committed Nov 7, 2023
1 parent 9f4527d commit b4e3f1d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ const PreviewBrowser: React.FC<{
const [showDebugConsole, setDebugConsoleVisibility] = useState(false);
const [
flowId,
flowMetabaseLink,
flowAnalyticsLink,
resetPreview,
publishFlow,
lastPublished,
lastPublisher,
validateAndDiffFlow,
] = useStore((state) => [
state.id,
state.flowMetabaseLink,
state.flowAnalyticsLink,
state.resetPreview,
state.publishFlow,
state.lastPublished,
Expand Down Expand Up @@ -160,10 +160,10 @@ const PreviewBrowser: React.FC<{
/>
</Tooltip>

{flowMetabaseLink ? (
{flowAnalyticsLink ? (
<Tooltip arrow title="Open analytics page">
<Link
href={flowMetabaseLink}
href={flowAnalyticsLink}
target="_blank"
rel="noopener noreferrer"
color="inherit"
Expand Down
4 changes: 2 additions & 2 deletions editor.planx.uk/src/pages/FlowEditor/lib/store/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface SharedStore extends Store.Store {
flow: Store.flow;
flowSlug: string;
flowName: string;
flowMetabaseLink: string | null;
flowAnalyticsLink: string | null;
id: string;
getNode: (id: Store.nodeId) => Store.node | undefined;
resetPreview: () => void;
Expand Down Expand Up @@ -52,7 +52,7 @@ export const sharedStore: StateCreator<

flowName: "",

flowMetabaseLink: null,
flowAnalyticsLink: null,

id: "",
previewEnvironment: "standalone",
Expand Down
10 changes: 5 additions & 5 deletions editor.planx.uk/src/routes/flow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const nodeRoutes = mount({
const getFlowMetadata = async (
flow: string,
team: string,
): Promise<{ flowSettings: FlowSettings; flowMetabaseLink: string }> => {
): Promise<{ flowSettings: FlowSettings; flowAnalyticsLink: string }> => {
const { data } = await client.query({
query: gql`
query GetFlow($slug: String!, $team_slug: String!) {
Expand All @@ -186,7 +186,7 @@ const getFlowMetadata = async (
) {
id
flowSettings: settings
flowMetabaseLink: metabase_link
flowAnalyticsLink: analytics_link
}
}
`,
Expand All @@ -197,7 +197,7 @@ const getFlowMetadata = async (
});
const metadata = {
flowSettings: data.flows[0]?.flowSettings,
flowMetabaseLink: data.flows[0]?.flowMetabaseLink,
flowAnalyticsLink: data.flows[0]?.flowAnalyticsLink,
};
return metadata;
};
Expand All @@ -209,11 +209,11 @@ const routes = compose(

withView(async (req) => {
const [flow, ...breadcrumbs] = req.params.flow.split(",");
const { flowSettings, flowMetabaseLink } = await getFlowMetadata(
const { flowSettings, flowAnalyticsLink } = await getFlowMetadata(
flow,
req.params.team,
);
useStore.setState({ flowSettings, flowMetabaseLink });
useStore.setState({ flowSettings, flowAnalyticsLink });

return (
<>
Expand Down
4 changes: 2 additions & 2 deletions hasura.planx.uk/metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
- creator_id
- data
- id
- metabase_link
- analytics_link
- settings
- slug
- team_id
Expand Down Expand Up @@ -378,7 +378,7 @@
- creator_id
- data
- id
- metabase_link
- analytics_link
- settings
- slug
- team_id
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."flows" rename column "analytics_link" to "metabase_link";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."flows" rename column "metabase_link" to "analytics_link";

0 comments on commit b4e3f1d

Please sign in to comment.