diff --git a/mcserver-manager/src/main/resources/components.js b/mcserver-manager/src/main/resources/components.js index 208f84a..2625cbe 100644 --- a/mcserver-manager/src/main/resources/components.js +++ b/mcserver-manager/src/main/resources/components.js @@ -53,14 +53,36 @@ var NvLineChart = React.createClass({ } }); +var ServerListItem = React.createClass({ + render: function(){ + var status; + if (this.props.stopped) { + status = ce('span', {className: 'label label-danger'}, 'остановлен'); + } else { + status = ce('span', {className: 'label label-primary'}, this.props.players); + } + + return( + ce('a', {className: 'list-group-item clearfix' + (this.props.active ? ' active' : ''), href: '#'}, + ce('span', {style: {'padding-top': '15px'}}, + ce('span', {className: 'glyphicon glyphicon-tasks'}), + nbsp, + this.props.title + ), + ce('span', {className: 'pull-right'}, status) + ) + ) + } +}); + 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') + ce(ServerListItem, {title: 'Server 1 [hub-1]', players: 42}), + ce(ServerListItem, {title: 'Server 2 [skywars-1]', players: 6, active: true}), + ce(ServerListItem, {title: 'Server 3 [bedwars-3]', players: 23}), + ce(ServerListItem, {title: 'Server 4', stopped: true}), + ce(ServerListItem, {title: 'Server 5', stopped: true}), ) )} }); diff --git a/mcserver-manager/src/main/resources/module.js b/mcserver-manager/src/main/resources/module.js index ef5ed8a..5122680 100644 --- a/mcserver-manager/src/main/resources/module.js +++ b/mcserver-manager/src/main/resources/module.js @@ -42,7 +42,18 @@ var ContentModule = React.createClass({ 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)) + ce('div', {className: 'col-md-8'}, + ce('div', {className: 'pull-right'}, + ce('div', {className: 'btn-group'}, + ce(Button, {btnSize: 'xs'}, + ce('span', {className: 'glyphicon glyphicon-play'}), nbsp+'запуск'), + ce(Button, {btnSize: 'xs'}, + ce('span', {className: 'glyphicon glyphicon-stop'}), nbsp+'остановка') + ) + ), + ce('h2', {style: {'margin-top': '0px'}}, 'Server 2 [skywars-1]'), + ce(NvLineChart) + ) ); } else if (this.state.nvScriptReady < 0) { element = ce('span', null, 'error');