add config to html templates
Change-Id: Icdf676efef09106553cf76fb164457a344e00ad1
This commit is contained in:
parent
793906972c
commit
ee958030a3
File diff suppressed because one or more lines are too long
@ -339,6 +339,10 @@ angular.module('kbWebApp')
|
||||
function(response) { // .resolve
|
||||
kbCookie.setConfig(response.data);
|
||||
$scope.config =response.data;
|
||||
|
||||
$scope.config.server.flavor.disk==0?$scope.choose_disk_size1=0:$scope.choose_disk_size1=1;
|
||||
$scope.config.client.flavor.disk==0?$scope.choose_disk_size2=0:$scope.choose_disk_size2=1;
|
||||
|
||||
console.log("get & save default config");
|
||||
},
|
||||
function(response) { // .reject
|
||||
@ -365,6 +369,9 @@ angular.module('kbWebApp')
|
||||
kbCookie.setConfig(response.data);
|
||||
$scope.config = response.data;
|
||||
|
||||
$scope.config.server.flavor.disk==0?$scope.choose_disk_size1=0:$scope.choose_disk_size1=1;
|
||||
$scope.config.client.flavor.disk==0?$scope.choose_disk_size2=0:$scope.choose_disk_size2=1;
|
||||
|
||||
if(($scope.config.server.availability_zone!=null && $scope.config.server.availability_zone!="") || ($scope.config.client.availability_zone!=null && $scope.client.server.availability_zone!=""))
|
||||
{
|
||||
$scope.availability_zone=2;
|
||||
|
@ -182,6 +182,9 @@ angular.module('kbWebApp')
|
||||
function (response) { // .resolve
|
||||
kbCookie.setConfig(response.data);
|
||||
$scope.config = response.data;
|
||||
|
||||
$scope.config.client.flavor.disk==0?$scope.choose_disk_size=0:$scope.choose_disk_size=1;
|
||||
|
||||
console.log("get & save default config");
|
||||
},
|
||||
function (response) { // .reject
|
||||
@ -201,6 +204,7 @@ angular.module('kbWebApp')
|
||||
kbCookie.setConfig(response.data);
|
||||
$scope.config = response.data;
|
||||
|
||||
$scope.config.client.flavor.disk==0?$scope.choose_disk_size=0:$scope.choose_disk_size=1;
|
||||
$scope.checkStatus();
|
||||
|
||||
console.log("get & save running config");
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -311,7 +311,7 @@
|
||||
|
||||
<div class="panel panel-default" style="margin: 0">
|
||||
<div class="panel-body">
|
||||
<md-radio-group ng-model="choose_disk_size1" ng-init="config.server.flavor.disk==0?choose_disk_size1=0:choose_disk_size1=1">
|
||||
<md-radio-group ng-model="choose_disk_size1">
|
||||
<md-radio-button value="0" ng-click="config.server.flavor.disk=20" class="md-primary" style="margin:5px">Use default root disk size</md-radio-button>
|
||||
<md-radio-button value="1" class="md-primary" style="margin:5px">Use specific root disk size</md-radio-button>
|
||||
</md-radio-group>
|
||||
@ -420,7 +420,7 @@
|
||||
|
||||
<div class="panel panel-default" style="margin: 0">
|
||||
<div class="panel-body">
|
||||
<md-radio-group ng-model="choose_disk_size2" ng-init="config.client.flavor.disk==0?choose_disk_size2=0:choose_disk_size2=1">
|
||||
<md-radio-group ng-model="choose_disk_size2">
|
||||
<md-radio-button value="0" ng-click="config.client.flavor.disk=20" class="md-primary" style="margin:5px">Use default root disk size</md-radio-button>
|
||||
<md-radio-button value="1" class="md-primary" style="margin:5px">Use specific root disk size</md-radio-button>
|
||||
</md-radio-group>
|
||||
|
@ -131,7 +131,7 @@
|
||||
</md-content>
|
||||
<div class="panel panel-default" style="margin: 0">
|
||||
<div class="panel-body">
|
||||
<md-radio-group ng-model="choose_disk_size" ng-init="config.client.flavor.disk==0?choose_disk_size=0:choose_disk_size=1">
|
||||
<md-radio-group ng-model="choose_disk_size">
|
||||
<md-radio-button value="0" ng-click="config.client.flavor.disk=0" class="md-primary" style="margin:5px">Use default root disk size</md-radio-button>
|
||||
<md-radio-button value="1" class="md-primary" style="margin:5px">Use specific root disk size</md-radio-button>
|
||||
</md-radio-group>
|
||||
|
@ -698,20 +698,25 @@ class KloudBuster(object):
|
||||
|
||||
return quota_dict
|
||||
|
||||
def create_html(hfp, template, task_re):
|
||||
def create_html(hfp, template, task_re, is_config):
|
||||
for line in template:
|
||||
line = line.replace('[[result]]', task_re)
|
||||
if is_config:
|
||||
line = line.replace('[[is_config]]', 'true')
|
||||
line = line.replace('[[config]]', json.dumps(is_config, sort_keys=True))
|
||||
else:
|
||||
line = line.replace('[[is_config]]', 'false')
|
||||
if CONF.label:
|
||||
line = line.replace('[[label]]', CONF.label)
|
||||
else:
|
||||
line = line.replace('[[label]]', 'Report')
|
||||
line = line.replace('[[result]]', task_re)
|
||||
hfp.write(line)
|
||||
if not CONF.headless:
|
||||
# bring up the file in the default browser
|
||||
url = 'file://' + os.path.abspath(CONF.html)
|
||||
webbrowser.open(url, new=2)
|
||||
|
||||
def generate_charts(json_results, html_file_name):
|
||||
def generate_charts(json_results, html_file_name, is_config):
|
||||
'''Save results in HTML format file.'''
|
||||
LOG.info('Saving results to HTML file: ' + html_file_name + '...')
|
||||
try:
|
||||
@ -727,7 +732,8 @@ def generate_charts(json_results, html_file_name):
|
||||
with open(html_file_name, 'w') as hfp, open(template_path, 'r') as template:
|
||||
create_html(hfp,
|
||||
template,
|
||||
json.dumps(json_results, sort_keys=True))
|
||||
json.dumps(json_results, sort_keys=True),
|
||||
is_config)
|
||||
|
||||
def main():
|
||||
cli_opts = [
|
||||
@ -794,7 +800,7 @@ def main():
|
||||
sys.exit(1)
|
||||
with open(CONF.charts_from_json, 'r') as jfp:
|
||||
json_results = json.load(jfp)
|
||||
generate_charts(json_results, CONF.html)
|
||||
generate_charts(json_results, CONF.html, None)
|
||||
sys.exit(0)
|
||||
|
||||
if CONF.show_config:
|
||||
@ -825,7 +831,7 @@ def main():
|
||||
json.dump(kloudbuster.final_result, jfp, indent=4, sort_keys=True)
|
||||
|
||||
if CONF.html:
|
||||
generate_charts(kloudbuster.final_result, CONF.html)
|
||||
generate_charts(kloudbuster.final_result, CONF.html, kb_config.config_scale)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -51,10 +51,13 @@
|
||||
</a>
|
||||
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="active">
|
||||
<ul class="nav navbar-nav" ng-init="tab=0">
|
||||
<li ng-class="{active:tab==0}" ng-click="tab=0">
|
||||
<a><span class="glyphicon" aria-hidden="true" ></span>[[label]]</a>
|
||||
</li>
|
||||
<li ng-class="{active:tab==1}" ng-click="tab=1" ng-show="config == true">
|
||||
<a><span class="glyphicon" aria-hidden="true" ></span>Configuration</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!--<ul class="nav navbar-nav navbar-right">-->
|
||||
<!--<li><a href="#"></a></li>-->
|
||||
@ -63,7 +66,7 @@
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
<div class="container" ng-show="tab == 0">
|
||||
<h3>KloudBuster HTTP Testing Report</h3>
|
||||
<div class="my-chart" style="height: 400px;margin-bottom: 10%">
|
||||
<linechart data="data" options="options"></linechart>
|
||||
@ -85,6 +88,20 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="container" ng-show="tab == 1">
|
||||
<h3>KloudBuster HTTP Testing Configuration</h3>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body" style="word-wrap:break-word">
|
||||
<textarea style="width: 100%;height: 900px" disabled> {{from_outside_config}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<footer style="text-align: center;">
|
||||
<hr style="margin:2px"/>
|
||||
<h6 style="color:gray">{{from_outside["time"]}} - KloudBuster {{from_outside["version"]}}</h6>
|
||||
@ -93,6 +110,8 @@
|
||||
<script type="text/javascript">
|
||||
angular.module("app", ["n3-line-chart", "ngTable"]).controller("MainCtrl", function ($scope, color, ngTableParams) {
|
||||
|
||||
if($scope.config = [[is_config]]) $scope.from_outside_config = JSON.stringify([[config]], null, "\t");
|
||||
|
||||
$scope.from_outside = [[result]];
|
||||
|
||||
$scope.result = $scope.from_outside["kb_result"];
|
||||
|
@ -39,19 +39,22 @@
|
||||
</a>
|
||||
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="active">
|
||||
<ul class="nav navbar-nav" ng-init="tab=0">
|
||||
<li ng-class="{active:tab==0}" ng-click="tab=0">
|
||||
<a><span class="glyphicon" aria-hidden="true" ></span>[[label]]</a>
|
||||
</li>
|
||||
<li ng-class="{active:tab==1}" ng-click="tab=1" ng-show="config == true">
|
||||
<a><span class="glyphicon" aria-hidden="true" ></span>Configuration</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!--<ul class="nav navbar-nav navbar-right">-->
|
||||
<!--<li><a href="#"></a></li>-->
|
||||
<!--<li><a href="#"></a></li>-->
|
||||
<!--</ul>-->
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
<div class="container" ng-show="tab == 0">
|
||||
<h3>KloudBuster Storage Testing Report</h3>
|
||||
<ul class="nav nav-tabs">
|
||||
<li ng-repeat="title in titleList" ng-class="{active: current_index==$index}" ng-click="handleEvent($event, $index,'')">
|
||||
@ -104,6 +107,16 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="container" ng-show="tab == 1">
|
||||
<h3>KloudBuster HTTP Testing Configuration</h3>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body" style="word-wrap:break-word">
|
||||
<textarea style="width: 100%;height: 900px" disabled> {{from_outside_config}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<footer style="text-align: center;">
|
||||
<hr style="margin:2px"/>
|
||||
<h6 style="color:gray">{{from_outside["time"]}} - KloudBuster {{from_outside["version"]}}</h6>
|
||||
@ -172,6 +185,7 @@
|
||||
$scope.modes = modes;
|
||||
$scope.storage_target = storage_target;
|
||||
|
||||
if($scope.config = [[is_config]]) $scope.from_outside_config = JSON.stringify([[config]], null, "\t");
|
||||
|
||||
$scope.from_outside = [[result]];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user