From 3b9910529e5b981cc316fd06a318bfedca7f87c0 Mon Sep 17 00:00:00 2001 From: undefined Date: Thu, 16 Jul 2020 17:53:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dpretest=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E5=85=83=E4=BB=B6=E6=BA=A2=E5=87=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scratchpad/ScratchpadRecordsContainer.js | 83 +++++-------------- .../ScratchpadRecordsTableContainer.js | 33 -------- .../scratchpad/ScratchpadToolbarContainer.js | 25 ++++++ 3 files changed, 47 insertions(+), 94 deletions(-) delete mode 100644 ui/components/scratchpad/ScratchpadRecordsTableContainer.js diff --git a/ui/components/scratchpad/ScratchpadRecordsContainer.js b/ui/components/scratchpad/ScratchpadRecordsContainer.js index 43417ced7..9a51cd60b 100644 --- a/ui/components/scratchpad/ScratchpadRecordsContainer.js +++ b/ui/components/scratchpad/ScratchpadRecordsContainer.js @@ -1,44 +1,22 @@ import React from 'react'; import { connect } from 'react-redux'; -import Tabs, { TabPane } from 'rc-tabs'; -import TabContent from 'rc-tabs/lib/TabContent'; -import ScrollableInkTabBar from 'rc-tabs/lib/ScrollableInkTabBar'; - +import classNames from 'classnames'; import i18n from 'vj/utils/i18n'; -import request from 'vj/utils/request'; import Icon from 'vj/components/react/IconComponent'; import Panel from './PanelComponent'; -import PanelButton from './PanelButtonComponent'; -import ScratchpadRecordsTable from './ScratchpadRecordsTableContainer'; +import ScratchpadRecordsRow from './ScratchpadRecordsRowContainer'; -const mapDispatchToProps = (dispatch) => ({ - loadSubmissions() { - dispatch({ - type: 'SCRATCHPAD_RECORDS_LOAD_SUBMISSIONS', - payload: request.get(Context.getSubmissionsUrl), - }); - }, - handleClickClose() { - dispatch({ - type: 'SCRATCHPAD_UI_SET_VISIBILITY', - payload: { - uiElement: 'records', - visibility: false, - }, - }); - }, - handleClickRefresh() { - this.loadSubmissions(); - }, +const mapStateToProps = (state) => ({ + rows: state.records.rows, + isLoading: state.ui.records.isLoading, }); -@connect(null, mapDispatchToProps) +@connect(mapStateToProps) export default class ScratchpadRecordsContainer extends React.PureComponent { - componentDidMount() { - this.props.loadSubmissions(); - } - render() { + const cn = classNames('data-table is--full-row scratchpad__records__table', { + loading: this.props.isLoading, + }); return ( )} > - ( - - this.props.handleClickRefresh()} - > - {i18n('Refresh')} - - this.props.handleClickClose()} - > - - - - )} - /> - )} - renderTabContent={() => } - > - {i18n('All')}} key="all"> - - - + + + + + + + + + {this.props.rows.map((rowId) => ( + + ))} + +
); } diff --git a/ui/components/scratchpad/ScratchpadRecordsTableContainer.js b/ui/components/scratchpad/ScratchpadRecordsTableContainer.js deleted file mode 100644 index 76ee3a185..000000000 --- a/ui/components/scratchpad/ScratchpadRecordsTableContainer.js +++ /dev/null @@ -1,33 +0,0 @@ -import React from 'react'; -import classNames from 'classnames'; -import { connect } from 'react-redux'; -import ScratchpadRecordsRow from './ScratchpadRecordsRowContainer'; - -const mapStateToProps = (state) => ({ - rows: state.records.rows, - isLoading: state.ui.records.isLoading, -}); - -@connect(mapStateToProps) -export default class ScratchpadRecordsTableContainer extends React.PureComponent { - render() { - const cn = classNames('data-table is--full-row scratchpad__records__table', { - loading: this.props.isLoading, - }); - return ( - - - - - - - - - {this.props.rows.map((rowId) => ( - - ))} - -
- ); - } -} diff --git a/ui/components/scratchpad/ScratchpadToolbarContainer.js b/ui/components/scratchpad/ScratchpadToolbarContainer.js index 39f104b94..725fb0d73 100644 --- a/ui/components/scratchpad/ScratchpadToolbarContainer.js +++ b/ui/components/scratchpad/ScratchpadToolbarContainer.js @@ -59,6 +59,15 @@ const mapDispatchToProps = (dispatch) => ({ payload: req, }); }, + loadSubmissions() { + dispatch({ + type: 'SCRATCHPAD_RECORDS_LOAD_SUBMISSIONS', + payload: request.get(Context.getSubmissionsUrl), + }); + }, + handleClickRefresh() { + this.loadSubmissions(); + }, }); @connect(mapStateToProps, mapDispatchToProps) @@ -67,6 +76,10 @@ export default class ScratchpadToolbarContainer extends React.PureComponent { store: PropTypes.object, }; + componentDidMount() { + this.props.loadSubmissions(); + } + render() { return ( @@ -96,6 +109,18 @@ export default class ScratchpadToolbarContainer extends React.PureComponent { {' '} (F10) + this.props.handleClickRefresh()} + > + + {' '} + {i18n('Refresh')} + {' '} + (Alt+F) +