Skip to content

Commit 8fc7d8a

Browse files
committed
feat(nginx_log): add advanced indexing status check and update view mode logic
1 parent d82c603 commit 8fc7d8a

File tree

3 files changed

+37
-110
lines changed

3 files changed

+37
-110
lines changed

app/auto-imports.d.ts

Lines changed: 13 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -103,91 +103,18 @@ declare global {
103103
}
104104

105105
// for vue template auto import
106-
import { UnwrapRef } from 'vue'
106+
type UnwrapRefs<T> = {
107+
[K in keyof T]: import('vue').UnwrapRef<T[K]>
108+
}
109+
namespace _ComponentCustomProperties {
110+
const { $gettext, $ngettext, $npgettext, $pgettext }: typeof import('@/gettext')
111+
const { App }: typeof import('ant-design-vue')
112+
const { EffectScope, computed, createApp, customRef, defineAsyncComponent, defineComponent, effectScope, getCurrentInstance, getCurrentScope, getCurrentWatcher, h, inject, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, provide, reactive, readonly, ref, resolveComponent, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, toValue, triggerRef, unref, useAttrs, useCssModule, useCssVars, useId, useModel, useSlots, useTemplateRef, watch, watchEffect, watchPostEffect, watchSyncEffect }: typeof import('vue')
113+
const { T }: typeof import('@/language')
114+
const { acceptHMRUpdate, createPinia, defineStore, getActivePinia, mapActions, mapGetters, mapState, mapStores, mapWritableState, setActivePinia, setMapStoreSuffix, storeToRefs }: typeof import('pinia')
115+
const { onBeforeRouteLeave, onBeforeRouteUpdate, useLink, useRoute, useRouter }: typeof import('vue-router')
116+
const { useGlobalApp }: typeof import('@/composables/useGlobalApp')
117+
}
107118
declare module 'vue' {
108-
interface GlobalComponents {}
109-
interface ComponentCustomProperties {
110-
readonly $gettext: UnwrapRef<typeof import('@/gettext')['$gettext']>
111-
readonly $ngettext: UnwrapRef<typeof import('@/gettext')['$ngettext']>
112-
readonly $npgettext: UnwrapRef<typeof import('@/gettext')['$npgettext']>
113-
readonly $pgettext: UnwrapRef<typeof import('@/gettext')['$pgettext']>
114-
readonly App: UnwrapRef<typeof import('ant-design-vue')['App']>
115-
readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
116-
readonly T: UnwrapRef<typeof import('@/language')['T']>
117-
readonly acceptHMRUpdate: UnwrapRef<typeof import('pinia')['acceptHMRUpdate']>
118-
readonly computed: UnwrapRef<typeof import('vue')['computed']>
119-
readonly createApp: UnwrapRef<typeof import('vue')['createApp']>
120-
readonly createPinia: UnwrapRef<typeof import('pinia')['createPinia']>
121-
readonly customRef: UnwrapRef<typeof import('vue')['customRef']>
122-
readonly defineAsyncComponent: UnwrapRef<typeof import('vue')['defineAsyncComponent']>
123-
readonly defineComponent: UnwrapRef<typeof import('vue')['defineComponent']>
124-
readonly defineStore: UnwrapRef<typeof import('pinia')['defineStore']>
125-
readonly effectScope: UnwrapRef<typeof import('vue')['effectScope']>
126-
readonly getActivePinia: UnwrapRef<typeof import('pinia')['getActivePinia']>
127-
readonly getCurrentInstance: UnwrapRef<typeof import('vue')['getCurrentInstance']>
128-
readonly getCurrentScope: UnwrapRef<typeof import('vue')['getCurrentScope']>
129-
readonly getCurrentWatcher: UnwrapRef<typeof import('vue')['getCurrentWatcher']>
130-
readonly h: UnwrapRef<typeof import('vue')['h']>
131-
readonly inject: UnwrapRef<typeof import('vue')['inject']>
132-
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
133-
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
134-
readonly isReadonly: UnwrapRef<typeof import('vue')['isReadonly']>
135-
readonly isRef: UnwrapRef<typeof import('vue')['isRef']>
136-
readonly isShallow: UnwrapRef<typeof import('vue')['isShallow']>
137-
readonly mapActions: UnwrapRef<typeof import('pinia')['mapActions']>
138-
readonly mapGetters: UnwrapRef<typeof import('pinia')['mapGetters']>
139-
readonly mapState: UnwrapRef<typeof import('pinia')['mapState']>
140-
readonly mapStores: UnwrapRef<typeof import('pinia')['mapStores']>
141-
readonly mapWritableState: UnwrapRef<typeof import('pinia')['mapWritableState']>
142-
readonly markRaw: UnwrapRef<typeof import('vue')['markRaw']>
143-
readonly nextTick: UnwrapRef<typeof import('vue')['nextTick']>
144-
readonly onActivated: UnwrapRef<typeof import('vue')['onActivated']>
145-
readonly onBeforeMount: UnwrapRef<typeof import('vue')['onBeforeMount']>
146-
readonly onBeforeRouteLeave: UnwrapRef<typeof import('vue-router')['onBeforeRouteLeave']>
147-
readonly onBeforeRouteUpdate: UnwrapRef<typeof import('vue-router')['onBeforeRouteUpdate']>
148-
readonly onBeforeUnmount: UnwrapRef<typeof import('vue')['onBeforeUnmount']>
149-
readonly onBeforeUpdate: UnwrapRef<typeof import('vue')['onBeforeUpdate']>
150-
readonly onDeactivated: UnwrapRef<typeof import('vue')['onDeactivated']>
151-
readonly onErrorCaptured: UnwrapRef<typeof import('vue')['onErrorCaptured']>
152-
readonly onMounted: UnwrapRef<typeof import('vue')['onMounted']>
153-
readonly onRenderTracked: UnwrapRef<typeof import('vue')['onRenderTracked']>
154-
readonly onRenderTriggered: UnwrapRef<typeof import('vue')['onRenderTriggered']>
155-
readonly onScopeDispose: UnwrapRef<typeof import('vue')['onScopeDispose']>
156-
readonly onServerPrefetch: UnwrapRef<typeof import('vue')['onServerPrefetch']>
157-
readonly onUnmounted: UnwrapRef<typeof import('vue')['onUnmounted']>
158-
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
159-
readonly onWatcherCleanup: UnwrapRef<typeof import('vue')['onWatcherCleanup']>
160-
readonly provide: UnwrapRef<typeof import('vue')['provide']>
161-
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
162-
readonly readonly: UnwrapRef<typeof import('vue')['readonly']>
163-
readonly ref: UnwrapRef<typeof import('vue')['ref']>
164-
readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']>
165-
readonly setActivePinia: UnwrapRef<typeof import('pinia')['setActivePinia']>
166-
readonly setMapStoreSuffix: UnwrapRef<typeof import('pinia')['setMapStoreSuffix']>
167-
readonly shallowReactive: UnwrapRef<typeof import('vue')['shallowReactive']>
168-
readonly shallowReadonly: UnwrapRef<typeof import('vue')['shallowReadonly']>
169-
readonly shallowRef: UnwrapRef<typeof import('vue')['shallowRef']>
170-
readonly storeToRefs: UnwrapRef<typeof import('pinia')['storeToRefs']>
171-
readonly toRaw: UnwrapRef<typeof import('vue')['toRaw']>
172-
readonly toRef: UnwrapRef<typeof import('vue')['toRef']>
173-
readonly toRefs: UnwrapRef<typeof import('vue')['toRefs']>
174-
readonly toValue: UnwrapRef<typeof import('vue')['toValue']>
175-
readonly triggerRef: UnwrapRef<typeof import('vue')['triggerRef']>
176-
readonly unref: UnwrapRef<typeof import('vue')['unref']>
177-
readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
178-
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
179-
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
180-
readonly useGlobalApp: UnwrapRef<typeof import('@/composables/useGlobalApp')['useGlobalApp']>
181-
readonly useId: UnwrapRef<typeof import('vue')['useId']>
182-
readonly useLink: UnwrapRef<typeof import('vue-router')['useLink']>
183-
readonly useModel: UnwrapRef<typeof import('vue')['useModel']>
184-
readonly useRoute: UnwrapRef<typeof import('vue-router')['useRoute']>
185-
readonly useRouter: UnwrapRef<typeof import('vue-router')['useRouter']>
186-
readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
187-
readonly useTemplateRef: UnwrapRef<typeof import('vue')['useTemplateRef']>
188-
readonly watch: UnwrapRef<typeof import('vue')['watch']>
189-
readonly watchEffect: UnwrapRef<typeof import('vue')['watchEffect']>
190-
readonly watchPostEffect: UnwrapRef<typeof import('vue')['watchPostEffect']>
191-
readonly watchSyncEffect: UnwrapRef<typeof import('vue')['watchSyncEffect']>
192-
}
119+
interface ComponentCustomProperties extends UnwrapRefs<typeof _ComponentCustomProperties> {}
193120
}

app/components.d.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,13 @@ declare module 'vue' {
1010
export interface GlobalComponents {
1111
AAlert: typeof import('ant-design-vue/es')['Alert']
1212
AApp: typeof import('ant-design-vue/es')['App']
13-
AAutoComplete: typeof import('ant-design-vue/es')['AutoComplete']
1413
AAvatar: typeof import('ant-design-vue/es')['Avatar']
1514
ABadge: typeof import('ant-design-vue/es')['Badge']
1615
ABreadcrumb: typeof import('ant-design-vue/es')['Breadcrumb']
1716
ABreadcrumbItem: typeof import('ant-design-vue/es')['BreadcrumbItem']
1817
AButton: typeof import('ant-design-vue/es')['Button']
1918
ACard: typeof import('ant-design-vue/es')['Card']
20-
ACheckbox: typeof import('ant-design-vue/es')['Checkbox']
21-
ACheckboxGroup: typeof import('ant-design-vue/es')['CheckboxGroup']
2219
ACol: typeof import('ant-design-vue/es')['Col']
23-
ACollapse: typeof import('ant-design-vue/es')['Collapse']
24-
ACollapsePanel: typeof import('ant-design-vue/es')['CollapsePanel']
25-
AComment: typeof import('ant-design-vue/es')['Comment']
2620
AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider']
2721
ADivider: typeof import('ant-design-vue/es')['Divider']
2822
ADrawer: typeof import('ant-design-vue/es')['Drawer']
@@ -32,7 +26,6 @@ declare module 'vue' {
3226
AFormItem: typeof import('ant-design-vue/es')['FormItem']
3327
AInput: typeof import('ant-design-vue/es')['Input']
3428
AInputGroup: typeof import('ant-design-vue/es')['InputGroup']
35-
AInputNumber: typeof import('ant-design-vue/es')['InputNumber']
3629
AInputPassword: typeof import('ant-design-vue/es')['InputPassword']
3730
ALayout: typeof import('ant-design-vue/es')['Layout']
3831
ALayoutContent: typeof import('ant-design-vue/es')['LayoutContent']
@@ -43,38 +36,29 @@ declare module 'vue' {
4336
AListItem: typeof import('ant-design-vue/es')['ListItem']
4437
AListItemMeta: typeof import('ant-design-vue/es')['ListItemMeta']
4538
AMenu: typeof import('ant-design-vue/es')['Menu']
46-
AMenuDivider: typeof import('ant-design-vue/es')['MenuDivider']
4739
AMenuItem: typeof import('ant-design-vue/es')['MenuItem']
4840
AModal: typeof import('ant-design-vue/es')['Modal']
4941
APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
5042
APopover: typeof import('ant-design-vue/es')['Popover']
5143
AppProvider: typeof import('./src/components/AppProvider.vue')['default']
5244
AProgress: typeof import('ant-design-vue/es')['Progress']
53-
AQrcode: typeof import('ant-design-vue/es')['QRCode']
54-
ARadio: typeof import('ant-design-vue/es')['Radio']
55-
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
5645
ARangePicker: typeof import('ant-design-vue/es')['RangePicker']
57-
AResult: typeof import('ant-design-vue/es')['Result']
5846
ARow: typeof import('ant-design-vue/es')['Row']
5947
ASegmented: typeof import('ant-design-vue/es')['Segmented']
6048
ASelect: typeof import('ant-design-vue/es')['Select']
6149
ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
6250
ASpace: typeof import('ant-design-vue/es')['Space']
6351
ASpin: typeof import('ant-design-vue/es')['Spin']
6452
AStatistic: typeof import('ant-design-vue/es')['Statistic']
65-
AStep: typeof import('ant-design-vue/es')['Step']
66-
ASteps: typeof import('ant-design-vue/es')['Steps']
6753
ASubMenu: typeof import('ant-design-vue/es')['SubMenu']
6854
ASwitch: typeof import('ant-design-vue/es')['Switch']
6955
ATable: typeof import('ant-design-vue/es')['Table']
7056
ATabPane: typeof import('ant-design-vue/es')['TabPane']
7157
ATabs: typeof import('ant-design-vue/es')['Tabs']
7258
ATag: typeof import('ant-design-vue/es')['Tag']
73-
ATextarea: typeof import('ant-design-vue/es')['Textarea']
7459
ATooltip: typeof import('ant-design-vue/es')['Tooltip']
7560
ATypographyText: typeof import('ant-design-vue/es')['TypographyText']
7661
ATypographyTitle: typeof import('ant-design-vue/es')['TypographyTitle']
77-
AUploadDragger: typeof import('ant-design-vue/es')['UploadDragger']
7862
AutoCertFormAutoCertForm: typeof import('./src/components/AutoCertForm/AutoCertForm.vue')['default']
7963
AutoCertFormDNSChallenge: typeof import('./src/components/AutoCertForm/DNSChallenge.vue')['default']
8064
BaseEditorBaseEditor: typeof import('./src/components/BaseEditor/BaseEditor.vue')['default']
@@ -93,9 +77,6 @@ declare module 'vue' {
9377
LLMChatMessageInput: typeof import('./src/components/LLM/ChatMessageInput.vue')['default']
9478
LLMChatMessageList: typeof import('./src/components/LLM/ChatMessageList.vue')['default']
9579
LLMLLM: typeof import('./src/components/LLM/LLM.vue')['default']
96-
LLMLLMIframe: typeof import('./src/components/LLM/LLMIframe.vue')['default']
97-
LLMLLMSessionSelector: typeof import('./src/components/LLM/LLMSessionSelector.vue')['default']
98-
LLMLLMSessionSidebar: typeof import('./src/components/LLM/LLMSessionSidebar.vue')['default']
9980
LLMLLMSessionTabs: typeof import('./src/components/LLM/LLMSessionTabs.vue')['default']
10081
LogoLogo: typeof import('./src/components/Logo/Logo.vue')['default']
10182
NamespaceRenderNamespaceRender: typeof import('./src/components/NamespaceRender/NamespaceRender.vue')['default']
@@ -127,15 +108,12 @@ declare module 'vue' {
127108
SelfCheckSelfCheckHeaderBanner: typeof import('./src/components/SelfCheck/SelfCheckHeaderBanner.vue')['default']
128109
SensitiveStringSensitiveString: typeof import('./src/components/SensitiveString/SensitiveString.vue')['default']
129110
SetLanguageSetLanguage: typeof import('./src/components/SetLanguage/SetLanguage.vue')['default']
130-
ShadowRootShadowRoot: typeof import('./src/components/ShadowRoot/ShadowRoot.vue')['default']
131111
SwitchAppearanceIconsVPIconMoon: typeof import('./src/components/SwitchAppearance/icons/VPIconMoon.vue')['default']
132112
SwitchAppearanceIconsVPIconSun: typeof import('./src/components/SwitchAppearance/icons/VPIconSun.vue')['default']
133113
SwitchAppearanceSwitchAppearance: typeof import('./src/components/SwitchAppearance/SwitchAppearance.vue')['default']
134114
SyncNodesPreviewSyncNodesPreview: typeof import('./src/components/SyncNodesPreview/SyncNodesPreview.vue')['default']
135115
SystemRestoreSystemRestoreContent: typeof import('./src/components/SystemRestore/SystemRestoreContent.vue')['default']
136116
TabFilterTabFilter: typeof import('./src/components/TabFilter/TabFilter.vue')['default']
137-
TerminalTerminalStatusBar: typeof import('./src/components/Terminal/TerminalStatusBar.vue')['default']
138-
TestMessage: typeof import('./src/components/TestMessage.vue')['default']
139117
TwoFAAuthorization: typeof import('./src/components/TwoFA/Authorization.vue')['default']
140118
UpstreamCardsUpstreamCards: typeof import('./src/components/UpstreamCards/UpstreamCards.vue')['default']
141119
UpstreamDetailModalUpstreamDetailModal: typeof import('./src/components/UpstreamDetailModal/UpstreamDetailModal.vue')['default']

app/src/views/nginx_log/NginxLog.vue

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import { FileOutlined } from '@ant-design/icons-vue'
33
import { useRouteQuery } from '@vueuse/router'
4+
import nginxLog from '@/api/nginx_log'
45
import FooterToolBar from '@/components/FooterToolbar'
56
import DashboardViewer from './dashboard/DashboardViewer.vue'
67
import RawLogViewer from './raw/RawLogViewer.vue'
@@ -20,6 +21,20 @@ const logType = computed(() => {
2021
2122
const viewMode = useRouteQuery<'raw' | 'structured' | 'dashboard'>('view', 'structured')
2223
24+
// Advanced indexing status
25+
const isAdvancedIndexingEnabled = ref(false)
26+
27+
onMounted(async () => {
28+
try {
29+
const res = await nginxLog.getAdvancedIndexingStatus()
30+
isAdvancedIndexingEnabled.value = !!res.enabled
31+
}
32+
catch (err) {
33+
console.error('Failed to get advanced indexing status:', err)
34+
isAdvancedIndexingEnabled.value = false
35+
}
36+
})
37+
2338
// Check if this is an error log
2439
const isErrorLog = computed(() => {
2540
return logType.value === 'error' || logPath.value.includes('error.log') || logPath.value.includes('error_log')
@@ -32,6 +47,13 @@ watch(logType, v => {
3247
viewMode.value = 'raw'
3348
}
3449
}, { immediate: true })
50+
51+
// Force raw view when advanced indexing is disabled
52+
watch(isAdvancedIndexingEnabled, enabled => {
53+
if (!enabled) {
54+
viewMode.value = 'raw'
55+
}
56+
}, { immediate: true })
3557
</script>
3658

3759
<template>
@@ -47,8 +69,8 @@ watch(logType, v => {
4769

4870
<template #extra>
4971
<div class="flex items-center gap-4">
50-
<!-- View Mode Toggle (hide for error logs) -->
51-
<div v-if="!isErrorLog" class="flex items-center">
72+
<!-- View Mode Toggle (hide for error logs or when advanced indexing is disabled) -->
73+
<div v-if="!isErrorLog && isAdvancedIndexingEnabled" class="flex items-center">
5274
<ASegmented
5375
v-model:value="viewMode"
5476
:options="[

0 commit comments

Comments
 (0)