Skip to content

feat(site): display user status counts over time as an indicator of license usage #15893

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

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
69e4a09
add user_status_changes table
SasSwart Dec 14, 2024
0913355
add GetUserStatusCountsByDay
SasSwart Dec 14, 2024
d952af0
rename unused variable
SasSwart Dec 14, 2024
34ac634
Test GetUserStatusCountsByDay
SasSwart Dec 17, 2024
d5d3021
make gen
SasSwart Dec 17, 2024
c6b50af
fix dbauthz tests
SasSwart Dec 17, 2024
b2fb346
do the plumbing to get sql, api and frontend talking to one another
SasSwart Dec 23, 2024
ad42c16
rename migration
SasSwart Dec 23, 2024
ed86820
move aggregation logic for GetUserStatusChanges into the SQL
SasSwart Dec 24, 2024
0f17038
use window functions for efficiency
SasSwart Dec 24, 2024
1b3976d
ensure we use the same time zone as the start_time param
SasSwart Dec 24, 2024
e2d0d15
ensure we use the same time zone as the start_time param
SasSwart Dec 24, 2024
7fdd9a5
Merge remote-tracking branch 'origin/main' into jjs/dau-history
SasSwart Dec 24, 2024
aed4132
make gen
SasSwart Dec 24, 2024
9c65856
update field names and fix tests
SasSwart Dec 24, 2024
d6c5a4f
exclude deleted users from the user status graph
SasSwart Dec 27, 2024
d1c5baf
Merge remote-tracking branch 'origin/main' into jjs/dau-history
SasSwart Dec 30, 2024
fa66382
GetUserStatusChanges now passes all querier tests
SasSwart Jan 2, 2025
a8c125c
renumber migrations
SasSwart Jan 2, 2025
726bcba
add partial fixture for CI
SasSwart Jan 3, 2025
8bcbe03
fix migration numbers
SasSwart Jan 3, 2025
494f165
rename and document sql function
SasSwart Jan 3, 2025
dbebf0b
revert backend changes for now. so that we can review and merge the d…
SasSwart Jan 3, 2025
e85bc1f
Merge remote-tracking branch 'origin/main' into jjs/dau-history-backend
SasSwart Jan 3, 2025
e738a0e
make gen
SasSwart Jan 3, 2025
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
Prev Previous commit
Next Next commit
revert backend changes for now. so that we can review and merge the d…
…b side
  • Loading branch information
SasSwart committed Jan 3, 2025
commit dbebf0b820aaa9d42a65fd707dec05b76f68bde0
8 changes: 8 additions & 0 deletions site/.storybook/preview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ export const parameters = {
},
type: "tablet",
},
iphone12: {
name: "iPhone 12",
styles: {
height: "844px",
width: "390px",
},
type: "mobile",
},
terminal: {
name: "Terminal",
styles: {
Expand Down
21 changes: 10 additions & 11 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"update-emojis": "cp -rf ./node_modules/emoji-datasource-apple/img/apple/64/* ./static/emojis"
},
"dependencies": {
"@alwaysmeticulous/recorder-loader": "2.137.0",
"@emoji-mart/data": "1.2.1",
"@emoji-mart/react": "1.1.1",
"@emotion/cache": "11.14.0",
Expand All @@ -45,15 +44,15 @@
"@fontsource-variable/inter": "5.0.15",
"@fontsource/ibm-plex-mono": "5.1.0",
"@monaco-editor/react": "4.6.0",
"@mui/icons-material": "5.16.7",
"@mui/lab": "5.0.0-alpha.173",
"@mui/material": "5.16.7",
"@mui/system": "5.16.7",
"@mui/utils": "5.16.6",
"@mui/x-tree-view": "7.18.0",
"@mui/icons-material": "5.16.13",
"@mui/lab": "5.0.0-alpha.175",
"@mui/material": "5.16.13",
"@mui/system": "5.16.13",
"@mui/utils": "5.16.13",
"@mui/x-tree-view": "7.23.2",
"@radix-ui/react-avatar": "1.1.2",
"@radix-ui/react-collapsible": "1.1.2",
"@radix-ui/react-dialog": "1.1.2",
"@radix-ui/react-dialog": "1.1.4",
"@radix-ui/react-dropdown-menu": "2.1.4",
"@radix-ui/react-label": "2.1.0",
"@radix-ui/react-popover": "1.1.3",
Expand Down Expand Up @@ -103,7 +102,7 @@
"react-markdown": "9.0.1",
"react-query": "npm:@tanstack/react-query@4.35.3",
"react-router-dom": "6.26.2",
"react-syntax-highlighter": "15.5.0",
"react-syntax-highlighter": "15.6.1",
"react-virtualized-auto-sizer": "1.0.24",
"react-window": "1.8.10",
"remark-gfm": "4.0.0",
Expand Down Expand Up @@ -131,7 +130,7 @@
"@storybook/addon-links": "8.4.6",
"@storybook/addon-mdx-gfm": "8.4.6",
"@storybook/addon-themes": "8.4.6",
"@storybook/preview-api": "8.4.6",
"@storybook/preview-api": "8.4.7",
"@storybook/react": "8.4.6",
"@storybook/react-vite": "8.4.6",
"@storybook/test": "8.4.6",
Expand All @@ -147,7 +146,7 @@
"@types/file-saver": "2.0.7",
"@types/jest": "29.5.14",
"@types/lodash": "4.17.13",
"@types/node": "20.17.6",
"@types/node": "20.17.11",
"@types/react": "18.3.12",
"@types/react-color": "3.0.12",
"@types/react-date-range": "1.4.4",
Expand Down
645 changes: 294 additions & 351 deletions site/pnpm-lock.yaml

Large diffs are not rendered by default.

13 changes: 0 additions & 13 deletions site/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2097,19 +2097,6 @@ class ApiMethods {
return response.data;
};

getInsightsUserStatusCountsOverTime = async (
offset = Math.trunc(new Date().getTimezoneOffset() / 60),
): Promise<TypesGen.GetUserStatusCountsOverTimeResponse> => {
const searchParams = new URLSearchParams({
offset: offset.toString(),
});
const response = await this.axios.get(
`/api/v2/insights/user-status-counts-over-time?${searchParams}`,
);

return response.data;
};

getHealth = async (force = false) => {
const params = new URLSearchParams({ force: force.toString() });
const response = await this.axios.get<TypesGen.HealthcheckReport>(
Expand Down
7 changes: 0 additions & 7 deletions site/src/api/queries/insights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,3 @@ export const insightsUserActivity = (params: InsightsParams) => {
queryFn: () => API.getInsightsUserActivity(params),
};
};

export const userStatusCountsOverTime = () => {
return {
queryKey: ["userStatusCountsOverTime"],
queryFn: () => API.getInsightsUserStatusCountsOverTime(),
};
};
1 change: 1 addition & 0 deletions site/src/api/queries/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type {
UpdateUserProfileRequest,
User,
UsersRequest,
ValidateUserPasswordRequest,
} from "api/typesGenerated";
import {
type MetadataState,
Expand Down
26 changes: 2 additions & 24 deletions site/src/api/typesGenerated.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 8 additions & 61 deletions site/src/components/ActiveUserChart/ActiveUserChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,14 @@ const meta: Meta<typeof ActiveUserChart> = {
title: "components/ActiveUserChart",
component: ActiveUserChart,
args: {
series: [
{
label: "Daily",
data: [
{ date: "1/1/2024", amount: 5 },
{ date: "1/2/2024", amount: 6 },
{ date: "1/3/2024", amount: 7 },
{ date: "1/4/2024", amount: 8 },
{ date: "1/5/2024", amount: 9 },
{ date: "1/6/2024", amount: 10 },
{ date: "1/7/2024", amount: 11 },
],
},
data: [
{ date: "1/1/2024", amount: 5 },
{ date: "1/2/2024", amount: 6 },
{ date: "1/3/2024", amount: 7 },
{ date: "1/4/2024", amount: 8 },
{ date: "1/5/2024", amount: 9 },
{ date: "1/6/2024", amount: 10 },
{ date: "1/7/2024", amount: 11 },
],
interval: "day",
},
Expand All @@ -27,51 +22,3 @@ export default meta;
type Story = StoryObj<typeof ActiveUserChart>;

export const Example: Story = {};

export const MultipleSeries: Story = {
args: {
series: [
{
label: "Active",
data: [
{ date: "1/1/2024", amount: 150 },
{ date: "1/2/2024", amount: 165 },
{ date: "1/3/2024", amount: 180 },
{ date: "1/4/2024", amount: 155 },
{ date: "1/5/2024", amount: 190 },
{ date: "1/6/2024", amount: 200 },
{ date: "1/7/2024", amount: 210 },
],
color: "green",
},
{
label: "Dormant",
data: [
{ date: "1/1/2024", amount: 80 },
{ date: "1/2/2024", amount: 82 },
{ date: "1/3/2024", amount: 85 },
{ date: "1/4/2024", amount: 88 },
{ date: "1/5/2024", amount: 90 },
{ date: "1/6/2024", amount: 92 },
{ date: "1/7/2024", amount: 95 },
],
color: "grey",
},
{
label: "Suspended",
data: [
{ date: "1/1/2024", amount: 20 },
{ date: "1/2/2024", amount: 22 },
{ date: "1/3/2024", amount: 25 },
{ date: "1/4/2024", amount: 23 },
{ date: "1/5/2024", amount: 28 },
{ date: "1/6/2024", amount: 30 },
{ date: "1/7/2024", amount: 32 },
],
color: "red",
},
],
interval: "day",
userLimit: 100,
},
};
Loading