Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ interface DashboardRowNameLink {

interface DashboardRow {
name: DashboardRowNameLink;
id: string;
tags: ReactNode;
project: string;
created: ReactNode;
Expand Down Expand Up @@ -166,6 +167,9 @@ const sortDashboardData = (
if (sortBy === rowFilter('name')) {
return [...data].sort((a, b) => localeCompareSort(a.name.label, b.name.label, direction));
}
if (sortBy === rowFilter('id')) {
return [...data].sort((a, b) => localeCompareSort(a.id, b.id, direction));
}
if (sortBy === rowFilter('project')) {
return [...data].sort((a, b) => localeCompareSort(a.project, b.project, direction));
}
Expand Down Expand Up @@ -216,7 +220,19 @@ const DashboardsTable: FC<DashboardsTableProps> = ({

const columnKeys = useMemo(
() => [
{ label: t('Dashboard'), key: rowFilter('name') },
{ label: t('Display Name'), key: rowFilter('name') },
{
label: t('Name'),
key: rowFilter('id'),
props: {
info: {
tooltip: t(
'This is the immutable, unique identifier for the dashboard. It cannot be changed after the dashboard is created.',
),
ariaLabel: t('More information on Dashboard ID'),
},
},
},
{ label: t('Project'), key: rowFilter('project') },
{ label: t('Tags'), key: rowFilter('tags') },
{ label: t('Created on'), key: rowFilter('created') },
Expand All @@ -233,7 +249,8 @@ const DashboardsTable: FC<DashboardsTableProps> = ({
}
return persesDashboards.map((board) => {
const metadata = board?.metadata;
const displayName = board?.spec?.display?.name || metadata?.name;
const id = metadata?.name;
const displayName = board?.spec?.display?.name || id;
const dashboardsParams = `?dashboard=${metadata?.name}&project=${metadata?.project}`;
const dashboardName: DashboardRowNameLink = {
link: (
Expand Down Expand Up @@ -263,6 +280,7 @@ const DashboardsTable: FC<DashboardsTableProps> = ({

return {
name: dashboardName,
id: id,
project: board?.metadata?.project || '',
tags: dashboardTags,
created: <Timestamp timestamp={metadata?.createdAt} />,
Expand Down Expand Up @@ -331,8 +349,9 @@ const DashboardsTable: FC<DashboardsTableProps> = ({
const pageRows: DataViewTr[] = useMemo(() => {
return sortedAndFilteredData
.slice((page - 1) * perPage, (page - 1) * perPage + perPage)
.map(({ name, project, tags, created, modified, dashboard }) => [
.map(({ name, id, project, tags, created, modified, dashboard }) => [
name.link,
id,
project,
tags,
created,
Expand Down