添加服务器地区筛选按钮
This commit is contained in:
parent
2e1514d15c
commit
6c356c1e4c
@ -6,16 +6,10 @@ import {ElMessage, ElMessageBox} from "element-plus";
|
|||||||
import {cpuNameToImage, fitToRightByteUnit, osNameToIcon, percentageToStatus, rename} from "@/tools";
|
import {cpuNameToImage, fitToRightByteUnit, osNameToIcon, percentageToStatus, rename} from "@/tools";
|
||||||
import RuntimeHistroy from "@/component/RuntimeHistroy.vue";
|
import RuntimeHistroy from "@/component/RuntimeHistroy.vue";
|
||||||
import {Delete} from "@element-plus/icons-vue";
|
import {Delete} from "@element-plus/icons-vue";
|
||||||
|
import {useStore} from "@/store";
|
||||||
|
|
||||||
const locations = [
|
const store = useStore()
|
||||||
{name: 'cn', desc: '中国大陆'},
|
const locations = store.locations
|
||||||
{name: 'hk', desc: '香港'},
|
|
||||||
{name: 'jp', desc: '日本'},
|
|
||||||
{name: 'us', desc: '美国'},
|
|
||||||
{name: 'sg', desc: '新加坡'},
|
|
||||||
{name: 'kr', desc: '韩国'},
|
|
||||||
{name: 'de', desc: '德国'}
|
|
||||||
]
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
id: Number,
|
id: Number,
|
||||||
@ -80,8 +74,10 @@ function deleteClient() {
|
|||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
if(props.show && details.runtime) {
|
if(props.show && details.runtime) {
|
||||||
get(`/api/monitor/runtime-now?clientId=${props.id}`, data => {
|
get(`/api/monitor/runtime-now?clientId=${props.id}`, data => {
|
||||||
details.runtime.list.splice(0, 1)
|
if(details.runtime.list[0].timestamp !== data.timestamp) {
|
||||||
details.runtime.list.push(data)
|
details.runtime.list.splice(0, 1)
|
||||||
|
details.runtime.list.push(data)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, 10000)
|
}, 10000)
|
||||||
|
@ -7,7 +7,16 @@ export const useStore = defineStore('general', {
|
|||||||
role: '',
|
role: '',
|
||||||
username: '',
|
username: '',
|
||||||
email: ''
|
email: ''
|
||||||
}
|
}, locations: [
|
||||||
|
{name: 'cn', desc: '中国大陆'},
|
||||||
|
{name: 'hk', desc: '香港'},
|
||||||
|
{name: 'jp', desc: '日本'},
|
||||||
|
{name: 'us', desc: '美国'},
|
||||||
|
{name: 'sg', desc: '新加坡'},
|
||||||
|
{name: 'kr', desc: '韩国'},
|
||||||
|
{name: 'de', desc: '德国'}
|
||||||
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import PreviewCard from "@/component/PreviewCard.vue";
|
import PreviewCard from "@/component/PreviewCard.vue";
|
||||||
import {get} from "@/net";
|
import {get} from "@/net";
|
||||||
import {reactive, ref} from "vue";
|
import {computed, reactive, ref} from "vue";
|
||||||
import ClientDetails from "@/component/ClientDetails.vue";
|
import ClientDetails from "@/component/ClientDetails.vue";
|
||||||
import {Plus} from "@element-plus/icons-vue";
|
import {Plus} from "@element-plus/icons-vue";
|
||||||
import RegisterCard from "@/component/RegisterCard.vue";
|
import RegisterCard from "@/component/RegisterCard.vue";
|
||||||
@ -11,6 +11,8 @@ import {useStore} from "@/store";
|
|||||||
const store = useStore()
|
const store = useStore()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const list = ref([])
|
const list = ref([])
|
||||||
|
const checkedNodes = ref([])
|
||||||
|
const locations = store.locations
|
||||||
|
|
||||||
const detail = reactive({
|
const detail = reactive({
|
||||||
show: false,
|
show: false,
|
||||||
@ -26,6 +28,14 @@ const register = reactive({
|
|||||||
})
|
})
|
||||||
const refreshToken = () => get('/api/monitor/register', code => register.token = code)
|
const refreshToken = () => get('/api/monitor/register', code => register.token = code)
|
||||||
|
|
||||||
|
const clientList = computed(() => {
|
||||||
|
if(checkedNodes.value.length === 0) {
|
||||||
|
return list.value
|
||||||
|
} else {
|
||||||
|
return list.value.filter(item => checkedNodes.value.indexOf(item.location) >= 0)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const updateList = () => {
|
const updateList = () => {
|
||||||
if(route.name === 'manage')
|
if(route.name === 'manage')
|
||||||
get('/api/monitor/list', data => list.value = data)
|
get('/api/monitor/list', data => list.value = data)
|
||||||
@ -47,8 +57,16 @@ updateList()
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-divider style="margin: 10px 0"/>
|
<el-divider style="margin: 10px 0"/>
|
||||||
|
<div style="margin-bottom: 20px">
|
||||||
|
<el-checkbox-group v-model="checkedNodes">
|
||||||
|
<el-checkbox v-for="node in locations" :key="node" :label="node.name" border>
|
||||||
|
<span :class="`flag-icon flag-icon-${node.name}`"></span>
|
||||||
|
<span style="font-size: 13px;margin-left: 10px">{{node.desc}}</span>
|
||||||
|
</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</div>
|
||||||
<div class="card-list">
|
<div class="card-list">
|
||||||
<preview-card :update="updateList" :data="item" v-for="item in list"
|
<preview-card :update="updateList" :data="item" v-for="item in clientList"
|
||||||
@click="displayClientDetails(item.id)"/>
|
@click="displayClientDetails(item.id)"/>
|
||||||
</div>
|
</div>
|
||||||
<el-drawer size="520" :show-close="false" v-model="detail.show"
|
<el-drawer size="520" :show-close="false" v-model="detail.show"
|
||||||
@ -64,6 +82,10 @@ updateList()
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
:deep(.el-checkbox-group .el-checkbox) {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
:deep(.el-drawer) {
|
:deep(.el-drawer) {
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
height: calc(100% - 20px);
|
height: calc(100% - 20px);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user