Skip to content

Commit

Permalink
Merge pull request #1457 from MFlyer/issue#998_Dashboard_crashes_if_o…
Browse files Browse the repository at this point in the history
…pened_long_DiskActivity_Widget

Issue#998 dashboard crashes if opened long - Disks Widget - Part 7 (last chapter)
  • Loading branch information
schakrava committed Oct 14, 2016
2 parents f487449 + b65e145 commit eebec38
Show file tree
Hide file tree
Showing 4 changed files with 555 additions and 436 deletions.
35 changes: 18 additions & 17 deletions src/rockstor/smart_manager/data_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ def recv_disconnect(self):
def send_top_disks(self):

def disk_stats(prev_stats):
disks_stats = []
# invoke body of disk_stats with empty cur_stats
stats_file_path = '/proc/diskstats'
cur_stats = {}
Expand Down Expand Up @@ -455,23 +456,23 @@ def disk_stats(prev_stats):
else:
datum = (float(cur[i]) - float(prev[i]))/interval
data.append(datum)
self.emit('diskWidget:top_disks', {
'key': 'diskWidget:top_disks', 'data': [{
'name': disk,
'reads_completed': data[0],
'reads_merged': data[1],
'sectors_read': data[2],
'ms_reading': data[3],
'writes_completed': data[4],
'writes_merged': data[5],
'sectors_written': data[6],
'ms_writing': data[7],
'ios_progress': data[8],
'ms_ios': data[9],
'weighted_ios': data[10],
'ts': str(datetime.utcnow().replace(tzinfo=utc).isoformat())
}]
})
disks_stats.append({
'name': disk,
'reads_completed': data[0],
'reads_merged': data[1],
'sectors_read': data[2],
'ms_reading': data[3],
'writes_completed': data[4],
'writes_merged': data[5],
'sectors_written': data[6],
'ms_writing': data[7],
'ios_progress': data[8],
'ms_ios': data[9],
'weighted_ios': data[10],
'ts': str(datetime.utcnow().replace(tzinfo=utc).isoformat())
})

self.emit('diskWidget:top_disks',{ 'key': 'diskWidget:top_disks', 'data': disks_stats })
return cur_stats

def get_stats():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<div id="disk-details-ph">
<div id="disk-select-ph">
<span class="h4">Disk activity</span> for disk
<select name="disk-select" id="disk-select" class="inline">
{{#each disks}}
<option value="{{this.name}}">{{this.name}}</option>
{{/each}}
</select>
</div>
<div id="disk-graph-reads-ph"></div>
<div id="disk-graph-data-ph"></div>
</div>
<div id="disk-select-ph">
<span class="h4">Disk activity</span> for disk
<select name="disk-select" id="disk-select" class="inline">
{{#each disks}}
<option value="{{this.name}}">{{this.name}}</option>
{{/each}}
</select>
</div>
<canvas id="single-disk-chart" width="500" height="180"></canvas>
</div>
Original file line number Diff line number Diff line change
@@ -1,28 +1,45 @@
<!-- Header -->
<script>
/*
* Copyright (c) 2012-2016 RockStor, Inc. <http://rockstor.com>
* This file is part of RockStor.
*
* RockStor is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* RockStor is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
</script>

<div class="widget-header">
<div class="title"><span class="h4">{{ displayName }}</span></div>
<div class="gear">
<a class="resize-widget" href="#"><i class="glyphicon glyphicon-resize-full"></i></a>
<a class="close-widget" href="#"><i class="glyphicon glyphicon-remove"></i></a>
</div>
<div class="title"><span class="h4">{{ displayName }}</span></div>
<div class="gear">
<a class="resize-widget" href="#"><i class="glyphicon glyphicon-resize-full"></i></a>
<a class="close-widget" href="#"><i class="glyphicon glyphicon-remove"></i></a>
</div>
</div>

<!-- Content -->
<div class="widget-content">
<h4>Top Disks</h4>
<div id="top-disks-ph"></div>
<div id="disks-msg"></div>
<div id="disks-sort-attrs">
Sort by:
<input type="checkbox" class="diskSortAttr checkbox-inline radio-inline" name="reads_completed" value="reads_completed" checked="true">Reads&nbsp;
<input type="checkbox" class="diskSortAttr checkbox-inline" name="writes_completed" value="writes_completed">Writes

&nbsp;&nbsp;
Total: <span id="attr-total"></span>

</div>
<br>
<div id="disk-details-ph"></div>
<div id="top-disks-container" style="width: 70%; margin: 0 auto;">
<canvas id="top-disks-chart"></canvas>
</div>
<div id="disk-sort">
<span class="h4">Top disks</span> sort by:
<select name="attr-select" id="attr-select" class="inline">
{{genAttrSelect}}
</select>
</div>
<br>
<div id="disk-details-ph"></div>
</div>
<!-- End Content -->

Expand Down
Loading

0 comments on commit eebec38

Please sign in to comment.