mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
display localized type in reports table
This commit is contained in:
parent
aa341d1dd2
commit
34d3d16641
@ -5,6 +5,7 @@ import { useMessages } from 'components/hooks';
|
|||||||
import useUser from 'components/hooks/useUser';
|
import useUser from 'components/hooks/useUser';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Button, Flexbox, Icon, Icons, Modal, Text } from 'react-basics';
|
import { Button, Flexbox, Icon, Icons, Modal, Text } from 'react-basics';
|
||||||
|
import { REPORT_TYPES } from 'lib/constants';
|
||||||
|
|
||||||
export function ReportsTable({
|
export function ReportsTable({
|
||||||
data = [],
|
data = [],
|
||||||
@ -34,6 +35,15 @@ export function ReportsTable({
|
|||||||
{ name: 'action', label: ' ' },
|
{ name: 'action', label: ' ' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const cellRender = (row, data, key) => {
|
||||||
|
if (key === 'type') {
|
||||||
|
return formatMessage(
|
||||||
|
labels[Object.keys(REPORT_TYPES).find(key => REPORT_TYPES[key] === row.type)],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return data[key];
|
||||||
|
};
|
||||||
|
|
||||||
const handleConfirm = () => {
|
const handleConfirm = () => {
|
||||||
onDelete(report.id);
|
onDelete(report.id);
|
||||||
};
|
};
|
||||||
@ -42,6 +52,7 @@ export function ReportsTable({
|
|||||||
<>
|
<>
|
||||||
<SettingsTable
|
<SettingsTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
|
cellRender={cellRender}
|
||||||
data={data}
|
data={data}
|
||||||
showSearch={true}
|
showSearch={true}
|
||||||
showPaging={true}
|
showPaging={true}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user