feat(common): handle null collection and add private access hint for mock servers (#5527)

* fix(mock-server): handle null collection case in dashboard display

* feat(mock-server): add private access hint for non-public mock servers

* fix(mock-server): update private access hint for clarity

* refactor(mock-server): remove console logs from mock server creation and update
This commit is contained in:
Anwarul Islam 2025-10-29 23:21:05 +06:00 committed by GitHub
parent ae3d73bb32
commit bb4f4aca54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 15 additions and 6 deletions

View file

@ -873,6 +873,8 @@
"subdomain_based_url": "Subdomain based URL",
"mock_server_updated": "Mock server updated successfully",
"no_collection": "No collection",
"collection_deleted": "associated collection deleted.",
"private_access_hint": "For private mock servers, include the header 'x-api-key' with your Personal Access Token (create one from your profile).",
"status": "Status",
"server_running": "Server is running",
"server_stopped": "Server is stopped",

View file

@ -182,6 +182,10 @@
</HoppSmartToggle>
</div>
</div>
<!-- Hint for private mock servers -->
<div v-if="!isPublic" class="w-full mt-2 text-xs text-secondaryLight">
{{ t("mock_server.private_access_hint") }}
</div>
<!-- Display created server info -->
<div v-if="createdServer" class="flex flex-col space-y-4">
@ -478,7 +482,6 @@ const createMockServer = async () => {
loading.value = false
},
(result) => {
console.log("Mock server created:", result)
toast.success(t("mock_server.mock_server_created"))
// Add the new mock server to the store
@ -511,7 +514,6 @@ const toggleMockServer = async () => {
loading.value = false
},
(result) => {
console.log("Mock server updated:", result)
toast.success(
newActiveState
? t("mock_server.mock_server_started")

View file

@ -117,6 +117,9 @@
}}
</span>
</div>
<div v-if="!isPublic" class="text-xs text-secondaryLight">
{{ t("mock_server.private_access_hint") }}
</div>
</div>
</div>
</template>
@ -255,8 +258,7 @@ const toggleMockServer = async () => {
toast.error(t("error.something_went_wrong"))
loading.value = false
},
(result) => {
console.log("Mock server updated:", result)
() => {
toast.success(
newActiveState
? t("mock_server.mock_server_started")

View file

@ -87,7 +87,10 @@
</span>
<span class="truncate text-secondaryLight">
{{
mockServer.collection?.title || t("mock_server.no_collection")
mockServer.collection === null
? t("mock_server.collection_deleted")
: mockServer.collection?.title ||
t("mock_server.no_collection")
}}
</span>
</div>

View file

@ -32,7 +32,7 @@ export type MockServer = {
id: string
title: string
requests?: any[]
}
} | null
// Legacy fields for backward compatibility
userUid?: string
collectionID?: string