|
|
@@ -24,16 +24,16 @@ class Collection extends React.Component {
|
|
|
}
|
|
|
|
|
|
generateCollectionMenus() {
|
|
|
- const { home } = this.props;
|
|
|
+ const { home, dispatch } = this.props;
|
|
|
const { collectionDashboards, menuFilterLabel } = home;
|
|
|
const reg = new RegExp('([+ \\- & | ! ( ) { } \\[ \\] ^ \" ~ * ? : ( ) \/])', 'g'); // 需要转义的字符
|
|
|
const regLabel = menuFilterLabel.replace(new RegExp('(\\\\)', 'g'), '\\$1').replace(reg, '\\$1'); // 添加转义符号
|
|
|
if(collectionDashboards.length > 0) {
|
|
|
return collectionDashboards.filter(c => c.name.search(new RegExp('(' + regLabel + '){1}', 'ig')) > -1).map((c, i) => (
|
|
|
- <li className='item' key={i}>
|
|
|
- <span style={{ fontWeight: 'bold', cursor: 'pointer' }} onClick={() => {
|
|
|
- this.openTab(c);
|
|
|
- }}>
|
|
|
+ <li className='item' key={i} onClick={() => {
|
|
|
+ this.openTab(c);
|
|
|
+ }}>
|
|
|
+ <span style={{ fontWeight: 'bold', cursor: 'pointer' }}>
|
|
|
<Icon style={{ marginRight: '8px' }} type="pushpin" />
|
|
|
{
|
|
|
<span>
|
|
|
@@ -47,6 +47,10 @@ class Collection extends React.Component {
|
|
|
</span>
|
|
|
}
|
|
|
</span>
|
|
|
+ <Icon type="star" theme="filled" style={{ color: '#F2B91D', cursor: 'pointer' }} onClick={(e) => {
|
|
|
+ e.stopPropagation()
|
|
|
+ dispatch({ type: 'home/uncollect', data: c });
|
|
|
+ }}/>
|
|
|
</li>
|
|
|
));
|
|
|
}else {
|