refactor: updated dashboard gql queries and components to use the new infra type of the updated schema (#3455)

This commit is contained in:
Joel Jacob Stephen
2023-11-01 23:40:19 +05:30
committed by GitHub
parent a215860782
commit 9dcbc4a126
19 changed files with 33 additions and 28 deletions

View File

@@ -57,5 +57,5 @@ const t = useI18n();
// Get Metrics Data
const { fetching, error, data } = useQuery({ query: MetricsDocument });
const metrics = computed(() => data?.value?.admin);
const metrics = computed(() => data?.value?.infra);
</script>

View File

@@ -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;

View File

@@ -77,11 +77,11 @@ const t = useI18n();
const toast = useToast();
// Get Users List
const { 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 }

View File

@@ -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;
});

View File

@@ -112,7 +112,7 @@ const {
hasNextPage,
} = usePagedQuery(
UsersListDocument,
(x) => x.admin.allUsers,
(x) => x.infra.allUsers,
(x) => x.uid,
usersPerPage,
{ cursor: undefined, take: usersPerPage }

View File

@@ -101,5 +101,5 @@ const getCreatedTime = (date: string) => format(new Date(date), 'hh:mm a');
// Get Invited Users
const { fetching, error, data } = useQuery({ query: InvitedUsersDocument });
const invitedUsers = computed(() => data?.value?.admin.invitedUsers);
const invitedUsers = computed(() => data?.value?.infra.invitedUsers);
</script>