Skip to content

Commit 27f7498

Browse files
committed
Add translations
Update Name of DashboardListPage
1 parent be8bd6c commit 27f7498

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

web/src/components/dashboards/perses/dashboard-list-page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const queryClient = new QueryClient({
1313
},
1414
});
1515

16-
const MonitoringDashboardListPage: FC = () => {
16+
const DashboardListPage: FC = () => {
1717
return (
1818
<QueryParamProvider adapter={ReactRouter5Adapter}>
1919
<QueryClientProvider client={queryClient}>
@@ -23,4 +23,4 @@ const MonitoringDashboardListPage: FC = () => {
2323
);
2424
};
2525

26-
export default MonitoringDashboardListPage;
26+
export default DashboardListPage;

web/src/components/dashboards/perses/dashboard-list.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ interface DashboardRowFilters {
4242
'project-filter'?: string;
4343
}
4444

45-
const DASHBOARD_COLUMNS = [
46-
{ label: 'Dashboard', key: 'name' as keyof DashboardRow, index: 0 },
47-
{ label: 'Project', key: 'project' as keyof DashboardRow, index: 1 },
48-
{ label: 'Created on', key: 'created' as keyof DashboardRow, index: 2 },
49-
{ label: 'Last Modified', key: 'modified' as keyof DashboardRow, index: 3 },
50-
];
51-
5245
const sortDashboardData = (
5346
data: DashboardRow[],
5447
sortBy: keyof DashboardRow | undefined,
@@ -101,10 +94,18 @@ const DashboardsTable: React.FunctionComponent<DashboardsTableProps> = ({
10194
const pagination = useDataViewPagination({ perPage: perPageOptions[0].value });
10295
const { page, perPage } = pagination;
10396

104-
const sortByIndex = useMemo(
105-
() => DASHBOARD_COLUMNS.findIndex((item) => item.key === sortBy),
106-
[sortBy],
97+
const DASHBOARD_COLUMNS = useMemo(
98+
() => [
99+
{ label: t('Dashboard'), key: 'name' as keyof DashboardRow, index: 0 },
100+
{ label: t('Project'), key: 'project' as keyof DashboardRow, index: 1 },
101+
{ label: t('Created on'), key: 'created' as keyof DashboardRow, index: 2 },
102+
{ label: t('Last Modified'), key: 'modified' as keyof DashboardRow, index: 3 },
103+
],
104+
[t],
107105
);
106+
const sortByIndex = useMemo(() => {
107+
return DASHBOARD_COLUMNS.findIndex((item) => item.key === sortBy);
108+
}, [DASHBOARD_COLUMNS, sortBy]);
108109

109110
const getSortParams = (columnIndex: number): ThProps['sort'] => ({
110111
sortBy: {
@@ -195,11 +196,15 @@ const DashboardsTable: React.FunctionComponent<DashboardsTableProps> = ({
195196
pagination={<PaginationTool />}
196197
filters={
197198
<DataViewFilters onChange={(_e, values) => onSetFilters(values)} values={filters}>
198-
<DataViewTextFilter filterId="name" title="Name" placeholder="Filter by name" />
199+
<DataViewTextFilter
200+
filterId="name"
201+
title={t('Name')}
202+
placeholder={t('Filter by name')}
203+
/>
199204
<DataViewTextFilter
200205
filterId="project-filter"
201-
title="Project"
202-
placeholder="Filter by project"
206+
title={t('Project')}
207+
placeholder={t('Filter by project')}
203208
/>
204209
</DataViewFilters>
205210
}

web/src/components/dashboards/perses/project/ProjectBar.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ export const ProjectBar: FC<ProjectBarProps> = ({ setActiveProject, activeProjec
2020
onSelect={(event, newProject) => {
2121
const params = new URLSearchParams();
2222
if (newProject === '') {
23-
const url = `${getDashboardsListUrl(perspective)}?${params.toString()}`;
24-
navigate(url);
2523
setActiveProject(null);
2624
} else {
2725
params.set('project', newProject);
28-
const url = `${getDashboardsListUrl(perspective)}?${params.toString()}`;
29-
navigate(url);
3026
setActiveProject(newProject);
3127
}
28+
const url = `${getDashboardsListUrl(perspective)}?${params.toString()}`;
29+
navigate(url);
3230
}}
3331
selected={activeProject || ''}
3432
shortCut={KEYBOARD_SHORTCUTS.focusNamespaceDropdown}

0 commit comments

Comments
 (0)