From 50382890e5c5a999adabf4ec291899d45d91112d Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Mon, 11 Aug 2014 15:57:06 -0400 Subject: [PATCH] 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. --- awx/ui/static/js/helpers/HostEventsViewer.js | 32 +++++++++++++++----- awx/ui/static/partials/job_detail.html | 9 ++---- awx/ui/tests/e2e/CheckLicense.js | 19 +++++++----- 3 files changed, 39 insertions(+), 21 deletions(-) diff --git a/awx/ui/static/js/helpers/HostEventsViewer.js b/awx/ui/static/js/helpers/HostEventsViewer.js index e322225e33..26e5df7f60 100644 --- a/awx/ui/static/js/helpers/HostEventsViewer.js +++ b/awx/ui/static/js/helpers/HostEventsViewer.js @@ -20,10 +20,28 @@ angular.module('HostEventsViewerHelper', ['ModalDialog', 'Utilities', 'EventView url = params.url, title = params.title, //optional 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_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); @@ -224,19 +242,19 @@ angular.module('HostEventsViewerHelper', ['ModalDialog', 'Utilities', 'EventView 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'; } - else if (scope.host_events_search_status === 'failed') { + else if (scope.host_events_search_status.value === 'failed') { 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'; } - else if (scope.host_events_search_status === 'unreachable') { + else if (scope.host_events_search_status.value === '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¬__event=runner_on_skipped'; } diff --git a/awx/ui/static/partials/job_detail.html b/awx/ui/static/partials/job_detail.html index f2ace757ea..97f9cc7389 100644 --- a/awx/ui/static/partials/job_detail.html +++ b/awx/ui/static/partials/job_detail.html @@ -429,13 +429,8 @@
- +
diff --git a/awx/ui/tests/e2e/CheckLicense.js b/awx/ui/tests/e2e/CheckLicense.js index 229d35b543..dcc0ef2db3 100644 --- a/awx/ui/tests/e2e/CheckLicense.js +++ b/awx/ui/tests/e2e/CheckLicense.js @@ -7,17 +7,22 @@ * */ - /* global describe, it, expect, browser */ + /* global describe, it, expect, by, browser, element, beforeEach */ describe('E2E:CheckLicense', function() { - it('should present login dialog', function() { + beforeEach(function() { 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'); - element(by.model('login_password')).sendKeys('password'); - element(by.id('login-button')).click();*/ + it('should present login dialog', function() { + var msg = element.all(by.css('#login-modal .login-alert')); + 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(); }); }); \ No newline at end of file