From b59601b8d7f809d1f27e4605d3d6b065b1461d3d Mon Sep 17 00:00:00 2001 From: Hongyuan Ma Date: Sun, 8 Jul 2018 23:43:21 +0800 Subject: [PATCH] adapt the style of userinfo-card --- .../src/component/userinfo-card/index.css | 24 +++++++++- .../src/component/userinfo-card/index.jsx | 26 ++++++---- front-end/src/page/portal/index.jsx | 6 ++- front-end/src/util/machine-table/index.jsx | 47 ++++++++++--------- 4 files changed, 71 insertions(+), 32 deletions(-) diff --git a/front-end/src/component/userinfo-card/index.css b/front-end/src/component/userinfo-card/index.css index e5c7b4e..5493460 100644 --- a/front-end/src/component/userinfo-card/index.css +++ b/front-end/src/component/userinfo-card/index.css @@ -2,11 +2,31 @@ border-top: 3px solid #2497ba; } -.panel-default > .panel-heading { - background-color: #dadada; +.panel-default > .userinfo-panel-heading{ + padding-bottom: 5px; + /*border-bottom: 0.5px solid #333333;*/ + display: flex; + justify-content: space-between; } +.panel-report-num{ + font-size: 14px; + color: rgba(0,0,0,.4); +} .panel-body-ul{ list-style: none!important; padding: 0!important; +} + +.userinfo-panel-body{ + font-size: 15.5px; + line-height: initial; + padding-top: 0; + padding-bottom: 0; + border-top: 1px solid #ddd; +} + +.user-avatar{ + height: 35px; + width: 35px; } \ No newline at end of file diff --git a/front-end/src/component/userinfo-card/index.jsx b/front-end/src/component/userinfo-card/index.jsx index 6aacbe3..ec5fbd3 100644 --- a/front-end/src/component/userinfo-card/index.jsx +++ b/front-end/src/component/userinfo-card/index.jsx @@ -1,7 +1,7 @@ import React from 'react'; import NavTop from 'component/nav-top/index.jsx'; -// import './index.css'; +import './index.css'; import {Image, Card, Button, List, Icon} from 'semantic-ui-react' class UserInfoCard extends React.Component { constructor(props){ @@ -15,12 +15,22 @@ class UserInfoCard extends React.Component {
-
-

-   Your Info -

+
+
+

+   Your Info +

+ + report num: 4 + +
+ +
+ + +
-
+

{userinfo.username}

  • {userinfo.machine_num} machine(s)
  • @@ -29,8 +39,8 @@ class UserInfoCard extends React.Component {
  • {userinfo.email}
- {/*
*/} - {/*
*/} +
+
); diff --git a/front-end/src/page/portal/index.jsx b/front-end/src/page/portal/index.jsx index 3f9b6cb..de542f0 100644 --- a/front-end/src/page/portal/index.jsx +++ b/front-end/src/page/portal/index.jsx @@ -14,6 +14,7 @@ class Portal extends React.Component { constructor(props) { super(props); this.state = { + username: '', isLoading: false, machines:[], userinfo: {} @@ -22,6 +23,9 @@ class Portal extends React.Component { } componentDidMount(){ let user = _util.getStorage('userInfo') + this.setState({ + username: user.username, + }); console.log(user.token) this.loadUserMachineManageList(); } @@ -39,7 +43,7 @@ class Portal extends React.Component { loadUserMachineManageList(page=1){ _user.getUserMachineManageList().then(res => { this.setState({ - machines: res.machines, + machines: res.results, total: res.count, isLoading: false }); diff --git a/front-end/src/util/machine-table/index.jsx b/front-end/src/util/machine-table/index.jsx index 356bc32..d590bde 100644 --- a/front-end/src/util/machine-table/index.jsx +++ b/front-end/src/util/machine-table/index.jsx @@ -4,17 +4,20 @@ import {Icon, Table, Label, Message, Button} from 'semantic-ui-react' import Pagination from 'util/pagination/index.jsx' import './index.css'; -function Bubble(props) { - - if (props.num <= 0) { +function LastestLink(props) { + let _list = props.list + if (_list <= 0) { return null; } - let className = props.name + 'IconClassName'; - return ( - - ); + + let ret = _list.map((item, index) => { + return ( + + {item.branch} + + ); + }); + return ret; } // general basic table @@ -44,16 +47,18 @@ class MachineTable extends React.Component { let style = { display: 'show' }; - let listBody = _list.map((record, index) => { - let machine = record.machine_info[0]; + let listBody = _list.map((machineItem, index) => { + let machine = machineItem let system = machine.os_name + ' ' + machine.os_version + ' ' + machine.comp_name + ' ' + machine.comp_version; let alias = machine.alias; + let lastest = machine.lastest; + let state = machine.state; + let reports = machine.reports - let trend = record.trend - let improvedIconClassName = trend.improved > 0 ? 'improved' : 'anonymous' - let quoIconClassName = trend.quo > 0 ? 'quo' : 'anonymous' - let regressiveIconClassName = trend.regressive > 0 ? 'regressive' : 'anonymous' + // let improvedIconClassName = trend.improved > 0 ? 'improved' : 'anonymous' + // let quoIconClassName = trend.quo > 0 ? 'quo' : 'anonymous' + // let regressiveIconClassName = trend.regressive > 0 ? 'regressive' : 'anonymous' return ( @@ -64,24 +69,24 @@ class MachineTable extends React.Component { {system} {/*State*/} - acitve + {state} {/*lastest-records*/} - - - + {/**/} + {/**/} + {/*machine history*/} - + Link {/*date*/} - {record.add_time} + {} ); }); -- 2.39.5