fix: fix overview page style when no-cinder

1. Fix cards styles in no-cinder overview page
2. Fix resource card style in no-cinder administra overview page
3. Fix overview cards border-radius, shadow, margin

Change-Id: Ifc44a923300074c07c6ff2eff449b1cfe0d003b1
This commit is contained in:
Jingwei.Zhang 2022-06-21 11:15:14 +08:00
parent 2e0d504594
commit 32cb739fd6
4 changed files with 21 additions and 16 deletions

View File

@ -14,7 +14,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Badge, Row, Col, Card, Descriptions } from 'antd'; import { Badge, Row, Col, Card } from 'antd';
import { inject, observer } from 'mobx-react'; import { inject, observer } from 'mobx-react';
import adminInstance from 'asset/image/admin-instance.svg'; import adminInstance from 'asset/image/admin-instance.svg';
import adminVolume from 'asset/image/admin-volume.svg'; import adminVolume from 'asset/image/admin-volume.svg';
@ -119,10 +119,11 @@ export class virtualResourceInfo extends Component {
renderCard() { renderCard() {
const { virtualResource } = this.props.store; const { virtualResource } = this.props.store;
const span = this.card.length === 1 ? 24 : 12;
return ( return (
<Row> <Row gutter={20}>
{this.card.map((item) => ( {this.card.map((item) => (
<Col span={12} style={{ textAlign: 'center' }} key={item.key}> <Col span={span} style={{ textAlign: 'center' }} key={item.key}>
<Card className={styles.card}> <Card className={styles.card}>
<Link to={item.to} style={{ color: '#000000' }}> <Link to={item.to} style={{ color: '#000000' }}>
<Row> <Row>
@ -194,12 +195,7 @@ export class virtualResourceInfo extends Component {
title={t('Virtual Resource Overview')} title={t('Virtual Resource Overview')}
bordered={false} bordered={false}
> >
<Descriptions column={1}> <div>{this.renderCard()}</div>
<div className="site-card-wrapper">
{this.renderCard()}
{/* {this.renderSmallCard()} */}
</div>
</Descriptions>
</Card> </Card>
); );
} }

View File

@ -45,7 +45,6 @@
.resource-overview { .resource-overview {
.card { .card {
height: 100%; height: 100%;
margin-right: 20px;
.label { .label {
display: block; display: block;

View File

@ -60,8 +60,15 @@ export class Overview extends Component {
return actions; return actions;
} }
get span() {
if (!globalRootStore.checkEndpoint('cinder')) {
return 8;
}
return 6;
}
renderAction = (item) => ( renderAction = (item) => (
<Row className={styles['action-button']} gutter={[8]}> <Row className={styles['action-button']}>
<Col span={8} className={styles['main-icon']}> <Col span={8} className={styles['main-icon']}>
<img alt="avatar" src={item.avatar} className={styles['action-icon']} /> <img alt="avatar" src={item.avatar} className={styles['action-icon']} />
</Col> </Col>
@ -73,7 +80,7 @@ export class Overview extends Component {
renderActions() { renderActions() {
return this.filterActions.map((item) => ( return this.filterActions.map((item) => (
<Col span={6} key={item.key}> <Col span={this.span} key={item.key}>
<Link to={item.to}>{this.renderAction(item)}</Link> <Link to={item.to}>{this.renderAction(item)}</Link>
</Col> </Col>
)); ));
@ -96,8 +103,8 @@ export class Overview extends Component {
<div className={styles.container}> <div className={styles.container}>
<Row <Row
justify="space-between" justify="space-between"
gutter={[22, 22]} gutter={16}
style={{ marginBottom: '22px' }} style={{ marginBottom: '16px' }}
> >
{this.renderActions()} {this.renderActions()}
</Row> </Row>

View File

@ -1,4 +1,5 @@
@import '~antd/lib/style/themes/default.less'; @import '~antd/lib/style/themes/default.less';
@import '~styles/variables';
.container { .container {
height: 100%; height: 100%;
@ -16,8 +17,8 @@
font-size: 18px; font-size: 18px;
line-height: 88px; line-height: 88px;
background: #fff; background: #fff;
border-radius: 9px; border-radius: @border-radius;
box-shadow: 0 0 4px 1px rgba(175, 175, 175, 50%); box-shadow: 0 2px 20px 0 rgba(0, 0, 0, 9%);
opacity: 0.9; opacity: 0.9;
} }
@ -109,6 +110,8 @@
} }
.bottom { .bottom {
border-radius: @border-radius;
:global { :global {
.ant-card { .ant-card {
box-shadow: unset; box-shadow: unset;