-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: Pesist FlowEditor
state on route changes
#3671
Merged
+192
−187
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8c4be05
fix: Stop re-render of most of the app on each rout change
DafyddLlyr 504f19b
feat: Single instance of flow editor to persist state
DafyddLlyr 19f3f4f
chore: Move settings pages to parent scope to escape flow editor view
DafyddLlyr 9ec9120
chore: Remove legacy /service-flags and /data routes and associated c…
DafyddLlyr b00b743
fix: Don't flash login screen on load
DafyddLlyr 4351014
fix: Ensure EditorNavMenu has flowSlug
DafyddLlyr 0cad0b9
fix: Add back flow and breadcrumbs variables
DafyddLlyr 24641a8
fix: NavBar flash on route change to external portal
DafyddLlyr 52a7db2
feat: Route loading progress bar (#3684)
DafyddLlyr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
editor.planx.uk/src/pages/FlowEditor/components/Settings/DataManagerSettings.tsx
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
editor.planx.uk/src/pages/FlowEditor/components/Settings/ServiceFlags.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
import ErrorFallback from "components/ErrorFallback"; | ||
import FlowEditor from "pages/FlowEditor"; | ||
import React, { PropsWithChildren } from "react"; | ||
import { ErrorBoundary } from "react-error-boundary"; | ||
|
||
const FlowEditorLayout: React.FC<PropsWithChildren> = ({ children }) => ( | ||
<ErrorBoundary FallbackComponent={ErrorFallback}>{children}</ErrorBoundary> | ||
<ErrorBoundary FallbackComponent={ErrorFallback}> | ||
<FlowEditor /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the single |
||
{children} | ||
</ErrorBoundary> | ||
); | ||
|
||
export default FlowEditorLayout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { gql } from "@apollo/client"; | ||
import { FlowStatus } from "@opensystemslab/planx-core/types"; | ||
import { compose, mount, NaviRequest, route, withData } from "navi"; | ||
import ServiceSettings from "pages/FlowEditor/components/Settings/ServiceSettings"; | ||
|
||
import { client } from "../lib/graphql"; | ||
import { useStore } from "../pages/FlowEditor/lib/store"; | ||
import type { FlowSettings } from "../types"; | ||
import { makeTitle } from "./utils"; | ||
|
||
interface GetFlowSettings { | ||
flows: { | ||
id: string; | ||
settings: FlowSettings; | ||
status: FlowStatus; | ||
}[]; | ||
} | ||
|
||
export const getFlowSettings = async (req: NaviRequest) => { | ||
const { | ||
data: { | ||
flows: [{ settings, status }], | ||
}, | ||
} = await client.query<GetFlowSettings>({ | ||
query: gql` | ||
query GetFlow($slug: String!, $team_slug: String!) { | ||
flows( | ||
limit: 1 | ||
where: { slug: { _eq: $slug }, team: { slug: { _eq: $team_slug } } } | ||
) { | ||
id | ||
settings | ||
status | ||
} | ||
} | ||
`, | ||
variables: { | ||
slug: req.params.flow, | ||
team_slug: req.params.team, | ||
}, | ||
}); | ||
|
||
useStore.getState().setFlowSettings(settings); | ||
useStore.getState().setFlowStatus(status); | ||
}; | ||
|
||
const serviceSettingsRoutes = compose( | ||
withData((req) => ({ | ||
mountpath: req.mountpath, | ||
})), | ||
|
||
mount({ | ||
"/": compose( | ||
route(async (req) => ({ | ||
getData: await getFlowSettings(req), | ||
title: makeTitle( | ||
[req.params.team, req.params.flow, "service"].join("/"), | ||
), | ||
view: ServiceSettings, | ||
})), | ||
), | ||
}), | ||
); | ||
|
||
export default serviceSettingsRoutes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { compose, mount, route, withData } from "navi"; | ||
import Submissions from "pages/FlowEditor/components/Settings/Submissions"; | ||
|
||
import { makeTitle } from "./utils"; | ||
|
||
const submissionsLogRoutes = compose( | ||
withData((req) => ({ | ||
mountpath: req.mountpath, | ||
})), | ||
|
||
mount({ | ||
"/": compose( | ||
route(async (req) => ({ | ||
title: makeTitle( | ||
[req.params.team, req.params.flow, "submissions-log"].join("/"), | ||
), | ||
view: Submissions, | ||
})), | ||
), | ||
}), | ||
); | ||
|
||
export default submissionsLogRoutes; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this, the login page flashed on initial load of the application.