From c611b39f52469e599fa61082941b83227264e078 Mon Sep 17 00:00:00 2001 From: Joel Jacob Stephen <70131076+JoelJacobStephen@users.noreply.github.com> Date: Mon, 20 Mar 2023 19:26:03 +0530 Subject: [PATCH] feat: introducing metrics to admin dashboard homepage (#47) --- .../hoppscotch-sh-admin/src/components.d.ts | 15 ++++ .../backend/gql/queries/Metrics.graphql | 8 ++ .../src/pages/dashboard.vue | 73 +++++++++++++------ 3 files changed, 72 insertions(+), 24 deletions(-) create mode 100644 packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/Metrics.graphql diff --git a/packages/hoppscotch-sh-admin/src/components.d.ts b/packages/hoppscotch-sh-admin/src/components.d.ts index 963c86ccd..66d312765 100644 --- a/packages/hoppscotch-sh-admin/src/components.d.ts +++ b/packages/hoppscotch-sh-admin/src/components.d.ts @@ -28,6 +28,21 @@ declare module '@vue/runtime-core' { IconLucideSidebarClose: typeof import('~icons/lucide/sidebar-close')['default'] IconLucideSidebarOpen: typeof import('~icons/lucide/sidebar-open')['default'] IconLucideUser: typeof import('~icons/lucide/user')['default'] + IconLucideBell: typeof import('~icons/lucide/bell')['default'] + IconLucideChevronDown: typeof import('~icons/lucide/chevron-down')['default'] + IconLucideChevronLeft: typeof import('~icons/lucide/chevron-left')['default'] + IconLucideChevronRight: typeof import('~icons/lucide/chevron-right')['default'] + IconLucideFolderTree: typeof import('~icons/lucide/folder-tree')['default'] + IconLucideInbox: typeof import('~icons/lucide/inbox')['default'] + IconLucideLayoutDashboard: typeof import('~icons/lucide/layout-dashboard')['default'] + IconLucideLineChart: typeof import('~icons/lucide/line-chart')['default'] + IconLucideMenu: typeof import('~icons/lucide/menu')['default'] + IconLucideMoreHorizontal: typeof import('~icons/lucide/more-horizontal')['default'] + IconLucideSettings: typeof import('~icons/lucide/settings')['default'] + IconLucideSidebarClose: typeof import('~icons/lucide/sidebar-close')['default'] + IconLucideSidebarOpen: typeof import('~icons/lucide/sidebar-open')['default'] + IconLucideUser: typeof import('~icons/lucide/user')['default'] + IconLucideUserCog: typeof import('~icons/lucide/user-cog')['default'] IconLucideUsers: typeof import('~icons/lucide/users')['default'] ProfilePicture: typeof import('./components/profile/Picture.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/Metrics.graphql b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/Metrics.graphql new file mode 100644 index 000000000..b75020167 --- /dev/null +++ b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/Metrics.graphql @@ -0,0 +1,8 @@ +query Metrics { + admin { + usersCount + teamsCount + teamRequestsCount + teamCollectionsCount + } +} diff --git a/packages/hoppscotch-sh-admin/src/pages/dashboard.vue b/packages/hoppscotch-sh-admin/src/pages/dashboard.vue index fa7b6c548..af9bbba75 100644 --- a/packages/hoppscotch-sh-admin/src/pages/dashboard.vue +++ b/packages/hoppscotch-sh-admin/src/pages/dashboard.vue @@ -2,62 +2,87 @@

Dashboard

-
-
+
+ +
+
+

No Metrics Found..

+
+ +
+
- + -
-

1000

-
Total Users
+
+

+ {{ metrics?.usersCount }} +

+
Total Users
- + -
-

200

-
Total Teams
+
+

+ {{ metrics?.teamsCount }} +

+
Total Teams
- + -
-

20

-
Total Requests
+
+

+ {{ metrics?.teamRequestsCount }} +

+
Total Requests
- + -
-

215

-
Total Collections
+
+

+ {{ metrics?.teamCollectionsCount }} +

+
+ Total Collections +
- -
+ +