Some basic components for building forms.
This commit is contained in:
parent
d13fc65ce2
commit
4504d539c5
22 changed files with 827 additions and 246 deletions
|
@ -7,30 +7,29 @@ import jQuery from 'jquery';
|
|||
import '../../public/jquery/jquery-ui-1.12.1.min.js';
|
||||
import '../../public/fancytree/jquery.fancytree-all.min.js';
|
||||
import '../../public/fancytree/skin-bootstrap/ui.fancytree.min.css';
|
||||
import axios from 'axios';
|
||||
|
||||
translate();
|
||||
class NamespacesTreeTable extends Component {
|
||||
@translate()
|
||||
export default class NamespacesTreeTable extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
treeData: [
|
||||
{title: 'A', key: '1', expanded: true},
|
||||
{title: 'B', key: '2', expanded: true, folder: true, children: [
|
||||
{title: 'BA', key: '3', expanded: true, folder: true, children: [
|
||||
{title: 'BAA', key: '4', expanded: true},
|
||||
{title: 'BAB', key: '5', expanded: true}
|
||||
]},
|
||||
{title: 'BB', key: '6', expanded: true, folder: true, children: [
|
||||
{title: 'BBA', key: '7', expanded: true},
|
||||
{title: 'BBB', key: '8', expanded: true}
|
||||
]}
|
||||
]}
|
||||
]
|
||||
treeData: []
|
||||
};
|
||||
|
||||
axios.get('/namespaces/rest/namespacesTree')
|
||||
.then(response => {
|
||||
this.setState({
|
||||
treeData: response.data
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const history = this.props.history;
|
||||
|
||||
const glyphOpts = {
|
||||
map: {
|
||||
expanderClosed: 'glyphicon glyphicon-menu-right',
|
||||
|
@ -49,8 +48,15 @@ class NamespacesTreeTable extends Component {
|
|||
source: this.state.treeData,
|
||||
table: {
|
||||
nodeColumnIdx: 0
|
||||
},
|
||||
createNode: (event, data) => {
|
||||
const node = data.node;
|
||||
const tdList = jQuery(node.tr).find(">td");
|
||||
tdList.eq(1).html('<a href="#">Edit</a>').click(() => {
|
||||
history.push('/namespaces/edit/' + node.key);
|
||||
});
|
||||
}
|
||||
});
|
||||
}).fancytree("getTree");
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
|
@ -58,13 +64,15 @@ class NamespacesTreeTable extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
const t = this.props.t;
|
||||
|
||||
const container =
|
||||
<div ref={(domElem) => { this.domTableContainer = domElem; }} style={{ height: '100px', overflow: 'auto'}}>
|
||||
<table ref={(domElem) => { this.domTable = domElem; }} className="table table-hover table-striped table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>B</th>
|
||||
<th>{t('Name')}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -81,6 +89,4 @@ class NamespacesTreeTable extends Component {
|
|||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default NamespacesTreeTable;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue