Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Change Code Insights url hierarchy#21856

Merged
vovakulikov merged 4 commits intomainfrom
code-insights/url-hierarchy
Jun 9, 2021
Merged

Change Code Insights url hierarchy#21856
vovakulikov merged 4 commits intomainfrom
code-insights/url-hierarchy

Conversation

@vovakulikov
Copy link
Contributor

Closes https://github.com/sourcegraph/sourcegraph/issues/21012

This PR changes URLs of code insights pages

Old URLs

/insights
/insights/create-intro
/insights/create-search-insight
/insights/create-lang-stats-insight

New URLs

/* dashboard page */
/insights  

/* Intro insight creation page */
/insights/create 

/* Search based insight creation UI page */
/insights/create/search

/* Code stats (lang-stats) insight creation UI page */
/insights/create/lang-stats

@vovakulikov vovakulikov added debt Technical debt. code-insights Issues related to the Code Insights product labels Jun 8, 2021
@vovakulikov vovakulikov self-assigned this Jun 8, 2021
@vovakulikov
Copy link
Contributor Author

@valerybugakov I remember that we had a conversation about routes URL management. IRTL we wanted to add something like this

/**
 * Enum with all insights related pages URLs
 */
export enum InsightsRouteUrl {
    dashboard = '/insights',
    creation = '/insights/create',
    creationInsight = '/insights/create/:type',
}

But can you please elaborate on this a bit more. Should we use absolute paths for insight sub routing or would it be better if we stick with absolute only paths?

Copy link
Contributor

@tjkandala tjkandala left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@valerybugakov valerybugakov left a comment

Choose a reason for hiding this comment

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

Cross-posting here messages from our Slack DM for visibility about shared routes:

As for https://github.com/sourcegraph/sourcegraph/issues/20693, I thought about the app-wide shared constant that should be used everywhere instead of the raw strings:

const routes = {
  userProfile: '/:organization/user/:userId/profile'
}

<Route path={routes.userProfile} />

For routes with params we need some kind of a factory function to fill params in the actual links:

<Link to={routesFactory.userProfile({ userId: 123, organization: 'github' })} />

Ideally, all paths should be absolute. It will simplify things because there won't be a need to keep a context of where a router is mounted. It should be easy to achieve in one application because we have full control over all parts of it.

Let me know if you see any use-cases that don't play well with this approach. You have more hands-on experience with routing in this repo already 🙂

@vovakulikov vovakulikov force-pushed the code-insights/url-hierarchy branch from 0d23bdd to 846ee68 Compare June 9, 2021 08:31
@vovakulikov vovakulikov merged commit 6d0b683 into main Jun 9, 2021
@vovakulikov vovakulikov deleted the code-insights/url-hierarchy branch June 9, 2021 09:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

code-insights Issues related to the Code Insights product debt Technical debt.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Creation UI URL hierarchy

3 participants