mirror of
https://github.com/chaos-zhu/easynode.git
synced 2026-10-07 16:37:58 +08:00
🆕 重构监控数据结构
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
const { readGroupList, writeGroupList, readHostList, writeHostList, randomStr } = require('../utils')
|
||||
|
||||
async function getGroupList({ res }) {
|
||||
const data = await readGroupList()
|
||||
let data = await readGroupList()
|
||||
data = data.map(item => {
|
||||
return { ...item, id: item._id }
|
||||
})
|
||||
data?.sort((a, b) => Number(b.index || 0) - Number(a.index || 0))
|
||||
res.success({ data })
|
||||
}
|
||||
|
||||
@@ -5,9 +5,11 @@ async function getHostList({ res }) {
|
||||
let data = await readHostList()
|
||||
data?.sort((a, b) => Number(b.index || 0) - Number(a.index || 0))
|
||||
data = data.map((item) => {
|
||||
const isConfig = Boolean(item.username && item.port && (item[item.authType]))
|
||||
const { username, port, authType, _id: id } = item
|
||||
const isConfig = Boolean(username && port && (item[authType]))
|
||||
return {
|
||||
...item,
|
||||
id,
|
||||
isConfig,
|
||||
password: '',
|
||||
privateKey: ''
|
||||
|
||||
Reference in New Issue
Block a user