Add log to task

This commit is contained in:
Yang Luo 2023-09-08 02:03:44 +08:00
parent f66fc26b61
commit b9cff77248
1 changed files with 24 additions and 0 deletions

View File

@ -19,6 +19,11 @@ import * as Setting from "./Setting";
import i18next from "i18next"; import i18next from "i18next";
import * as ProviderBackend from "./backend/ProviderBackend"; import * as ProviderBackend from "./backend/ProviderBackend";
import {Controlled as CodeMirror} from "react-codemirror2";
import "codemirror/lib/codemirror.css";
require("codemirror/theme/material-darker.css");
require("codemirror/mode/javascript/javascript");
const {Option} = Select; const {Option} = Select;
class TaskEditPage extends React.Component { class TaskEditPage extends React.Component {
@ -142,10 +147,29 @@ class TaskEditPage extends React.Component {
}} /> }} />
</Col> </Col>
</Row> </Row>
<Row style={{marginTop: "20px"}} >
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
{i18next.t("task:Log")}:
</Col>
<Col span={22} >
<Button style={{marginBottom: "20px", width: "100px"}} type="primary" onClick={this.runTask.bind(this)}>{i18next.t("general:Run")}</Button>
<div style={{height: "600px"}}>
<CodeMirror
value={this.state.task.log}
options={{mode: "javascript", theme: "material-darker"}}
onBeforeChange={(editor, data, value) => {}}
/>
</div>
</Col>
</Row>
</Card> </Card>
); );
} }
runTask() {
alert("runTask");
}
submitTaskEdit() { submitTaskEdit() {
const task = Setting.deepCopy(this.state.task); const task = Setting.deepCopy(this.state.task);
TaskBackend.updateTask(this.state.task.owner, this.state.taskName, task) TaskBackend.updateTask(this.state.task.owner, this.state.taskName, task)