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

🪟 🧹 Reorganize connections pages #20845

Merged
merged 17 commits into from
Jan 12, 2023

Conversation

edmundito
Copy link
Contributor

@edmundito edmundito commented Dec 22, 2022

What

Reorganize the new connections pages with better names, less folder nesting, and unified routing component

How

The reasons behind this change were to ensure that all the routes were defined under a single file (ConnectionRoutes.tsx), simplify the folder structure, and clean up any areas (names, confusing imports)

The Changes include:

  • Moves the pages from ConnectionPage to connections/ to match route
  • Replace Tab with Page for all pages
  • Update route syntax to use the new react-router <Outlet /> component
  • Cleans up an issue with the job logs

Recommended reading order

  1. pages/connections/ConnectionsRoutes.tsx

@edmundito edmundito requested a review from josephkmh December 22, 2022 21:31
@octavia-squidington-iv octavia-squidington-iv added area/platform issues related to the platform area/frontend Related to the Airbyte webapp labels Dec 22, 2022
@edmundito edmundito requested review from a team and removed request for a team December 22, 2022 21:31
@edmundito edmundito force-pushed the edmundito/reorganize-connections-pages branch from d2a528c to dde6a0f Compare January 3, 2023 18:33
@edmundito edmundito marked this pull request as ready for review January 3, 2023 20:32
@edmundito edmundito requested a review from a team as a code owner January 3, 2023 20:32
Copy link
Contributor

@josephkmh josephkmh left a comment

Choose a reason for hiding this comment

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

Nice! I'm really happy to see the routes getting cleaned up 🤩 Just left a few comments

airbyte-webapp/src/pages/connections/ConnectionsRoutes.tsx Outdated Show resolved Hide resolved
airbyte-webapp/src/pages/connections/types.ts Outdated Show resolved Hide resolved
const { connection } = useConnectionEditService();
const isConnectionDeleted = connection.status === ConnectionStatus.deprecated;

return isConnectionDeleted ? <Navigate replace to=".." /> : <ConnectionSettingsPageInner />;
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: could we navigate to an explicit route here? I find it easier to understand than "back one page" (to=".."), which requires you to go look at the <Routes> and figure out what that means in the current context. I think it also makes editing routes later easier, because we can see all instances of navigation to a particular route.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wish we had a better way to generate paths that don't involve a lot of reconstruction. In this case, we'd have to pull the workspaceId to navigate to the right place.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, however I would still prefer explicit routes to a relative one. Getting the workspace ID Is pretty straightforward with useCurrentWorkspaceId(). I don't feel super strongly though, so feel free to keep it this way if you like.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a comment on where the user is supposed to end up?

@josephkmh josephkmh changed the title [DRAFT] 🪟 🧹 Reorganize connections pages 🪟 🧹 Reorganize connections pages Jan 4, 2023
@edmundito edmundito requested a review from krishnaglick January 5, 2023 18:48
@edmundito edmundito requested a review from josephkmh January 5, 2023 20:56
@edmundito
Copy link
Contributor Author

Pulled master and incorporated the lazy loading changes. Ready for another pass.

Copy link
Contributor

@krishnaglick krishnaglick left a comment

Choose a reason for hiding this comment

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

Mostly nit-picky stuff. Awesome work here!!


describe("<StatusMainInfo />", () => {
describe("<connectionInfo />", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
describe("<connectionInfo />", () => {
describe("<ConnectionInfoCard />", () => {

Copy link
Contributor

@josephkmh josephkmh Jan 12, 2023

Choose a reason for hiding this comment

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

One thing I like to do for test names is:

describe(`${ConnectionInfoCard.name}`, () => { ...

So that renaming the variable will automatically update the name of the test.

const { mode } = useConnectionFormService();
const initialValues = useMemo(
() => ({
normalization: getInitialNormalization(operations, true),
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be available from the connection form service.
It makes initalValues available which should have normalization on it.

<Route path={ConnectionRoutePaths.Settings} element={<ConnectionSettingsPage />} />
<Route index element={<Navigate to={ConnectionRoutePaths.Status} replace />} />
</Route>
<Route index element={<AllConnectionsPage />} />
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd move this above <Route path={ConnectionRoutePaths.Root}. Seems more clear to me.

<Route path={DestinationPaths.Root} element={<DestinationItemPage />}>
<Route path={DestinationPaths.Settings} element={<DestinationSettingsPage />} />
<Route index element={<DestinationOverviewPage />} />
</Route>
</Route>
<Route path={`${RoutePaths.Source}/*`} element={<SourcesPage />} />
<Route path={`${RoutePaths.Connections}/*`} element={<ConnectionPage />} />
<Route path={`${RoutePaths.Connections}/*`} element={<ConnectionsRoutes />} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we make a note to change Connections -> Connection in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The path is /connections/ so I kept it consistent. I think it makes more sense than /source/ and /destination/

Copy link
Contributor

@josephkmh josephkmh left a comment

Choose a reason for hiding this comment

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

Changes look good to me, just looks like there are a few conflicts that need to be resolved

@octavia-squidington-iv octavia-squidington-iv removed the area/platform issues related to the platform label Jan 11, 2023
@edmundito
Copy link
Contributor Author

@josephkmh Conflicts resolved!

@edmundito edmundito requested a review from josephkmh January 11, 2023 20:31
Copy link
Contributor

@josephkmh josephkmh left a comment

Choose a reason for hiding this comment

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

Changes LGTM, there are still a few nit comments from @krishnaglick, but approving from my side ✅

@edmundito
Copy link
Contributor Author

@josephkmh thanks for pointing those out; I missed them

@edmundito edmundito enabled auto-merge (squash) January 12, 2023 14:24
@edmundito edmundito merged commit 2515385 into master Jan 12, 2023
@edmundito edmundito deleted the edmundito/reorganize-connections-pages branch January 12, 2023 15:00
jbfbell pushed a commit that referenced this pull request Jan 13, 2023
* Reorganize connection pages
Flatten structure
Simplify names

* Consolidate all the Connection routes to a single file

* Extract job types and utilities to own files within JobItem
Move JobsWithJobs to JobItem/utils

* Move ConnectionName component to components/connection

* Move StatusMainInfo components and rename to components/connection/ConnectionInfoCard

* Move ConnectionBlock to components/connection

* Clean up ConnectionPage structure

* Update style import in ConnectionInfoCard test

* Clean up ConnectionRoutePaths enum

* Apply suggestions from code review - Update export default style

Co-authored-by: Krishna (kc) Glick <krishna@airbyte.io>

* Update ConnectionInfoCard test description name

* Update test snapshots

Co-authored-by: Krishna (kc) Glick <krishna@airbyte.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants