Job detail

Removed empty value from the status drop-down on the host event viewer. Selecting the empty value caused a second empty value to appear. All empty values now gone. User can only choose valid status options. Default choice is All.
This commit is contained in:
Chris Houseknecht
2014-08-11 15:57:06 -04:00
parent 9e134ba8b9
commit 50382890e5
3 changed files with 39 additions and 21 deletions

View File

@@ -20,10 +20,28 @@ angular.module('HostEventsViewerHelper', ['ModalDialog', 'Utilities', 'EventView
url = params.url, url = params.url,
title = params.title, //optional title = params.title, //optional
fixHeight, buildTable, fixHeight, buildTable,
lastID, setStatus, buildRow; lastID, setStatus, buildRow, status;
// initialize the status dropdown
scope.host_events_status_options = [
{ value: "all", name: "All" },
{ value: "changed", name: "Changed" },
{ value: "failed", name: "Failed" },
{ value: "ok", name: "OK" },
{ value: "unreachable", name: "Unreachable" }
];
scope.host_events_search_name = params.name; scope.host_events_search_name = params.name;
scope.host_events_search_status = (params.status) ? params.status : 'all'; status = (params.status) ? params.status : 'all';
scope.host_events_status_options.every(function(opt, idx) {
if (opt.value === status) {
scope.host_events_search_status = scope.host_events_status_options[idx];
return false;
}
return true;
});
if (!scope.host_events_search_status) {
scope.host_events_search_status = scope.host_events_status_options[0];
}
$log.debug('job_id: ' + job_id + ' url: ' + url + ' title: ' + title + ' name: ' + name + ' status: ' + status); $log.debug('job_id: ' + job_id + ' url: ' + url + ' title: ' + title + ' name: ' + name + ' status: ' + status);
@@ -224,19 +242,19 @@ angular.module('HostEventsViewerHelper', ['ModalDialog', 'Utilities', 'EventView
url += '?host_name__isnull=false'; url += '?host_name__isnull=false';
} }
if (scope.host_events_search_status === 'changed') { if (scope.host_events_search_status.value === 'changed') {
url += '&event__icontains=runner&changed=true'; url += '&event__icontains=runner&changed=true';
} }
else if (scope.host_events_search_status === 'failed') { else if (scope.host_events_search_status.value === 'failed') {
url += '&event__icontains=runner&failed=true'; url += '&event__icontains=runner&failed=true';
} }
else if (scope.host_events_search_status === 'ok') { else if (scope.host_events_search_status.value === 'ok') {
url += '&event=runner_on_ok&changed=false'; url += '&event=runner_on_ok&changed=false';
} }
else if (scope.host_events_search_status === 'unreachable') { else if (scope.host_events_search_status.value === 'unreachable') {
url += '&event=runner_on_unreachable'; url += '&event=runner_on_unreachable';
} }
else if (!scope.host_events_search_status) { else if (scope.host_events_search_status.value === 'all') {
url += '&event__icontains=runner&not__event=runner_on_skipped'; url += '&event__icontains=runner&not__event=runner_on_skipped';
} }

View File

@@ -429,13 +429,8 @@
</div> </div>
<div class="form-group" id="status-field"> <div class="form-group" id="status-field">
<label>Status</label> <label>Status</label>
<select id="host-events-search-status" class="form-control input-sm" ng-model="host_events_search_status" name="host-events-search-name" ng-change="searchEvents()"> <select id="host-events-search-status" class="form-control input-sm" ng-model="host_events_search_status" name="host-events-search-name" ng-change="searchEvents()"
<option value="all">All</option> ng-options="opt.name for opt in host_events_status_options track by opt.value"></select>
<option value="changed">Changed</option>
<option value="failed">Failed</option>
<option value="ok">OK</option>
<option value="unreachable">Unreachable</option>
</select>
</div> </div>
<div class="form-group" id="search-indicator" ng-show="hostViewSearching"><i class="fa fa-lg fa-spin fa-cog"></i></div> <div class="form-group" id="search-indicator" ng-show="hostViewSearching"><i class="fa fa-lg fa-spin fa-cog"></i></div>
</div> </div>

View File

@@ -7,17 +7,22 @@
* *
*/ */
/* global describe, it, expect, browser */ /* global describe, it, expect, by, browser, element, beforeEach */
describe('E2E:CheckLicense', function() { describe('E2E:CheckLicense', function() {
it('should present login dialog', function() { beforeEach(function() {
browser.get('http://localhost:8013'); browser.get('http://localhost:8013');
var msg = $('#login-modal .login-alert:eq(1)'); });
expect(msg.getText()).toMatch(/Please sign in/);
/*element(by.model('login_username')).sendKeys('admin'); it('should present login dialog', function() {
element(by.model('login_password')).sendKeys('password'); var msg = element.all(by.css('#login-modal .login-alert'));
element(by.id('login-button')).click();*/ expect(msg.get(0).getText()).toMatch(/Please sign in/);
});
it('should login', function() {
element(by.model('login_username')).sendKeys('admin');
element(by.model('login_password')).sendKeys('password01!');
element(by.id('login-button')).click();
}); });
}); });