Skip to content

Commit

Permalink
[Proposal] Update schema errors routing to better work with nav/bread…
Browse files Browse the repository at this point in the history
…crumbs

- `exact` is required to make the parent schemas/ not gobble schema/{errorId}

- added bonus breadcrumb for nicer schema navigation UX

- No tests need to update AFAICT
  • Loading branch information
cee-chen committed Jun 18, 2021
1 parent d77ee41 commit b6a62b6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const SOURCE_CONTENT_PATH = `${SOURCES_PATH}/:sourceId/content`;
export const SOURCE_SCHEMAS_PATH = `${SOURCES_PATH}/:sourceId/schemas`;
export const SOURCE_DISPLAY_SETTINGS_PATH = `${SOURCES_PATH}/:sourceId/display_settings`;
export const SOURCE_SETTINGS_PATH = `${SOURCES_PATH}/:sourceId/settings`;
export const REINDEX_JOB_PATH = `${SOURCES_PATH}/:sourceId/schema_errors/:activeReindexJobId`;
export const REINDEX_JOB_PATH = `${SOURCE_SCHEMAS_PATH}/:activeReindexJobId`;

export const DISPLAY_SETTINGS_SEARCH_RESULT_PATH = `${SOURCE_DISPLAY_SETTINGS_PATH}/`;
export const DISPLAY_SETTINGS_RESULT_DETAIL_PATH = `${SOURCE_DISPLAY_SETTINGS_PATH}/result_detail`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ export const SchemaChangeErrors: React.FC = () => {
}, []);

return (
<SourceLayout pageChrome={[NAV.SCHEMA]} pageViewTelemetry="source_schema">
<SourceLayout
pageChrome={[NAV.SCHEMA, SCHEMA_ERRORS_HEADING]}
pageViewTelemetry="source_schema"
>
<ViewContentHeader title={SCHEMA_ERRORS_HEADING} />
<SchemaErrorsAccordion fieldCoercionErrors={fieldCoercionErrors} schema={serverSchema} />
</SourceLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ export const useSourceSubNav = () => {
navItems.push({
id: 'sourceSchema',
name: NAV.SCHEMA,
...generateNavLink({ to: getContentSourcePath(SOURCE_SCHEMAS_PATH, id, isOrganization) }),
...generateNavLink({
to: getContentSourcePath(SOURCE_SCHEMAS_PATH, id, isOrganization),
shouldShowActiveForSubroutes: true,
}),
});
navItems.push({
id: 'sourceDisplaySettings',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ export const SourceRouter: React.FC = () => {
<SourceContent />
</Route>
{isCustomSource && (
<Route path={sourcePath(SOURCE_SCHEMAS_PATH, sourceId, isOrganization)}>
<Route exact path={sourcePath(SOURCE_SCHEMAS_PATH, sourceId, isOrganization)}>
<Schema />
</Route>
)}
{isCustomSource && (
<Route path={getSourcesPath(REINDEX_JOB_PATH, isOrganization)}>
<Route exact path={getSourcesPath(REINDEX_JOB_PATH, isOrganization)}>
<SchemaChangeErrors />
</Route>
)}
{isCustomSource && (
<Route path={sourcePath(SOURCE_DISPLAY_SETTINGS_PATH, sourceId, isOrganization)}>
<Route exact path={sourcePath(SOURCE_DISPLAY_SETTINGS_PATH, sourceId, isOrganization)}>
<DisplaySettingsRouter />
</Route>
)}
Expand Down

0 comments on commit b6a62b6

Please sign in to comment.