Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
refactor: updated dashboard gql queries and components to use the new infra type of the updated schema (#3455)
Joel Jacob Stephen9dcbc4a1265c
diff --git a/packages/hoppscotch-sh-admin/src/components.d.ts b/packages/hoppscotch-sh-admin/src/components.d.tsindex 5c0e165ff..953862949 100644--- a/packages/hoppscotch-sh-admin/src/components.d.ts+++ b/packages/hoppscotch-sh-admin/src/components.d.ts@@ -23,9 +23,14 @@ declare module '@vue/runtime-core' {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'];+ 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'];TeamsAdd: typeof import('./components/teams/Add.vue')['default'];TeamsDetails: typeof import('./components/teams/Details.vue')['default'];TeamsInvite: typeof import('./components/teams/Invite.vue')['default'];diff --git a/packages/hoppscotch-sh-admin/src/components/teams/Details.vue b/packages/hoppscotch-sh-admin/src/components/teams/Details.vueindex c358c2f19..12c9bec6f 100644--- a/packages/hoppscotch-sh-admin/src/components/teams/Details.vue+++ b/packages/hoppscotch-sh-admin/src/components/teams/Details.vue@@ -79,7 +79,7 @@ const t = useI18n();const toast = useToast();const props = defineProps<{- team: TeamInfoQuery['admin']['teamInfo'];+ team: TeamInfoQuery['infra']['teamInfo'];teamName: string;showRenameInput: boolean;}>();diff --git a/packages/hoppscotch-sh-admin/src/components/teams/Invite.vue b/packages/hoppscotch-sh-admin/src/components/teams/Invite.vueindex 380f6656c..edfeeaf37 100644--- a/packages/hoppscotch-sh-admin/src/components/teams/Invite.vue+++ b/packages/hoppscotch-sh-admin/src/components/teams/Invite.vue@@ -213,11 +213,11 @@ const t = useI18n();// Get Users Listconst { data } = useQuery({ query: MetricsDocument });-const usersPerPage = computed(() => data.value?.admin.usersCount || 10000);+const usersPerPage = computed(() => data.value?.infra.usersCount || 10000);const { list: usersList } = usePagedQuery(UsersListDocument,- (x) => x.admin.allUsers,+ (x) => x.infra.allUsers,(x) => x.uid,usersPerPage.value,{ cursor: undefined, take: usersPerPage.value }diff --git a/packages/hoppscotch-sh-admin/src/components/teams/Members.vue b/packages/hoppscotch-sh-admin/src/components/teams/Members.vueindex 60918d71d..222904a6f 100644--- a/packages/hoppscotch-sh-admin/src/components/teams/Members.vue+++ b/packages/hoppscotch-sh-admin/src/components/teams/Members.vue@@ -187,7 +187,7 @@ const emit = defineEmits<{const showInvite = ref(false);// Get Team Details-const team = ref<TeamInfoQuery['admin']['teamInfo'] | undefined>();+const team = ref<TeamInfoQuery['infra']['teamInfo'] | undefined>();const fetching = ref(true);const route = useRoute();const { client } = useClientHandle();@@ -201,8 +201,8 @@ const getTeamInfo = async () => {if (result.error) {return toast.error(`${t('teams.load_info_error')}`);}- if (result.data?.admin.teamInfo) {- team.value = result.data.admin.teamInfo;+ if (result.data?.infra.teamInfo) {+ team.value = result.data.infra.teamInfo;}fetching.value = false;};diff --git a/packages/hoppscotch-sh-admin/src/components/teams/PendingInvites.vue b/packages/hoppscotch-sh-admin/src/components/teams/PendingInvites.vueindex 4bf16d5b9..df757d1e1 100644--- a/packages/hoppscotch-sh-admin/src/components/teams/PendingInvites.vue+++ b/packages/hoppscotch-sh-admin/src/components/teams/PendingInvites.vue@@ -72,9 +72,9 @@ const fetching = ref(true);const error = ref(false);const { client } = useClientHandle();const route = useRoute();-const team = ref<TeamInfoQuery['admin']['teamInfo'] | undefined>();+const team = ref<TeamInfoQuery['infra']['teamInfo'] | undefined>();const pendingInvites = ref<- TeamInfoQuery['admin']['teamInfo']['teamInvitations'] | undefined+ TeamInfoQuery['infra']['teamInfo']['teamInvitations'] | undefined>();const getTeamInfo = async () => {@@ -88,8 +88,8 @@ const getTeamInfo = async () => {return toast.error(`${t('teams.load_info_error')}`);}- if (result.data?.admin.teamInfo) {- team.value = result.data.admin.teamInfo;+ if (result.data?.infra.teamInfo) {+ team.value = result.data.infra.teamInfo;pendingInvites.value = team.value.teamInvitations;}fetching.value = false;diff --git a/packages/hoppscotch-sh-admin/src/components/teams/Table.vue b/packages/hoppscotch-sh-admin/src/components/teams/Table.vueindex 421c79137..5e26bbc05 100644--- a/packages/hoppscotch-sh-admin/src/components/teams/Table.vue+++ b/packages/hoppscotch-sh-admin/src/components/teams/Table.vue@@ -92,7 +92,7 @@ import { TeamListQuery } from '~/helpers/backend/graphql';const tippyActions = ref<TippyComponent | null>(null);defineProps<{- teamList: TeamListQuery['admin']['allTeams'];+ teamList: TeamListQuery['infra']['allTeams'];}>();defineEmits<{diff --git a/packages/hoppscotch-sh-admin/src/components/users/Table.vue b/packages/hoppscotch-sh-admin/src/components/users/Table.vueindex 2e028abd0..9e3c8d657 100644--- a/packages/hoppscotch-sh-admin/src/components/users/Table.vue+++ b/packages/hoppscotch-sh-admin/src/components/users/Table.vue@@ -143,7 +143,7 @@ import { useI18n } from '~/composables/i18n';const t = useI18n();defineProps<{- usersList: UsersListQuery['admin']['allUsers'];+ usersList: UsersListQuery['infra']['allUsers'];}>();defineEmits<{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.graphqlindex 8608eb008..4083ccf5f 100644--- a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/InvitedUsers.graphql+++ b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/InvitedUsers.graphql@@ -1,5 +1,5 @@query InvitedUsers {- admin {+ infra {invitedUsers {adminUidadminEmaildiff --git a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/Metrics.graphql b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/Metrics.graphqlindex b75020167..ba7d3b70c 100644--- a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/Metrics.graphql+++ b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/Metrics.graphql@@ -1,5 +1,5 @@query Metrics {- admin {+ infra {usersCountteamsCountteamRequestsCountdiff --git a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/TeamInfo.graphql b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/TeamInfo.graphqlindex d30f22b83..d3956db31 100644--- a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/TeamInfo.graphql+++ b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/TeamInfo.graphql@@ -1,5 +1,5 @@query TeamInfo($teamID: ID!) {- admin {+ infra {teamInfo(teamID: $teamID) {idnamediff --git a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/TeamList.graphql b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/TeamList.graphqlindex ae828ff39..cb71b60d4 100644--- a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/TeamList.graphql+++ b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/TeamList.graphql@@ -1,5 +1,5 @@query TeamList($cursor: ID, $take: Int) {- admin {+ infra {allTeams(cursor: $cursor, take: $take) {idnamediff --git a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/UserInfo.graphql b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/UserInfo.graphqlsimilarity index 93%rename from packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/UserInfo.graphqlrename to packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/UserInfo.graphqlindex c117cb911..aadf6a8e1 100644--- a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/mutations/UserInfo.graphql+++ b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/UserInfo.graphql@@ -1,5 +1,5 @@query UserInfo($uid: ID!) {- admin {+ infra {userInfo(userUid: $uid) {uiddisplayNamediff --git a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/UsersList.graphql b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/UsersList.graphqlindex 9baa9e70a..9d483f8d4 100644--- a/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/UsersList.graphql+++ b/packages/hoppscotch-sh-admin/src/helpers/backend/gql/queries/UsersList.graphql@@ -1,6 +1,6 @@# Write your query or mutation herequery UsersList($cursor: ID, $take: Int) {- admin {+ infra {allUsers(cursor: $cursor, take: $take) {uiddisplayNamediff --git a/packages/hoppscotch-sh-admin/src/pages/dashboard.vue b/packages/hoppscotch-sh-admin/src/pages/dashboard.vueindex 4b82bb60c..593e75b37 100644--- a/packages/hoppscotch-sh-admin/src/pages/dashboard.vue+++ b/packages/hoppscotch-sh-admin/src/pages/dashboard.vue@@ -57,5 +57,5 @@ const t = useI18n();// Get Metrics Dataconst { fetching, error, data } = useQuery({ query: MetricsDocument });-const metrics = computed(() => data?.value?.admin);+const metrics = computed(() => data?.value?.infra);</script>diff --git a/packages/hoppscotch-sh-admin/src/pages/teams/_id.vue b/packages/hoppscotch-sh-admin/src/pages/teams/_id.vueindex 51eaf3d29..d692c8477 100644--- a/packages/hoppscotch-sh-admin/src/pages/teams/_id.vue+++ b/packages/hoppscotch-sh-admin/src/pages/teams/_id.vue@@ -91,7 +91,7 @@ const currentTabName = computed(() => {});// Get the details of the team-const team = ref<TeamInfoQuery['admin']['teamInfo'] | undefined>();+const team = ref<TeamInfoQuery['infra']['teamInfo'] | undefined>();const teamName = ref('');const route = useRoute();const fetching = ref(true);@@ -105,8 +105,8 @@ const getTeamInfo = async () => {if (result.error) {return toast.error(`${t('team.load_info_error')}`);}- if (result.data?.admin.teamInfo) {- team.value = result.data.admin.teamInfo;+ if (result.data?.infra.teamInfo) {+ team.value = result.data.infra.teamInfo;teamName.value = team.value.name;}fetching.value = false;diff --git a/packages/hoppscotch-sh-admin/src/pages/teams/index.vue b/packages/hoppscotch-sh-admin/src/pages/teams/index.vueindex 42bdb9cf5..a51b75aca 100644--- a/packages/hoppscotch-sh-admin/src/pages/teams/index.vue+++ b/packages/hoppscotch-sh-admin/src/pages/teams/index.vue@@ -77,11 +77,11 @@ const t = useI18n();const toast = useToast();// Get Users Listconst { data } = useQuery({ query: MetricsDocument });-const usersPerPage = computed(() => data.value?.admin.usersCount || 10000);+const usersPerPage = computed(() => data.value?.infra.usersCount || 10000);const { list: usersList } = usePagedQuery(UsersListDocument,- (x) => x.admin.allUsers,+ (x) => x.infra.allUsers,(x) => x.uid,usersPerPage.value,{ cursor: undefined, take: usersPerPage.value }@@ -100,7 +100,7 @@ const {hasNextPage,} = usePagedQuery(TeamListDocument,- (x) => x.admin.allTeams,+ (x) => x.infra.allTeams,(x) => x.id,teamsPerPage,{ cursor: undefined, take: teamsPerPage }diff --git a/packages/hoppscotch-sh-admin/src/pages/users/_id.vue b/packages/hoppscotch-sh-admin/src/pages/users/_id.vueindex c3a77b834..f628e45ae 100644--- a/packages/hoppscotch-sh-admin/src/pages/users/_id.vue+++ b/packages/hoppscotch-sh-admin/src/pages/users/_id.vue@@ -179,7 +179,7 @@ onMounted(async () => {if (result.error) {toast.error(`${t('users.load_info_error')}`);}- user.value = result.data?.admin.userInfo ?? {};+ user.value = result.data?.infra.userInfo ?? {};fetching.value = false;});diff --git a/packages/hoppscotch-sh-admin/src/pages/users/index.vue b/packages/hoppscotch-sh-admin/src/pages/users/index.vueindex 8355fdd3c..40c35d337 100644--- a/packages/hoppscotch-sh-admin/src/pages/users/index.vue+++ b/packages/hoppscotch-sh-admin/src/pages/users/index.vue@@ -112,7 +112,7 @@ const {hasNextPage,} = usePagedQuery(UsersListDocument,- (x) => x.admin.allUsers,+ (x) => x.infra.allUsers,(x) => x.uid,usersPerPage,{ cursor: undefined, take: usersPerPage }diff --git a/packages/hoppscotch-sh-admin/src/pages/users/invited.vue b/packages/hoppscotch-sh-admin/src/pages/users/invited.vueindex 190b8b185..028e0086e 100644--- a/packages/hoppscotch-sh-admin/src/pages/users/invited.vue+++ b/packages/hoppscotch-sh-admin/src/pages/users/invited.vue@@ -101,5 +101,5 @@ const getCreatedTime = (date: string) => format(new Date(date), 'hh:mm a');// Get Invited Usersconst { fetching, error, data } = useQuery({ query: InvitedUsersDocument });-const invitedUsers = computed(() => data?.value?.admin.invitedUsers);+const invitedUsers = computed(() => data?.value?.infra.invitedUsers);</script>