mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 06:07:17 +01:00
Fixed insights report.
This commit is contained in:
parent
d0e1912faf
commit
e068ac0dd9
6 changed files with 16 additions and 15 deletions
|
|
@ -37,10 +37,10 @@ export function InsightsTable() {
|
|||
width="100px"
|
||||
alignment="end"
|
||||
>
|
||||
{row => row.visitors.toLocaleString()}
|
||||
{row => row?.visitors?.toLocaleString()}
|
||||
</GridColumn>
|
||||
<GridColumn name="views" label={formatMessage(labels.views)} width="100px" alignment="end">
|
||||
{row => row.views.toLocaleString()}
|
||||
{row => row?.views?.toLocaleString()}
|
||||
</GridColumn>
|
||||
</GridTable>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -9,23 +9,23 @@ export function useFormat() {
|
|||
const { locale } = useLocale();
|
||||
const countryNames = useCountryNames(locale);
|
||||
|
||||
const formatBrowser = (value: string) => {
|
||||
const formatBrowser = (value: string): string => {
|
||||
return BROWSERS[value] || value;
|
||||
};
|
||||
|
||||
const formatCountry = (value: string) => {
|
||||
const formatCountry = (value: string): string => {
|
||||
return countryNames[value] || value;
|
||||
};
|
||||
|
||||
const formatRegion = (value: string) => {
|
||||
const formatRegion = (value: string): string => {
|
||||
return regions[value] ? regions[value] : value;
|
||||
};
|
||||
|
||||
const formatDevice = (value: string) => {
|
||||
const formatDevice = (value: string): string => {
|
||||
return formatMessage(labels[value] || labels.unknown);
|
||||
};
|
||||
|
||||
const formatValue = (value: string, type: string) => {
|
||||
const formatValue = (value: string, type: string): string => {
|
||||
switch (type) {
|
||||
case 'browser':
|
||||
return formatBrowser(value);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ const schema = {
|
|||
}),
|
||||
};
|
||||
|
||||
function convertFilters(filters) {
|
||||
function convertFilters(filters: any[]) {
|
||||
return filters.reduce((obj, { name, ...value }) => {
|
||||
obj[name] = value;
|
||||
|
||||
|
|
|
|||
|
|
@ -86,8 +86,9 @@ async function clickhouseQuery(
|
|||
).then(a => {
|
||||
return Object.values(a).map(a => {
|
||||
return {
|
||||
x: a.x,
|
||||
y: Number(a.y),
|
||||
...a,
|
||||
views: Number(a.views),
|
||||
visitors: Number(a.visitors),
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue