Skip to content

Commit

Permalink
Container info colors etc
Browse files Browse the repository at this point in the history
  • Loading branch information
fontenele committed Dec 30, 2016
1 parent 88de2e8 commit faf1980
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 10 deletions.
30 changes: 24 additions & 6 deletions app.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
.table-without-margin-bottom {
margin-bottom: 0;
}

.modal-lg {
width: 96%;
}

/*#terminal-bar {*/
/*position: fixed;*/
Expand Down Expand Up @@ -388,12 +392,26 @@ <h4 class="modal-title">Server info</h4>
<h4 class="modal-title"><span class="container-name"></span> <span class="label status-info label-right" style="margin-right: 10px"></span></h4>
</div>
<div class="modal-body">
<table class="tb-container-info table table-bordered table-condensed table-hover table-striped table-without-margin-bottom">
<tbody></tbody>
</table>
<table class="tb-container-top table table-bordered table-condensed table-hover table-striped table-without-margin-bottom" style="display: none;">
<tbody></tbody>
</table>
<div class="panel panel-default">
<div class="panel-heading">Info</div>
<table class="tb-container-info table table-bordered table-condensed table-hover table-striped table-without-margin-bottom">
<tbody></tbody>
</table>
</div>
<div class="panel panel-default">
<div class="panel-heading">Stats</div>
<table class="tb-container-stats table table-bordered table-condensed table-hover table-striped table-without-margin-bottom" style="display: none;">
<thead></thead>
<tbody></tbody>
</table>
</div>
<div class="panel panel-default">
<div class="panel-heading">Top</div>
<table class="tb-container-top table table-bordered table-condensed table-hover table-striped table-without-margin-bottom" style="display: none;">
<thead></thead>
<tbody></tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
Expand Down
27 changes: 23 additions & 4 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,23 @@ $(document).ready(function() {
$.post('/container-stats',{'containerId':containerId}, function(dataStats, textStatus, event) {
wdtLoading.done();
$('#modal-container-info .modal-body table.tb-container-top').show();
var html = '<tr><td width="130">Image</td><td>teste</td></tr>';
var html = '';
for(var i in dataTop.result.Processes) {
var item = dataTop.result.Processes[i];
html+= '<tr>';
for(var j in item) {
html+= '<td>' + item[j] + '</td>';
}
html+= '</tr>';
}
$('#modal-container-info .modal-body table.tb-container-top tbody').html(html);
var html = '<tr>';
for(var i in dataTop.result.Titles) {
var item = dataTop.result.Titles[i];
html+= '<th>' + item + '</th>';
}
html+= '</tr>';
$('#modal-container-info .modal-body table.tb-container-top thead').html(html);
console.log('topp', dataTop);
console.log('stats', dataStats);
// @TODO STATS
Expand All @@ -700,7 +715,7 @@ $(document).ready(function() {
.removeClass('bg-success')
.addClass(statusBgClass);

$('#modal-container-info .container-name').html(data.result.Name.substr(1));
$('#modal-container-info .container-name').html(data.result.Name.substr(1) + ' - Info');

var html = '<tr><td width="130">Image</td><td>' + data.result.Config.Image + '</td></tr>';
html+= '<tr><td>Name</td><td>' + data.result.Name.substr(1) + '</td></tr>';
Expand Down Expand Up @@ -746,28 +761,32 @@ $(document).ready(function() {

$('#modal-container-log .modal-body table tbody').html('');
var name = $(that).parents('.container-item').find('.container-name').text();
$('#modal-container-log .container-name').text(name);
$('#modal-container-log .container-name').text(name + ' - Logs');

var html = '';
for(var i in data.result) {
var item = data.result[i];
var statusString = '';
var statusClass = '';
var statusBgClass = '';
switch(item.Kind) {
case 0:
statusString = 'Modified';
statusClass = 'label-warning';
statusBgClass = 'warning';
break;
case 1:
statusString = 'Added';
statusClass = 'label-success';
statusBgClass = 'success';
break;
case 2:
statusString = 'Deleted';
statusClass = 'label-danger';
statusBgClass = 'danger';
break;
}
html+= '<tr><td>' + item.Path + '<span class="label label-right ' + statusClass + '">' + statusString + '</span></td></tr>';
html+= '<tr class="' + statusBgClass + '"><td>' + item.Path + '<span class="label label-right ' + statusClass + '">' + statusString + '</span></td></tr>';
}

$('#modal-container-log .modal-body table tbody').html(html);
Expand Down

0 comments on commit faf1980

Please sign in to comment.