From 0dc04cd0576b8a1767ffea4cec2ba2e0fd3bbfa4 Mon Sep 17 00:00:00 2001 From: Joe Fiorini Date: Tue, 10 Mar 2015 10:03:25 -0400 Subject: [PATCH 1/2] Use columnNgClass instead of ngClass for columns ngClass gets placed on both the td and the link (if an ngClick is provided); this is not good, therefore splitting them out into ngClass for the link class (for backwards compatibility) and columnNgClass for the class on the td. --- awx/ui/static/js/shared/generator-helpers.js | 3 ++- awx/ui/static/js/shared/list-generator.js | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/awx/ui/static/js/shared/generator-helpers.js b/awx/ui/static/js/shared/generator-helpers.js index 449016324b..dd88d7e9cc 100644 --- a/awx/ui/static/js/shared/generator-helpers.js +++ b/awx/ui/static/js/shared/generator-helpers.js @@ -330,6 +330,7 @@ angular.module('GeneratorHelpers', []) html = "\n"; html += " Date: Tue, 10 Mar 2015 10:35:56 -0400 Subject: [PATCH 2/2] Replace enabled checkbox with disabled tag display --- awx/ui/static/js/lists/HomeHosts.js | 11 ++--------- awx/ui/static/js/lists/InventoryHosts.js | 10 ++-------- awx/ui/static/js/shared/list-generator.js | 4 ---- awx/ui/static/less/ansible-ui.less | 1 + awx/ui/static/less/text-label.less | 22 ++++++++++++++++++++++ 5 files changed, 27 insertions(+), 21 deletions(-) create mode 100644 awx/ui/static/less/text-label.less diff --git a/awx/ui/static/js/lists/HomeHosts.js b/awx/ui/static/js/lists/HomeHosts.js index 897851ec7a..992a46a7b8 100644 --- a/awx/ui/static/js/lists/HomeHosts.js +++ b/awx/ui/static/js/lists/HomeHosts.js @@ -41,6 +41,7 @@ export default key: true, label: 'Name', columnClass: 'col-lg-4 col-md3 col-sm-3 col-xs-7 ellipsis', + ngClass: "{ 'host-disabled-label': !host.enabled }", ngClick: "editHost(host.id)" }, inventory_name: { @@ -78,14 +79,6 @@ export default }, fieldActions: { - enabled_flag: { - //label: 'Enabled', - iconClass: "{{ 'fa icon-enabled-' + host.enabled }}", - dataPlacement: 'top', - awToolTip: "{{ host.enabledToolTip }}", - dataTipWatch: "host.enabledToolTip", - ngClick: "toggleHostEnabled(host.id, host.has_inventory_sources)" - }, /*active_failures: { //label: 'Job Status', //ngHref: "\{\{'/#/hosts/' + host.id + '/job_host_summaries/?inventory=' + inventory_id \}\}", @@ -113,4 +106,4 @@ export default } } - }); \ No newline at end of file + }); diff --git a/awx/ui/static/js/lists/InventoryHosts.js b/awx/ui/static/js/lists/InventoryHosts.js index 026fc59a43..2a54bc71b4 100644 --- a/awx/ui/static/js/lists/InventoryHosts.js +++ b/awx/ui/static/js/lists/InventoryHosts.js @@ -28,6 +28,7 @@ export default key: true, label: 'Hosts', ngClick: "editHost(host.id)", + ngClass: "{ 'host-disabled-label': !host.enabled }", columnClass: 'col-lg-8 col-md-9 col-sm-9 col-xs-7', dataHostId: "{{ host.id }}", dataType: "host" @@ -53,13 +54,6 @@ export default columnClass: 'col-lg-4 col-md-3 col-sm-3 col-xs-5 text-right', label: false, - enabled_flag: { - iconClass: "{{ 'fa icon-enabled-' + host.enabled }}", - dataPlacement: 'top', - awToolTip: "{{ host.enabledToolTip }}", - dataTipWatch: "host.enabledToolTip", - ngClick: "toggleHostEnabled(host.id, host.has_inventory_sources)" - }, active_failures: { awPopOver: "{{ host.job_status_html }}", dataTitle: "{{ host.job_status_title }}", @@ -111,4 +105,4 @@ export default } } - }); \ No newline at end of file + }); diff --git a/awx/ui/static/js/shared/list-generator.js b/awx/ui/static/js/shared/list-generator.js index d5732529db..6f031ba7cf 100644 --- a/awx/ui/static/js/shared/list-generator.js +++ b/awx/ui/static/js/shared/list-generator.js @@ -548,10 +548,6 @@ angular.module('ListGenerator', ['GeneratorHelpers']) html += " " + list.fields[fld].columnClass; } - if (list.fields[fld].columnNgClass) { - html += "\" ng-class=\"" + list.fields[fld].columnNgClass - } - html += "\" id=\"" + list.iterator + "-" + fld + "-header\""; html += (list.fields[fld].columnShow) ? " ng-show=\"" + list.fields[fld].columnShow + "\" " : ""; html += (list.fields[fld].nosort === undefined || list.fields[fld].nosort !== true) ? " ng-click=\"sort('" + list.iterator + "','" + fld + "')\"" : ""; diff --git a/awx/ui/static/less/ansible-ui.less b/awx/ui/static/less/ansible-ui.less index dc2c4c48ba..c039f6a755 100644 --- a/awx/ui/static/less/ansible-ui.less +++ b/awx/ui/static/less/ansible-ui.less @@ -62,6 +62,7 @@ @import "jPushMenu.less"; @import "survey-maker.less"; @import "portal.less"; +@import "text-label.less"; /* Bootstrap fix that's causing a right margin to appear whenver a modal is opened */ diff --git a/awx/ui/static/less/text-label.less b/awx/ui/static/less/text-label.less new file mode 100644 index 0000000000..cb3c6898a9 --- /dev/null +++ b/awx/ui/static/less/text-label.less @@ -0,0 +1,22 @@ +.include-text-label(@background-color; @color; @content) { + display: inline-block; + content: @content; + + border-radius: 3px; + background-color: @background-color; + color: @color; + text-transform: uppercase; + font-size: .7em; + font-weight: bold; + font-style: normal; + margin-left: 0.5em; + padding: 0.35em; + padding-bottom: 0.2em; + line-height: 1.1; +} + +.host-disabled-label { + &:after { + .include-text-label(#676767; white; "disabled"); + } +}