Skip to content

Commit bc4cab5

Browse files
committed
fix(nginx_log): use path instead of log_path
1 parent 8ad1f0c commit bc4cab5

File tree

7 files changed

+59
-66
lines changed

7 files changed

+59
-66
lines changed

api/nginx_log/nginx_log.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const (
2222

2323
// controlStruct represents the request parameters for getting log content
2424
type controlStruct struct {
25-
Type string `json:"type"` // Type of log: "access" or "error"
26-
LogPath string `json:"log_path"` // Path to the log file
25+
Type string `json:"type"` // Type of log: "access" or "error"
26+
Path string `json:"path"` // Path to the log file
2727
}
2828

2929
// nginxLogPageResp represents the response format for log content

api/nginx_log/websocket.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import (
2121
// It checks if the path is under the whitelist directories
2222
func getLogPath(control *controlStruct) (logPath string, err error) {
2323
// If direct log path is provided, use it
24-
if control.LogPath != "" {
25-
logPath = control.LogPath
24+
if control.Path != "" {
25+
logPath = control.Path
2626
// Check if logPath is under one of the paths in LogDirWhiteList
2727
if !nginx_log.IsLogPathUnderWhiteList(logPath) {
2828
return "", nginx_log.ErrLogPathIsNotUnderTheLogDirWhiteList

app/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
"@fingerprintjs/fingerprintjs": "^4.6.2",
1919
"@formkit/auto-animate": "^0.8.2",
2020
"@simplewebauthn/browser": "^13.1.2",
21-
"@uozi-admin/curd": "^4.5.7",
21+
"@uozi-admin/curd": "^4.5.8",
2222
"@uozi-admin/request": "^2.8.4",
2323
"@vue/reactivity": "^3.5.18",
2424
"@vue/shared": "^3.5.18",
25-
"@vueuse/components": "^13.5.0",
26-
"@vueuse/core": "^13.5.0",
27-
"@vueuse/integrations": "^13.5.0",
25+
"@vueuse/components": "^13.6.0",
26+
"@vueuse/core": "^13.6.0",
27+
"@vueuse/integrations": "^13.6.0",
2828
"@xterm/addon-attach": "^0.11.0",
2929
"@xterm/addon-fit": "^0.10.0",
3030
"@xterm/xterm": "^5.5.0",

app/pnpm-lock.yaml

Lines changed: 36 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/api/nginx_log.ts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
1-
import { http } from '@uozi-admin/request'
1+
import { extendCurdApi, http, useCurdApi } from '@uozi-admin/request'
22

3-
export interface INginxLogData {
4-
type: string
5-
log_path?: string
3+
export interface NginxLogData {
4+
type?: string
5+
path?: string
66
}
77

8-
const nginx_log = {
9-
page(page = 0, data: INginxLogData | undefined = undefined) {
8+
const nginx_log = extendCurdApi(useCurdApi('/nginx_logs'), {
9+
page(page = 0, data: NginxLogData | undefined = undefined) {
1010
return http.post(`/nginx_log?page=${page}`, data)
1111
},
12-
13-
getList(params: {
14-
type?: string
15-
name?: string
16-
path?: string
17-
}) {
18-
return http.get(`/nginx_logs`, { params })
19-
},
20-
}
12+
})
2113

2214
export default nginx_log

app/src/views/nginx_log/NginxLog.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import type ReconnectingWebSocket from 'reconnecting-websocket'
3-
import type { INginxLogData } from '@/api/nginx_log'
3+
import type { NginxLogData } from '@/api/nginx_log'
44
import { debounce } from 'lodash'
55
import nginx_log from '@/api/nginx_log'
66
import FooterToolBar from '@/components/FooterToolbar'
@@ -17,9 +17,9 @@ const loading = ref(false)
1717
const filter = ref('')
1818
1919
// Setup log control data based on route params
20-
const control = reactive<INginxLogData>({
20+
const control = reactive<NginxLogData>({
2121
type: logType(),
22-
log_path: route.query.log_path as string,
22+
path: route.query.log_path as string,
2323
})
2424
2525
function logType() {
@@ -92,7 +92,7 @@ watch(autoRefresh, async value => {
9292
watch(route, () => {
9393
// Update control data when route changes
9494
control.type = logType()
95-
control.log_path = route.query.log_path as string
95+
control.path = route.query.log_path as string
9696
9797
clearLog()
9898
init()
@@ -169,7 +169,7 @@ const computedBuffer = computed(() => {
169169
@scroll="debounceScrollLog"
170170
/>
171171
</ACard>
172-
<FooterToolBar v-if="control.log_path">
172+
<FooterToolBar v-if="control.path">
173173
<AButton @click="router.go(-1)">
174174
{{ $gettext('Back') }}
175175
</AButton>

app/src/views/nginx_log/NginxLogList.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script setup lang="tsx">
22
import type { CustomRenderArgs, StdTableColumn } from '@uozi-admin/curd'
3+
import type { NginxLogData } from '@/api/nginx_log'
34
import { SyncOutlined } from '@ant-design/icons-vue'
45
import { StdCurd } from '@uozi-admin/curd'
56
import { Tag } from 'ant-design-vue'
@@ -71,11 +72,11 @@ const columns: StdTableColumn[] = [
7172
},
7273
]
7374
74-
function viewLog(record: { type: string, path: string }) {
75+
function viewLog(record: NginxLogData) {
7576
router.push({
7677
path: `/nginx_log/${record.type}`,
7778
query: {
78-
log_path: record.path,
79+
path: record.path,
7980
},
8081
})
8182
}

0 commit comments

Comments
 (0)