Skip to content

Commit 4e72208

Browse files
committed
fe/sr: schema details: Parse context
We want the user to understand that the qualified subject name means that the first part `:...:` is the context, so we grey-out the context name as we do in the other pages.
1 parent d15d9f5 commit 4e72208

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

frontend/src/components/layout/header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function AppPageHeader() {
113113
className={cn('mr-2', lastBreadcrumb.options?.canBeTruncated ? 'break-spaces break-all' : 'nowrap')}
114114
level={1}
115115
>
116-
{lastBreadcrumb.title}
116+
{lastBreadcrumb.titleNode ?? lastBreadcrumb.title}
117117
</Heading>
118118
) : null}
119119
{lastBreadcrumb ? (

frontend/src/components/pages/schemas/schema-details.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const routeApi = getRouteApi('/schema-registry/subjects/$subjectName/');
4141
import React, { useEffect, useState } from 'react';
4242

4343
import { openDeleteModal, openPermanentDeleteModal } from './modals';
44+
import { parseSubjectContext } from './schema-context-utils';
4445
import { SchemaRegistryCapability } from '../../../protogen/redpanda/api/console/v1alpha1/authentication_pb';
4546
import { useGetIdentityQuery } from '../../../react-query/api/authentication';
4647
import {
@@ -93,11 +94,19 @@ const SchemaDetailsView: React.FC<{ subjectName: string }> = ({ subjectName: sub
9394

9495
// Update page title and breadcrumbs
9596
useEffect(() => {
97+
const parsed = parseSubjectContext(subjectNameRaw);
9698
uiState.pageTitle = subjectNameRaw;
9799
uiState.pageBreadcrumbs = [
98100
{ title: 'Schema Registry', linkTo: '/schema-registry' },
99101
{
100102
title: subjectNameRaw,
103+
titleNode:
104+
parsed.context !== 'default' ? (
105+
<>
106+
<span className="text-gray-400">:.{parsed.context}:</span>
107+
{parsed.displayName}
108+
</>
109+
) : undefined,
101110
linkTo: `/schema-registry/${encodeURIComponent(subjectNameRaw)}?version=${version}`,
102111
options: {
103112
canBeTruncated: true,
@@ -751,6 +760,7 @@ const SchemaReferences = (p: { subject: SchemaRegistrySubjectDetails; schema: Sc
751760
// Navigation uses encodeURIComponentPercents() instead of encodeURIComponent()
752761
// because schema subject names with periods/slashes cause URL parsing issues
753762
// in React Router. The special encoder replaces % with ﹪ to avoid conflicts.
763+
const parsed = parseSubjectContext(ref.subject);
754764
return (
755765
<ListItem key={ref.name + ref.subject + ref.version}>
756766
<Link
@@ -759,7 +769,8 @@ const SchemaReferences = (p: { subject: SchemaRegistrySubjectDetails; schema: Sc
759769
search={{ version: String(ref.version) }}
760770
to="/schema-registry/subjects/$subjectName"
761771
>
762-
{ref.subject}
772+
{parsed.context !== 'default' && <span className="text-gray-400">:.{parsed.context}:</span>}
773+
{parsed.displayName}
763774
</Link>
764775
</ListItem>
765776
);
@@ -786,6 +797,7 @@ const SchemaReferences = (p: { subject: SchemaRegistrySubjectDetails; schema: Sc
786797
// so this section was already displaying correctly. However, we use
787798
// encodeURIComponentPercents() for consistent navigation behavior
788799
// with the References section above.
800+
const parsed = parseSubjectContext(ref.subject);
789801
return (
790802
<ListItem key={ref.subject + ref.version}>
791803
<Link
@@ -794,7 +806,8 @@ const SchemaReferences = (p: { subject: SchemaRegistrySubjectDetails; schema: Sc
794806
search={{ version: String(ref.version) }}
795807
to="/schema-registry/subjects/$subjectName"
796808
>
797-
{ref.subject}
809+
{parsed.context !== 'default' && <span className="text-gray-400">:.{parsed.context}:</span>}
810+
{parsed.displayName}
798811
</Link>
799812
</ListItem>
800813
);

frontend/src/state/ui-state.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export type BreadcrumbOptions = {
3030

3131
export type BreadcrumbEntry = {
3232
title: string;
33+
titleNode?: React.ReactNode;
3334
heading?: string;
3435
linkTo: string;
3536
options?: BreadcrumbOptions;

0 commit comments

Comments
 (0)