refactoring of less rules (#26)

This is a difficult first step to more unified less code.

replace inline styles with class names and define rules at the end of vue files
remove first ant-pro classes (no benefits with it yet)
move some less rules to components

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
M. Weber 2019-08-13 10:05:01 +02:00 committed by Rohit Yadav
parent c614de862e
commit 671a04cc8c
31 changed files with 708 additions and 430 deletions

View File

@ -23,7 +23,7 @@ export default {
}
</script>
<style>
#app {
height: 100%;
}
#app {
height: 100%;
}
</style>

View File

@ -1,9 +1,9 @@
<template>
<div :class="prefixCls">
<div style="float: left">
<div class="footer-toolbar">
<div class="footer-toolbar-left">
<slot name="extra">{{ extra }}</slot>
</div>
<div style="float: right">
<div class="footer-toolbar-right">
<slot></slot>
</div>
</div>
@ -15,7 +15,7 @@ export default {
props: {
prefixCls: {
type: String,
default: 'ant-pro-footer-toolbar'
default: 'reduced'
},
extra: {
type: [String, Object],
@ -26,5 +26,32 @@ export default {
</script>
<style lang="less" scoped>
.footer-toolbar {
position: fixed;
width: 100%;
bottom: 0;
right: 0;
height: 56px;
line-height: 56px;
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.03);
background: #fff;
border-top: 1px solid #e8e8e8;
padding: 0 24px;
z-index: 9;
&:after {
content: "";
display: block;
clear: both;
}
&-left {
float: left;
}
&-right {
float: right;
}
}
</style>

View File

@ -157,8 +157,8 @@ export default {
})
return (
<div class="ant-pro-multi-tab">
<div class="ant-pro-multi-tab-wrapper">
<div class="multi-tab">
<div class="multi-tab-wrapper">
<a-tabs
hideAdd
type={'editable-card'}
@ -173,3 +173,15 @@ export default {
}
}
</script>
<style lang="less" scoped>
.multi-tab {
margin: -23px -24px 24px -24px;
background: #fff;
}
.topmenu .multi-tab-wrapper {
max-width: 1200px;
margin: 0 auto;
}
</style>

View File

@ -21,7 +21,7 @@ export default {
props: {
prefixCls: {
type: String,
default: 'ant-pro-number-info'
default: 'number-info'
},
total: {
type: Number,
@ -50,5 +50,57 @@ export default {
</script>
<style lang="less" scoped>
@import "index";
@import '~ant-design-vue/lib/style/themes/default';
.number-info {
.number-info-subtitle {
color: @text-color-secondary;
font-size: @font-size-base;
height: 22px;
line-height: 22px;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
white-space: nowrap;
}
.number-info-value {
margin-top: 4px;
font-size: 0;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
white-space: nowrap;
& > span {
color: @heading-color;
display: inline-block;
line-height: 32px;
height: 32px;
font-size: 24px;
margin-right: 32px;
}
.sub-total {
color: @text-color-secondary;
font-size: @font-size-lg;
vertical-align: top;
margin-right: 0;
i {
font-size: 12px;
transform: scale(0.82);
margin-left: 4px;
}
:global {
.anticon-caret-up {
color: @red-6;
}
.anticon-caret-down {
color: @green-6;
}
}
}
}
}
</style>

View File

@ -1,5 +1,5 @@
<template>
<div :class="[prefixCls, reverseColor && 'reverse-color' ]">
<div class="trend" :class="[ reverseColor && 'reverse-color' ]">
<span>
<slot name="term"></slot>
<span class="item-text">
@ -31,5 +31,43 @@ export default {
</script>
<style lang="less" scoped>
@import "index";
@import "~ant-design-vue/lib/style/themes/default";
.trend {
display: inline-block;
font-size: @font-size-base;
line-height: 22px;
.up,
.down {
margin-left: 4px;
position: relative;
top: 1px;
i {
font-size: 12px;
transform: scale(0.83);
}
}
.item-text {
display: inline-block;
margin-left: 8px;
color: rgba(0,0,0,.85);
}
.up {
color: @red-6;
}
.down {
color: @green-6;
top: -1px;
}
&.reverse-color .up {
color: @green-6;
}
&.reverse-color .down {
color: @red-6;
}
}
</style>

View File

@ -1,11 +1,10 @@
<template>
<div :style="{ padding: '0 0 32px 32px' }">
<h4 :style="{ marginBottom: '20px' }">{{ title }}</h4>
<div class="bar-wrapper">
<h4 class="bar-headline">{{ title }}</h4>
<v-chart
height="254"
class="bar-chart"
:data="data"
:forceFit="true"
:padding="['auto', 'auto', '40', '50']">
:forceFit="true">
<v-tooltip />
<v-axis />
<v-bar position="x*y"/>
@ -55,3 +54,20 @@ export default {
}
}
</script>
<style lang="less" scoped>
.bar {
&-wrapper {
padding: 0 0 32px 32px;
}
&-headline {
margin-bottom: 20px;
}
&-chart {
height: 254px;
padding: 0 0 40px 50px;
}
}
</style>

View File

@ -1,7 +1,7 @@
<template>
<a-card :loading="loading" :body-style="{ padding: '20px 24px 8px' }" :bordered="false">
<div class="chart-card-header">
<div class="meta">
<div class="chart-card-meta">
<span class="chart-card-title">
<slot name="title">
{{ title }}
@ -11,19 +11,19 @@
<slot name="action"></slot>
</span>
</div>
<div class="total">
<div class="chart-card-total">
<slot name="total">
<span>{{ typeof total === 'function' && total() || total }}</span>
</slot>
</div>
</div>
<div class="chart-card-content">
<div class="content-fix">
<div class="chart-card-content-fix">
<slot></slot>
</div>
</div>
<div class="chart-card-footer">
<div class="field">
<div class="chart-card-field">
<slot name="footer"></slot>
</div>
</div>
@ -52,61 +52,59 @@ export default {
</script>
<style lang="less" scoped>
.chart-card-header {
.chart-card {
&-header {
position: relative;
overflow: hidden;
width: 100%;
.meta {
position: relative;
overflow: hidden;
width: 100%;
color: rgba(0, 0, 0, .45);
font-size: 14px;
line-height: 22px;
}
}
.chart-card-action {
&-meta {
position: relative;
overflow: hidden;
width: 100%;
color: rgba(0, 0, 0, .45);
font-size: 14px;
line-height: 22px;
}
&-action {
cursor: pointer;
position: absolute;
top: 0;
right: 0;
}
.chart-card-footer {
&-footer {
border-top: 1px solid #e8e8e8;
padding-top: 9px;
margin-top: 8px;
> * {
position: relative;
}
.field {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin: 0;
}
}
.chart-card-content {
&-field {
position: relative;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin: 0;
}
&-content {
margin-top: -42px;
margin-bottom: 12px;
position: relative;
height: 100%;
width: 100%;
.content-fix {
position: relative;
left: 0;
bottom: 0;
width: 100%;
}
}
.total {
&-content-fix {
position: relative;
left: 0;
bottom: 0;
width: 100%;
}
&-total {
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
@ -118,4 +116,5 @@ export default {
line-height: 38px;
height: 38px;
}
}
</style>

View File

@ -1,20 +1,20 @@
<template>
<div>
<v-chart
class="liquid-chart"
:forceFit="true"
:height="height"
:width="width"
:data="data"
:scale="scale"
:padding="0">
:scale="scale">
<v-tooltip />
<v-interval
:shape="['liquid-fill-gauge']"
position="transfer*value"
color=""
class="liquid-interval"
:v-style="{
lineWidth: 10,
opacity: 0.75
lineWidth: 10
}"
:tooltip="[
'transfer*value',
@ -27,6 +27,7 @@
]"
></v-interval>
<v-guide
class="liquid-guide"
v-for="(row, index) in data"
:key="index"
type="text"
@ -36,11 +37,6 @@
value: 45
}"
:content="row.value + '%'"
:v-style="{
fontSize: 100,
textAlign: 'center',
opacity: 0.75,
}"
/>
</v-chart>
</div>
@ -62,6 +58,19 @@ export default {
}
</script>
<style scoped>
<style lang="less" scoped>
.liquid {
&-graph {
padding: 0;
}
&-interval {
opacity: 0.75;
}
&-guide {
text-align: 'center';
opacity: 0.75;
}
}
</style>

View File

@ -1,7 +1,7 @@
<template>
<div class="antv-chart-mini">
<div class="chart-wrapper" :style="{ height: 46 }">
<v-chart :force-fit="true" :height="height" :data="data" :padding="[36, 0, 18, 0]">
<div class="mini-area-wrapper">
<div class="mini-area-wrapper2">
<v-chart class="mini-area-chart" :force-fit="true" :data="data">
<v-tooltip />
<v-smooth-area position="x*y" />
</v-chart>
@ -28,6 +28,7 @@ const tooltip = [
value: y
})
]
const scale = [{
dataKey: 'x',
min: 2
@ -44,13 +45,29 @@ export default {
return {
data,
tooltip,
scale,
height: 100
scale
}
}
}
</script>
<style lang="less" scoped>
@import "chart";
.mini-area {
&-wrapper {
position: relative;
width: 100%;
}
&-wrapper2 {
position: absolute;
bottom: -28px;
width: 100%;
height: 46px;
}
&-chart {
padding: 36px 0 18px 0;
height: 100px;
}
}
</style>

View File

@ -1,7 +1,7 @@
<template>
<div class="antv-chart-mini">
<div class="chart-wrapper" :style="{ height: 46 }">
<v-chart :force-fit="true" :height="height" :data="data" :padding="[36, 5, 18, 5]">
<div class="mini-bar-wrapper">
<div class="mini-bar-wrapper2">
<v-chart class="mini-bar-chart" :force-fit="true" :data="data">
<v-tooltip />
<v-bar position="x*y" />
</v-chart>
@ -36,22 +36,38 @@ const scale = [{
dataKey: 'y',
title: '时间',
min: 1,
max: 30
max: 22
}]
export default {
name: 'MiniBar',
name: 'MiniArea',
data () {
return {
data,
tooltip,
scale,
height: 100
scale
}
}
}
</script>
<style lang="less" scoped>
@import "chart";
.mini-bar {
&-wrapper {
position: relative;
width: 100%;
}
&-wrapper2 {
position: absolute;
bottom: -28px;
width: 100%;
height: 46px;
}
&-chart {
padding: 36px 0 18px 0;
height: 100px;
}
}
</style>

View File

@ -1,11 +1,11 @@
<template>
<div class="chart-mini-progress">
<div class="target" :style="{ left: target + '%'}">
<span :style="{ backgroundColor: color }" />
<span :style="{ backgroundColor: color }"/>
<div class="mini-progress-wrapper">
<div class="mini-progress-target target" :style="{ left: target + '%'}">
<span class="mini-progress-background"/>
<span class="mini-progress-background2"/>
</div>
<div class="progress-wrapper">
<div class="progress" :style="{ backgroundColor: color, width: percentage + '%', height: height }"></div>
<div class="mini-progress-wrapper-inner">
<div class="mini-progress-progress"></div>
</div>
</div>
</template>
@ -35,41 +35,59 @@ export default {
</script>
<style lang="less" scoped>
.chart-mini-progress {
@import "~ant-design-vue/lib/style/themes/default";
.mini-progress {
&-wrapper {
padding: 5px 0;
position: relative;
width: 100%;
.target {
position: absolute;
top: 0;
bottom: 0;
span {
border-radius: 100px;
position: absolute;
top: 0;
left: 0;
height: 4px;
width: 2px;
&:last-child {
top: auto;
bottom: 0;
}
}
}
.progress-wrapper {
background-color: #f5f5f5;
position: relative;
.progress {
transition: all .4s cubic-bezier(.08,.82,.17,1) 0s;
border-radius: 1px 0 0 1px;
background-color: #1890ff;
width: 0;
height: 100%;
}
}
}
&-wrapper-inner {
background-color: #f5f5f5;
position: relative;
}
&-target {
left: 0;
position: absolute;
top: 0;
bottom: 0;
}
&-background {
background-color: @cyan-6;
border-radius: 100px;
position: absolute;
top: 0;
left: 0;
height: 4px;
width: 2px;
}
&-background2 {
background-color: @cyan-6;
border-radius: 100px;
position: absolute;
top: 0;
left: 0;
height: 4px;
width: 2px;
top: auto;
bottom: 0;
}
&-progress {
background-color: @cyan-6;
width: 0%;
height: 0;
transition: all .4s cubic-bezier(.08, .82, .17, 1) 0s;
border-radius: 1px 0 0 1px;
background-color: #1890ff;
width: 0;
height: 100%;
}
}
</style>

View File

@ -1,5 +1,5 @@
<template>
<v-chart :forceFit="true" height="400" :data="data" :padding="[20, 20, 95, 20]" :scale="scale">
<v-chart class="radar-chart" :forceFit="true" :data="data" :scale="scale">
<v-tooltip></v-tooltip>
<v-axis :dataKey="axis1Opts.dataKey" :line="axis1Opts.line" :tickLine="axis1Opts.tickLine" :grid="axis1Opts.grid" />
<v-axis :dataKey="axis2Opts.dataKey" :line="axis2Opts.line" :tickLine="axis2Opts.tickLine" :grid="axis2Opts.grid" />
@ -63,6 +63,11 @@ export default {
}
</script>
<style scoped>
<style lang="less" scoped>
.radar {
&-chart {
height: 400px;
padding: 20 20 95 20;
}
}
</style>

View File

@ -1,11 +1,11 @@
<template>
<div class="rank">
<h4 class="title">{{ title }}</h4>
<ul class="list">
<li :key="index" v-for="(item, index) in list">
<span :class="index < 3 ? 'active' : null">{{ index + 1 }}</span>
<span>{{ item.name }}</span>
<span>{{ item.total }}</span>
<div class="rank-list-wrapper">
<h4>{{ title }}</h4>
<ul class="rank-list-list">
<li class="rank-list-item" :key="index" v-for="(item, index) in list">
<span class="rank-list-index" :class="index < 3 ? 'is-active' : null">{{ index + 1 }}</span>
<span class="rank-list-name">{{ item.name }}</span>
<span class="rank-list-total">{{ item.total }}</span>
</li>
</ul>
</div>
@ -29,49 +29,46 @@ export default {
</script>
<style lang="less" scoped>
.rank-list {
margin: 25px 0 0;
padding: 0;
list-style: none;
.rank {
&-wrapper {
padding: 0 32px 32px 72px;
.list {
margin: 25px 0 0;
padding: 0;
list-style: none;
li {
margin-top: 16px;
span {
color: rgba(0, 0, 0, .65);
font-size: 14px;
line-height: 22px;
&:first-child {
background-color: #f5f5f5;
border-radius: 20px;
display: inline-block;
font-size: 12px;
font-weight: 600;
margin-right: 24px;
height: 20px;
line-height: 20px;
width: 20px;
text-align: center;
}
&.active {
background-color: #314659;
color: #fff;
}
&:last-child {
float: right;
}
}
}
.mobile & {
padding-left: 32px;
}
}
.mobile .rank {
padding: 0 32px 32px 32px;
&-item {
margin-top: 16px;
color: rgba(0, 0, 0, .65);
font-size: 14px;
line-height: 22px;
}
&-index {
background-color: #f5f5f5;
border-radius: 20px;
display: inline-block;
font-size: 12px;
font-weight: 600;
margin-right: 24px;
height: 20px;
line-height: 20px;
width: 20px;
text-align: center;
&.is-active {
background-color: #314659;
color: #fff;
}
}
&-total {
float: right;
}
}
</style>

View File

@ -1,12 +1,12 @@
<template>
<div :style="{ padding: '0 0 32px 32px' }">
<h4 :style="{ marginBottom: '20px' }">{{ title }}</h4>
<div class="transfer-bar-wrapper">
<h4 class="transfer-bar-headline">{{ title }}</h4>
<v-chart
height="254"
class="transfer-bar-chart"
:data="data"
:scale="scale"
:forceFit="true"
:padding="['auto', 'auto', '40', '50']">
>
<v-tooltip />
<v-axis />
<v-bar position="x*y"/>
@ -62,3 +62,20 @@ export default {
}
}
</script>
<style lang="less" scoped>
.c-transfer-bar {
&-wrapper {
padding: 0 0 32px 32px;
}
&-headline {
margin-bottom: 20px;
}
&-chart {
height: 254px;
padding: 0 0 40px 50px;
}
}
</style>

View File

@ -1,8 +1,8 @@
<template>
<div class="chart-trend">
<template class="trend">
<div class="trend-wrapper chart-trend">
{{ term }}
<span>{{ rate }}%</span>
<span :class="['trend-icon', trend]"><a-icon :type="'caret-' + trend"/></span>
<span class="trend-rate">{{ rate }}%</span>
<span class="trend-icon " :class="[trend]"><a-icon :type="'caret-' + trend"/></span>
</div>
</template>
@ -51,32 +51,36 @@ export default {
</script>
<style lang="less" scoped>
.chart-trend {
.trend {
&-wrapper {
display: inline-block;
font-size: 14px;
line-height: 22px;
}
.trend-icon {
font-size: 12px;
&-icon {
font-size: 12px;
&.up, &.down {
margin-left: 4px;
position: relative;
top: 1px;
&.up,
&.down {
margin-left: 4px;
position: relative;
i {
font-size: 12px;
transform: scale(.83);
}
}
&.up {
color: #f5222d;
}
&.down {
color: #52c41a;
top: -1px;
i {
font-size: 12px;
transform: scale(.83);
}
}
&.up {
color: #f5222d;
top: 1px;
}
&.down {
color: #52c41a;
top: -1px;
}
}
}
</style>

View File

@ -11,8 +11,7 @@
:menu="menus"
:theme="theme"
:mode="mode"
@select="onSelect"
style="padding: 16px 0px;"></s-menu>
@select="onSelect"></s-menu>
</a-layout-sider>
</template>
@ -60,3 +59,35 @@ export default {
}
}
</script>
<style lang="less" scoped>
.sider {
box-shadow: 2px 0 6px rgba(0, 21, 41, .35);
position: relative;
z-index: 10;
height: auto;
.ant-layout-sider-children {
overflow-y: hidden;
&:hover {
overflow-y: auto;
}
}
&.ant-fixed-sidemenu {
position: fixed;
height: 100%;
}
&.light {
background-color: #fff;
box-shadow: 2px 0px 8px 0px rgba(29, 35, 41, 0.05);
.ant-menu-light {
border-right-color: transparent;
padding: 24px 0;
}
}
}
</style>

View File

@ -151,7 +151,28 @@ export default {
</script>
<style lang="less" scoped>
.breadcrumb {
display: inline;
.ant-layout-header {
.anticon-menu-fold {
font-size: 18px;
line-height: 1;
}
.ant-breadcrumb {
display: inline;
vertical-align: text-bottom;
}
.ant-breadcrumb .anticon {
margin-top: -3px;
margin-left: 12px;
}
.anticon-home {
font-size: 14px;
}
.anticon {
vertical-align: middle;
}
}
</style>

View File

@ -59,7 +59,7 @@
/>
<!-- layout content -->
<a-layout-content :style="{ margin: $store.getters.multiTab ? '24px 24px 0' : '24px 24px 0', height: '100%', paddingTop: fixedHeader ? '40px' : '0' }">
<a-layout-content class="layout-content" :class="{'is-header-fixed': fixedHeader}">
<slot></slot>
</a-layout-content>
@ -154,6 +154,12 @@ export default {
</script>
<style lang="less">
.layout-content {
&.is-header-fixed {
margin: 68px 24px 0;
}
}
// Todo try to get this rules scoped
.ant-drawer.drawer-sider {
.sider {

View File

@ -1,8 +1,8 @@
<template>
<div class="head-info" :class="center && 'center'">
<span>{{ title }}</span>
<p>{{ content }}</p>
<em v-if="bordered"/>
<span class="head-info-title">{{ title }}</span>
<p class="head-info-content">{{ content }}</p>
<em class="head-info-border" v-if="bordered"/>
</div>
</template>
@ -31,37 +31,39 @@ export default {
</script>
<style lang="less" scoped>
.head-info {
position: relative;
text-align: left;
padding: 0 32px 0 0;
min-width: 125px;
.head-info {
position: relative;
text-align: left;
padding: 0 32px 0 0;
min-width: 125px;
&.center {
text-align: center;
padding: 0 32px;
}
span {
color: rgba(0, 0, 0, .45);
display: inline-block;
font-size: 14px;
line-height: 22px;
margin-bottom: 4px;
}
p {
color: rgba(0, 0, 0, .85);
font-size: 24px;
line-height: 32px;
margin: 0;
}
em {
background-color: #e8e8e8;
position: absolute;
height: 56px;
width: 1px;
top: 0;
right: 0;
}
&.center {
text-align: center;
padding: 0 32px;
}
&-title {
color: rgba(0, 0, 0, .45);
display: inline-block;
font-size: 14px;
line-height: 22px;
margin-bottom: 4px;
}
&-content {
color: rgba(0, 0, 0, .85);
font-size: 24px;
line-height: 32px;
margin: 0;
}
&-border {
background-color: #e8e8e8;
position: absolute;
height: 56px;
width: 1px;
top: 0;
right: 0;
}
}
</style>

View File

@ -5,8 +5,7 @@
placement="bottomRight"
:autoAdjustOverflow="true"
:arrowPointAtCenter="true"
overlayClassName="ant-pro-header-notice__popover"
:overlayStyle="{ width: '300px', top: '50px' }">
overlayClassName="header-notice-popover">
<template slot="content">
<a-spin :spinning="loadding">
<a-tabs>
@ -38,9 +37,9 @@
</a-tabs>
</a-spin>
</template>
<span @click="fetchNotice" class="ant-pro-header-notice__opener">
<span @click="fetchNotice" class="header-notice-opener">
<a-badge count="12">
<a-icon class="ant-pro-header-notice__icon" type="bell" />
<a-icon class="header-notice-icon" type="bell" />
</a-badge>
</span>
</a-popover>
@ -76,27 +75,19 @@ export default {
display: inline-block;
transition: all 0.3s;
span {
vertical-align: initial;
}
}
.ant-pro-header-notice {
&__popover {
&-popover {
top: 50px !important;
width: 300px;
top: 50px;
}
&__opener {
&-opener {
display: inline-block;
transition: all 0.3s;
span {
vertical-align: initial;
}
vertical-align: initial;
}
&__icon {
&-icon {
font-size: 18px;
padding: 4px;
}

View File

@ -1,6 +1,6 @@
<template>
<div class="logo">
<img src="../../assets/logo.png"/>
<img class="logo-image" src="../../assets/logo.png"/>
<project-menu></project-menu>
</div>
</template>
@ -28,8 +28,28 @@ export default {
}
</script>
<style>
.logo img {
margin-right: 10px;
}
<style type="less" scoped>
.logo {
height: 64px;
position: relative;
line-height: 64px;
padding-left: 24px;
-webkit-transition: all .3s;
transition: all .3s;
background: #002140;
overflow: hidden;
}
.sider.light .logo {
background: #fff;
box-shadow: 1px 1px 0px 0px #e8e8e8;
}
.logo-image {
margin-right: 10px;
height: 32px;
width: 32px;
display: inline-block;
vertical-align: middle;
}
</style>

View File

@ -1,8 +1,8 @@
<template>
<span class="project-wrapper" :disabled="true">
<a-select
class="project-wrapper-select"
size="default"
style="width: 75%"
defaultValue="Default View"
:value="selectedProject"
:disabled="isDisabled()"
@ -83,3 +83,11 @@ export default {
}
}
</script>
<style lang="less" scoped>
.project-wrapper {
&-select {
width: 75%;
}
}
</style>

View File

@ -1,7 +1,7 @@
<template>
<a-dropdown>
<span class="action ant-dropdown-link ant-pro-translation-menu">
<span class="action ant-dropdown-link translation-menu">
<a-icon type="global"></a-icon>
</span>
<a-menu slot="overlay" @click="onClick">
@ -44,3 +44,10 @@ export default {
}
}
</script>
<style lang="less" scoped>
.translation-menu {
font-size: 18px;
line-height: 1;
}
</style>

View File

@ -1,41 +1,41 @@
<template>
<div class="user-wrapper">
<div class="user-menu">
<translation-menu class="action"/>
<header-notice class="action"/>
<a-dropdown>
<span class="action ant-dropdown-link user-dropdown-menu">
<a-avatar class="avatar" size="small" :src="avatar()"/>
<span class="user-menu-dropdown action">
<a-avatar class="user-menu-avatar avatar" size="small" :src="avatar()"/>
<span>{{ nickname() }}</span>
</span>
<a-menu slot="overlay" class="user-dropdown-menu-wrapper">
<a-menu-item key="0">
<a-menu slot="overlay" class="user-menu-wrapper">
<a-menu-item class="user-menu-item" key="0">
<router-link :to="{ name: 'account' }">
<a-icon type="user"/>
<span>Profile</span>
<a-icon class="user-menu-item-icon" type="user"/>
<span class="user-menu-item-name">Profile</span>
</router-link>
</a-menu-item>
<a-menu-item key="1">
<a-menu-item class="user-menu-item" key="1">
<router-link :to="{ name: 'account' }">
<a-icon type="setting"/>
<span>Account</span>
<a-icon class="user-menu-item-icon" type="setting"/>
<span class="user-menu-item-name">Account</span>
</router-link>
</a-menu-item>
<a-menu-item key="2" disabled>
<a-icon type="setting"/>
<span>测试</span>
<a-menu-item class="user-menu-item" key="2" disabled>
<a-icon class="user-menu-item-icon" type="setting"/>
<span class="user-menu-item-name">测试</span>
</a-menu-item>
<a-menu-item key="3" disabled>
<a-menu-item class="user-menu-item" key="3" disabled>
<a :href="helpUrl" target="_blank">
<a-icon type="question-circle-o"></a-icon>
<span>Help</span>
<a-icon class="user-menu-item-icon" type="question-circle-o"></a-icon>
<span class="user-menu-item-name">Help</span>
</a>
</a-menu-item>
<a-menu-divider/>
<a-menu-item key="4">
<a-menu-item class="user-menu-item" key="4">
<a href="javascript:;" @click="handleLogout">
<a-icon type="logout"/>
<span>Logout</span>
<a-icon class="user-menu-item-icon" type="logout"/>
<span class="user-menu-item-name">Logout</span>
</a>
</a-menu-item>
</a-menu>
@ -78,25 +78,23 @@ export default {
</script>
<style lang="less" scoped>
.user-dropdown-menu {
span {
user-select: none;
}
}
.user-dropdown-menu-wrapper.ant-dropdown-menu {
.user-menu {
&-wrapper {
padding: 4px 0;
.ant-dropdown-menu-item {
width: 160px;
}
.ant-dropdown-menu-item > .anticon:first-child,
.ant-dropdown-menu-item > a > .anticon:first-child,
.ant-dropdown-menu-submenu-title > .anticon:first-child .ant-dropdown-menu-submenu-title > a > .anticon:first-child {
min-width: 12px;
margin-right: 8px;
}
}
&-item {
width: 160px;
}
&-item-name {
user-select: none;
margin-left: 8px;
}
&-item-icon i {
min-width: 12px;
margin-right: 8px;
}
}
</style>

View File

@ -1,4 +0,0 @@
.ant-pro-translation-menu {
font-size: 18px;
line-height: 1;
}

View File

@ -14,10 +14,8 @@
@import "ant-overwrite/ant-layout-header";
@import "ant-overwrite/ant-progress";
@import "frame/header/translation-menu";
@import "frame/content";
@import "frame/search";
@import "frame/sider";
@import "frame/top-menu";
@import "objects/table";

View File

@ -1,3 +1,4 @@
// todo refactor this file
.layout.ant-layout {
height: auto;
overflow-x: hidden;
@ -5,13 +6,6 @@
&.mobile,
&.tablet {
.ant-layout-content {
.content {
margin: 24px 0 0;
}
}
.ant-table-wrapper {
.ant-table-content {
overflow-y: auto;
@ -120,9 +114,10 @@
.header,
.top-nav-header-index {
.user-wrapper {
.user-menu {
float: right;
height: 100%;
padding: 0 2px;
.action {
cursor: pointer;
@ -153,7 +148,8 @@
}
&.dark {
.user-wrapper {
.user-menu {
.action {
color: rgba(255, 255, 255, 0.85);
@ -305,12 +301,4 @@
}
}
}
.layout-content {
margin: 24px 24px 0px;
height: 100%;
height: 64px;
padding: 0 12px 0 0;
}
}

View File

@ -1,83 +1,81 @@
<template>
<div class="page-header-index-wide">
<a-row :gutter="12" :style="{ marginTop: '24px' }">
<a-col :xl="18">
<div class="ant-pro-capacity-dashboard__wrapper">
<div class="ant-pro-capacity-dashboard__select">
<a-select
showSearch
optionFilterProp="children"
:defaultValue="zoneSelected.name"
:value="zoneSelected.name"
@change="changeZone"
style="width: 100%" >
<a-select-option v-for="(zone, index) in zones" :key="index">
{{ zone.name }}
</a-select-option>
</a-select>
</div>
<div class="ant-pro-capacity-dashboard__button">
<a-button
type="primary"
@click="listCapacity(zoneSelected, true)">Fetch Latest</a-button>
</div>
<div class="ant-pro-capacity-dashboard__button">
<a-button>
<router-link :to="{ name: 'alert' }">
<a-icon style="font-size: 16px; padding: 2px" type="flag" />
</router-link>
</a-button>
</div>
<div class="ant-pro-capacity-dashboard__button">
<a-button type="danger">
<router-link :to="{ name: 'host', query: {'state': 'Alert'} }">
<a-badge dot>
<a-icon style="font-size: 16px" type="desktop" />
</a-badge>
</router-link>
</a-button>
</div>
<a-row :gutter="12" :style="{ marginTop: '24px' }">
<a-col :xl="18">
<div class="ant-pro-capacity-dashboard__wrapper">
<div class="ant-pro-capacity-dashboard__select">
<a-select
showSearch
optionFilterProp="children"
:defaultValue="zoneSelected.name"
:value="zoneSelected.name"
@change="changeZone"
style="width: 100%" >
<a-select-option v-for="(zone, index) in zones" :key="index">
{{ zone.name }}
</a-select-option>
</a-select>
</div>
<a-row :gutter="12">
<a-col
:xl="6"
:style="{ marginBottom: '12px' }"
v-for="stat in stats"
:key="stat.type">
<chart-card :loading="loading">
<div style="text-align: center; white-space: nowrap; overflow: hidden;">
<h4>{{ stat.name }}</h4>
<a-progress type="dashboard" :percent="Number(parseFloat(stat.percentused, 10).toFixed(2))" :width="100" />
</div>
<template slot="footer"><span>{{ stat.capacityused }} / {{ stat.capacitytotal }}</span></template>
</chart-card>
</a-col>
</a-row>
</a-col>
<a-col :xl="6">
<chart-card>
<div style="text-align: center">
<a-button><router-link :to="{ name: 'event' }">View Events</router-link></a-button>
</div>
<template slot="footer">
<div :style="{ paddingTop: '12px', paddingLeft: '3px', whiteSpace: 'normal' }">
<a-timeline pending="...">
<a-timeline-item
v-for="event in events"
:key="event.id"
:color="getEventColour(event)">
<span :style="{ color: '#999' }"><small>{{ event.created }}</small></span><br/>
<span :style="{ color: '#666' }"><small>{{ event.type }}</small></span><br/>
<span :style="{ color: '#aaa' }">({{ event.username }}) {{ event.description }}</span>
</a-timeline-item>
</a-timeline>
<div class="ant-pro-capacity-dashboard__button">
<a-button
type="primary"
@click="listCapacity(zoneSelected, true)">Fetch Latest</a-button>
</div>
<div class="ant-pro-capacity-dashboard__button">
<a-button>
<router-link :to="{ name: 'alert' }">
<a-icon style="font-size: 16px; padding: 2px" type="flag" />
</router-link>
</a-button>
</div>
<div class="ant-pro-capacity-dashboard__button">
<a-button type="danger">
<router-link :to="{ name: 'host', query: {'state': 'Alert'} }">
<a-badge dot>
<a-icon style="font-size: 16px" type="desktop" />
</a-badge>
</router-link>
</a-button>
</div>
</div>
<a-row :gutter="12">
<a-col
:xl="6"
:style="{ marginBottom: '12px' }"
v-for="stat in stats"
:key="stat.type">
<chart-card :loading="loading">
<div style="text-align: center; white-space: nowrap; overflow: hidden;">
<h4>{{ stat.name }}</h4>
<a-progress type="dashboard" :percent="Number(parseFloat(stat.percentused, 10).toFixed(2))" :width="100" />
</div>
</template>
</chart-card>
</a-col>
</a-row>
</div>
<template slot="footer"><span>{{ stat.capacityused }} / {{ stat.capacitytotal }}</span></template>
</chart-card>
</a-col>
</a-row>
</a-col>
<a-col :xl="6">
<chart-card>
<div style="text-align: center">
<a-button><router-link :to="{ name: 'event' }">View Events</router-link></a-button>
</div>
<template slot="footer">
<div :style="{ paddingTop: '12px', paddingLeft: '3px', whiteSpace: 'normal' }">
<a-timeline pending="...">
<a-timeline-item
v-for="event in events"
:key="event.id"
:color="getEventColour(event)">
<span :style="{ color: '#999' }"><small>{{ event.created }}</small></span><br/>
<span :style="{ color: '#666' }"><small>{{ event.type }}</small></span><br/>
<span :style="{ color: '#aaa' }">({{ event.username }}) {{ event.description }}</span>
</a-timeline-item>
</a-timeline>
</div>
</template>
</chart-card>
</a-col>
</a-row>
</template>
<script>
@ -182,33 +180,19 @@ export default {
</script>
<style lang="less" scoped>
.extra-wrapper {
line-height: 55px;
//padding-right: 24px;
.extra-item {
display: inline-block;
//margin-right: 24px;
a {
//margin-left: 24px;
}
}
.ant-pro-capacity-dashboard {
&__wrapper {
display: flex;
margin-bottom: 12px;
}
.ant-pro-capacity-dashboard {
&__wrapper {
display: flex;
margin-bottom: 12px;
}
&__select {
width: 100%;
}
&__button {
width: auto;
padding-left: 12px;
}
&__select {
width: 100%;
}
&__button {
width: auto;
padding-left: 12px;
}
}
</style>

View File

@ -2,7 +2,10 @@
<div class="page-header-index-wide">
<a-row :gutter="12">
<a-col
:xl="16"
class="user-dashboard-chart-card"
:sm="12"
:md="12"
:xl="6"
:style="{ marginTop: '24px' }">
<a-row :gutter="12">
<a-col
@ -10,7 +13,7 @@
v-for="stat in stats"
:key="stat.type"
:style="{ marginBottom: '12px' }">
<chart-card :loading="loading">
<chart-card class="user-dashboard-chart-card" :loading="loading">
<router-link :to="{ name: stat.path }">
<div style="text-align: center">
<h4>{{ stat.name }}</h4>
@ -153,17 +156,15 @@ export default {
</script>
<style lang="less" scoped>
.extra-wrapper {
line-height: 55px;
//padding-right: 24px;
.user-dashboard {
margin-top: 24px;
.extra-item {
display: inline-block;
//margin-right: 24px;
&-chart-card {
padding-top: 24px;
}
a {
//margin-left: 24px;
}
&-chart-card-inner {
text-align: center;
}
}
</style>