fix: modified graphql files in dashboard users and teams module to match resolver changes (#50)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
committed by
GitHub
parent
3df0492275
commit
5164315243
16
packages/hoppscotch-sh-admin/src/components.d.ts
vendored
16
packages/hoppscotch-sh-admin/src/components.d.ts
vendored
@@ -13,22 +13,6 @@ declare module '@vue/runtime-core' {
|
||||
AppModal: typeof import('./components/app/Modal.vue')['default']
|
||||
AppSidebar: typeof import('./components/app/Sidebar.vue')['default']
|
||||
AppToast: typeof import('./components/app/Toast.vue')['default']
|
||||
HoppButtonPrimary: typeof import('@hoppscotch/ui')['HoppButtonPrimary']
|
||||
HoppButtonSecondary: typeof import('@hoppscotch/ui')['HoppButtonSecondary']
|
||||
HoppSmartAnchor: typeof import('@hoppscotch/ui')['HoppSmartAnchor']
|
||||
HoppSmartConfirmModal: typeof import('@hoppscotch/ui')['HoppSmartConfirmModal']
|
||||
HoppSmartItem: typeof import('@hoppscotch/ui')['HoppSmartItem']
|
||||
IconLucideChevronDown: typeof import('~icons/lucide/chevron-down')['default']
|
||||
IconLucideChevronLeft: typeof import('~icons/lucide/chevron-left')['default']
|
||||
IconLucideChevronRight: typeof import('~icons/lucide/chevron-right')['default']
|
||||
IconLucideInbox: typeof import('~icons/lucide/inbox')['default']
|
||||
IconLucideLayoutDashboard: typeof import('~icons/lucide/layout-dashboard')['default']
|
||||
IconLucideMenu: typeof import('~icons/lucide/menu')['default']
|
||||
IconLucideMoreHorizontal: typeof import('~icons/lucide/more-horizontal')['default']
|
||||
IconLucideSidebarClose: typeof import('~icons/lucide/sidebar-close')['default']
|
||||
IconLucideSidebarOpen: typeof import('~icons/lucide/sidebar-open')['default']
|
||||
IconLucideUser: typeof import('~icons/lucide/user')['default']
|
||||
IconLucideUsers: typeof import('~icons/lucide/users')['default']
|
||||
ProfilePicture: typeof import('./components/profile/Picture.vue')['default']
|
||||
TeamsAddMembers: typeof import('./components/teams/AddMembers.vue')['default']
|
||||
TeamsDetails: typeof import('./components/teams/Details.vue')['default']
|
||||
|
||||
@@ -10,6 +10,7 @@ export function usePagedQuery<
|
||||
query: string | TypedDocumentNode<Result, Vars> | DocumentNode,
|
||||
getList: (result: Result) => ListItem[],
|
||||
getCursor: (value: ListItem) => string,
|
||||
itemsPerPage: number,
|
||||
variables: Vars
|
||||
) {
|
||||
//Fetch All Users
|
||||
@@ -26,6 +27,7 @@ export function usePagedQuery<
|
||||
const result = await client
|
||||
.query(query, {
|
||||
...variables,
|
||||
take: itemsPerPage,
|
||||
cursor:
|
||||
list.value.length > 0 ? getCursor(list.value.at(-1)) : undefined,
|
||||
})
|
||||
@@ -33,7 +35,7 @@ export function usePagedQuery<
|
||||
|
||||
const resultList = getList(result.data!);
|
||||
|
||||
if (resultList.length < 20) {
|
||||
if (resultList.length < itemsPerPage) {
|
||||
hasNextPage.value = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
mutation CreateTeam($userUid: String!, $name: String!) {
|
||||
mutation CreateTeam($userUid: ID!, $name: String!) {
|
||||
createTeamByAdmin(userUid: $userUid, name: $name) {
|
||||
id
|
||||
name
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
mutation InviteNewUser($inviteeEmail: String!) {
|
||||
inviteNewUser(inviteeEmail: $inviteeEmail) {
|
||||
inviteeEmail
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
mutation InviteUserToSignIn($inviteeEmail: String!) {
|
||||
inviteUserToSignin(inviteeEmail: $inviteeEmail) {
|
||||
inviteeEmail
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
mutation MakeUserAdmin($uid: String!) {
|
||||
mutation MakeUserAdmin($uid: ID!) {
|
||||
makeUserAdmin(userUID: $uid)
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
mutation RemoveUserAccountByAdmin($uid: String!) {
|
||||
removeUserAccountByAdmin(userUID: $uid)
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
mutation RemoveUserAsAdmin($uid: String!) {
|
||||
mutation RemoveUserAsAdmin($uid: ID!) {
|
||||
removeUserAsAdmin(userUID: $uid)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
mutation RemoveUserByAdmin($uid: ID!) {
|
||||
removeUserByAdmin(userUID: $uid)
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
query Me {
|
||||
me {
|
||||
uid
|
||||
displayName
|
||||
photoURL
|
||||
isAdmin
|
||||
createdOn
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
query UsersList($cursor: ID) {
|
||||
# Write your query or mutation here
|
||||
query UsersList($cursor: ID, $take: Int) {
|
||||
admin {
|
||||
allUsers(cursor: $cursor) {
|
||||
allUsers(cursor: $cursor, take: $take) {
|
||||
uid
|
||||
displayName
|
||||
email
|
||||
isAdmin
|
||||
photoURL
|
||||
createdOn
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ const addTeam = async () => {
|
||||
|
||||
if (data) {
|
||||
name.value = '';
|
||||
goToTeamDetailsPage(data.createATeamByAdmin.id);
|
||||
goToTeamDetailsPage(data.createTeamByAdmin.id);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
</td>
|
||||
|
||||
<td
|
||||
class="sm:p-3 py-2 px-1 md:table-cell hidden text-sky-300"
|
||||
class="sm:p-3 py-2 px-1 md:table-cell text-sky-300"
|
||||
@click="goToTeam(team.id)"
|
||||
>
|
||||
<span class="hover:underline cursor-pointer">
|
||||
@@ -175,7 +175,8 @@ const {
|
||||
TeamListDocument,
|
||||
(x) => x.admin.allTeams,
|
||||
(x) => x.id,
|
||||
{ cursor: undefined }
|
||||
10,
|
||||
{ cursor: undefined, take: 10 }
|
||||
);
|
||||
|
||||
const goToTeam = (teamId: string) => {
|
||||
|
||||
@@ -144,7 +144,7 @@ import { useMutation } from '@urql/vue';
|
||||
import {
|
||||
MakeUserAdminDocument,
|
||||
UserInfoDocument,
|
||||
RemoveUserAccountByAdminDocument,
|
||||
RemoveUserByAdminDocument,
|
||||
RemoveUserAsAdminDocument,
|
||||
} from '../../helpers/backend/graphql';
|
||||
import { useClientHandle } from '@urql/vue';
|
||||
@@ -179,7 +179,7 @@ onMounted(async () => {
|
||||
|
||||
// User Deletion
|
||||
const router = useRouter();
|
||||
const userDeletion = useMutation(RemoveUserAccountByAdminDocument);
|
||||
const userDeletion = useMutation(RemoveUserByAdminDocument);
|
||||
const confirmDeletion = ref(false);
|
||||
const deleteUserUID = ref<string | null>(null);
|
||||
|
||||
|
||||
@@ -235,9 +235,9 @@
|
||||
import { onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import { useMutation } from '@urql/vue';
|
||||
import {
|
||||
InviteUserToSignInDocument,
|
||||
InviteNewUserDocument,
|
||||
MakeUserAdminDocument,
|
||||
RemoveUserAccountByAdminDocument,
|
||||
RemoveUserByAdminDocument,
|
||||
RemoveUserAsAdminDocument,
|
||||
UsersListDocument,
|
||||
} from '../../helpers/backend/graphql';
|
||||
@@ -256,6 +256,7 @@ const getCreatedDate = (date: string) => format(new Date(date), 'dd-MM-yyyy');
|
||||
const getCreatedTime = (date: string) => format(new Date(date), 'hh:mm a');
|
||||
|
||||
// Get Paginated Results of all the users in the infra
|
||||
const usersPerPage = 20;
|
||||
const {
|
||||
fetching,
|
||||
error,
|
||||
@@ -266,12 +267,13 @@ const {
|
||||
UsersListDocument,
|
||||
(x) => x.admin.allUsers,
|
||||
(x) => x.uid,
|
||||
{ cursor: undefined }
|
||||
usersPerPage,
|
||||
{ cursor: undefined, take: usersPerPage }
|
||||
);
|
||||
|
||||
// Send Invitation through Email
|
||||
const email = ref('');
|
||||
const sendInvitation = useMutation(InviteUserToSignInDocument);
|
||||
const sendInvitation = useMutation(InviteNewUserDocument);
|
||||
const showInviteUserModal = ref(false);
|
||||
|
||||
const sendInvite = async () => {
|
||||
@@ -321,7 +323,7 @@ watch(
|
||||
);
|
||||
|
||||
// User Deletion
|
||||
const userDeletion = useMutation(RemoveUserAccountByAdminDocument);
|
||||
const userDeletion = useMutation(RemoveUserByAdminDocument);
|
||||
const confirmDeletion = ref(false);
|
||||
const deleteUserUID = ref<string | null>(null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user