2023-07-08 22:59:16 +08:00
|
|
|
<script setup>
|
|
|
|
import {reactive} from "vue";
|
2023-07-11 16:11:15 +08:00
|
|
|
import {useWebNotification} from '@vueuse/core'
|
2023-07-08 22:59:16 +08:00
|
|
|
import {GetAllEnv} from "frontend/wailsjs/go/env/Env";
|
|
|
|
import {hideDebugger, showDebugger} from "src/utils/debugger/eruda";
|
2023-07-10 23:14:40 +08:00
|
|
|
import {useGlobalConfig} from "src/store/globalConfig";
|
|
|
|
import {storeToRefs} from "pinia";
|
2023-07-08 22:59:16 +08:00
|
|
|
|
|
|
|
const controller = reactive({
|
|
|
|
input: ""
|
|
|
|
})
|
|
|
|
|
|
|
|
function sendNotify() {
|
2023-07-12 00:35:32 +08:00
|
|
|
const options = {
|
|
|
|
title: '通知测试',
|
|
|
|
dir: 'auto',
|
|
|
|
body: "通知测试",
|
|
|
|
lang: 'zh-CN',
|
|
|
|
renotify: true,
|
|
|
|
tag: 'notify',
|
|
|
|
};
|
|
|
|
|
|
|
|
const notification = useWebNotification(options);
|
|
|
|
setTimeout(() => {
|
|
|
|
notification.close()
|
|
|
|
}, 5 * 1000)
|
|
|
|
notification.show()
|
2023-07-08 22:59:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function getAllEnv(){
|
|
|
|
GetAllEnv().then(allEnv => {
|
|
|
|
console.log(allEnv)
|
|
|
|
})
|
|
|
|
}
|
2023-07-10 23:14:40 +08:00
|
|
|
|
|
|
|
const globalConfig = useGlobalConfig()
|
|
|
|
const globalConfigState = storeToRefs(globalConfig)
|
|
|
|
|
|
|
|
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
|
|
|
import en from 'element-plus/dist/locale/en.mjs'
|
2023-07-11 01:27:05 +08:00
|
|
|
import {useGlobalTabs} from "src/store/globalTabs";
|
|
|
|
import {useRouter} from "vue-router";
|
2023-07-16 03:07:37 +08:00
|
|
|
import CPUUsage from "src/components/system/cpu/CPUUsage.vue";
|
2023-07-16 04:26:30 +08:00
|
|
|
import MemoryUsage from "src/components/system/memory/MemoryUsage.vue";
|
2023-07-17 15:53:59 +08:00
|
|
|
import CPUUsageChart from "src/components/system/cpu/CPUUsageChart.vue";
|
2023-07-18 12:00:28 +08:00
|
|
|
import MemoryUsageChart from "src/components/system/memory/MemoryUsageChart.vue";
|
2023-07-19 16:07:35 +08:00
|
|
|
import NetworkCounter from "src/components/system/network/NetworkCounter.vue";
|
2023-07-19 22:48:25 +08:00
|
|
|
import NetworkSumRateChart from "src/components/system/network/NetworkSumRateChart.vue"
|
2023-07-20 15:06:36 +08:00
|
|
|
import NetworkSumMaxRate from "src/components/system/network/NetworkSumMaxRate.vue";
|
2023-07-20 15:35:06 +08:00
|
|
|
import {useCpuInfo} from "src/utils/system/cpu";
|
2023-07-10 23:14:40 +08:00
|
|
|
function switchLocale(){
|
|
|
|
console.log(globalConfigState.ui.value.locale)
|
|
|
|
if(globalConfigState.ui.value.locale.name === 'zh-cn'){
|
|
|
|
globalConfig.$patch(state=>{
|
|
|
|
state.ui.locale = en
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
globalConfig.$patch(state=>{
|
|
|
|
state.ui.locale = zhCn
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2023-07-11 01:27:05 +08:00
|
|
|
|
|
|
|
const router = useRouter()
|
2023-07-11 16:11:15 +08:00
|
|
|
const globalTabState = useGlobalTabs()
|
2023-07-11 01:27:05 +08:00
|
|
|
function addTab(){
|
2023-07-11 16:11:15 +08:00
|
|
|
globalTabState.addTab({
|
2023-07-11 01:27:05 +08:00
|
|
|
name: "/test",
|
|
|
|
title: "测试",
|
|
|
|
})
|
2023-07-11 16:11:15 +08:00
|
|
|
globalTabState.tab = "/test"
|
2023-07-11 01:27:05 +08:00
|
|
|
}
|
2023-07-13 02:13:10 +08:00
|
|
|
|
|
|
|
const generateColumns = (length = 10, prefix = 'column-', props) =>
|
|
|
|
Array.from({ length }).map((_, columnIndex) => ({
|
|
|
|
...props,
|
|
|
|
key: `${prefix}${columnIndex}`,
|
|
|
|
dataKey: `${prefix}${columnIndex}`,
|
|
|
|
title: `Column ${columnIndex}`,
|
|
|
|
width: 150,
|
|
|
|
}))
|
|
|
|
|
2023-07-14 15:02:31 +08:00
|
|
|
const generateData = (
|
|
|
|
columns,
|
|
|
|
length = 200,
|
|
|
|
prefix = 'row-'
|
|
|
|
) =>
|
|
|
|
Array.from({ length }).map((_, rowIndex) => {
|
|
|
|
return columns.reduce(
|
|
|
|
(rowData, column, columnIndex) => {
|
|
|
|
rowData[column.dataKey] = `Row ${rowIndex} - Col ${columnIndex}`
|
|
|
|
return rowData
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: `${prefix}${rowIndex}`,
|
|
|
|
parentId: null,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
2023-07-20 15:35:06 +08:00
|
|
|
|
|
|
|
const cpuInfo = useCpuInfo()
|
2023-07-08 22:59:16 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-07-16 03:07:37 +08:00
|
|
|
|
2023-07-17 15:53:59 +08:00
|
|
|
<el-row>
|
2023-07-20 15:06:36 +08:00
|
|
|
<el-col :md="4" :sm="12">
|
2023-07-20 15:35:06 +08:00
|
|
|
<CPUUsage>
|
|
|
|
<template #footer>
|
|
|
|
<div class="text-sm">{{cpuInfo.modelName}}</div>
|
|
|
|
</template>
|
|
|
|
</CPUUsage>
|
2023-07-17 15:53:59 +08:00
|
|
|
</el-col>
|
2023-07-20 15:06:36 +08:00
|
|
|
<el-col :md="4" :sm="12">
|
2023-07-17 15:53:59 +08:00
|
|
|
<MemoryUsage>
|
|
|
|
<template #footer="{used, total}">
|
|
|
|
<div class="text-sm">{{ used }}/{{ total }}</div>
|
|
|
|
</template>
|
|
|
|
</MemoryUsage>
|
|
|
|
</el-col>
|
2023-07-20 15:06:36 +08:00
|
|
|
<el-col :sm="12" :md="4">
|
2023-07-19 16:07:35 +08:00
|
|
|
<NetworkCounter></NetworkCounter>
|
|
|
|
</el-col>
|
2023-07-20 15:06:36 +08:00
|
|
|
<el-col :sm="12" :md="4">
|
|
|
|
<NetworkSumMaxRate></NetworkSumMaxRate>
|
|
|
|
</el-col>
|
2023-07-17 15:53:59 +08:00
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-row>
|
2023-07-20 15:06:36 +08:00
|
|
|
<el-col :xs="24" :sm="12" :md="8">
|
2023-07-17 15:53:59 +08:00
|
|
|
<CPUUsageChart style="height: 300px"/>
|
|
|
|
</el-col>
|
2023-07-20 15:06:36 +08:00
|
|
|
<el-col :xs="24" :sm="12" :md="8">
|
2023-07-18 12:00:28 +08:00
|
|
|
<MemoryUsageChart style="height: 300px"/>
|
|
|
|
</el-col>
|
2023-07-20 15:06:36 +08:00
|
|
|
<el-col :xs="24" :sm="12" :md="8">
|
2023-07-19 22:48:25 +08:00
|
|
|
<NetworkSumRateChart style="height: 300px"/>
|
|
|
|
</el-col>
|
2023-07-17 15:53:59 +08:00
|
|
|
</el-row>
|
2023-07-16 03:07:37 +08:00
|
|
|
|
2023-07-17 10:05:45 +08:00
|
|
|
|
|
|
|
<el-button class="btn" @click="sendNotify()">通知</el-button>
|
2023-07-08 22:59:16 +08:00
|
|
|
<el-button @click="getAllEnv()">获取所有环境变量</el-button>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<el-button @click="showDebugger()">显示 debugger</el-button>
|
|
|
|
<el-button @click="hideDebugger()">隐藏 debugger</el-button>
|
|
|
|
</div>
|
2023-07-10 23:14:40 +08:00
|
|
|
|
|
|
|
<el-button @click="switchLocale()">切换 locale</el-button>
|
2023-07-11 01:27:05 +08:00
|
|
|
|
|
|
|
<el-button @click="addTab()">添加tab</el-button>
|
2023-07-14 17:20:38 +08:00
|
|
|
<el-button @click="router.push('/environment')">环境变量</el-button>
|
2023-07-25 02:12:00 +08:00
|
|
|
<el-button @click="router.push('/location-record')">定位记录</el-button>
|
2023-07-08 22:59:16 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
</style>
|