Commit b2f6e619 authored by Afaq Tariq's avatar Afaq Tariq

line-chart now shows No Data message if get call returns empty

parent 5cfee02b
......@@ -458,6 +458,8 @@
templateUrl: 'templates/app/line-chart-plugin.html',
link: function(scope, element) {
scope.initializing = true
if (!scope.color) scope.color = '0, 255, 0';
var series, w, h, canvas;
......@@ -511,12 +513,20 @@
// update data on chart
scope.getData = function() {
if(scope.initializing)
scope.initializing = false
if (dataCallInProgress) return;
dataCallInProgress = true;
server.get(scope.moduleName, function(serverResponseData) {
if (serverResponseData.length < 1) {
scope.emptyResult = true
return
}
dataCallInProgress = false;
scope.lastGet = new Date().getTime();
......
......@@ -3,10 +3,13 @@ if [ `which sensors` ]; then
returnString=`sensors`
#amd
if [[ "${returnString/"k10"}" != "${returnString}" ]] ; then
echo ${returnString##*k10} | cut -d ' ' -f 6 | cut -c 2- | cut -c 1-4
echo ${returnString##*k10} | cut -d ' ' -f 6 | cut -c 2- | cut -c 1-4
#intel
elif [[ "${returnString/"core"}" != "${returnString}" ]] ; then
fromcore=${returnString##*"coretemp"}
echo ${fromcore##*Physical} | cut -d ' ' -f 3 | cut -c 2-5
fi
echo ${fromcore##*Physical} | cut -d ' ' -f 3 | cut -c 2-5
fi
else
echo "[]"
fi
<div class="plugin">
<top-bar heading="heading" last-updated="lastGet" no-refresh-btn></top-bar>
<div class="plugin-body no-padding">
<canvas class="canvas" width="400" height="200"></canvas>
<canvas ng-show="!initializing && !emptyResult" class="canvas" width="400" height="200"></canvas>
<table border="0" class="metrics-table">
<table ng-show="!initializing && !emptyResult" border="0" class="metrics-table">
<tbody>
<tr ng-repeat="metric in metrics">
<td><strong>{{ metric.name }}</strong></td>
......@@ -14,7 +14,8 @@
</tr>
</tbody>
</table>
</div>
</plugin>
\ No newline at end of file
<no-data ng-show="emptyResult"></no-data>
</div>
</plugin>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment