Skip to content

Add appAuthorId and appAuthorOrgId for app-usage #1735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
35 changes: 33 additions & 2 deletions client/packages/lowcoder/src/pages/setting/appUsage/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export function AppUsageDashboard() {
isAnonymous: boolean;
details: Record<string, any>;
geolocationDataJsonb?: Record<string, any>,
applicationAuthor?: string;
applicationAuthorOrgId?: string;
};

const currentUser = useSelector(getUser);
Expand Down Expand Up @@ -253,13 +255,17 @@ export function AppUsageDashboard() {
const orgId = e.orgId;
const appId = e.appId;
const name = e.details?.applicationName ?? 'Unknown';
acc[appId] = acc[appId] || { appId, name, orgId, environmentId, count: 0 };
const applicationAuthor = e.applicationAuthor;
const applicationAuthorOrgId = e.applicationAuthorOrgId;
acc[appId] = acc[appId] || { appId, name, orgId, environmentId, applicationAuthor, applicationAuthorOrgId, count: 0 };
acc[appId].count++;
return acc;
}, {} as Record<string, {
appId: string, name: string,
orgId: string,
environmentId: string,
applicationAuthor?: string,
applicationAuthorOrgId?: string,
count: number
}>);
}, [allLogs]);
Expand Down Expand Up @@ -352,6 +358,22 @@ export function AppUsageDashboard() {
<a onClick={() => handleClickFilter("environmentId", text)}>{dataMap[text] ?? text}</a>
),
},
{
title: "App Author",
dataIndex: "applicationAuthor",
key: "applicationAuthor",
render: (text: string) => (
text ? <a onClick={() => handleClickFilter("appAuthor", text)}>{text}</a> : '-'
),
},
{
title: "App Author Org ID",
dataIndex: "applicationAuthorOrgId",
key: "applicationAuthorOrgId",
render: (text: string) => (
text ? <a onClick={() => handleClickFilter("appAuthorOrgId", text)}>{dataMap[text] ?? text}</a> : '-'
),
},
{
title: "Total Views",
dataIndex: "count",
Expand Down Expand Up @@ -380,7 +402,7 @@ export function AppUsageDashboard() {
const key = Object.keys(changedValue)[0];
if (key === "dateRange") {
handleDateChange(changedValue.dateRange);
} else if (["environmentId", "orgId", "userId", "appId"].includes(key)) {
} else if (["environmentId", "orgId", "userId", "appId", "appAuthor", "appAuthorOrgId"].includes(key)) {
handleInputChange(); // Debounced input change
} else {
// Avoid calling fetchLogs if `handleDateChange` already did
Expand Down Expand Up @@ -421,6 +443,15 @@ export function AppUsageDashboard() {
<Input placeholder="App ID" allowClear />
</Form.Item>
</Flex>

<Flex>
<Form.Item name="appAuthor">
<Input placeholder="App Author" allowClear />
</Form.Item>
<Form.Item name="appAuthorOrgId">
<Input placeholder="App Author Org ID" allowClear />
</Form.Item>
</Flex>
</Flex>
</Form>
</Card>
Expand Down
Loading