update json format in UI
Change-Id: Id7f049f8bb08617efe02b18a4fe81b3763965602
This commit is contained in:
parent
8ca72c93f4
commit
1048de065d
@ -586,10 +586,10 @@ angular.module('kbWebApp')
|
||||
kbHttp.getMethod2("/kloudbuster/report/"+$scope.sessionID+"?final=true")
|
||||
.then(
|
||||
function(response) { // .resolve
|
||||
console.log("get report totally:"+response.data.length);
|
||||
console.log("get report totally:"+response.data["kb_result"].length);
|
||||
//console.log(response.data);
|
||||
if(response.data.length>0 && countRep < response.data.length) {
|
||||
countRep = response.data.length;
|
||||
if(response.data["kb_result"].length>0 && countRep < response.data["kb_result"].length) {
|
||||
countRep = response.data["kb_result"].length;
|
||||
|
||||
$scope.refreshChart();
|
||||
//console.log($scope.data);
|
||||
@ -598,7 +598,7 @@ angular.module('kbWebApp')
|
||||
|
||||
for(var i = 0 ; i < countRep; i++)
|
||||
{
|
||||
$scope.result = response.data[i];
|
||||
$scope.result = response.data["kb_result"][i];
|
||||
var pickColor = color.getColor();
|
||||
if($scope.config.client.progression.enabled) {
|
||||
//$scope.name = $scope.config.client.progression.vm_start + $scope.config.client.progression.vm_step * i;
|
||||
|
@ -738,9 +738,9 @@ angular.module('kbWebApp')
|
||||
//response.data=
|
||||
//response.data = JSON.parse(response.data);
|
||||
//console.log(response.data);
|
||||
if(response.data.length>0 && countRep < response.data.length) {
|
||||
console.log("get report totally:"+response.data.length);
|
||||
countRep = response.data.length;
|
||||
if(response.data["kb_result"].length>0 && countRep < response.data["kb_result"].length) {
|
||||
console.log("get report totally:"+response.data["kb_result"].length);
|
||||
countRep = response.data["kb_result"].length;
|
||||
|
||||
storageMode.setResult(response.data);
|
||||
|
||||
@ -757,7 +757,7 @@ angular.module('kbWebApp')
|
||||
};
|
||||
|
||||
$scope.draw = function(results){
|
||||
$scope.results = results;
|
||||
$scope.results = results["kb_result"];
|
||||
var countRep = $scope.results.length;
|
||||
var countRep2 = $scope.results[0].length;
|
||||
var mode = $scope.current_mode['name'];
|
||||
|
@ -699,9 +699,7 @@ class KloudBuster(object):
|
||||
return quota_dict
|
||||
|
||||
def create_html(hfp, template, task_re):
|
||||
cur_time = time.strftime('%Y-%m-%d %A %X %Z', time.localtime(time.time()))
|
||||
for line in template:
|
||||
line = line.replace('[[time]]', cur_time)
|
||||
if CONF.label:
|
||||
line = line.replace('[[label]]', CONF.label)
|
||||
else:
|
||||
@ -716,10 +714,13 @@ def create_html(hfp, template, task_re):
|
||||
def generate_charts(json_results, html_file_name):
|
||||
'''Save results in HTML format file.'''
|
||||
LOG.info('Saving results in HTML file: ' + html_file_name + "...")
|
||||
if CONF.storage:
|
||||
if json_results['test_mode'] == "storage":
|
||||
template_path = resource_filename(__name__, 'template_storage.html')
|
||||
else:
|
||||
elif json_results['test_mode'] == "http":
|
||||
template_path = resource_filename(__name__, 'template_http.html')
|
||||
else:
|
||||
LOG.error('Error parsing the json file')
|
||||
sys.exit(1)
|
||||
with open(html_file_name, 'w') as hfp, open(template_path, 'r') as template:
|
||||
create_html(hfp,
|
||||
template,
|
||||
|
@ -50,9 +50,9 @@
|
||||
<a class="navbar-brand" href="#">KloudBuster Report</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="#">[[time]]</a></li>
|
||||
</ul>
|
||||
<!--<ul class="nav navbar-nav navbar-right">-->
|
||||
<!--<li><a href="#"></a></li>-->
|
||||
<!--</ul>-->
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@ -78,9 +78,18 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<footer style="text-align: center;">
|
||||
<hr style="margin:2px"/>
|
||||
<h6 style="color:gray">{{from_outside["time"]}} - KloudBuster {{from_outside["version"]}}</h6>
|
||||
</footer>
|
||||
|
||||
<script type="text/javascript">
|
||||
angular.module("app", ["n3-line-chart", "ngTable"]).controller("MainCtrl", function ($scope, color, ngTableParams) {
|
||||
$scope.result = [[result]];
|
||||
|
||||
$scope.from_outside = [[result]];
|
||||
|
||||
$scope.result = $scope.from_outside["kb_result"];
|
||||
|
||||
var countRep = $scope.result.length;
|
||||
$scope.data = {dataset0: [{x: 0}, {x: 10}, {x: 20}, {x: 30}, {x: 40}, {x: 50}, {x: 60}]};
|
||||
$scope.options = {
|
||||
|
@ -44,9 +44,9 @@
|
||||
<a><span class="glyphicon" aria-hidden="true" ></span>[[label]]</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="#">[[time]]</a></li>
|
||||
</ul>
|
||||
<!--<ul class="nav navbar-nav navbar-right">-->
|
||||
<!--<li><a href="#"></a></li>-->
|
||||
<!--</ul>-->
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@ -70,7 +70,8 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4 style="text-align: center">{{modes[current_mode_name]["title"]}} {{current_title}} ({{current_mode_description}})</h4>
|
||||
<h4 style="text-align: center"> {{current_mode_description}}</h4>
|
||||
<h5 style="text-align: center">{{modes[current_mode_name]["title"]}} {{current_title}} ({{storage_target[from_outside.storage_target]}})</h5>
|
||||
|
||||
<div class="my-chart" style="height: 550px;margin-bottom: 5%">
|
||||
<h6 style="margin-bottom:0"><span>{{current_mode["y_axis"]}}</span><span style="float:right">Latency(ms)</span></h6>
|
||||
@ -103,6 +104,11 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<footer style="text-align: center;">
|
||||
<hr style="margin:2px"/>
|
||||
<h6 style="color:gray">{{from_outside["time"]}} - KloudBuster {{from_outside["version"]}}</h6>
|
||||
</footer>
|
||||
|
||||
<script type="text/javascript">
|
||||
var num = -1;
|
||||
var colorList = ["#F44336", "#673AB7", "#03A9F4", "#4CAF50", "#FFEB3B", "#BF360C", "#795548", "#E91E63", "#3F51B5", "#00BCD4", "#CDDC39", "#FF9800", "#9E9E9E", "#9C27B0", "#009688"];
|
||||
@ -159,13 +165,17 @@
|
||||
}
|
||||
};
|
||||
|
||||
var storage_target = {"volume":"Cinder Volume","ephemeral":"Ephemeral Volume"};
|
||||
|
||||
angular.module("app", ["n3-line-chart", "ngTable"]).controller("MainCtrl", function ($scope, ngTableParams) {
|
||||
$scope.current_index = 0;
|
||||
$scope.modes = modes;
|
||||
$scope.storage_target = storage_target;
|
||||
|
||||
content = [[result]];
|
||||
|
||||
$scope.from_outside = [[result]];
|
||||
|
||||
content = $scope.from_outside["kb_result"];
|
||||
$scope.titleList = [];
|
||||
get_title($scope,content);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user