From 90569192b75d63d28507bf745218b2a071258fc7 Mon Sep 17 00:00:00 2001 From: Joel Jacob Stephen <70131076+JoelJacobStephen@users.noreply.github.com> Date: Fri, 3 Mar 2023 19:26:34 +0530 Subject: [PATCH] feat: implementation of users module of the admin dashboard (#29) Co-authored-by: Anwarul Islam --- packages/hoppscotch-sh-admin/package.json | 4 +- .../hoppscotch-sh-admin/src/components.d.ts | 10 +- .../src/components/app/Header.vue | 4 +- .../src/components/app/Modal.vue | 6 +- .../src/components/app/Sidebar.vue | 13 +- .../src/components/app/Toast.vue | 28 + .../src/components/users/Details.vue | 108 ++++ .../src/composables/toast.ts | 3 + .../src/composables/usePagedQuery.ts | 63 +++ .../gql/mutations/InviteUserToSignIn.graphql | 5 + .../gql/mutations/MakeUserAdmin.graphql | 3 + .../backend/gql/mutations/UserInfo.graphql | 11 + .../gql/queries/GetCollectionChildren.graphql | 8 - .../backend/gql/queries/InvitedUsers.graphql | 10 + .../helpers/backend/gql/queries/Me.graphql | 9 - .../queries/RemoveUserAccountByAdmin.graphql | 3 + .../backend/gql/queries/UsersList.graphql | 11 + packages/hoppscotch-sh-admin/src/main.ts | 20 +- .../src/pages/dashboard.vue | 12 +- .../src/pages/users/AddUser.vue | 125 ----- .../src/pages/users/_id.vue | 153 ++++++ .../src/pages/users/details.vue | 126 ----- .../src/pages/users/index.vue | 496 +++++++++++------- .../src/pages/users/invited.vue | 203 ++----- packages/hoppscotch-sh-admin/vite.config.ts | 2 +- pnpm-lock.yaml | 11 +- 26 files changed, 797 insertions(+), 650 deletions(-) create mode 100644 packages/hoppscotch-sh-admin/src/components/app/Toast.vue create mode 100644 packages/hoppscotch-sh-admin/src/components/users/Details.vue create mode 100644 packages/hoppscotch-sh-admin/src/composables/toast.ts create mode 100644 packages/hoppscotch-sh-admin/src/composables/usePagedQuery.ts create mode 100644 packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/InviteUserToSignIn.graphql create mode 100644 packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/MakeUserAdmin.graphql create mode 100644 packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/UserInfo.graphql delete mode 100644 packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/GetCollectionChildren.graphql create mode 100644 packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/InvitedUsers.graphql delete mode 100644 packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/Me.graphql create mode 100644 packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/RemoveUserAccountByAdmin.graphql create mode 100644 packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/UsersList.graphql delete mode 100644 packages/hoppscotch-sh-admin/src/pages/users/AddUser.vue create mode 100644 packages/hoppscotch-sh-admin/src/pages/users/_id.vue delete mode 100644 packages/hoppscotch-sh-admin/src/pages/users/details.vue diff --git a/packages/hoppscotch-sh-admin/package.json b/packages/hoppscotch-sh-admin/package.json index db3751f20..b551f5804 100644 --- a/packages/hoppscotch-sh-admin/package.json +++ b/packages/hoppscotch-sh-admin/package.json @@ -12,12 +12,14 @@ }, "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", - "@hoppscotch/ui": "workspace:^", + "@hoppscotch/ui": "workspace:^0.0.1", + "@hoppscotch/vue-toasted": "^0.1.0", "@types/cors": "^2.8.13", "@types/express": "^4.17.15", "@urql/vue": "^1.0.4", "@vueuse/core": "^9.10.0", "cors": "^2.8.5", + "date-fns": "^2.29.3", "express": "^4.18.2", "express-graphql": "^0.12.0", "graphql": "^16.6.0", diff --git a/packages/hoppscotch-sh-admin/src/components.d.ts b/packages/hoppscotch-sh-admin/src/components.d.ts index f6b43a8b5..8bf86976e 100644 --- a/packages/hoppscotch-sh-admin/src/components.d.ts +++ b/packages/hoppscotch-sh-admin/src/components.d.ts @@ -10,14 +10,21 @@ declare module '@vue/runtime-core' { AppHeader: typeof import('./components/app/Header.vue')['default'] AppModal: typeof import('./components/app/Modal.vue')['default'] AppSidebar: typeof import('./components/app/Sidebar.vue')['default'] + AppToast: typeof import('./components/app/Toast.vue')['default'] ButtonPrimary: typeof import('./../../hoppscotch-ui/src/components/button/Primary.vue')['default'] ButtonSecondary: typeof import('./../../hoppscotch-ui/src/components/button/Secondary.vue')['default'] - HoppSmartExpand: typeof import('@hoppscotch/ui')['HoppSmartExpand'] + HoppButtonPrimary: typeof import('@hoppscotch/ui')['HoppButtonPrimary'] + HoppSmartConfirmModal: typeof import('@hoppscotch/ui')['HoppSmartConfirmModal'] + HoppSmartModal: typeof import('@hoppscotch/ui')['HoppSmartModal'] 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'] IconLucideLayoutDashboard: typeof import('~icons/lucide/layout-dashboard')['default'] IconLucideLineChart: typeof import('~icons/lucide/line-chart')['default'] IconLucideLock: typeof import('~icons/lucide/lock')['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'] @@ -47,6 +54,7 @@ declare module '@vue/runtime-core' { SmartWindow: typeof import('./../../hoppscotch-ui/src/components/smart/Window.vue')['default'] SmartWindows: typeof import('./../../hoppscotch-ui/src/components/smart/Windows.vue')['default'] TeamsAddMembers: typeof import('./components/teams/AddMembers.vue')['default'] + UsersDetails: typeof import('./components/users/Details.vue')['default'] } } diff --git a/packages/hoppscotch-sh-admin/src/components/app/Header.vue b/packages/hoppscotch-sh-admin/src/components/app/Header.vue index b9eaf6bd3..0d8c61f12 100644 --- a/packages/hoppscotch-sh-admin/src/components/app/Header.vue +++ b/packages/hoppscotch-sh-admin/src/components/app/Header.vue @@ -5,12 +5,12 @@
-
+
- -
- - -
- - -
- -
-
-
- - - - - - - -
- +
+ +
+
+

No Invited Users Found

+
+ +
- - + @@ -126,47 +35,34 @@ class="text-gray-600 dark:text-gray-300" > - - @@ -181,46 +77,17 @@ diff --git a/packages/hoppscotch-sh-admin/vite.config.ts b/packages/hoppscotch-sh-admin/vite.config.ts index c5eae879e..461b2cdba 100644 --- a/packages/hoppscotch-sh-admin/vite.config.ts +++ b/packages/hoppscotch-sh-admin/vite.config.ts @@ -13,7 +13,7 @@ import path from 'path'; export default defineConfig({ envDir: path.resolve(__dirname, "../../"), server: { - port: 3100, + port: 3000, }, plugins: [ vue(), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2d3c49646..4217996ef 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -642,7 +642,8 @@ importers: '@graphql-codegen/typescript-operations': 3.0.0 '@graphql-codegen/urql-introspection': 2.2.1 '@graphql-typed-document-node/core': ^3.1.1 - '@hoppscotch/ui': workspace:^ + '@hoppscotch/ui': workspace:^0.0.1 + '@hoppscotch/vue-toasted': ^0.1.0 '@types/cors': ^2.8.13 '@types/express': ^4.17.15 '@urql/vue': ^1.0.4 @@ -650,6 +651,7 @@ importers: '@vue/compiler-sfc': ^3.2.6 '@vueuse/core': ^9.10.0 cors: ^2.8.5 + date-fns: ^2.29.3 express: ^4.18.2 express-graphql: ^0.12.0 graphql: ^16.6.0 @@ -672,11 +674,13 @@ importers: dependencies: '@graphql-typed-document-node/core': 3.1.1_graphql@16.6.0 '@hoppscotch/ui': link:../hoppscotch-ui + '@hoppscotch/vue-toasted': 0.1.0_vue@3.2.45 '@types/cors': 2.8.13 '@types/express': 4.17.16 '@urql/vue': 1.0.4_graphql@16.6.0+vue@3.2.45 '@vueuse/core': 9.12.0_vue@3.2.45 cors: 2.8.5 + date-fns: 2.29.3 express: 4.18.2 express-graphql: 0.12.0_graphql@16.6.0 graphql: 16.6.0 @@ -10191,6 +10195,11 @@ packages: resolution: {integrity: sha512-8YnDaaf7N3k/q5HnTJVuzSyLETjoZjVmHc4AeKAzOvKHEFQKcn64OKBfzHYtE9zGjctNM7V9I0MfnUVLpi7M5g==} dev: true + /date-fns/2.29.3: + resolution: {integrity: sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==} + engines: {node: '>=0.11'} + dev: false + /de-indent/1.0.2: resolution: {integrity: sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==} dev: true
Admin ID Admin EmailInvitee Email Invited On
- - -
- - {{ user.adminId }} +
+
+ + {{ user?.adminUid }}
-
- {{ user.adminEmail }} +
+ {{ user?.adminEmail }}
-
-