chore: restore the ability to disable tracking request history

This commit is contained in:
jamesgeorge007 2025-01-30 13:34:01 +05:30
parent 7be23dfb59
commit 86ea3e427c
2 changed files with 27 additions and 3 deletions

View file

@ -1132,6 +1132,7 @@
"create_new": "Create new workspace",
"deleted": "Workspace deleted",
"delete_all_activity_logs": "Delete all activity logs",
"successfully_deleted_all_activity_logs": "Successfully deleted all activity logs",
"delete_activity_log": "Delete activity log",
"deleted_activity_log": "Deleted selected activity log",
"deleted_all_activity_logs": "Deleted all activity logs",

View file

@ -50,7 +50,11 @@
<HoppButtonSecondary
v-tippy="{ theme: 'tooltip' }"
data-testid="clear_history"
:disabled="history.length === 0"
:disabled="
history.length === 0 ||
!isHistoryStoreEnabled ||
isFetchingHistoryStoreStatus
"
:icon="IconTrash2"
:title="t('action.clear_all')"
@click="confirmRemove = true"
@ -58,7 +62,10 @@
</div>
</div>
</div>
<div class="flex flex-col">
<div
v-if="isHistoryStoreEnabled && !isFetchingHistoryStoreStatus"
class="flex flex-col"
>
<details
v-for="(
filteredHistoryGroup, filteredHistoryGroupIndex
@ -109,7 +116,13 @@
</details>
</div>
<HoppSmartPlaceholder
v-if="history.length === 0"
v-if="!isHistoryStoreEnabled && !isFetchingHistoryStoreStatus"
:src="`/images/states/${colorMode.value}/time.svg`"
:alt="`${t('empty.history')}`"
:text="t('settings.history_disabled')"
/>
<HoppSmartPlaceholder
v-else-if="history.length === 0"
:src="`/images/states/${colorMode.value}/time.svg`"
:alt="`${t('empty.history')}`"
:text="t('empty.history')"
@ -179,6 +192,7 @@ import HistoryGraphqlCard from "./graphql/Card.vue"
import { defineActionHandler, invokeAction } from "~/helpers/actions"
import { useService } from "dioc/vue"
import { RESTTabService } from "~/services/tab/rest"
import { platform } from "~/platform"
type HistoryEntry = GQLHistoryEntry | RESTHistoryEntry
@ -204,6 +218,15 @@ const history = useReadonlyStream<RESTHistoryEntry[] | GQLHistoryEntry[]>(
[]
)
const { isHistoryStoreEnabled, isFetchingHistoryStoreStatus } =
"requestHistoryStore" in platform.sync.history &&
platform.sync.history.requestHistoryStore
? platform.sync.history.requestHistoryStore
: {
isHistoryStoreEnabled: ref(true),
isFetchingHistoryStoreStatus: ref(false),
}
const deepCheckForRegex = (value: unknown, regExp: RegExp): boolean => {
if (value === null || value === undefined) return false