Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/components/ShardsTable/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ export const getPathColumn: GetShardsColumn = ({schemaPath = ''}) => {
name: TOP_SHARDS_COLUMNS_IDS.Path,
header: TOP_SHARDS_COLUMNS_TITLES.Path,
render: ({row}) => {
// row.Path - relative schema path
return <LinkToSchemaObject path={schemaPath + row.Path}>{row.Path}</LinkToSchemaObject>;
// row.RelativePath - relative schema path
return (
<LinkToSchemaObject path={schemaPath + row.RelativePath}>
{row.RelativePath}
</LinkToSchemaObject>
);
},
width: 300,
};
Expand All @@ -43,7 +47,12 @@ export const getTabletIdColumn: GetShardsColumn = () => {
if (!row.TabletId) {
return EMPTY_DATA_PLACEHOLDER;
}
return <TabletNameWrapper tabletId={row.TabletId} />;
return (
<TabletNameWrapper
tabletId={row.TabletId}
followerId={row.FollowerId || undefined}
/>
);
},
width: 220,
};
Expand Down
8 changes: 5 additions & 3 deletions src/components/TabletNameWrapper/TabletNameWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import i18n from './i18n';

interface TabletNameWrapperProps {
tabletId: string | number;
followerId?: string | number;
database?: string;
}

export function TabletNameWrapper({tabletId, database}: TabletNameWrapperProps) {
export function TabletNameWrapper({tabletId, followerId, database}: TabletNameWrapperProps) {
const isUserAllowedToMakeChanges = useIsUserAllowedToMakeChanges();

const tabletPath = getTabletPagePath(tabletId, {database});
const tabletPath = getTabletPagePath(tabletId, {database, followerId: followerId?.toString()});
const tabletName = `${tabletId}${followerId ? `.${followerId}` : ''}`;

return (
<CellWithPopover
Expand All @@ -37,7 +39,7 @@ export function TabletNameWrapper({tabletId, database}: TabletNameWrapperProps)
behavior={PopoverBehavior.Immediate}
>
<EntityStatus
name={tabletId.toString()}
name={tabletName}
path={tabletPath}
hasClipboardButton
showStatus={false}
Expand Down
10 changes: 6 additions & 4 deletions src/containers/Tablet/Tablet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ export function Tablet() {

const {id} = useParams<{id: string}>();

const [{database: queryDatabase, clusterName: queryClusterName}] =
const [{database: queryDatabase, clusterName: queryClusterName, followerId: queryFollowerId}] =
useQueryParams(tabletPageQueryParams);

const [autoRefreshInterval] = useAutoRefreshInterval();
const {currentData, isFetching, error} = tabletApi.useGetTabletQuery(
{id, database: queryDatabase ?? undefined},
{id, database: queryDatabase ?? undefined, followerId: queryFollowerId ?? undefined},
{pollingInterval: autoRefreshInterval},
);

Expand Down Expand Up @@ -131,7 +131,9 @@ function TabletContent({
history: ITabletPreparedHistoryItem[];
}) {
const isEmpty = !Object.keys(tablet).length;
const {Overall, HiveId} = tablet;
const {Overall, HiveId, FollowerId} = tablet;

const tabletName = `${id}${FollowerId ? `.${FollowerId}` : ''}`;

return (
<EmptyStateWrapper
Expand All @@ -143,7 +145,7 @@ function TabletContent({
<EntityPageTitle
entityName={i18n('tablet.header')}
status={Overall ?? EFlag.Grey}
id={id}
id={tabletName}
/>
<TabletControls tablet={tablet} />
<TabletInfo tablet={tablet} />
Expand Down
8 changes: 7 additions & 1 deletion src/containers/Tablets/TabletsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ function getColumns({database}: {database?: string}) {
return EMPTY_DATA_PLACEHOLDER;
}

return <TabletNameWrapper tabletId={row.TabletId} database={database} />;
return (
<TabletNameWrapper
tabletId={row.TabletId}
database={database}
followerId={row.FollowerId || undefined}
/>
);
},
},
{
Expand Down
1 change: 1 addition & 0 deletions src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export const tabletPageQueryParams = {
database: StringParam,
clusterName: StringParam,
activeTab: StringParam,
followerId: StringParam,
} as const;

type TabletPageQuery = QueryParamsTypeFromQueryObject<typeof tabletPageQueryParams>;
Expand Down
8 changes: 2 additions & 6 deletions src/store/reducers/shardsWorkload/shardsWorkload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,14 @@ LIMIT 20`;
}

function createShardQueryImmediate(path: string, database: string, sortOrder?: SortOrder[]) {
const pathSelect = `CAST(SUBSTRING(CAST(Path AS String), ${database.length}) AS Utf8) AS Path`;
const pathSelect = `CAST(SUBSTRING(CAST(Path AS String), ${database.length}) AS Utf8) AS RelativePath`;

const orderBy = prepareOrderByFromTableSort(sortOrder);

return `${QUERY_TECHNICAL_MARK}
SELECT
${pathSelect},
TabletId,
CPUCores,
DataSize,
NodeId,
InFlightTxCount
\`.sys/partition_stats\`.*
FROM \`.sys/partition_stats\`
WHERE
Path='${path}'
Expand Down
14 changes: 11 additions & 3 deletions src/store/reducers/tablet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ export const tabletApi = api.injectEndpoints({
endpoints: (build) => ({
getTablet: build.query({
queryFn: async (
{id, database}: {id: string; database?: string; nodeId?: string},
{
id,
database,
followerId,
}: {id: string; database?: string; nodeId?: string; followerId?: string},
{signal},
) => {
try {
Expand Down Expand Up @@ -50,8 +54,12 @@ export const tabletApi = api.injectEndpoints({
}, []);

const {TabletStateInfo = []} = tabletResponseData;
const [tabletData = {}] = TabletStateInfo;
const {TabletId} = tabletData;
const tabletData =
followerId === undefined
? TabletStateInfo.find((t) => t.Leader)
: TabletStateInfo.find((t) => t.FollowerId?.toString() === followerId);

const {TabletId} = tabletData || {};

return {data: {id: TabletId, data: tabletData, history: historyData}};
} catch (error) {
Expand Down
Loading