mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
[frontend-next] Optimized styles
This commit is contained in:
parent
4512fc0309
commit
2a13103186
6 changed files with 85 additions and 72 deletions
|
@ -176,7 +176,9 @@ const reset_search = async () => {
|
||||||
layout="inline"
|
layout="inline"
|
||||||
>
|
>
|
||||||
<template #action>
|
<template #action>
|
||||||
<a-button @click="reset_search">重置</a-button>
|
<div class="reset-btn">
|
||||||
|
<a-button @click="reset_search">重置</a-button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</std-data-entry>
|
</std-data-entry>
|
||||||
<a-table
|
<a-table
|
||||||
|
@ -238,4 +240,11 @@ const reset_search = async () => {
|
||||||
// overflow-x: scroll;
|
// overflow-x: scroll;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.reset-btn {
|
||||||
|
// min-height: 50px;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {defineComponent} from 'vue'
|
import {defineComponent} from 'vue'
|
||||||
import {Form, FormItem} from 'ant-design-vue'
|
import {Form, FormItem} from 'ant-design-vue'
|
||||||
|
import './style.less'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: ['dataList', 'dataSource', 'error', 'layout'],
|
props: ['dataList', 'dataSource', 'error', 'layout'],
|
||||||
|
@ -18,7 +19,7 @@ export default defineComponent({
|
||||||
})
|
})
|
||||||
|
|
||||||
if (slots.action) {
|
if (slots.action) {
|
||||||
template.push(<div>{slots.action()}</div>)
|
template.push(<div class={'std-data-entry-action'}>{slots.action()}</div>)
|
||||||
}
|
}
|
||||||
|
|
||||||
return <Form layout={props.layout || 'vertical'}>{template}</Form>
|
return <Form layout={props.layout || 'vertical'}>{template}</Form>
|
||||||
|
|
7
frontend/src/components/StdDataEntry/style.less
Normal file
7
frontend/src/components/StdDataEntry/style.less
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
.std-data-entry-action {
|
||||||
|
@media (max-width: 350px) {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,19 +1,60 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import HeaderLayout from './HeaderLayout.vue'
|
||||||
|
import SideBar from './SideBar.vue'
|
||||||
|
import FooterLayout from './FooterLayout.vue'
|
||||||
|
import PageHeader from '@/components/PageHeader/PageHeader.vue'
|
||||||
|
import zh_CN from 'ant-design-vue/es/locale/zh_CN'
|
||||||
|
import zh_TW from 'ant-design-vue/es/locale/zh_TW'
|
||||||
|
import en_US from 'ant-design-vue/es/locale/en_US'
|
||||||
|
import {computed, ref} from 'vue'
|
||||||
|
import _ from 'lodash'
|
||||||
|
|
||||||
|
import gettext from '@/gettext'
|
||||||
|
|
||||||
|
const drawer_visible = ref(false)
|
||||||
|
const collapsed = ref(collapse())
|
||||||
|
const clientWidth = ref(getClientWidth())
|
||||||
|
|
||||||
|
addEventListener('resize', _.throttle(() => {
|
||||||
|
collapsed.value = collapse()
|
||||||
|
}, 50))
|
||||||
|
|
||||||
|
function getClientWidth() {
|
||||||
|
return document.body.clientWidth
|
||||||
|
}
|
||||||
|
|
||||||
|
function collapse() {
|
||||||
|
return getClientWidth() < 768
|
||||||
|
}
|
||||||
|
|
||||||
|
const lang = computed(() => {
|
||||||
|
switch (gettext.current) {
|
||||||
|
case 'zh_CN':
|
||||||
|
return zh_CN
|
||||||
|
case 'zh_TW':
|
||||||
|
return zh_TW
|
||||||
|
default:
|
||||||
|
return en_US
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<a-config-provider :locale="lang">
|
<a-config-provider :locale="lang">
|
||||||
<a-layout style="min-height: 100%;">
|
<a-layout style="min-height: 100%;">
|
||||||
<a-drawer
|
<template v-show="clientWidth.value<512">
|
||||||
v-show="clientWidth<512"
|
<a-drawer
|
||||||
:closable="false"
|
:closable="false"
|
||||||
:visible="collapsed"
|
v-model:visible="drawer_visible"
|
||||||
placement="left"
|
placement="left"
|
||||||
@close="collapsed=false"
|
@close="drawer_visible=false"
|
||||||
>
|
>
|
||||||
<side-bar/>
|
<side-bar/>
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
<a-layout-sider
|
<a-layout-sider
|
||||||
v-show="clientWidth>=512"
|
v-model:collapsed="collapsed"
|
||||||
v-model="collapsed"
|
|
||||||
:collapsible="true"
|
:collapsible="true"
|
||||||
:style="{zIndex: 11}"
|
:style="{zIndex: 11}"
|
||||||
theme="light"
|
theme="light"
|
||||||
|
@ -24,7 +65,7 @@
|
||||||
|
|
||||||
<a-layout>
|
<a-layout>
|
||||||
<a-layout-header :style="{position: 'fixed', zIndex: 10, width:'100%'}">
|
<a-layout-header :style="{position: 'fixed', zIndex: 10, width:'100%'}">
|
||||||
<header-layout @clickUnFold="collapsed=true"/>
|
<header-layout @clickUnFold="drawer_visible=true"/>
|
||||||
</a-layout-header>
|
</a-layout-header>
|
||||||
|
|
||||||
<a-layout-content>
|
<a-layout-content>
|
||||||
|
@ -43,59 +84,14 @@
|
||||||
</a-config-provider>
|
</a-config-provider>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<style lang="less" scoped>
|
||||||
import HeaderLayout from './HeaderLayout.vue'
|
.layout-sider {
|
||||||
import SideBar from './SideBar.vue'
|
@media (max-width: 600px) {
|
||||||
import FooterLayout from './FooterLayout.vue'
|
display: none;
|
||||||
import PageHeader from '@/components/PageHeader/PageHeader.vue'
|
|
||||||
import zh_CN from 'ant-design-vue/es/locale/zh_CN'
|
|
||||||
import zh_TW from 'ant-design-vue/es/locale/zh_TW'
|
|
||||||
import en_US from 'ant-design-vue/es/locale/en_US'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'BaseLayout',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
collapsed: this.collapse(),
|
|
||||||
clientWidth: document.body.clientWidth,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
window.onresize = () => {
|
|
||||||
this.collapsed = this.collapse()
|
|
||||||
this.clientWidth = this.getClientWidth()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
SideBar,
|
|
||||||
PageHeader,
|
|
||||||
HeaderLayout,
|
|
||||||
FooterLayout
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getClientWidth() {
|
|
||||||
return document.body.clientWidth
|
|
||||||
},
|
|
||||||
collapse() {
|
|
||||||
return !(this.getClientWidth() > 768 || this.getClientWidth() < 512)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
lang: {
|
|
||||||
get() {
|
|
||||||
switch (this.$language.current) {
|
|
||||||
case 'zh_CN':
|
|
||||||
return zh_CN
|
|
||||||
case 'zh_TW':
|
|
||||||
return zh_TW
|
|
||||||
default:
|
|
||||||
return en_US
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</style>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
.layout-sider .sidebar {
|
.layout-sider .sidebar {
|
||||||
//position: fixed;
|
//position: fixed;
|
||||||
|
|
|
@ -68,7 +68,7 @@ function logout() {
|
||||||
.tool {
|
.tool {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 20px;
|
left: 20px;
|
||||||
@media (min-width: 512px) {
|
@media (min-width: 600px) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ function wsOnMessage(m: { data: any }) {
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<a-row :gutter="[16,16]" class="first-row">
|
<a-row :gutter="[16,16]" class="first-row">
|
||||||
<a-col :xl="7" :lg="24" :md="24">
|
<a-col :xl="7" :lg="24" :md="24" :xs="24">
|
||||||
<a-card :title="$gettext('Server Info')" :bordered="false">
|
<a-card :title="$gettext('Server Info')" :bordered="false">
|
||||||
<p>
|
<p>
|
||||||
<translate>Uptime:</translate>
|
<translate>Uptime:</translate>
|
||||||
|
@ -155,7 +155,7 @@ function wsOnMessage(m: { data: any }) {
|
||||||
</p>
|
</p>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :xl="10" :lg="16" :md="24" class="chart_dashboard">
|
<a-col :xl="10" :lg="16" :md="24" :xs="24" class="chart_dashboard">
|
||||||
<a-card :title="$gettext('Memory and Storage')" :bordered="false">
|
<a-card :title="$gettext('Memory and Storage')" :bordered="false">
|
||||||
<a-row :gutter="[0,16]">
|
<a-row :gutter="[0,16]">
|
||||||
<a-col :xs="24" :sm="24" :md="8">
|
<a-col :xs="24" :sm="24" :md="8">
|
||||||
|
@ -174,7 +174,7 @@ function wsOnMessage(m: { data: any }) {
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :xl="7" :lg="8" :sm="24" class="chart_dashboard">
|
<a-col :xl="7" :lg="8" :sm="24" :xs="24" class="chart_dashboard">
|
||||||
<a-card :title="$gettext('Network Statistics')" :bordered="false">
|
<a-card :title="$gettext('Network Statistics')" :bordered="false">
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
|
@ -190,7 +190,7 @@ function wsOnMessage(m: { data: any }) {
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
<a-row class="row-two" :gutter="[16,32]">
|
<a-row class="row-two" :gutter="[16,32]">
|
||||||
<a-col :xl="8" :lg="24" :md="24" :sm="24">
|
<a-col :xl="8" :lg="24" :md="24" :sm="24" :xs="24">
|
||||||
<a-card :title="$gettext('CPU Status')" :bordered="false">
|
<a-card :title="$gettext('CPU Status')" :bordered="false">
|
||||||
<a-statistic :value="cpu" title="CPU">
|
<a-statistic :value="cpu" title="CPU">
|
||||||
<template v-slot:suffix>
|
<template v-slot:suffix>
|
||||||
|
@ -200,7 +200,7 @@ function wsOnMessage(m: { data: any }) {
|
||||||
<area-chart :series="cpu_analytic_series" :max="100"/>
|
<area-chart :series="cpu_analytic_series" :max="100"/>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :xl="8" :lg="12" :md="24" :sm="24">
|
<a-col :xl="8" :lg="12" :md="24" :sm="24" :xs="24">
|
||||||
<a-card :title="$gettext('Network')">
|
<a-card :title="$gettext('Network')">
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
|
@ -222,7 +222,7 @@ function wsOnMessage(m: { data: any }) {
|
||||||
<area-chart :series="net_analytic" :y_formatter="net_formatter"/>
|
<area-chart :series="net_analytic" :y_formatter="net_formatter"/>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :xl="8" :lg="12" :md="24" :sm="24">
|
<a-col :xl="8" :lg="12" :md="24" :sm="24" :xs="24">
|
||||||
<a-card :title="$gettext('Disk IO')">
|
<a-card :title="$gettext('Disk IO')">
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue