Skip to content

Commit

Permalink
Merge pull request #600 from emqx/adapt-2.6
Browse files Browse the repository at this point in the history
refactor(config.ts): adapt log level
  • Loading branch information
oucb authored Dec 26, 2024
2 parents 16c4b68 + bbbd997 commit 189b0f8
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/api/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ export const queryNodeConfig = async (node: string) => {
}
}

export const updateNodeLogLevelToDebug = (nodeName: string) => {
return http.put('/log/level', { node: nodeName })
export const updateNodeLogLevelToDebug = (nodeName: string, logLevel: string) => {
return http.put('/log/level', { node: nodeName, level: logLevel })
}

/* GROUP */
Expand Down
4 changes: 2 additions & 2 deletions src/composables/config/useDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ export const dataStatistics = () => {
export const useNodeDebugLogLevel = () => {
const { t } = useI18n()

const modifyNodeLogLevelToDebug = async (nodeName: string) => {
const modifyNodeLogLevelToDebug = async (nodeName: string, logLevel: string) => {
try {
await updateNodeLogLevelToDebug(nodeName)
await updateNodeLogLevelToDebug(nodeName, logLevel)
EmqxMessage.success(t('config.modifyNodeLogLevelSuc'))
return Promise.resolve()
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion src/composables/config/useNorthDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default (autoLoad = true, needRefreshStatus = false) => {
}

const modifyNodeLogLevel = async (node: DriverItemInList) => {
await modifyNodeLogLevelToDebug(node.name)
await modifyNodeLogLevelToDebug(node.name, node.log_level)
}

if (autoLoad) {
Expand Down
2 changes: 1 addition & 1 deletion src/composables/config/useSouthDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export default (autoLoad = true, needRefreshStatus = false) => {
}

const modifyNodeLogLevel = async (node: DriverItemInList) => {
await modifyNodeLogLevelToDebug(node.name)
await modifyNodeLogLevelToDebug(node.name, node.log_level)
}

const reloadDriverList = () => {
Expand Down
1 change: 1 addition & 0 deletions src/types/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export interface DriverStateData {
running: NodeState
link: NodeLinkState
rtt?: number
log_level: string
}

export interface DriverAllStatusData {
Expand Down

0 comments on commit 189b0f8

Please sign in to comment.