mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
添加path_section
This commit is contained in:
1 parent
53a6dbeb1a
commit
a2600d5cc4
8 files changed
+67
-39
No files matched your search
@@ -13,20 +13,11 @@ import Toolbar, {
|
||||
ToolbarSplitComponent as ToolbarSplit,
|
||||
} from './ToolbarComponent';
|
||||
|
||||
function isTestCaseDataValid(data) {
|
||||
return data.input.trim().length > 0 && data.output.trim().length > 0;
|
||||
}
|
||||
|
||||
function isPretestValid(state) {
|
||||
return _.some(state.tabs, id => isTestCaseDataValid(state.data[id]));
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
pretestVisible: state.ui.pretest.visible,
|
||||
recordsVisible: state.ui.records.visible,
|
||||
isPosting: state.ui.isPosting,
|
||||
editorLang: state.editor.lang,
|
||||
pretestValid: isPretestValid(state.pretest),
|
||||
});
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
@@ -45,9 +36,7 @@ const mapDispatchToProps = dispatch => ({
|
||||
postPretest(context) {
|
||||
const state = context.store.getState();
|
||||
const { pretest } = state;
|
||||
const testCases = pretest.tabs
|
||||
.filter(tabId => isTestCaseDataValid(pretest.data[tabId]));
|
||||
// const titles = testCases.map(tabId => pretest.meta[tabId].title);
|
||||
const testCases = pretest.tabs;
|
||||
const inputs = testCases.map(tabId => pretest.data[tabId].input);
|
||||
const outputs = testCases.map(tabId => pretest.data[tabId].output);
|
||||
const req = request.post(Context.postPretestUrl, {
|
||||
@@ -123,7 +112,7 @@ export default class ScratchpadToolbarContainer extends React.PureComponent {
|
||||
</ToolbarItem>
|
||||
<ToolbarSplit />
|
||||
<ToolbarButton
|
||||
activated={this.props.pretestVisible}
|
||||
activated
|
||||
onClick={() => this.props.togglePanel('pretest')}
|
||||
data-global-hotkey="alt+p"
|
||||
data-tooltip={`${i18n('Toggle Pretest Panel')} (Alt+P)`}
|
||||
|
||||
Reference in new issue
Block a user