Przeglądaj źródła

fix: radial bar chart style broken in 1.3k-1.7k px window

Jacky 10 miesięcy temu
rodzic
commit
7d5104e550

+ 2 - 0
api/user/auth.go

@@ -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"
@@ -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",
 		})

+ 27 - 22
app/src/components/Chart/RadialBarChart.vue

@@ -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,
@@ -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: {
@@ -61,7 +64,7 @@ const chartOptions = reactive({
       },
     },
   },
-})
+}))
 </script>
 
 <template>
@@ -70,9 +73,6 @@ const chartOptions = reactive({
     :key="theme"
     class="radial-bar-container"
   >
-    <p class="text">
-      {{ centerText }}
-    </p>
     <p class="bottom_text">
       {{ bottomText }}
     </p>
@@ -96,6 +96,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%);
@@ -104,7 +107,6 @@ const chartOptions = reactive({
 
   .text {
     position: absolute;
-    top: calc(50% - 5px);
     width: 100%;
     text-align: center;
   }
@@ -112,6 +114,9 @@ const chartOptions = reactive({
   .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;

+ 1 - 1
app/src/version.json

@@ -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}

+ 1 - 1
app/version.json

@@ -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}