From 89fe5c39e46441ec227d28aab20c15aef496fc81 Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Thu, 20 Jun 2013 13:25:14 -0400 Subject: [PATCH] Changes to inventory detail page -improved display of has_active_failures, added variable data field. Fixed Teams organization lookup issue. Set production min js setting to False (leave set to False until we actually have minified js). --- ansibleworks/settings/production.py | 3 +- ansibleworks/ui/static/css/ansible-ui.css | 5 +++ ansibleworks/ui/static/js/forms/Groups.js | 2 +- ansibleworks/ui/static/js/forms/Hosts.js | 2 +- .../ui/static/js/forms/Inventories.js | 37 +++++++++++++++---- ansibleworks/ui/static/js/helpers/teams.js | 2 +- .../ui/static/js/lists/Inventories.js | 4 +- .../ui/static/lib/ansible/directives.js | 2 +- .../ui/static/lib/ansible/form-generator.js | 24 ++++++++++++ 9 files changed, 67 insertions(+), 14 deletions(-) diff --git a/ansibleworks/settings/production.py b/ansibleworks/settings/production.py index 0abfdf7a0c..346583cec6 100644 --- a/ansibleworks/settings/production.py +++ b/ansibleworks/settings/production.py @@ -19,7 +19,8 @@ SECRET_KEY = None ALLOWED_HOSTS = [] # Production should only use minified JS for UI. -USE_MINIFIED_JS = True +# CLH 6/20/13 - leave the following set to False until we actually have minified js ready +USE_MINIFIED_JS = False INTERNAL_API_URL = 'http://127.0.0.1:80' diff --git a/ansibleworks/ui/static/css/ansible-ui.css b/ansibleworks/ui/static/css/ansible-ui.css index 83f722df64..4663a2510d 100644 --- a/ansibleworks/ui/static/css/ansible-ui.css +++ b/ansibleworks/ui/static/css/ansible-ui.css @@ -307,6 +307,11 @@ color: #FF0000; } + .job-failures-true { + padding-top: 5px; + color: #da4f49; + } + .job-new, input[type="text"].job-new, .job-canceled, input[type="text"].job-canceled { color: #778899; diff --git a/ansibleworks/ui/static/js/forms/Groups.js b/ansibleworks/ui/static/js/forms/Groups.js index a228305a3c..b0f2db5db3 100644 --- a/ansibleworks/ui/static/js/forms/Groups.js +++ b/ansibleworks/ui/static/js/forms/Groups.js @@ -40,7 +40,7 @@ angular.module('GroupFormDefinition', []) dataPlacement: 'right', awPopOver: "

Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.

" + '

View JSON examples at www.json.org

' + - '

View YAML examples at ansiblewors.com

' + '

View YAML examples at ansibleworks.com

' } }, diff --git a/ansibleworks/ui/static/js/forms/Hosts.js b/ansibleworks/ui/static/js/forms/Hosts.js index 8a545cb548..e15eb89a42 100644 --- a/ansibleworks/ui/static/js/forms/Hosts.js +++ b/ansibleworks/ui/static/js/forms/Hosts.js @@ -43,7 +43,7 @@ angular.module('HostFormDefinition', []) "default": "\{\}", awPopOver: "

Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.

" + '

View JSON examples at www.json.org

' + - '

View YAML examples at ansiblewors.com

', + '

View YAML examples at ansibleworks.com

', dataTitle: 'Host Variables', dataPlacement: 'right' } diff --git a/ansibleworks/ui/static/js/forms/Inventories.js b/ansibleworks/ui/static/js/forms/Inventories.js index 58f0dc77ea..0c2b041fb4 100644 --- a/ansibleworks/ui/static/js/forms/Inventories.js +++ b/ansibleworks/ui/static/js/forms/Inventories.js @@ -17,22 +17,34 @@ angular.module('InventoryFormDefinition', []) collapse: true, collapseTitle: 'Edit Inventory', collapseMode: 'edit', + twoColumns: true, fields: { + has_active_failures: { + label: 'Host Status', + control: '
' + + ' Failed jobs
', + type: 'custom', + ngShow: 'has_active_failures', + readonly: true, + column: 1 + }, inventory_name: { realName: 'name', label: 'Name', type: 'text', addRequired: true, editRequired: true, - capitalize: false + capitalize: false, + column: 1 }, inventory_description: { realName: 'description', label: 'Description', type: 'text', addRequired: false, - editRequired: false + editRequired: false, + column: 1 }, organization: { label: 'Organization', @@ -41,12 +53,23 @@ angular.module('InventoryFormDefinition', []) sourceField: 'name', addRequired: true, editRequired: true, - ngClick: 'lookUpOrganization()' + ngClick: 'lookUpOrganization()', + column: 1 }, - has_active_failures: { - label: 'Failures', - readonly: true, - type: 'text' + variables: { + label: 'Variables', + type: 'textarea', + addRequired: false, + editRequird: false, + rows: 10, + "class": "modal-input-xlarge", + "default": "\{\}", + awPopOver: "

Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.

" + + '

View JSON examples at www.json.org

' + + '

View YAML examples at ansibleworks.com

', + dataTitle: 'Inventory Variables', + dataPlacement: 'bottom', + column: 2 } }, diff --git a/ansibleworks/ui/static/js/helpers/teams.js b/ansibleworks/ui/static/js/helpers/teams.js index b0da1df2ef..d122cdf840 100644 --- a/ansibleworks/ui/static/js/helpers/teams.js +++ b/ansibleworks/ui/static/js/helpers/teams.js @@ -68,7 +68,7 @@ angular.module('TeamHelper', [ 'RestServices', 'Utilities', 'OrganizationListDef var list = OrganizationList; var listGenerator = GenerateList; var listScope = listGenerator.inject(list, { mode: 'lookup', hdr: 'Select Organization' }); - var defaultUrl = '/api/v1/organizations'; + var defaultUrl = '/api/v1/organizations/'; listScope.selectAction = function() { var found = false; diff --git a/ansibleworks/ui/static/js/lists/Inventories.js b/ansibleworks/ui/static/js/lists/Inventories.js index 5c14060de7..415377b524 100644 --- a/ansibleworks/ui/static/js/lists/Inventories.js +++ b/ansibleworks/ui/static/js/lists/Inventories.js @@ -33,9 +33,9 @@ angular.module('InventoriesListDefinition', []) sourceField: 'name' }, has_active_failures: { - label: 'Failures', + label: 'Host Status', showValue: false, - text: 'Failed events', + text: 'Failed jobs', ngShow: "\{\{ inventory.has_active_failures \}\}", icon: 'icon-exclamation-sign', "class": 'active-failures-\{\{ inventory.has_active_failures \}\}', diff --git a/ansibleworks/ui/static/lib/ansible/directives.js b/ansibleworks/ui/static/lib/ansible/directives.js index 0e8c08da56..a8bff15baa 100644 --- a/ansibleworks/ui/static/lib/ansible/directives.js +++ b/ansibleworks/ui/static/lib/ansible/directives.js @@ -149,7 +149,7 @@ angular.module('AWDirectives', ['RestServices']) } }) - /* + /* * Enable TB pop-overs. To add a pop-over to an element, include the following directive in * the element's attributes: * diff --git a/ansibleworks/ui/static/lib/ansible/form-generator.js b/ansibleworks/ui/static/lib/ansible/form-generator.js index b9f270288e..6646e7959b 100644 --- a/ansibleworks/ui/static/lib/ansible/form-generator.js +++ b/ansibleworks/ui/static/lib/ansible/form-generator.js @@ -410,6 +410,30 @@ angular.module('FormGenerator', ['GeneratorHelpers']) html += "\n"; } + //text fields + if (field.type == 'custom') { + if ( (! field.readonly) || (field.readonly && options.mode == 'edit') ) { + html += "
'; + if (field.awPopOver) { + html += " "; + } + html += (field.icon) ? this.icon(field.icon) : ""; + html += field.label + '' + "\n"; + html += "
\n"; + html += field.control; + html += "
\n"; + html += "
\n"; + } + } + return html; },