Web interface: переход на модульный контент
This commit is contained in:
@@ -51,11 +51,14 @@ var Panel = React.createClass({
|
||||
if (this.props.colored) {
|
||||
colored = this.props.colored;
|
||||
}
|
||||
|
||||
elements = [ce('div', {className: 'panel-body'}, this.props.children)];
|
||||
if (this.props.title) {
|
||||
elements.unshift(ce('div', {className: 'panel-heading'}, this.props.title));
|
||||
}
|
||||
|
||||
return(
|
||||
ce('div', {className: 'panel panel-'+colored},
|
||||
ce('div', {className: 'panel-heading'}, this.props.title),
|
||||
ce('div', {className: 'panel-body'}, this.props.children)
|
||||
)
|
||||
ce('div', {className: 'panel panel-'+colored}, elements)
|
||||
)
|
||||
}
|
||||
});
|
||||
@@ -82,71 +85,8 @@ var Button = React.createClass({
|
||||
|
||||
// -- Разное -- //
|
||||
|
||||
var BundleTable = React.createClass({
|
||||
render: function(){return(
|
||||
ce('table', {className: 'table table-hover', width: '100%', style: {'margin-bottom': '0'}},
|
||||
ce('thead', null,
|
||||
ce('tr', null,
|
||||
ce('th', {className: 'col-xs-1'}, '#'),
|
||||
ce('th', null, 'Название'),
|
||||
ce('th', {className: 'hidden-xs'}, 'Версия'),
|
||||
ce('th', null, 'Статус'),
|
||||
ce('th', {className: 'col-xs-1'}, nbsp)
|
||||
)
|
||||
),
|
||||
ce('tbody', null, this.props.children)
|
||||
)
|
||||
var ContentModule = React.createClass({
|
||||
render:function(){return(
|
||||
ce(Panel, null, 'no module content')
|
||||
)}
|
||||
});
|
||||
|
||||
var BundleTableRow = React.createClass({
|
||||
getInitialState: function(){return{
|
||||
id: this.props.id,
|
||||
name: this.props.name,
|
||||
state: this.props.state,
|
||||
version: this.props.version,
|
||||
lastModified: this.props.lastModified
|
||||
}},
|
||||
stateToStr: function(state) {
|
||||
if (state == 1) {return 'UNINSTALLED'}
|
||||
else if (state == 2) {return 'INSTALLED'}
|
||||
else if (state == 4) {return 'RESOLVED'}
|
||||
else if (state == 8) {return 'STARTING'}
|
||||
else if (state == 16) {return 'STOPPING'}
|
||||
else if (state == 32) {return 'ACTIVE'}
|
||||
else {return 'UNKNOW('+state+')'}
|
||||
},
|
||||
bndUpd: function() {
|
||||
var _this = this;
|
||||
fetch('/ajax/bundles.json?id='+this.props.id+'&act=upd')
|
||||
.then(function(resp){
|
||||
resp.json().then(function(data){
|
||||
_this.setState({
|
||||
id: data.id,
|
||||
name: data.name,
|
||||
state: data.state,
|
||||
version: data.version,
|
||||
lastModified: data.lastModified
|
||||
});
|
||||
console.debug(data);
|
||||
});
|
||||
})
|
||||
.catch(function(err){
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
render: function(){
|
||||
vertAlign = {'vertical-align': 'middle'};
|
||||
return(
|
||||
ce('tr', null,
|
||||
ce('td', {style: vertAlign}, this.state.id),
|
||||
ce('td', {style: vertAlign}, this.state.name),
|
||||
ce('td', {className: 'hidden-xs', style: vertAlign}, this.state.version),
|
||||
ce('td', {style: vertAlign}, this.stateToStr(this.state.state)),
|
||||
ce('td', {style: vertAlign},
|
||||
ce(Button, {colored: 'danger', btnSize: 'xs', onClick: this.bndUpd}, 'update')
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user