Archived
0

MCSM: список серверов

This commit is contained in:
2017-03-25 04:28:57 +03:00
parent a57d41f5b4
commit 99a1d787b7
2 changed files with 30 additions and 14 deletions

View File

@@ -52,3 +52,15 @@ var NvLineChart = React.createClass({
}); });
} }
}); });
var ServerList = React.createClass({
render: function(){return(
ce('div', {className: 'list-group'},
ce('button', {className: 'list-group-item', type: 'button'}, 'Server 1'),
ce('button', {className: 'list-group-item', type: 'button'}, 'Server 2'),
ce('button', {className: 'list-group-item', type: 'button'}, 'Server 3'),
ce('button', {className: 'list-group-item', type: 'button'}, 'Server 4'),
ce('button', {className: 'list-group-item', type: 'button'}, 'Server 5')
)
)}
});

View File

@@ -20,34 +20,38 @@ var ContentModule = React.createClass({
componentWillMount: function(){ componentWillMount: function(){
var _this = this; var _this = this;
this.loadScript("/mcsmanager/components.js"); this.loadScript("/mcsmanager/components.js",
this.loadScript( function(){ _this.setState({nvScriptReady: _this.state.nvScriptReady+1}); console.debug('components - ok'); },
"https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js", 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(){ 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.loadStyle("https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.5/nv.d3.min.css");
_this.loadScript( _this.loadScript("https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.5/nv.d3.js",
"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: 1}); console.info('nv ok'); }, function(){ _this.setState({nvScriptReady: -5}); console.error('nv - error'); }
function(){ _this.setState({nvScriptReady: 2}); console.error('nv error load'); }
); );
}, },
function(){ _this.setState({nvScriptReady: 2}); console.error('d3 error load'); } function(){ _this.setState({nvScriptReady: -5}); console.error('d3 - error'); }
); );
}, },
render: function(){ render: function(){
var element; var element;
if (this.state.nvScriptReady == 1) { if (this.state.nvScriptReady == 3) {
element = ce(NvLineChart); element = ce('div', {className: 'row'},
} else if (this.state.nvScriptReady == 2) { 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'); element = ce('span', null, 'error');
} else { } else {
element = ce('span', null, 'loading...'); element = ce('span', null, 'loading...');
} }
return( return(
ce(Panel, {title: 'MC Server Manager'}, ce(Panel, {title: 'Серверы'}, element)
element
)
) )
} }
}); });