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> </script>
<style> <style>
#app { #app {
height: 100%; height: 100%;
} }
</style> </style>

View File

@ -1,9 +1,9 @@
<template> <template>
<div :class="prefixCls"> <div class="footer-toolbar">
<div style="float: left"> <div class="footer-toolbar-left">
<slot name="extra">{{ extra }}</slot> <slot name="extra">{{ extra }}</slot>
</div> </div>
<div style="float: right"> <div class="footer-toolbar-right">
<slot></slot> <slot></slot>
</div> </div>
</div> </div>
@ -15,7 +15,7 @@ export default {
props: { props: {
prefixCls: { prefixCls: {
type: String, type: String,
default: 'ant-pro-footer-toolbar' default: 'reduced'
}, },
extra: { extra: {
type: [String, Object], type: [String, Object],
@ -26,5 +26,32 @@ export default {
</script> </script>
<style lang="less" scoped> <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> </style>

View File

@ -157,8 +157,8 @@ export default {
}) })
return ( return (
<div class="ant-pro-multi-tab"> <div class="multi-tab">
<div class="ant-pro-multi-tab-wrapper"> <div class="multi-tab-wrapper">
<a-tabs <a-tabs
hideAdd hideAdd
type={'editable-card'} type={'editable-card'}
@ -173,3 +173,15 @@ export default {
} }
} }
</script> </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: { props: {
prefixCls: { prefixCls: {
type: String, type: String,
default: 'ant-pro-number-info' default: 'number-info'
}, },
total: { total: {
type: Number, type: Number,
@ -50,5 +50,57 @@ export default {
</script> </script>
<style lang="less" scoped> <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> </style>

View File

@ -1,5 +1,5 @@
<template> <template>
<div :class="[prefixCls, reverseColor && 'reverse-color' ]"> <div class="trend" :class="[ reverseColor && 'reverse-color' ]">
<span> <span>
<slot name="term"></slot> <slot name="term"></slot>
<span class="item-text"> <span class="item-text">
@ -31,5 +31,43 @@ export default {
</script> </script>
<style lang="less" scoped> <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> </style>

View File

@ -1,11 +1,10 @@
<template> <template>
<div :style="{ padding: '0 0 32px 32px' }"> <div class="bar-wrapper">
<h4 :style="{ marginBottom: '20px' }">{{ title }}</h4> <h4 class="bar-headline">{{ title }}</h4>
<v-chart <v-chart
height="254" class="bar-chart"
:data="data" :data="data"
:forceFit="true" :forceFit="true">
:padding="['auto', 'auto', '40', '50']">
<v-tooltip /> <v-tooltip />
<v-axis /> <v-axis />
<v-bar position="x*y"/> <v-bar position="x*y"/>
@ -55,3 +54,20 @@ export default {
} }
} }
</script> </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> <template>
<a-card :loading="loading" :body-style="{ padding: '20px 24px 8px' }" :bordered="false"> <a-card :loading="loading" :body-style="{ padding: '20px 24px 8px' }" :bordered="false">
<div class="chart-card-header"> <div class="chart-card-header">
<div class="meta"> <div class="chart-card-meta">
<span class="chart-card-title"> <span class="chart-card-title">
<slot name="title"> <slot name="title">
{{ title }} {{ title }}
@ -11,19 +11,19 @@
<slot name="action"></slot> <slot name="action"></slot>
</span> </span>
</div> </div>
<div class="total"> <div class="chart-card-total">
<slot name="total"> <slot name="total">
<span>{{ typeof total === 'function' && total() || total }}</span> <span>{{ typeof total === 'function' && total() || total }}</span>
</slot> </slot>
</div> </div>
</div> </div>
<div class="chart-card-content"> <div class="chart-card-content">
<div class="content-fix"> <div class="chart-card-content-fix">
<slot></slot> <slot></slot>
</div> </div>
</div> </div>
<div class="chart-card-footer"> <div class="chart-card-footer">
<div class="field"> <div class="chart-card-field">
<slot name="footer"></slot> <slot name="footer"></slot>
</div> </div>
</div> </div>
@ -52,61 +52,59 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.chart-card-header { .chart-card {
&-header {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
width: 100%; 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; cursor: pointer;
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
} }
.chart-card-footer { &-footer {
border-top: 1px solid #e8e8e8; border-top: 1px solid #e8e8e8;
padding-top: 9px; padding-top: 9px;
margin-top: 8px; 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-top: -42px;
margin-bottom: 12px; margin-bottom: 12px;
position: relative; position: relative;
height: 100%; height: 100%;
width: 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; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
word-break: break-all; word-break: break-all;
@ -118,4 +116,5 @@ export default {
line-height: 38px; line-height: 38px;
height: 38px; height: 38px;
} }
}
</style> </style>

View File

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

View File

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

View File

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

View File

@ -1,11 +1,11 @@
<template> <template>
<div class="chart-mini-progress"> <div class="mini-progress-wrapper">
<div class="target" :style="{ left: target + '%'}"> <div class="mini-progress-target target" :style="{ left: target + '%'}">
<span :style="{ backgroundColor: color }" /> <span class="mini-progress-background"/>
<span :style="{ backgroundColor: color }"/> <span class="mini-progress-background2"/>
</div> </div>
<div class="progress-wrapper"> <div class="mini-progress-wrapper-inner">
<div class="progress" :style="{ backgroundColor: color, width: percentage + '%', height: height }"></div> <div class="mini-progress-progress"></div>
</div> </div>
</div> </div>
</template> </template>
@ -35,41 +35,59 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.chart-mini-progress { @import "~ant-design-vue/lib/style/themes/default";
.mini-progress {
&-wrapper {
padding: 5px 0; padding: 5px 0;
position: relative; position: relative;
width: 100%; 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> </style>

View File

@ -1,5 +1,5 @@
<template> <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-tooltip></v-tooltip>
<v-axis :dataKey="axis1Opts.dataKey" :line="axis1Opts.line" :tickLine="axis1Opts.tickLine" :grid="axis1Opts.grid" /> <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" /> <v-axis :dataKey="axis2Opts.dataKey" :line="axis2Opts.line" :tickLine="axis2Opts.tickLine" :grid="axis2Opts.grid" />
@ -63,6 +63,11 @@ export default {
} }
</script> </script>
<style scoped> <style lang="less" scoped>
.radar {
&-chart {
height: 400px;
padding: 20 20 95 20;
}
}
</style> </style>

View File

@ -1,11 +1,11 @@
<template> <template>
<div class="rank"> <div class="rank-list-wrapper">
<h4 class="title">{{ title }}</h4> <h4>{{ title }}</h4>
<ul class="list"> <ul class="rank-list-list">
<li :key="index" v-for="(item, index) in list"> <li class="rank-list-item" :key="index" v-for="(item, index) in list">
<span :class="index < 3 ? 'active' : null">{{ index + 1 }}</span> <span class="rank-list-index" :class="index < 3 ? 'is-active' : null">{{ index + 1 }}</span>
<span>{{ item.name }}</span> <span class="rank-list-name">{{ item.name }}</span>
<span>{{ item.total }}</span> <span class="rank-list-total">{{ item.total }}</span>
</li> </li>
</ul> </ul>
</div> </div>
@ -29,49 +29,46 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.rank-list {
margin: 25px 0 0;
padding: 0;
list-style: none;
.rank { &-wrapper {
padding: 0 32px 32px 72px; padding: 0 32px 32px 72px;
.list { .mobile & {
margin: 25px 0 0; padding-left: 32px;
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 .rank { &-item {
padding: 0 32px 32px 32px; 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> </style>

View File

@ -1,12 +1,12 @@
<template> <template>
<div :style="{ padding: '0 0 32px 32px' }"> <div class="transfer-bar-wrapper">
<h4 :style="{ marginBottom: '20px' }">{{ title }}</h4> <h4 class="transfer-bar-headline">{{ title }}</h4>
<v-chart <v-chart
height="254" class="transfer-bar-chart"
:data="data" :data="data"
:scale="scale" :scale="scale"
:forceFit="true" :forceFit="true"
:padding="['auto', 'auto', '40', '50']"> >
<v-tooltip /> <v-tooltip />
<v-axis /> <v-axis />
<v-bar position="x*y"/> <v-bar position="x*y"/>
@ -62,3 +62,20 @@ export default {
} }
} }
</script> </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> <template class="trend">
<div class="chart-trend"> <div class="trend-wrapper chart-trend">
{{ term }} {{ term }}
<span>{{ rate }}%</span> <span class="trend-rate">{{ rate }}%</span>
<span :class="['trend-icon', trend]"><a-icon :type="'caret-' + trend"/></span> <span class="trend-icon " :class="[trend]"><a-icon :type="'caret-' + trend"/></span>
</div> </div>
</template> </template>
@ -51,32 +51,36 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.chart-trend { .trend {
&-wrapper {
display: inline-block; display: inline-block;
font-size: 14px; font-size: 14px;
line-height: 22px; line-height: 22px;
}
.trend-icon { &-icon {
font-size: 12px; font-size: 12px;
&.up, &.down { &.up,
margin-left: 4px; &.down {
position: relative; margin-left: 4px;
top: 1px; position: relative;
i { i {
font-size: 12px; font-size: 12px;
transform: scale(.83); transform: scale(.83);
}
}
&.up {
color: #f5222d;
}
&.down {
color: #52c41a;
top: -1px;
} }
} }
&.up {
color: #f5222d;
top: 1px;
}
&.down {
color: #52c41a;
top: -1px;
}
} }
}
</style> </style>

View File

@ -11,8 +11,7 @@
:menu="menus" :menu="menus"
:theme="theme" :theme="theme"
:mode="mode" :mode="mode"
@select="onSelect" @select="onSelect"></s-menu>
style="padding: 16px 0px;"></s-menu>
</a-layout-sider> </a-layout-sider>
</template> </template>
@ -60,3 +59,35 @@ export default {
} }
} }
</script> </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> </script>
<style lang="less" scoped> <style lang="less" scoped>
.breadcrumb { .ant-layout-header {
display: inline; .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> </style>

View File

@ -59,7 +59,7 @@
/> />
<!-- layout content --> <!-- 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> <slot></slot>
</a-layout-content> </a-layout-content>
@ -154,6 +154,12 @@ export default {
</script> </script>
<style lang="less"> <style lang="less">
.layout-content {
&.is-header-fixed {
margin: 68px 24px 0;
}
}
// Todo try to get this rules scoped // Todo try to get this rules scoped
.ant-drawer.drawer-sider { .ant-drawer.drawer-sider {
.sider { .sider {

View File

@ -1,8 +1,8 @@
<template> <template>
<div class="head-info" :class="center && 'center'"> <div class="head-info" :class="center && 'center'">
<span>{{ title }}</span> <span class="head-info-title">{{ title }}</span>
<p>{{ content }}</p> <p class="head-info-content">{{ content }}</p>
<em v-if="bordered"/> <em class="head-info-border" v-if="bordered"/>
</div> </div>
</template> </template>
@ -31,37 +31,39 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.head-info { .head-info {
position: relative; position: relative;
text-align: left; text-align: left;
padding: 0 32px 0 0; padding: 0 32px 0 0;
min-width: 125px; min-width: 125px;
&.center { &.center {
text-align: center; text-align: center;
padding: 0 32px; 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;
}
} }
&-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> </style>

View File

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

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="logo"> <div class="logo">
<img src="../../assets/logo.png"/> <img class="logo-image" src="../../assets/logo.png"/>
<project-menu></project-menu> <project-menu></project-menu>
</div> </div>
</template> </template>
@ -28,8 +28,28 @@ export default {
} }
</script> </script>
<style> <style type="less" scoped>
.logo img { .logo {
margin-right: 10px; 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> </style>

View File

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

View File

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

View File

@ -1,41 +1,41 @@
<template> <template>
<div class="user-wrapper"> <div class="user-menu">
<translation-menu class="action"/> <translation-menu class="action"/>
<header-notice class="action"/> <header-notice class="action"/>
<a-dropdown> <a-dropdown>
<span class="action ant-dropdown-link user-dropdown-menu"> <span class="user-menu-dropdown action">
<a-avatar class="avatar" size="small" :src="avatar()"/> <a-avatar class="user-menu-avatar avatar" size="small" :src="avatar()"/>
<span>{{ nickname() }}</span> <span>{{ nickname() }}</span>
</span> </span>
<a-menu slot="overlay" class="user-dropdown-menu-wrapper"> <a-menu slot="overlay" class="user-menu-wrapper">
<a-menu-item key="0"> <a-menu-item class="user-menu-item" key="0">
<router-link :to="{ name: 'account' }"> <router-link :to="{ name: 'account' }">
<a-icon type="user"/> <a-icon class="user-menu-item-icon" type="user"/>
<span>Profile</span> <span class="user-menu-item-name">Profile</span>
</router-link> </router-link>
</a-menu-item> </a-menu-item>
<a-menu-item key="1"> <a-menu-item class="user-menu-item" key="1">
<router-link :to="{ name: 'account' }"> <router-link :to="{ name: 'account' }">
<a-icon type="setting"/> <a-icon class="user-menu-item-icon" type="setting"/>
<span>Account</span> <span class="user-menu-item-name">Account</span>
</router-link> </router-link>
</a-menu-item> </a-menu-item>
<a-menu-item key="2" disabled> <a-menu-item class="user-menu-item" key="2" disabled>
<a-icon type="setting"/> <a-icon class="user-menu-item-icon" type="setting"/>
<span>测试</span> <span class="user-menu-item-name">测试</span>
</a-menu-item> </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 :href="helpUrl" target="_blank">
<a-icon type="question-circle-o"></a-icon> <a-icon class="user-menu-item-icon" type="question-circle-o"></a-icon>
<span>Help</span> <span class="user-menu-item-name">Help</span>
</a> </a>
</a-menu-item> </a-menu-item>
<a-menu-divider/> <a-menu-divider/>
<a-menu-item key="4"> <a-menu-item class="user-menu-item" key="4">
<a href="javascript:;" @click="handleLogout"> <a href="javascript:;" @click="handleLogout">
<a-icon type="logout"/> <a-icon class="user-menu-item-icon" type="logout"/>
<span>Logout</span> <span class="user-menu-item-name">Logout</span>
</a> </a>
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
@ -78,25 +78,23 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.user-dropdown-menu { .user-menu {
span { &-wrapper {
user-select: none;
}
}
.user-dropdown-menu-wrapper.ant-dropdown-menu {
padding: 4px 0; 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> </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-layout-header";
@import "ant-overwrite/ant-progress"; @import "ant-overwrite/ant-progress";
@import "frame/header/translation-menu";
@import "frame/content"; @import "frame/content";
@import "frame/search"; @import "frame/search";
@import "frame/sider";
@import "frame/top-menu"; @import "frame/top-menu";
@import "objects/table"; @import "objects/table";

View File

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

View File

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