MCSM: список серверов
This commit is contained in:
@@ -20,34 +20,38 @@ var ContentModule = React.createClass({
|
||||
componentWillMount: function(){
|
||||
var _this = this;
|
||||
|
||||
this.loadScript("/mcsmanager/components.js");
|
||||
this.loadScript(
|
||||
"https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js",
|
||||
this.loadScript("/mcsmanager/components.js",
|
||||
function(){ _this.setState({nvScriptReady: _this.state.nvScriptReady+1}); console.debug('components - ok'); },
|
||||
function(){ _this.setState({nvScriptReady: -5}); console.debug('components - error'); },
|
||||
);
|
||||
|
||||
this.loadScript("https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js",
|
||||
function(){
|
||||
_this.setState({nvScriptReady: _this.state.nvScriptReady+1}); console.info('d3 - ok');
|
||||
_this.loadStyle("https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.5/nv.d3.min.css");
|
||||
_this.loadScript(
|
||||
"https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.5/nv.d3.js",
|
||||
function(){ _this.setState({nvScriptReady: 1}); console.info('nv ok'); },
|
||||
function(){ _this.setState({nvScriptReady: 2}); console.error('nv error load'); }
|
||||
_this.loadScript("https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.5/nv.d3.js",
|
||||
function(){ _this.setState({nvScriptReady: _this.state.nvScriptReady+1}); console.info('nv - ok'); },
|
||||
function(){ _this.setState({nvScriptReady: -5}); console.error('nv - error'); }
|
||||
);
|
||||
},
|
||||
function(){ _this.setState({nvScriptReady: 2}); console.error('d3 error load'); }
|
||||
function(){ _this.setState({nvScriptReady: -5}); console.error('d3 - error'); }
|
||||
);
|
||||
},
|
||||
render: function(){
|
||||
var element;
|
||||
if (this.state.nvScriptReady == 1) {
|
||||
element = ce(NvLineChart);
|
||||
} else if (this.state.nvScriptReady == 2) {
|
||||
if (this.state.nvScriptReady == 3) {
|
||||
element = ce('div', {className: 'row'},
|
||||
ce('div', {className: 'col-md-4'}, ce(ServerList)),
|
||||
ce('div', {className: 'col-md-8'}, ce(NvLineChart))
|
||||
);
|
||||
} else if (this.state.nvScriptReady < 0) {
|
||||
element = ce('span', null, 'error');
|
||||
} else {
|
||||
element = ce('span', null, 'loading...');
|
||||
}
|
||||
|
||||
return(
|
||||
ce(Panel, {title: 'MC Server Manager'},
|
||||
element
|
||||
)
|
||||
ce(Panel, {title: 'Серверы'}, element)
|
||||
)
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user