diff --git a/packages/hoppscotch-sh-admin/locales/en.json b/packages/hoppscotch-sh-admin/locales/en.json index 8ee46d30b..8920ee48b 100644 --- a/packages/hoppscotch-sh-admin/locales/en.json +++ b/packages/hoppscotch-sh-admin/locales/en.json @@ -19,6 +19,25 @@ "owner": "OWNER", "viewer": "VIEWER" }, + "shared_requests": { + "clear_filter": "Clear Filter", + "confirm_request_deletion": "Confirm deletion of the selected shared request?", + "copy": "Copy", + "created_on": "Created On", + "delete": "Delete", + "email": "Email", + "filter": "Filter", + "filter_by_email": "Filter by email", + "id": "ID", + "load_list_error": "Unable to load shared requests list", + "no_requests": "No shared requests found", + "open_request": "Open Request", + "properties": "Properties", + "request": "Request", + "show_more": "Show more", + "title": "Shared Requests", + "url": "URL" + }, "state": { "add_user_failure": "Failed to add user to the team!!", "add_user_success": "User is now a member of the team!!", @@ -31,8 +50,11 @@ "continue_github": "Continue with Github", "continue_google": "Continue with Google", "continue_microsoft": "Continue with Microsoft", + "copied_to_clipboard": "Copied to clipboard", "create_team_failure": "Failed to create team!!", "create_team_success": "Team created successfully!!", + "delete_request_failure": "Shared Request deletion failed!!", + "delete_request_success": "Shared Request deleted successfully!!", "delete_team_failure": "Team deletion failed!!", "delete_team_success": "Team deleted successfully!!", "delete_user_failure": "User deletion failed!!", @@ -128,10 +150,12 @@ "date": "Date", "delete": "Delete", "delete_user": "Delete User", + "details": "Details", "email": "Email", "email_address": "Email Address", "id": "User ID", "invalid_user": "Invalid User", + "invite_load_list_error": "Unable to Load Invited Users List", "invite_user": "Invite User", "invited_on": "Invited On", "invited_users": "Invited Users", @@ -139,9 +163,9 @@ "load_info_error": "Unable to load user info", "load_list_error": "Unable to Load Users List", "make_admin": "Make admin", - "invite_load_list_error": "Unable to Load Invited Users List", "name": "Name", "no_invite": "No invited users found", + "no_shared_requests": "No shared requests created by the user", "no_users": "No users found", "not_found": "User not found", "remove_admin_privilege": "Remove Admin Privilege", diff --git a/packages/hoppscotch-sh-admin/src/components.d.ts b/packages/hoppscotch-sh-admin/src/components.d.ts index 95dbd07cd..9e29af7b4 100644 --- a/packages/hoppscotch-sh-admin/src/components.d.ts +++ b/packages/hoppscotch-sh-admin/src/components.d.ts @@ -19,25 +19,22 @@ declare module '@vue/runtime-core' { HoppButtonPrimary: typeof import('@hoppscotch/ui')['HoppButtonPrimary'] HoppButtonSecondary: typeof import('@hoppscotch/ui')['HoppButtonSecondary'] HoppSmartAnchor: typeof import('@hoppscotch/ui')['HoppSmartAnchor'] - HoppSmartAutoComplete: typeof import('@hoppscotch/ui')['HoppSmartAutoComplete'] HoppSmartConfirmModal: typeof import('@hoppscotch/ui')['HoppSmartConfirmModal'] HoppSmartInput: typeof import('@hoppscotch/ui')['HoppSmartInput'] HoppSmartItem: typeof import('@hoppscotch/ui')['HoppSmartItem'] - HoppSmartModal: typeof import('@hoppscotch/ui')['HoppSmartModal'] HoppSmartPicture: typeof import('@hoppscotch/ui')['HoppSmartPicture'] - HoppSmartPlaceholder: typeof import('@hoppscotch/ui')['HoppSmartPlaceholder'] HoppSmartSpinner: typeof import('@hoppscotch/ui')['HoppSmartSpinner'] HoppSmartTab: typeof import('@hoppscotch/ui')['HoppSmartTab'] HoppSmartTable: typeof import('@hoppscotch/ui')['HoppSmartTable'] + HoppSmartTabs: typeof import('@hoppscotch/ui')['HoppSmartTabs'] IconLucideArrowLeft: typeof import('~icons/lucide/arrow-left')['default'] IconLucideChevronDown: typeof import('~icons/lucide/chevron-down')['default'] - IconLucideHelpCircle: typeof import('~icons/lucide/help-circle')['default'] IconLucideInbox: typeof import('~icons/lucide/inbox')['default'] + IconLucideUser: typeof import('~icons/lucide/user')['default'] SmartAnchor: typeof import('./../../hoppscotch-ui/src/components/smart/Anchor.vue')['default'] SmartAutoComplete: typeof import('./../../hoppscotch-ui/src/components/smart/AutoComplete.vue')['default'] SmartCheckbox: typeof import('./../../hoppscotch-ui/src/components/smart/Checkbox.vue')['default'] SmartConfirmModal: typeof import('./../../hoppscotch-ui/src/components/smart/ConfirmModal.vue')['default'] - SmartEnvInput: typeof import('./components/smart/EnvInput.vue')['default'] SmartExpand: typeof import('./../../hoppscotch-ui/src/components/smart/Expand.vue')['default'] SmartFileChip: typeof import('./../../hoppscotch-ui/src/components/smart/FileChip.vue')['default'] SmartInput: typeof import('./../../hoppscotch-ui/src/components/smart/Input.vue')['default'] @@ -66,7 +63,10 @@ declare module '@vue/runtime-core' { TeamsMembers: typeof import('./components/teams/Members.vue')['default'] TeamsPendingInvites: typeof import('./components/teams/PendingInvites.vue')['default'] Tippy: typeof import('vue-tippy')['Tippy'] + UiAutoResetIcon: typeof import('./components/ui/AutoResetIcon.vue')['default'] + UsersDetails: typeof import('./components/users/Details.vue')['default'] UsersInviteModal: typeof import('./components/users/InviteModal.vue')['default'] + UsersSharedRequests: typeof import('./components/users/SharedRequests.vue')['default'] } } diff --git a/packages/hoppscotch-sh-admin/src/components/ui/AutoResetIcon.vue b/packages/hoppscotch-sh-admin/src/components/ui/AutoResetIcon.vue new file mode 100644 index 000000000..89a72e9b5 --- /dev/null +++ b/packages/hoppscotch-sh-admin/src/components/ui/AutoResetIcon.vue @@ -0,0 +1,47 @@ + + + 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..3d26fa163 --- /dev/null +++ b/packages/hoppscotch-sh-admin/src/components/users/Details.vue @@ -0,0 +1,127 @@ + + + diff --git a/packages/hoppscotch-sh-admin/src/components/users/SharedRequests.vue b/packages/hoppscotch-sh-admin/src/components/users/SharedRequests.vue new file mode 100644 index 000000000..891ddb2d4 --- /dev/null +++ b/packages/hoppscotch-sh-admin/src/components/users/SharedRequests.vue @@ -0,0 +1,191 @@ + + + diff --git a/packages/hoppscotch-sh-admin/src/composables/usePagedQuery.ts b/packages/hoppscotch-sh-admin/src/composables/usePagedQuery.ts index 8e742a4bf..450749eb7 100644 --- a/packages/hoppscotch-sh-admin/src/composables/usePagedQuery.ts +++ b/packages/hoppscotch-sh-admin/src/composables/usePagedQuery.ts @@ -1,6 +1,6 @@ -import { TypedDocumentNode, useClientHandle } from '@urql/vue'; -import { DocumentNode } from 'graphql'; import { onMounted, ref } from 'vue'; +import { DocumentNode } from 'graphql'; +import { TypedDocumentNode, useClientHandle } from '@urql/vue'; export function usePagedQuery< Result, @@ -13,7 +13,6 @@ export function usePagedQuery< itemsPerPage: number, variables: Vars ) { - //Fetch All Users const { client } = useClientHandle(); const fetching = ref(true); const error = ref(false); @@ -23,16 +22,19 @@ export function usePagedQuery< const fetchNextPage = async () => { fetching.value = true; - try { - const result = await client - .query(query, { - ...variables, - take: itemsPerPage, - cursor: - list.value.length > 0 ? getCursor(list.value.at(-1)) : undefined, - }) - .toPromise(); + try { + const cursor = + list.value.length > 0 ? getCursor(list.value.at(-1)) : undefined; + const variablesForPagination = { + ...variables, + take: itemsPerPage, + cursor, + }; + + const result = await client + .query(query, variablesForPagination) + .toPromise(); const resultList = getList(result.data!); if (resultList.length < itemsPerPage) { @@ -43,8 +45,9 @@ export function usePagedQuery< currentPage.value++; } catch (e) { error.value = true; + } finally { + fetching.value = false; } - fetching.value = false; }; onMounted(async () => { diff --git a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/RevokeShortcodeByAdmin.graphql b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/RevokeShortcodeByAdmin.graphql new file mode 100644 index 000000000..5afe57089 --- /dev/null +++ b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/RevokeShortcodeByAdmin.graphql @@ -0,0 +1,3 @@ +mutation RevokeShortcodeByAdmin($codeID: ID!) { + revokeShortcodeByAdmin(code: $codeID) +} diff --git a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/SharedRequests.graphql b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/SharedRequests.graphql new file mode 100644 index 000000000..1bd8916a6 --- /dev/null +++ b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/SharedRequests.graphql @@ -0,0 +1,13 @@ +query SharedRequests($cursor: ID, $take: Int, $email: String) { + infra { + allShortcodes(cursor: $cursor, take: $take, userEmail: $email) { + id + request + properties + createdOn + creator { + email + } + } + } +} diff --git a/packages/hoppscotch-sh-admin/src/helpers/utils/clipboard.ts b/packages/hoppscotch-sh-admin/src/helpers/utils/clipboard.ts new file mode 100644 index 000000000..3d7944f8c --- /dev/null +++ b/packages/hoppscotch-sh-admin/src/helpers/utils/clipboard.ts @@ -0,0 +1,18 @@ +/** + * Copies a given string to the clipboard using + * the legacy exec method + * + * @param content The content to be copied + */ +export function copyToClipboard(content: string) { + if (navigator.clipboard) { + navigator.clipboard.writeText(content); + } else { + const dummy = document.createElement('textarea'); + document.body.appendChild(dummy); + dummy.value = content; + dummy.select(); + document.execCommand('copy'); + document.body.removeChild(dummy); + } +} diff --git a/packages/hoppscotch-sh-admin/src/pages/teams/index.vue b/packages/hoppscotch-sh-admin/src/pages/teams/index.vue index c89745fd9..3e793adf8 100644 --- a/packages/hoppscotch-sh-admin/src/pages/teams/index.vue +++ b/packages/hoppscotch-sh-admin/src/pages/teams/index.vue @@ -24,7 +24,7 @@ class="text-secondary border-b border-dividerDark text-sm text-left bg-primaryLight" > {{ t('teams.id') }} - {{ t('teams.name') }} + {{ t('teams.name') }} {{ t('teams.members') }} diff --git a/packages/hoppscotch-sh-admin/src/pages/users/_id.vue b/packages/hoppscotch-sh-admin/src/pages/users/_id.vue index f628e45ae..1e631c864 100644 --- a/packages/hoppscotch-sh-admin/src/pages/users/_id.vue +++ b/packages/hoppscotch-sh-admin/src/pages/users/_id.vue @@ -1,123 +1,42 @@