mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
refactor: refactor app and api
This commit is contained in:
parent
5ab50b8a93
commit
287ef7527d
157 changed files with 8116 additions and 3587 deletions
|
@ -1,21 +1,28 @@
|
|||
<script setup lang="ts">
|
||||
import VueApexCharts from 'vue3-apexcharts'
|
||||
import {reactive} from 'vue'
|
||||
import {useSettingsStore} from '@/pinia'
|
||||
import {storeToRefs} from 'pinia'
|
||||
import { reactive } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useSettingsStore } from '@/pinia'
|
||||
import type { Series } from '@/components/Chart/types'
|
||||
|
||||
const {series, centerText, colors, name, bottomText}
|
||||
= defineProps(['series', 'centerText', 'colors', 'name', 'bottomText'])
|
||||
const { series, centerText, colors, name, bottomText }
|
||||
= defineProps<{
|
||||
series: Series[]
|
||||
centerText?: string
|
||||
colors?: string
|
||||
name?: string
|
||||
bottomText?: string
|
||||
}>()
|
||||
|
||||
const settings = useSettingsStore()
|
||||
|
||||
const {theme} = storeToRefs(settings)
|
||||
const { theme } = storeToRefs(settings)
|
||||
|
||||
const chartOptions = reactive({
|
||||
series: series,
|
||||
series,
|
||||
chart: {
|
||||
type: 'radialBar',
|
||||
offsetY: 0
|
||||
offsetY: 0,
|
||||
},
|
||||
plotOptions: {
|
||||
radialBar: {
|
||||
|
@ -25,7 +32,7 @@ const chartOptions = reactive({
|
|||
name: {
|
||||
fontSize: '14px',
|
||||
color: colors,
|
||||
offsetY: 36
|
||||
offsetY: 36,
|
||||
},
|
||||
value: {
|
||||
offsetY: 50,
|
||||
|
@ -33,42 +40,53 @@ const chartOptions = reactive({
|
|||
color: undefined,
|
||||
formatter: () => {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
fill: {
|
||||
colors: colors
|
||||
colors,
|
||||
},
|
||||
labels: [name],
|
||||
states: {
|
||||
hover: {
|
||||
filter: {
|
||||
type: 'none'
|
||||
}
|
||||
type: 'none',
|
||||
},
|
||||
},
|
||||
active: {
|
||||
filter: {
|
||||
type: 'none'
|
||||
}
|
||||
}
|
||||
}
|
||||
type: 'none',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- Use theme as key to rerender the chart when theme changes to prevent style issues -->
|
||||
<div class="radial-bar-container" :key="theme">
|
||||
<p class="text">{{ centerText }}</p>
|
||||
<p class="bottom_text">{{ bottomText }}</p>
|
||||
<VueApexCharts v-if="centerText" class="radialBar" type="radialBar" height="205" :options="chartOptions"
|
||||
:series="series"
|
||||
ref="chart"/>
|
||||
<div
|
||||
:key="theme"
|
||||
class="radial-bar-container"
|
||||
>
|
||||
<p class="text">
|
||||
{{ centerText }}
|
||||
</p>
|
||||
<p class="bottom_text">
|
||||
{{ bottomText }}
|
||||
</p>
|
||||
<VueApexCharts
|
||||
v-if="centerText"
|
||||
class="radialBar"
|
||||
type="radialBar"
|
||||
height="205"
|
||||
:options="chartOptions"
|
||||
:series="series"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<style lang="less" scoped>
|
||||
.radial-bar-container {
|
||||
position: relative;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue