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
fix(sh-admin): saving changes to server configurations post a failed attempt will require a page reload in dashboard (#4081)
Joel Jacob Stephenb601a2f55f04
diff --git a/packages/hoppscotch-sh-admin/src/components.d.ts b/packages/hoppscotch-sh-admin/src/components.d.tsindex eaaf88bfe..d26357c81 100644--- a/packages/hoppscotch-sh-admin/src/components.d.ts+++ b/packages/hoppscotch-sh-admin/src/components.d.ts@@ -17,7 +17,6 @@ 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']@@ -26,14 +25,9 @@ declare module '@vue/runtime-core' {HoppSmartPicture: typeof import('@hoppscotch/ui')['HoppSmartPicture']HoppSmartSpinner: typeof import('@hoppscotch/ui')['HoppSmartSpinner']HoppSmartTab: typeof import('@hoppscotch/ui')['HoppSmartTab']- HoppSmartTable: typeof import('@hoppscotch/ui')['HoppSmartTable']HoppSmartTabs: typeof import('@hoppscotch/ui')['HoppSmartTabs']HoppSmartToggle: typeof import('@hoppscotch/ui')['HoppSmartToggle']- IconLucideArrowLeft: typeof import('~icons/lucide/arrow-left')['default']- IconLucideChevronDown: typeof import('~icons/lucide/chevron-down')['default']IconLucideInbox: typeof import('~icons/lucide/inbox')['default']- IconLucideSearch: typeof import('~icons/lucide/search')['default']- IconLucideUser: typeof import('~icons/lucide/user')['default']SettingsAuthProvider: typeof import('./components/settings/AuthProvider.vue')['default']SettingsConfigurations: typeof import('./components/settings/Configurations.vue')['default']SettingsDataSharing: typeof import('./components/settings/DataSharing.vue')['default']diff --git a/packages/hoppscotch-sh-admin/src/components/settings/Reset.vue b/packages/hoppscotch-sh-admin/src/components/settings/Reset.vueindex ddfa35380..cc6e2b1b0 100644--- a/packages/hoppscotch-sh-admin/src/components/settings/Reset.vue+++ b/packages/hoppscotch-sh-admin/src/components/settings/Reset.vue@@ -24,7 +24,11 @@</div></div>- <SettingsServerRestart v-if="resetInfraConfigs" :reset="resetInfraConfigs" />+ <SettingsServerRestart+ v-if="resetInfraConfigs"+ :reset="resetInfraConfigs"+ @mutation-failure="resetInfraConfigs = false"+ /><HoppSmartConfirmModal:show="resetModal"diff --git a/packages/hoppscotch-sh-admin/src/components/settings/ServerRestart.vue b/packages/hoppscotch-sh-admin/src/components/settings/ServerRestart.vueindex d70a17d40..1cd0c25a4 100644--- a/packages/hoppscotch-sh-admin/src/components/settings/ServerRestart.vue+++ b/packages/hoppscotch-sh-admin/src/components/settings/ServerRestart.vue@@ -39,6 +39,10 @@ const props = withDefaults(});+const emit = defineEmits<{+ (e: 'mutationFailure'): void;+}>();+// Mutations to update or reset server configurations and audit logsconst resetInfraConfigsMutation = useMutation(ResetInfraConfigsDocument);const updateInfraConfigsMutation = useMutation(UpdateInfraConfigsDocument);@@ -73,28 +77,40 @@ const startCountdown = () => {}, 1000);};+const triggerComponentUnMount = () => emit('mutationFailure');+// Call relevant mutations on component mount and initiate server restartonMounted(async () => {- let success = true;-if (props.reset) {- success = await resetInfraConfigs(resetInfraConfigsMutation);- if (!success) return;+ const resetInfraConfigsResult = await resetInfraConfigs(+ resetInfraConfigsMutation+ );++ if (!resetInfraConfigsResult) {+ return triggerComponentUnMount();+ }} else {const infraResult = await updateInfraConfigs(updateInfraConfigsMutation);- if (!infraResult) return;+ if (!infraResult) {+ return triggerComponentUnMount();+ }const authResult = await updateAuthProvider(updateAllowedAuthProviderMutation);- if (!authResult) return;++ if (!authResult) {+ return triggerComponentUnMount();+ }const dataSharingResult = await updateDataSharingConfigs(toggleDataSharingMutation);- if (!dataSharingResult) return;+ if (!dataSharingResult) {+ return triggerComponentUnMount();+ }}restart.value = true;diff --git a/packages/hoppscotch-sh-admin/src/pages/settings.vue b/packages/hoppscotch-sh-admin/src/pages/settings.vueindex 23cddb6e7..783935414 100644--- a/packages/hoppscotch-sh-admin/src/pages/settings.vue+++ b/packages/hoppscotch-sh-admin/src/pages/settings.vue@@ -37,6 +37,7 @@<SettingsServerRestartv-if="initiateServerRestart":workingConfigs="workingConfigs"+ @mutation-failure="initiateServerRestart = false"/><HoppSmartConfirmModal