@@ -98,3 +98,12 @@ const activeClass =
const inactiveClass =
'border-gray-900 text-gray-500 hover:bg-gray-600 hover:bg-opacity-25 hover:text-gray-100';
+
+
diff --git a/packages/hoppscotch-sh-admin/src/components/app/Toast.vue b/packages/hoppscotch-sh-admin/src/components/app/Toast.vue
new file mode 100644
index 000000000..1a27e32fb
--- /dev/null
+++ b/packages/hoppscotch-sh-admin/src/components/app/Toast.vue
@@ -0,0 +1,28 @@
+
+
+ {{ message }}
+
+
+
+
diff --git a/packages/hoppscotch-sh-admin/src/components/users/Details.vue b/packages/hoppscotch-sh-admin/src/components/users/Details.vue
new file mode 100644
index 000000000..715aaebe9
--- /dev/null
+++ b/packages/hoppscotch-sh-admin/src/components/users/Details.vue
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
![]()
+
+
+
+
+ {{ user?.uid }}
+
+
+
+
+
+ {{ user?.displayName }}
+
+
+
+
+
+ {{ user?.email }}
+
+
+
+
+
+ {{ getCreatedDateAndTime(user?.createdOn) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/hoppscotch-sh-admin/src/composables/toast.ts b/packages/hoppscotch-sh-admin/src/composables/toast.ts
new file mode 100644
index 000000000..8611e474d
--- /dev/null
+++ b/packages/hoppscotch-sh-admin/src/composables/toast.ts
@@ -0,0 +1,3 @@
+import { useToasted } from '@hoppscotch/vue-toasted';
+
+export const useToast = useToasted;
diff --git a/packages/hoppscotch-sh-admin/src/composables/usePagedQuery.ts b/packages/hoppscotch-sh-admin/src/composables/usePagedQuery.ts
new file mode 100644
index 000000000..d9d8dae61
--- /dev/null
+++ b/packages/hoppscotch-sh-admin/src/composables/usePagedQuery.ts
@@ -0,0 +1,63 @@
+import { TypedDocumentNode, useClientHandle } from '@urql/vue';
+import { DocumentNode } from 'graphql';
+import { onMounted, ref } from 'vue';
+
+export function usePagedQuery<
+ Result,
+ Vars extends Record
,
+ ListItem
+>(
+ query: string | TypedDocumentNode | DocumentNode,
+ getList: (result: Result) => ListItem[],
+ getCursor: (value: ListItem) => string,
+ variables: Vars
+) {
+ //Fetch All Users
+ const { client } = useClientHandle();
+ const fetching = ref(true);
+ const error = ref(false);
+ const list = ref([]);
+ const currentPage = ref(1);
+
+ onMounted(async () => {
+ fetching.value = true;
+ try {
+ const result = await client.query(query, variables).toPromise();
+
+ const resultList = getList(result.data!);
+
+ list.value.push(...resultList);
+ } catch (e) {
+ error.value = true;
+ }
+ fetching.value = false;
+ });
+
+ const goToNextPage = async () => {
+ if (list.value.length % 20 === 0) {
+ fetching.value = true;
+ try {
+ const result = await client
+ .query(query, {
+ ...variables,
+ cursor: getCursor(list.value.at(-1)),
+ })
+ .toPromise();
+ const resultList = getList(result.data!);
+
+ list.value.push(...resultList);
+ currentPage.value++;
+ } catch (e) {
+ error.value = true;
+ }
+ fetching.value = false;
+ }
+ };
+
+ return {
+ fetching,
+ error,
+ goToNextPage,
+ list,
+ };
+}
diff --git a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/InviteUserToSignIn.graphql b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/InviteUserToSignIn.graphql
new file mode 100644
index 000000000..098e13f27
--- /dev/null
+++ b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/InviteUserToSignIn.graphql
@@ -0,0 +1,5 @@
+mutation InviteUserToSignIn($inviteeEmail: String!) {
+ inviteUserToSignin(inviteeEmail: $inviteeEmail) {
+ inviteeEmail
+ }
+}
diff --git a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/MakeUserAdmin.graphql b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/MakeUserAdmin.graphql
new file mode 100644
index 000000000..b1f948c0b
--- /dev/null
+++ b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/MakeUserAdmin.graphql
@@ -0,0 +1,3 @@
+mutation MakeUserAdmin($uid: String!) {
+ makeUserAdmin(userUID: $uid)
+}
diff --git a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/UserInfo.graphql b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/UserInfo.graphql
new file mode 100644
index 000000000..c94444ca3
--- /dev/null
+++ b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/UserInfo.graphql
@@ -0,0 +1,11 @@
+query UserInfo($uid: ID!) {
+ admin {
+ userInfo(userUid: $uid) {
+ uid
+ displayName
+ email
+ photoURL
+ createdOn
+ }
+ }
+}
diff --git a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/GetCollectionChildren.graphql b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/GetCollectionChildren.graphql
deleted file mode 100644
index 0dac0aa74..000000000
--- a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/GetCollectionChildren.graphql
+++ /dev/null
@@ -1,8 +0,0 @@
-query GetCollectionChildren($collectionID: ID!, $cursor: String) {
- collection(collectionID: $collectionID) {
- children(cursor: $cursor) {
- id
- title
- }
- }
-}
diff --git a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/InvitedUsers.graphql b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/InvitedUsers.graphql
new file mode 100644
index 000000000..8608eb008
--- /dev/null
+++ b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/InvitedUsers.graphql
@@ -0,0 +1,10 @@
+query InvitedUsers {
+ admin {
+ invitedUsers {
+ adminUid
+ adminEmail
+ inviteeEmail
+ invitedOn
+ }
+ }
+}
diff --git a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/Me.graphql b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/Me.graphql
deleted file mode 100644
index 0ebb2f444..000000000
--- a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/Me.graphql
+++ /dev/null
@@ -1,9 +0,0 @@
-query Me {
- me {
- uid
- displayName
- photoURL
- isAdmin
- createdOn
- }
-}
diff --git a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/RemoveUserAccountByAdmin.graphql b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/RemoveUserAccountByAdmin.graphql
new file mode 100644
index 000000000..61da38359
--- /dev/null
+++ b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/RemoveUserAccountByAdmin.graphql
@@ -0,0 +1,3 @@
+mutation RemoveUserAccountByAdmin($uid: String!) {
+ removeUserAccountByAdmin(userUID: $uid)
+}
diff --git a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/UsersList.graphql b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/UsersList.graphql
new file mode 100644
index 000000000..a07629d89
--- /dev/null
+++ b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/UsersList.graphql
@@ -0,0 +1,11 @@
+query UsersList($cursor: ID) {
+ admin {
+ allUsers(cursor: $cursor) {
+ uid
+ displayName
+ email
+ isAdmin
+ createdOn
+ }
+ }
+}
diff --git a/packages/hoppscotch-sh-admin/src/main.ts b/packages/hoppscotch-sh-admin/src/main.ts
index 3e9c28958..514d424cb 100644
--- a/packages/hoppscotch-sh-admin/src/main.ts
+++ b/packages/hoppscotch-sh-admin/src/main.ts
@@ -1,10 +1,17 @@
import { createApp } from 'vue';
import urql, { createClient } from '@urql/vue';
import App from './App.vue';
+import Toasted from '@hoppscotch/vue-toasted';
+import type { ToastOptions } from '@hoppscotch/vue-toasted';
+
+// STYLES
+import 'virtual:windi.css';
+import '@hoppscotch/vue-toasted/style.css';
+import '@hoppscotch/ui/style.css';
import '../assets/scss/themes.scss';
import '../assets/scss/styles.scss';
-import '@hoppscotch/ui/style.css';
-import 'virtual:windi.css';
+// END STYLES
+
import {
createRouter,
createWebHashHistory,
@@ -34,6 +41,15 @@ const app = createApp(App).use(
})
);
+// We are using a fork of Vue Toasted (github.com/clayzar/vue-toasted) which is a bit of
+// an untrusted fork, we will either want to make our own fork or move to a more stable one
+// The original Vue Toasted doesn't support Vue 3 and the OP has been irresponsive.
+app.use(Toasted, {
+ position: 'bottom-center',
+ duration: 3000,
+ keepOnHover: true,
+});
+
app.use(HoppUIPlugin, options);
app.use(
createRouter({
diff --git a/packages/hoppscotch-sh-admin/src/pages/dashboard.vue b/packages/hoppscotch-sh-admin/src/pages/dashboard.vue
index fee72ce44..5b6bee20c 100644
--- a/packages/hoppscotch-sh-admin/src/pages/dashboard.vue
+++ b/packages/hoppscotch-sh-admin/src/pages/dashboard.vue
@@ -1,12 +1,12 @@
-
+
Dashboard
-
-
+
+
-
+
-
+
-
+
diff --git a/packages/hoppscotch-sh-admin/src/pages/users/AddUser.vue b/packages/hoppscotch-sh-admin/src/pages/users/AddUser.vue
deleted file mode 100644
index dd31e1e00..000000000
--- a/packages/hoppscotch-sh-admin/src/pages/users/AddUser.vue
+++ /dev/null
@@ -1,125 +0,0 @@
-
-
- Add User
-
-
-
-
-
-
-
-
diff --git a/packages/hoppscotch-sh-admin/src/pages/users/_id.vue b/packages/hoppscotch-sh-admin/src/pages/users/_id.vue
new file mode 100644
index 000000000..0092b3dde
--- /dev/null
+++ b/packages/hoppscotch-sh-admin/src/pages/users/_id.vue
@@ -0,0 +1,153 @@
+
+
+
+
+ User Details
+
+
+
+
+
+
+
+
![]()
+
+
+
+
+
+
+
+ {{ user.uid }}
+
+
+
+
+
+ {{ user.displayName }}
+
+
+
+
+
+ {{ user.email }}
+
+
+
+
+
+ {{ getCreatedDateAndTime(user.createdOn) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/hoppscotch-sh-admin/src/pages/users/details.vue b/packages/hoppscotch-sh-admin/src/pages/users/details.vue
deleted file mode 100644
index 9bf062571..000000000
--- a/packages/hoppscotch-sh-admin/src/pages/users/details.vue
+++ /dev/null
@@ -1,126 +0,0 @@
-
-
-
- User Detail
-
-
-
-
-
-
-
-
-
-
- User Info
-
-
-
-
-
- Name:
-
-
- {{ user.name }}
-
-
-
-
-
- Username:
-
-
- {{ user.username }}
-
-
-
-
-
- Email:
-
-
- {{ user.email }}
-
-
-
-
-
- Password:
-
-
- {{ user.password }}
-
-
-
-
-
-
-
-
-
-
-
- Stats
-
-
-
-
-
- Role:
-
-
- {{ user.role }}
-
-
-
-
-
- Number of Teams:
-
-
10
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/hoppscotch-sh-admin/src/pages/users/index.vue b/packages/hoppscotch-sh-admin/src/pages/users/index.vue
index 6876213f8..c02875f90 100644
--- a/packages/hoppscotch-sh-admin/src/pages/users/index.vue
+++ b/packages/hoppscotch-sh-admin/src/pages/users/index.vue
@@ -6,260 +6,362 @@
Users
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Invite User
-
-
-
-
-
-
-
-
- Page 2 of 4
-
-
-
-
+
-
+
+
+
+ Unable to Load Users List..
+
+
- |
User ID |
- Sign-In Method |
-
- Email
- |
- Status |
+ Name |
+ Email |
Date |
+ |
- |
-
- |
-
+ |
- {{ user?.id }}
+ {{ user.uid }}
|
-
-
- {{ user?.signin }}
+
+
+ {{ user.displayName }}
+
+ Admin
+
+
+
+ -
+
+ Admin
+
|
- {{ user?.email }}
+ {{ user.email }}
|
-
- {{ user?.status }}
- |
-
-
-
- {{ user?.date }}
- 11:16 AM
+
+
+
+
+ {{ getCreatedDate(user.createdOn) }}
+
+ {{ getCreatedTime(user.createdOn) }}
+
+
+ |
+
+
+
+
+
+
+
+
+
|
| |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/hoppscotch-sh-admin/src/pages/users/invited.vue b/packages/hoppscotch-sh-admin/src/pages/users/invited.vue
index 8a611379c..ccdd9e7a3 100644
--- a/packages/hoppscotch-sh-admin/src/pages/users/invited.vue
+++ b/packages/hoppscotch-sh-admin/src/pages/users/invited.vue
@@ -10,113 +10,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Invite User
-
-
-
-
-
-
-
- Page 2 of 4
-
-
-
-
-
+
+
+
+
+
No Invited Users Found
+
+
+
- |
Admin ID |
Admin Email |
-
- Invitee Email
- |
+ Invitee Email |
Invited On |
@@ -126,47 +35,34 @@
class="text-gray-600 dark:text-gray-300"
>
- |
-
- |
-
-
-
- {{ user.adminId }}
+
+
+
+ {{ user?.adminUid }}
|
-
- {{ user.adminEmail }}
+
+ {{ user?.adminEmail }}
|
- {{ user.inviteeEmail }}
+ {{ user?.inviteeEmail }}
|
-
-
- {{ user.invitedOn }}
- 11:16 AM
+
+
+ {{ getCreatedDate(user?.invitedOn) }}
+
+ {{ getCreatedTime(user?.invitedOn) }}
+
-
|
|
@@ -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