Skip to content
This repository was archived by the owner on Aug 24, 2019. It is now read-only.

Commit bd42a99

Browse files
committed
fix
1 parent 729cb7f commit bd42a99

File tree

3 files changed

+60
-62
lines changed

3 files changed

+60
-62
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
]
195195
}
196196
},
197-
"pre-commit": "lint:staged",
197+
// "pre-commit": "lint:staged",
198198
"lint-staged": {
199199
"*.{cmd,html,json,md,sh,txt,xml,yml}": [
200200
"editorconfig-tools fix",

src/components/AccessKeys/AccessKeys.js

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
import React, { PropTypes, Component } from 'react';
3-
import {Breadcrumb, Table, Button, Col} from 'react-bootstrap';
3+
import { Breadcrumb, Table, Button, Col } from 'react-bootstrap';
44
import withStyles from 'isomorphic-style-loader/lib/withStyles';
55
import s from './AccessKeys.css';
66
import cx from 'classnames';
@@ -25,43 +25,43 @@ class AccessKeys extends Component {
2525
static defaultProps = {
2626
isFetching: true,
2727
rs: [],
28-
removeKey: (name)=>{},
29-
patchKey: (name, friendlyName=null, ttl=0)=>{},
28+
removeKey: (name) => {},
29+
patchKey: (name, friendlyName = null, ttl = 0) => {},
3030
isCreating: false,
31-
createKey: ()=>{},
31+
createKey: () => {},
3232
isShowKey: false,
33-
close: ()=>{},
33+
close: () => {},
3434
token: '',
3535
};
3636

37-
constructor(){
37+
constructor() {
3838
super();
3939
this.renderRow = this.renderRow.bind(this);
4040
}
4141

4242
renderRow(rowData, index) {
43-
let self = this;
44-
var moment = require('moment');
43+
const self = this;
44+
const moment = require('moment');
4545
return (
46-
<tr key={index}>
46+
<tr key={_.get(rowData, 'id')}>
4747
<td>
48-
<MyEditor
49-
saveData={(str)=>{
50-
if (!_.eq(str, _.get(rowData, 'friendlyName'))) {
51-
self.props.patchKey(_.get(rowData, 'friendlyName'), str);
52-
}
53-
}}
54-
value={_.get(rowData, 'friendlyName')}
48+
<MyEditor
49+
saveData={(str) => {
50+
if (!_.eq(str, _.get(rowData, 'friendlyName'))) {
51+
self.props.patchKey(_.get(rowData, 'friendlyName'), str);
52+
}
53+
}}
54+
value={_.get(rowData, 'friendlyName')}
5555
/>
5656
</td>
5757
<td>{_.get(rowData, 'createdBy')}</td>
58-
<td>{_.get(rowData, 'isSession') ? 'session': 'accessKey'}</td>
58+
<td>{_.get(rowData, 'isSession') ? 'session' : 'accessKey'}</td>
5959
<td>{moment(_.get(rowData, 'createdTime')).fromNow()}</td>
6060
<td>{moment(_.get(rowData, 'expires')).fromNow()}</td>
6161
<td>
62-
<Button
63-
onClick={()=>{self.props.removeKey(_.get(rowData, 'friendlyName'))}}
64-
bsStyle="danger"
62+
<Button
63+
onClick={() => { self.props.removeKey(_.get(rowData, 'friendlyName')); }}
64+
bsStyle="danger"
6565
>
6666
移除
6767
</Button>
@@ -71,10 +71,10 @@ class AccessKeys extends Component {
7171
}
7272

7373
render() {
74-
let self = this;
74+
const self = this;
7575
let tipText = '暂无数据';
7676
if (this.props.isFetching) {
77-
tipText = '加载数据中...'
77+
tipText = '加载数据中...';
7878
}
7979
return (
8080
<div className={s.root}>
@@ -85,41 +85,39 @@ class AccessKeys extends Component {
8585
/>
8686
<div className={s.container}>
8787
<Breadcrumb>
88-
<Breadcrumb.Item active={true}>
88+
<Breadcrumb.Item active>
8989
密钥列表
9090
</Breadcrumb.Item>
9191
</Breadcrumb>
92-
<Col style={{marginBottom:'20px'}}>
92+
<Col style={{ marginBottom: '20px' }}>
9393
<Button
94-
onClick={()=>{
94+
onClick={() => {
9595
self.props.createKey();
9696
}}
9797
bsStyle="primary"
98-
disabled={this.props.isCreating ? true:false }
98+
disabled={!!this.props.isCreating}
9999
>
100100
创建key
101101
</Button>
102102
</Col>
103103
<Table striped bordered condensed hover responsive>
104104
<thead>
105105
<tr>
106-
<th style={{ textAlign:'center' }} >名字</th>
107-
<th style={{ textAlign:'center' }} >创建者</th>
108-
<th style={{ textAlign:'center' }} >类型</th>
109-
<th style={{ textAlign:'center' }} >创建时间</th>
110-
<th style={{ textAlign:'center' }} >过期时间</th>
111-
<th style={{ textAlign:'center' }} >操作</th>
106+
<th style={{ textAlign: 'center' }} >名字</th>
107+
<th style={{ textAlign: 'center' }} >创建者</th>
108+
<th style={{ textAlign: 'center' }} >类型</th>
109+
<th style={{ textAlign: 'center' }} >创建时间</th>
110+
<th style={{ textAlign: 'center' }} >过期时间</th>
111+
<th style={{ textAlign: 'center' }} >操作</th>
112112
</tr>
113113
</thead>
114114
<tbody>
115115
{
116116
this.props.rs.length > 0 ?
117-
_.map(this.props.rs, function (item, index) {
118-
return self.renderRow(item, index);
119-
})
117+
_.map(this.props.rs, (item, index) => self.renderRow(item, index))
120118
:
121119
<tr>
122-
<td colSpan="6" >{tipText}</td>
120+
<td colSpan="6" >{tipText}</td>
123121
</tr>
124122
}
125123
</tbody>

src/components/ProductList/ProductList.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
import React, { PropTypes, Component } from 'react';
3-
import {Breadcrumb, Table, Button, Col} from 'react-bootstrap';
3+
import { Breadcrumb, Table, Button, Col } from 'react-bootstrap';
44
import cx from 'classnames';
55
import _ from 'lodash';
66
import withStyles from 'isomorphic-style-loader/lib/withStyles';
@@ -17,7 +17,7 @@ class ProductList extends Component {
1717
static defaultProps = {
1818
isFetching: true,
1919
rs: [],
20-
popAddApp: ()=>{},
20+
popAddApp: () => {},
2121
};
2222

2323
constructor() {
@@ -27,7 +27,7 @@ class ProductList extends Component {
2727
renderRow(rowData, index) {
2828
const appName = _.get(rowData, 'name');
2929
return (
30-
<tr key={index}>
30+
<tr key={_.get(rowData, 'name')}>
3131
<td>
3232
<Link to={`/apps/${appName}`}>{appName}</Link>
3333
</td>
@@ -74,39 +74,39 @@ class ProductList extends Component {
7474
return (
7575
<div className={s.root}>
7676
<div className={s.container}>
77-
<Breadcrumb>
78-
<Breadcrumb.Item active={true}>
77+
<Breadcrumb>
78+
<Breadcrumb.Item active>
7979
应用列表
8080
</Breadcrumb.Item>
81-
</Breadcrumb>
82-
<Col style={{marginBottom:'20px'}}>
83-
<Button
84-
onClick={this.props.popAddApp}
85-
bsStyle="primary"
86-
>
81+
</Breadcrumb>
82+
<Col style={{ marginBottom: '20px' }}>
83+
<Button
84+
onClick={this.props.popAddApp}
85+
bsStyle="primary"
86+
>
8787
添加应用
8888
</Button>
89-
</Col>
90-
<Table striped bordered condensed hover responsive>
91-
<thead>
92-
<tr>
93-
<th style={{ textAlign:'center' }} >产品名</th>
94-
<th style={{ textAlign:'center' }} >成员</th>
95-
<th style={{ textAlign:'center' }} >Deployments</th>
96-
<th style={{ textAlign:'center' }} >操作</th>
97-
</tr>
98-
</thead>
99-
<tbody>
100-
{
89+
</Col>
90+
<Table striped bordered condensed hover responsive>
91+
<thead>
92+
<tr>
93+
<th style={{ textAlign: 'center' }} >产品名</th>
94+
<th style={{ textAlign: 'center' }} >成员</th>
95+
<th style={{ textAlign: 'center' }} >Deployments</th>
96+
<th style={{ textAlign: 'center' }} >操作</th>
97+
</tr>
98+
</thead>
99+
<tbody>
100+
{
101101
this.props.rs.length > 0 ?
102102
_.map(this.props.rs, (item, index) => self.renderRow(item, index))
103103
:
104104
<tr>
105105
<td colSpan="4" >{tipText}</td>
106106
</tr>
107107
}
108-
</tbody>
109-
</Table>
108+
</tbody>
109+
</Table>
110110
</div>
111111
</div>
112112
);

0 commit comments

Comments
 (0)