Skip to content

Commit

Permalink
fix: radial bar chart style broken in 1.3k-1.7k px window
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJacky committed Jun 24, 2024
1 parent 6f349aa commit 355eec1
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 24 deletions.
2 changes: 2 additions & 0 deletions api/user/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/0xJacky/Nginx-UI/api"
"github.com/0xJacky/Nginx-UI/model"
"net/http"
"time"

"github.com/gin-gonic/gin"
"golang.org/x/crypto/bcrypt"
Expand All @@ -29,6 +30,7 @@ func Login(c *gin.Context) {
u, _ := model.GetUser(user.Name)

if err := bcrypt.CompareHashAndPassword([]byte(u.Password), []byte(user.Password)); err != nil {
time.Sleep(5 * time.Second)
c.JSON(http.StatusForbidden, gin.H{
"message": "The username or password is incorrect",
})
Expand Down
50 changes: 28 additions & 22 deletions app/src/components/Chart/RadialBarChart.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
<script setup lang="ts">
import VueApexCharts from 'vue3-apexcharts'
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: Series[] | number[]
centerText?: string
colors?: string
name?: string
bottomText?: string
}>()
const props = defineProps<{
series: Series[] | number[]
centerText?: string
colors?: string
name?: string
bottomText?: string
}>()
const settings = useSettingsStore()
const { theme } = storeToRefs(settings)
const chartOptions = reactive({
series,
const fontColor = () => {
return theme.value === 'dark' ? '#fcfcfc' : undefined
}
const chartOptions = computed(() => ({
series: props.series,
chart: {
type: 'radialBar',
offsetY: 0,
Expand All @@ -31,24 +34,24 @@ const chartOptions = reactive({
dataLabels: {
name: {
fontSize: '14px',
color: colors,
color: props.colors,
offsetY: 36,
},
value: {
offsetY: 50,
offsetY: -12,
fontSize: '14px',
color: undefined,
color: fontColor(),
formatter: () => {
return ''
return props.centerText
},
},
},
},
},
fill: {
colors,
colors: props.colors,
},
labels: [name],
labels: [props.name],
states: {
hover: {
filter: {
Expand All @@ -61,7 +64,7 @@ const chartOptions = reactive({
},
},
},
})
}))
</script>

<template>
Expand All @@ -70,14 +73,12 @@ const chartOptions = reactive({
:key="theme"
class="radial-bar-container"
>
<p class="text">
{{ centerText }}
</p>
<p class="bottom_text">
{{ bottomText }}
</p>
<VueApexCharts
v-if="centerText"
ref="refContainer"

Check failure on line 81 in app/src/components/Chart/RadialBarChart.vue

View workflow job for this annotation

GitHub Actions / build_app

'refContainer' is defined as ref, but never used
class="radialBar"
type="radialBar"
height="205"
Expand All @@ -96,6 +97,9 @@ const chartOptions = reactive({
.radialBar {
position: absolute;
top: -30px;
@media (max-width: 1700px) and (min-width: 1200px) {
top: -10px;
}
@media (max-width: 768px) and (min-width: 290px) {
left: 50%;
transform: translateX(-50%);
Expand All @@ -104,14 +108,16 @@ const chartOptions = reactive({
.text {
position: absolute;
top: calc(50% - 5px);
width: 100%;
text-align: center;
}
.bottom_text {
position: absolute;
top: calc(106px);
@media (max-width: 1300px) and (min-width: 1200px) {
top: calc(96px);
}
font-weight: 600;
width: 100%;
text-align: center;
Expand Down
2 changes: 1 addition & 1 deletion app/src/version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"2.0.0-beta.25","build_id":137,"total_build":341}
{"version":"2.0.0-beta.25","build_id":138,"total_build":342}
2 changes: 1 addition & 1 deletion app/version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"2.0.0-beta.25","build_id":137,"total_build":341}
{"version":"2.0.0-beta.25","build_id":138,"total_build":342}

0 comments on commit 355eec1

Please sign in to comment.