forked from Open-CT/openbrain
Add wordset graph page.
This commit is contained in:
parent
0c62dfc8ed
commit
a31b000446
|
@ -10,6 +10,7 @@ import * as Conf from "./Conf";
|
|||
import HomePage from "./HomePage";
|
||||
import WordsetListPage from "./WordsetListPage";
|
||||
import WordsetEditPage from "./WordsetEditPage";
|
||||
import WordsetGraphPage from "./WordsetGraphPage";
|
||||
import VectorsetListPage from "./VectorsetListPage";
|
||||
import VectorsetEditPage from "./VectorsetEditPage";
|
||||
import SigninPage from "./SigninPage";
|
||||
|
@ -282,6 +283,7 @@ class App extends Component {
|
|||
<Route exact path="/signin" render={(props) => this.renderHomeIfSignedIn(<SigninPage {...props} />)}/>
|
||||
<Route exact path="/wordsets" render={(props) => this.renderSigninIfNotSignedIn(<WordsetListPage account={this.state.account} {...props} />)}/>
|
||||
<Route exact path="/wordsets/:wordsetName" render={(props) => this.renderSigninIfNotSignedIn(<WordsetEditPage account={this.state.account} {...props} />)}/>
|
||||
<Route exact path="/wordsets/:wordsetName/graph" render={(props) => this.renderSigninIfNotSignedIn(<WordsetGraphPage account={this.state.account} {...props} />)}/>
|
||||
<Route exact path="/vectorsets" render={(props) => this.renderSigninIfNotSignedIn(<VectorsetListPage account={this.state.account} {...props} />)}/>
|
||||
<Route exact path="/vectorsets/:vectorsetName" render={(props) => this.renderSigninIfNotSignedIn(<VectorsetEditPage account={this.state.account} {...props} />)}/>
|
||||
</Switch>
|
||||
|
|
|
@ -153,7 +153,7 @@ class VectorsetListPage extends React.Component {
|
|||
title: i18next.t("general:Action"),
|
||||
dataIndex: 'action',
|
||||
key: 'action',
|
||||
width: '160px',
|
||||
width: '80px',
|
||||
render: (text, record, index) => {
|
||||
return (
|
||||
<div>
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
import React from "react";
|
||||
import * as WordsetBackend from "./backend/WordsetBackend";
|
||||
import Wordset from "./Wordset";
|
||||
|
||||
class WordsetGraphPage extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
classes: props,
|
||||
wordsetName: props.match.params.wordsetName,
|
||||
wordset: null,
|
||||
};
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
this.getWordset();
|
||||
}
|
||||
|
||||
getWordset() {
|
||||
WordsetBackend.getWordset(this.props.account.name, this.state.wordsetName)
|
||||
.then((wordset) => {
|
||||
this.setState({
|
||||
wordset: wordset,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (this.state.wordset === undefined || this.state.wordset === null) ? null : (
|
||||
<Wordset wordset={this.state.wordset} wordsetName={this.state.wordset.name}/>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default WordsetGraphPage;
|
|
@ -132,11 +132,12 @@ class WordsetListPage extends React.Component {
|
|||
title: i18next.t("general:Action"),
|
||||
dataIndex: 'action',
|
||||
key: 'action',
|
||||
width: '160px',
|
||||
width: '80px',
|
||||
render: (text, record, index) => {
|
||||
return (
|
||||
<div>
|
||||
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => this.props.history.push(`/wordsets/${record.name}`)}>{i18next.t("general:Edit")}</Button>
|
||||
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} onClick={() => this.props.history.push(`/wordsets/${record.name}/graph`)}>{i18next.t("general:Result")}</Button>
|
||||
<Button style={{marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => this.props.history.push(`/wordsets/${record.name}`)}>{i18next.t("general:Edit")}</Button>
|
||||
<Popconfirm
|
||||
title={`Sure to delete wordset: ${record.name} ?`}
|
||||
onConfirm={() => this.deleteWordset(index)}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
"Name": "Name",
|
||||
"No.": "No.",
|
||||
"Preview": "Preview",
|
||||
"Result": "Result",
|
||||
"Save": "Save",
|
||||
"URL": "URL",
|
||||
"Vectorsets": "Vectorsets",
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
"Name": "名称",
|
||||
"No.": "序号",
|
||||
"Preview": "预览",
|
||||
"Result": "结果",
|
||||
"Save": "保存",
|
||||
"URL": "链接",
|
||||
"Vectorsets": "向量集",
|
||||
|
|
Loading…
Reference in New Issue