Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Update language. Resolve loading reports error.

Brian Cao5168cf2a1bc5
diff --git a/components/messages.js b/components/messages.js
index c00248107..fc88d4d34 100644
--- a/components/messages.js
+++ b/components/messages.js
@@ -243,15 +243,7 @@ export const messages = defineMessages({
},
noResultsFound: {
id: 'message.no-results-found',
- defaultMessage: 'No results were found.',
- },
- noWebsitesConfigured: {
- id: 'message.no-websites-configured',
- defaultMessage: 'You do not have any websites configured.',
- },
- noReportsConfigured: {
- id: 'message.no-reports-configured',
- defaultMessage: 'You do not have any reports configured.',
+ defaultMessage: 'No results found.',
},
noTeamWebsites: {
id: 'message.no-team-websites',
diff --git a/components/pages/reports/ReportsPage.js b/components/pages/reports/ReportsPage.js
index d63fc77fa..8fc569174 100644
--- a/components/pages/reports/ReportsPage.js
+++ b/components/pages/reports/ReportsPage.js
@@ -3,7 +3,7 @@ import Page from 'components/layout/Page';
import PageHeader from 'components/layout/PageHeader';
import { useMessages, useReports } from 'hooks';
import Link from 'next/link';
-import { Button, Flexbox, Icon, Icons, Text } from 'react-basics';
+import { Button, Icon, Icons, Text } from 'react-basics';
import ReportsTable from './ReportsTable';
export function ReportsPage() {
@@ -12,6 +12,7 @@ export function ReportsPage() {
reports,
error,
isLoading,
+ deleteReport,
filter,
handleFilterChange,
handlePageChange,
@@ -20,6 +21,10 @@ export function ReportsPage() {
const hasData = (reports && reports?.data.length !== 0) || filter;
+ const handleDelete = async id => {
+ await deleteReport(id);
+ };
+
return (
<Page loading={isLoading} error={error}>
<PageHeader title={formatMessage(labels.reports)}>
@@ -41,12 +46,13 @@ export function ReportsPage() {
onFilterChange={handleFilterChange}
onPageChange={handlePageChange}
onPageSizeChange={handlePageSizeChange}
+ onDelete={deleteReport}
filterValue={filter}
showDomain={true}
/>
)}
{!hasData && (
- <EmptyPlaceholder message={formatMessage(messages.noReportsConfigured)}></EmptyPlaceholder>
+ <EmptyPlaceholder message={formatMessage(messages.noDataAvailable)}></EmptyPlaceholder>
)}
</Page>
);
diff --git a/components/pages/reports/ReportsTable.js b/components/pages/reports/ReportsTable.js
index 39a35c960..98f5267a4 100644
--- a/components/pages/reports/ReportsTable.js
+++ b/components/pages/reports/ReportsTable.js
@@ -51,19 +51,15 @@ export function ReportsTable({
filterValue={filterValue}
>
{row => {
- const {
- id,
- userId: reportOwnerId,
- website: { domain, userId: websiteOwnerId },
- } = row;
+ const { id, userId: reportOwnerId, website } = row;
if (showDomain) {
- row.domain = domain;
+ row.domain = website.domain;
}
return (
<Flexbox gap={10}>
<LinkButton href={`/reports/${id}`}>{formatMessage(labels.view)}</LinkButton>
- {!showDomain || user.id === reportOwnerId || user.id === websiteOwnerId}
+ {!showDomain || user.id === reportOwnerId || user.id === website?.userId}
<Button onClick={() => setReport(row)}>
<Icon>
<Icons.Trash />
diff --git a/components/pages/settings/websites/WebsitesList.js b/components/pages/settings/websites/WebsitesList.js
index f99b2d6ec..d7748f272 100644
--- a/components/pages/settings/websites/WebsitesList.js
+++ b/components/pages/settings/websites/WebsitesList.js
@@ -68,7 +68,7 @@ export function WebsitesList({ showTeam, showHeader = true, includeTeams, onlyTe
/>
)}
{!hasData && (
- <EmptyPlaceholder message={formatMessage(messages.noWebsitesConfigured)}>
+ <EmptyPlaceholder message={formatMessage(messages.noDataAvailable)}>
{addButton}
</EmptyPlaceholder>
)}
diff --git a/components/pages/websites/WebsiteReportsPage.js b/components/pages/websites/WebsiteReportsPage.js
index 85a002e69..b04c50d1d 100644
--- a/components/pages/websites/WebsiteReportsPage.js
+++ b/components/pages/websites/WebsiteReportsPage.js
@@ -48,7 +48,7 @@ export function WebsiteReportsPage({ websiteId }) {
filterValue={filter}
/>
)}
- {!hasData && <EmptyPlaceholder message={formatMessage(messages.noReportsConfigured)} />}
+ {!hasData && <EmptyPlaceholder message={formatMessage(messages.noDataAvailable)} />}
</Page>
);
}