Multiple UI/UX enhancements

1. Maintain the header bar consistency between stoarge and HTTP template
html files;
2. Setting up logging in earlier stage;
3. Print user-friendly message for stoping Pecan server from PyPI
installation;

Change-Id: I8bfc16812456a1475f0050a731cc4b9b081f2840
This commit is contained in:
Yichen Wang 2016-03-25 12:21:21 -07:00
parent 1048de065d
commit 84f2f3d741
4 changed files with 36 additions and 23 deletions

View File

@ -713,13 +713,16 @@ 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 json_results['test_mode'] == "storage":
template_path = resource_filename(__name__, 'template_storage.html')
elif json_results['test_mode'] == "http":
template_path = resource_filename(__name__, 'template_http.html')
else:
LOG.error('Error parsing the json file')
LOG.info('Saving results to HTML file: ' + html_file_name + '...')
try:
if json_results['test_mode'] == "storage":
template_path = resource_filename(__name__, 'template_storage.html')
elif json_results['test_mode'] == "http":
template_path = resource_filename(__name__, 'template_http.html')
else:
raise
except Exception:
LOG.error('Invalid json file.')
sys.exit(1)
with open(html_file_name, 'w') as hfp, open(template_path, 'r') as template:
create_html(hfp,
@ -783,10 +786,11 @@ def main():
CONF.set_default("verbose", True)
full_version = __version__ + ', VM image: ' + kb_vm_agent.get_image_name()
CONF(sys.argv[1:], project="kloudbuster", version=full_version)
logging.setup("kloudbuster")
if CONF.charts_from_json:
if not CONF.html:
print 'Error: you must specify the destination html file name using --html'
LOG.error('Destination html filename must be specified using --html.')
sys.exit(1)
with open(CONF.charts_from_json, 'r') as jfp:
json_results = json.load(jfp)
@ -797,7 +801,6 @@ def main():
print resource_string(__name__, "cfg.scale.yaml")
sys.exit(0)
logging.setup("kloudbuster")
try:
kb_config = KBConfig()
kb_config.init_with_cli()

View File

@ -29,12 +29,15 @@ def exec_command(cmd, cwd=None, show_console=False):
def main():
cwd = resource_filename(__name__, 'config.py')
cwd = cwd[:cwd.rfind('/')] + '/../kb_server'
cmd = ['stdbuf', '-oL', 'python', 'setup.py', 'develop']
rc = exec_command(cmd, cwd=cwd)
if not rc:
cmd = ['stdbuf', '-oL', 'pecan', 'serve', 'config.py']
rc = exec_command(cmd, cwd=cwd, show_console=True)
sys.exit(rc)
try:
cmd = ['stdbuf', '-oL', 'python', 'setup.py', 'develop']
rc = exec_command(cmd, cwd=cwd)
if not rc:
cmd = ['stdbuf', '-oL', 'pecan', 'serve', 'config.py']
rc = exec_command(cmd, cwd=cwd, show_console=True)
sys.exit(rc)
except KeyboardInterrupt:
print 'Terminating server...'
if __name__ == '__main__':
main()

View File

@ -46,18 +46,25 @@
<body ng-controller="MainCtrl">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">KloudBuster Report</a>
</div>
<a class="navbar-brand" ng-href="#/" style="font-family: Arial">
<span style="color:#DF314D">K</span>loudBuster
</a>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active">
<a><span class="glyphicon" aria-hidden="true" ></span>[[label]]</a>
</li>
</ul>
<!--<ul class="nav navbar-nav navbar-right">-->
<!--<li><a href="#"></a></li>-->
<!--</ul>-->
</div>
</div>
</nav>
<div class="container">
<h3>[[label]]</h3>
<h3>KloudBuster HTTP Testing Report</h3>
<div class="my-chart" style="height: 400px;margin-bottom: 10%">
<linechart data="data" options="options"></linechart>
</div>
@ -200,4 +207,4 @@
});
</script>
</body>
</html>
</html>

View File

@ -52,7 +52,7 @@
</nav>
<div class="container">
<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,'')">
<a data-toggle="tab" aria-expanded="true">
@ -165,7 +165,7 @@
}
};
var storage_target = {"volume":"Cinder Volume","ephemeral":"Ephemeral Volume"};
var storage_target = {"volume":"Cinder Volume","ephemeral":"Ephemeral Disk"};
angular.module("app", ["n3-line-chart", "ngTable"]).controller("MainCtrl", function ($scope, ngTableParams) {
$scope.current_index = 0;
@ -433,4 +433,4 @@
}
</script>
</body>
</html>
</html>