diff --git a/awx/ui/client/legacy-styles/forms.less b/awx/ui/client/legacy-styles/forms.less index 1afc218913..19cf74082c 100644 --- a/awx/ui/client/legacy-styles/forms.less +++ b/awx/ui/client/legacy-styles/forms.less @@ -15,12 +15,25 @@ flex-direction: row; } +.Form-textArea{ + width: 100% !important; +} + +.Form-header--fields{ + flex: 1 1 auto; +} + +.Form-header-field{ + margin-left: 10px; + flex: 1 1 auto; +} + .Form-header{ display: flex; } .Form-title{ - flex: 1 0 auto; + flex: 0 1 auto; text-transform: uppercase; color: @list-header-txt; font-size: 14px; diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index aec643803d..a79460b0ea 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -21,7 +21,7 @@ import './lists'; import './widgets'; import './help'; import './filters'; -import {Home, HomeGroups, HomeHosts} from './controllers/Home'; +import {Home, HomeGroups} from './controllers/Home'; import {SocketsController} from './controllers/Sockets'; import {CredentialsAdd, CredentialsEdit, CredentialsList} from './controllers/Credentials'; import {JobsListController} from './controllers/Jobs'; @@ -173,7 +173,6 @@ var tower = angular.module('Tower', [ 'CredentialsHelper', 'StreamListDefinition', 'HomeGroupListDefinition', - 'HomeHostListDefinition', 'ActivityDetailDefinition', 'VariablesHelper', 'SchedulesListDefinition', @@ -267,25 +266,6 @@ var tower = angular.module('Tower', [ } }). - state('dashboardHosts', { - url: '/home/hosts?has_active_failures&name&id', - templateUrl: urlPrefix + 'partials/subhome.html', - controller: HomeHosts, - data: { - activityStream: true, - activityStreamTarget: 'host' - }, - ncyBreadcrumb: { - parent: 'dashboard', - label: "HOSTS" - }, - resolve: { - features: ['FeaturesService', function(FeaturesService) { - return FeaturesService.get(); - }] - } - }). - state('jobs', { url: '/jobs', templateUrl: urlPrefix + 'partials/jobs.html', diff --git a/awx/ui/client/src/controllers/Home.js b/awx/ui/client/src/controllers/Home.js index 8006914355..d7f3847be9 100644 --- a/awx/ui/client/src/controllers/Home.js +++ b/awx/ui/client/src/controllers/Home.js @@ -1,5 +1,5 @@ /************************************************* - * Copyright (c) 2015 Ansible, Inc. + * Copyright (c) 2016 Ansible, Inc. * * All Rights Reserved *************************************************/ @@ -155,7 +155,6 @@ export function HomeGroups($rootScope, $log, $scope, $filter, $compile, $locatio ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. - var generator = GenerateList, list = HomeGroupList, defaultUrl = GetBasePath('groups'), @@ -516,112 +515,3 @@ HomeGroups.$inject = ['$rootScope', '$log', '$scope', '$filter', '$compile', '$l * @description This loads the page for 'home/hosts' * */ - -export function HomeHosts($scope, $location, $stateParams, HomeHostList, GenerateList, ProcessErrors, ReturnToCaller, ClearScope, - GetBasePath, SearchInit, PaginateInit, FormatDate, SetStatus, ToggleHostEnabled, HostsEdit, Find, ShowJobSummary) { - - ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior - //scope. - - var generator = GenerateList, - list = HomeHostList, - defaultUrl = GetBasePath('hosts'); - - if ($scope.removePostRefresh) { - $scope.removePostRefresh(); - } - $scope.removePostRefresh = $scope.$on('PostRefresh', function () { - for (var i = 0; i < $scope.hosts.length; i++) { - $scope.hosts[i].inventory_name = $scope.hosts[i].summary_fields.inventory.name; - //SetHostStatus($scope['hosts'][i]); - SetStatus({ - $scope: $scope, - host: $scope.hosts[i] - }); - } - - generator.inject(list, { mode: 'edit', scope: $scope }); - - }); - - SearchInit({ - scope: $scope, - set: 'hosts', - list: list, - url: defaultUrl - }); - - PaginateInit({ - scope: $scope, - list: list, - url: defaultUrl - }); - - // Process search params - if ($stateParams.name) { - $scope[HomeHostList.iterator + 'InputDisable'] = false; - $scope[HomeHostList.iterator + 'SearchValue'] = $stateParams.name; - $scope[HomeHostList.iterator + 'SearchField'] = 'name'; - $scope[HomeHostList.iterator + 'SearchFieldLabel'] = list.fields.name.label; - } - - if ($stateParams.id) { - $scope[HomeHostList.iterator + 'InputDisable'] = false; - $scope[HomeHostList.iterator + 'SearchValue'] = $stateParams.id; - $scope[HomeHostList.iterator + 'SearchField'] = 'id'; - $scope[HomeHostList.iterator + 'SearchFieldLabel'] = list.fields.id.label; - $scope[HomeHostList.iterator + 'SearchSelectValue'] = null; - } - - if ($stateParams.has_active_failures) { - $scope[HomeHostList.iterator + 'InputDisable'] = true; - $scope[HomeHostList.iterator + 'SearchValue'] = $stateParams.has_active_failures; - $scope[HomeHostList.iterator + 'SearchField'] = 'has_active_failures'; - $scope[HomeHostList.iterator + 'SearchFieldLabel'] = HomeHostList.fields.has_active_failures.label; - $scope[HomeHostList.iterator + 'SearchSelectValue'] = ($stateParams.has_active_failures === 'true') ? { value: 1 } : { value: 0 }; - } - - $scope.search(list.iterator); - - $scope.refreshHosts = function() { - $scope.search(list.iterator); - }; - - $scope.toggleHostEnabled = function (id, sources) { - ToggleHostEnabled({ - host_id: id, - external_source: sources, - host_scope: $scope - }); - }; - - $scope.editHost = function (host_id) { - var host = Find({ - list: $scope.hosts, - key: 'id', - val: host_id - }); - if (host) { - HostsEdit({ - host_scope: $scope, - host_id: host_id, - inventory_id: host.inventory, - group_id: null, - hostsReload: false, - mode: 'edit' - }); - } - }; - - $scope.showJobSummary = function (job_id) { - ShowJobSummary({ - job_id: job_id - }); - }; - -} - -HomeHosts.$inject = ['$scope', '$location', '$stateParams', 'HomeHostList', 'generateList', 'ProcessErrors', 'ReturnToCaller', - 'ClearScope', 'GetBasePath', 'SearchInit', 'PaginateInit', 'FormatDate', 'SetStatus', 'ToggleHostEnabled', 'HostsEdit', - 'Find', 'ShowJobSummary' -]; diff --git a/awx/ui/client/src/controllers/Projects.js b/awx/ui/client/src/controllers/Projects.js index a603f69bf2..c7ca0d1ab4 100644 --- a/awx/ui/client/src/controllers/Projects.js +++ b/awx/ui/client/src/controllers/Projects.js @@ -28,7 +28,6 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $stateParams, mode = (base === 'projects') ? 'edit' : 'select', url = (base === 'teams') ? GetBasePath('teams') + $stateParams.team_id + '/projects/' : defaultUrl, choiceCount = 0; - view.inject(list, { mode: mode, scope: $scope }); $rootScope.flashMessage = null; diff --git a/awx/ui/client/src/dashboard/hosts/dashboard-hosts-edit.controller.js b/awx/ui/client/src/dashboard/hosts/dashboard-hosts-edit.controller.js new file mode 100644 index 0000000000..8393088f4a --- /dev/null +++ b/awx/ui/client/src/dashboard/hosts/dashboard-hosts-edit.controller.js @@ -0,0 +1,50 @@ +/************************************************* + * Copyright (c) 2016 Ansible, Inc. + * + * All Rights Reserved + *************************************************/ + + export default + ['$scope', '$state', '$stateParams', 'DashboardHostsForm', 'GenerateForm', 'ParseTypeChange', 'DashboardHostService', 'host', + function($scope, $state, $stateParams, DashboardHostsForm, GenerateForm, ParseTypeChange, DashboardHostService, host){ + var generator = GenerateForm, + form = DashboardHostsForm; + $scope.parseType = 'yaml'; + $scope.formCancel = function(){ + $state.go('^', null, {reload: true}); + }; + $scope.toggleHostEnabled = function(){ + $scope.host.enabled = !$scope.host.enabled; + }; + $scope.toggleEnabled = function(){ + $scope.host.enabled = !$scope.host.enabled; + }; + $scope.formSave = function(){ + var host = { + id: $scope.host.id, + variables: $scope.extraVars === '---' || $scope.extraVars === '{}' ? null : $scope.extraVars, + name: $scope.name, + description: $scope.description, + enabled: $scope.host.enabled + }; + DashboardHostService.putHost(host).then(function(res){ + $state.go('^', null, {reload: true}); + }); + + }; + var init = function(){ + $scope.host = host; + $scope.extraVars = host.variables === '' ? '---' : host.variables; + generator.inject(form, {mode: 'edit', related: false, scope: $scope}); + $scope.extraVars = $scope.host.variables === '' ? '---' : $scope.host.variables; + $scope.name = host.name; + $scope.description = host.description; + ParseTypeChange({ + scope: $scope, + field_id: 'host_variables', + variable: 'extraVars', + }); + }; + + init(); + }]; \ No newline at end of file diff --git a/awx/ui/client/src/dashboard/hosts/dashboard-hosts-edit.partial.html b/awx/ui/client/src/dashboard/hosts/dashboard-hosts-edit.partial.html new file mode 100644 index 0000000000..5db1583d13 --- /dev/null +++ b/awx/ui/client/src/dashboard/hosts/dashboard-hosts-edit.partial.html @@ -0,0 +1,4 @@ +
Indicates if a host is available and should be included in running jobs.
For hosts that " + + "are part of an external inventory, this flag cannot be changed. It will be set by the inventory sync process.
", + dataTitle: 'Host Enabled' + } + }, + fields: { + name: { + label: 'Host Name', + type: 'text', + editRequired: true, + value: '{{name}}', + awPopOver: "Provide a host name, ip address, or ip address:port. Examples include:
" + + "myserver.domain.com", + dataTitle: 'Host Name', + dataPlacement: 'right', + dataContainer: 'body' + }, + description: { + label: 'Description', + type: 'text', + editRequired: false + }, + variables: { + label: 'Variables', + type: 'textarea', + editRequired: false, + rows: 6, + class: 'modal-input-xlarge Form-textArea', + dataTitle: 'Host Variables', + dataPlacement: 'right', + dataContainer: 'body', + default: '---', + awPopOver: "
" + + "127.0.0.1
" + + "10.1.0.140:25
" + + "server.example.com:25" + + "
Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.
" + + "JSON:{\n" + + "YAML:
\"somevar\": \"somevalue\",
\"password\": \"magic\"
}
---\n" + + '
somevar: somevalue
password: magic
View JSON examples at www.json.org
' + + 'View YAML examples at docs.ansible.com
', + } + }, + buttons: { + save: { + ngClick: 'formSave()', //$scope.function to call on click, optional + ngDisabled: "host_form.$invalid"//true //Disable when $pristine or $invalid, optional and when can_edit = false, for permission reasons + }, + cancel: { + ngClick: 'formCancel()' + } + } + }; +}; \ No newline at end of file diff --git a/awx/ui/client/src/lists/HomeHosts.js b/awx/ui/client/src/dashboard/hosts/dashboard-hosts.list.js similarity index 50% rename from awx/ui/client/src/lists/HomeHosts.js rename to awx/ui/client/src/dashboard/hosts/dashboard-hosts.list.js index ffa5fc2d52..4731155cbb 100644 --- a/awx/ui/client/src/lists/HomeHosts.js +++ b/awx/ui/client/src/dashboard/hosts/dashboard-hosts.list.js @@ -1,14 +1,12 @@ /************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ +* Copyright (c) 2015 Ansible, Inc. +* +* All Rights Reserved +*************************************************/ -export default - angular.module('HomeHostListDefinition', []) - .value('HomeHostList', { - +export default function(){ + return { name: 'hosts', iterator: 'host', selectTitle: 'Add Existing Hosts', @@ -20,38 +18,45 @@ export default fields: { status: { - label: "", + basePath: 'unified_jobs', + label: '', iconOnly: true, - icon: "{{ 'icon-job-' + host.active_failures }}", - awToolTip: "{{ host.badgeToolTip }}", - awTipPlacement: "right", - dataPlacement: "right", - awPopOver: "{{ host.job_status_html }}", - ngClick:"bob", - columnClass: "List-staticColumn--smallStatus", - searchable: false, - nosort: true + searchable: true, + searchType: 'select', + nosort: true, + searchOptions: [], + searchLabel: 'Job Status', + icon: 'icon-job-{{ host.active_failures }}', + awToolTip: '{{ host.badgeToolTip }}', + awTipPlacement: 'right', + dataPlacement: 'right', + awPopOver: '{{ host.job_status_html }}', + ngClick:'viewHost(host.id)', + columnClass: 'col-lg-1 col-md-1 col-sm-2 col-xs-2 List-staticColumn--smallStatus' }, name: { key: true, label: 'Name', columnClass: 'col-lg-5 col-md-5 col-sm-5 col-xs-8 ellipsis List-staticColumnAdjacent', - ngClass: "{ 'host-disabled-label': !host.enabled }", - ngClick: "editHost(host.id)" + ngClick: 'editHost(host.id)' }, inventory_name: { label: 'Inventory', sourceModel: 'inventory', sourceField: 'name', columnClass: 'col-lg-5 col-md-4 col-sm-4 hidden-xs elllipsis', - linkTo: "{{ '/#/inventories/' + host.inventory }}" + linkTo: "{{ '/#/inventories/' + host.inventory_id }}", + searchable: false }, enabled: { - label: 'Disabled?', - searchSingleValue: true, - searchType: 'boolean', - searchValue: 'false', - searchOnly: true + label: 'Status', + columnClass: 'List-staticColumn--toggle', + type: 'toggle', + ngClick: 'toggleHostEnabled(host)', + searchable: false, + nosort: true, + awToolTip: "Indicates if a host is available and should be included in running jobs.
For hosts that are part of an external inventory, this flag cannot be changed. It will be set by the inventory sync process.
", + dataTitle: 'Host Enabled', }, has_active_failures: { label: 'Has failed jobs?', @@ -66,30 +71,15 @@ export default searchType: 'boolean', searchValue: 'true', searchOnly: true - }, - id: { - label: 'ID', - searchOnly: true } }, fieldActions: { columnClass: 'col-lg-2 col-md-3 col-sm-3 col-xs-4', - - /*active_failures: { - //label: 'Job Status', - //ngHref: "\{\{'/#/hosts/' + host.id + '/job_host_summaries/?inventory=' + inventory_id \}\}", - awPopOver: "{{ host.job_status_html }}", - dataTitle: "{{ host.job_status_title }}", - awToolTip: "{{ host.badgeToolTip }}", - awTipPlacement: 'top', - dataPlacement: 'left', - iconClass: "{{ 'fa icon-failures-' + host.has_active_failures }}" - }*/ edit: { label: 'Edit', - ngClick: "editHost(host.id)", + ngClick: 'editHost(host.id)', icon: 'icon-edit', awToolTip: 'Edit host', dataPlacement: 'top' @@ -99,5 +89,5 @@ export default actions: { } - - }); + } +}; diff --git a/awx/ui/client/src/dashboard/hosts/dashboard-hosts.route.js b/awx/ui/client/src/dashboard/hosts/dashboard-hosts.route.js new file mode 100644 index 0000000000..84f31ad981 --- /dev/null +++ b/awx/ui/client/src/dashboard/hosts/dashboard-hosts.route.js @@ -0,0 +1,64 @@ +/************************************************* + * Copyright (c) 2016 Ansible, Inc. + * + * All Rights Reserved + *************************************************/ + +import {templateUrl} from '../../shared/template-url/template-url.factory'; +import listController from './dashboard-hosts-list.controller'; +import editController from './dashboard-hosts-edit.controller'; + +var dashboardHostsList = { + name: 'dashboardHosts', + url: '/home/hosts', + controller: listController, + templateUrl: templateUrl('dashboard/hosts/dashboard-hosts-list'), + data: { + activityStream: true, + activityStreamTarget: 'host' + }, + ncyBreadcrumb: { + parent: 'dashboard', + label: "HOSTS" + }, + resolve: { + features: ['FeaturesService', function(FeaturesService) { + return FeaturesService.get(); + }], + hosts: ['Rest', 'GetBasePath', function(Rest, GetBasePath){ + var defaultUrl = GetBasePath('hosts') + '?page_size=10'; + Rest.setUrl(defaultUrl); + return Rest.get().then(function(res){ + var results = _.map(res.data.results, function(value, key){ + value.inventory_name = value.summary_fields.inventory.name; + value.inventory_id = value.summary_fields.inventory.id; + return value; + }); + res.data.results = results; + return res.data + }); + }] + } +}; + +var dashboardHostsEdit = { + name: 'dashboardHosts.edit', + url: '/:id', + controller: editController, + templateUrl: templateUrl('dashboard/hosts/dashboard-hosts-edit'), + ncyBreadcrumb: { + parent: 'dashboardHosts', + label: "{{host.name}}" + }, + resolve: { + host: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath){ + var defaultUrl = GetBasePath('hosts') + '?id=' + $stateParams.id; + Rest.setUrl(defaultUrl); + return Rest.get().then(function(res){ + return res.data.results[0]; + }); + }] + } +}; + +export {dashboardHostsList, dashboardHostsEdit}; \ No newline at end of file diff --git a/awx/ui/client/src/dashboard/hosts/dashboard-hosts.service.js b/awx/ui/client/src/dashboard/hosts/dashboard-hosts.service.js new file mode 100644 index 0000000000..997167b90a --- /dev/null +++ b/awx/ui/client/src/dashboard/hosts/dashboard-hosts.service.js @@ -0,0 +1,30 @@ +export default + ['$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors', function($rootScope, Rest, GetBasePath, ProcessErrors){ + return { + + setHostStatus: function(host, enabled){ + var url = GetBasePath('hosts') + host.id; + Rest.setUrl(url); + return Rest.put({enabled: enabled, name: host.name}) + .success(function(data){ + return data; + }) + .error(function(data, status) { + ProcessErrors($rootScope, data, status, null, { hdr: 'Error!', + msg: 'Call to ' + url + '. GET returned: ' + status }); + }); + }, + putHost: function(host){ + var url = GetBasePath('hosts') + host.id; + Rest.setUrl(url); + return Rest.put(host) + .success(function(data){ + return data; + }) + .error(function(data, status) { + ProcessErrors($rootScope, data, status, null, { hdr: 'Error!', + msg: 'Call to ' + url + '. GET returned: ' + status }); + }); + } + }; + }]; \ No newline at end of file diff --git a/awx/ui/client/src/dashboard/hosts/main.js b/awx/ui/client/src/dashboard/hosts/main.js new file mode 100644 index 0000000000..7a02e597d0 --- /dev/null +++ b/awx/ui/client/src/dashboard/hosts/main.js @@ -0,0 +1,20 @@ +/************************************************* + * Copyright (c) 2016 Ansible, Inc. + * + * All Rights Reserved + *************************************************/ + +import {dashboardHostsList, dashboardHostsEdit} from './dashboard-hosts.route'; +import list from './dashboard-hosts.list'; +import form from './dashboard-hosts.form'; +import service from './dashboard-hosts.service'; + +export default + angular.module('dashboardHosts', []) + .service('DashboardHostService', service) + .factory('DashboardHostsList', list) + .factory('DashboardHostsForm', form) + .run(['$stateExtender', function($stateExtender){ + $stateExtender.addState(dashboardHostsList); + $stateExtender.addState(dashboardHostsEdit); + }]); diff --git a/awx/ui/client/src/dashboard/main.js b/awx/ui/client/src/dashboard/main.js index 80f27a1ff1..bd0fd75743 100644 --- a/awx/ui/client/src/dashboard/main.js +++ b/awx/ui/client/src/dashboard/main.js @@ -2,7 +2,8 @@ import dashboardCounts from './counts/main'; import dashboardGraphs from './graphs/main'; import dashboardLists from './lists/main'; import dashboardDirective from './dashboard.directive'; +import dashboardHosts from './hosts/main'; export default - angular.module('dashboard', [dashboardCounts.name, dashboardGraphs.name, dashboardLists.name]) + angular.module('dashboard', [dashboardHosts.name, dashboardCounts.name, dashboardGraphs.name, dashboardLists.name]) .directive('dashboard', dashboardDirective); diff --git a/awx/ui/client/src/lists.js b/awx/ui/client/src/lists.js index da4aa67f7b..925f57bd65 100644 --- a/awx/ui/client/src/lists.js +++ b/awx/ui/client/src/lists.js @@ -11,7 +11,6 @@ import AllJobs from "./lists/AllJobs"; import Credentials from "./lists/Credentials"; import Groups from "./lists/Groups"; import HomeGroups from "./lists/HomeGroups"; -import HomeHosts from "./lists/HomeHosts"; import Hosts from "./lists/Hosts"; import Inventories from "./lists/Inventories"; import InventoryGroups from "./lists/InventoryGroups"; @@ -39,7 +38,6 @@ export Credentials, Groups, HomeGroups, - HomeHosts, Hosts, Inventories, InventoryGroups, diff --git a/awx/ui/client/src/search/getSearchHtml.service.js b/awx/ui/client/src/search/getSearchHtml.service.js index 12b9f47da9..b7da64f702 100644 --- a/awx/ui/client/src/search/getSearchHtml.service.js +++ b/awx/ui/client/src/search/getSearchHtml.service.js @@ -1,16 +1,21 @@ export default ['GetBasePath', function(GetBasePath) { // given the list, return the fields that need searching this.getList = function(list) { - var f = _.clone(list.fields); + var f = _.cloneDeep(list.fields); return JSON.stringify(Object .keys(f) .filter(function(i) { return (f[i] .searchable !== false); }).map(function(i) { + // delete any fields which might include AngularJS interpolation tags {{ }} delete f[i].awToolTip; + delete f[i].awPopover; + delete f[i].linkTo; + delete f[i].dataTitle; delete f[i].ngClass; delete f[i].ngClick; + delete f[i].icon; return {[i]: f[i]}; }).reduce(function (acc, i) { var key = Object.keys(i); diff --git a/awx/ui/client/src/search/tagSearch.controller.js b/awx/ui/client/src/search/tagSearch.controller.js index 21121a648a..d49e294a5b 100644 --- a/awx/ui/client/src/search/tagSearch.controller.js +++ b/awx/ui/client/src/search/tagSearch.controller.js @@ -1,7 +1,7 @@ export default ['$scope', 'Refresh', 'tagSearchService', function($scope, Refresh, tagSearchService) { // JSONify passed field elements that can be searched - $scope.list = JSON.parse($scope.list); + $scope.list = angular.fromJson($scope.list); // Access config lines from list spec $scope.listConfig = $scope.$parent.list; // Grab options for the left-dropdown of the searchbar diff --git a/awx/ui/client/src/search/tagSearch.service.js b/awx/ui/client/src/search/tagSearch.service.js index 7b53d28c8c..eb004a2e39 100644 --- a/awx/ui/client/src/search/tagSearch.service.js +++ b/awx/ui/client/src/search/tagSearch.service.js @@ -35,8 +35,7 @@ export default ['Rest', '$q', 'GetBasePath', 'Wait', 'ProcessErrors', '$log', fu obj.value = value; obj.label = label; obj.type = type; - - + obj.basePath = field['basePath'] || null; // return the built option if (type === 'select') { @@ -79,7 +78,7 @@ export default ['Rest', '$q', 'GetBasePath', 'Wait', 'ProcessErrors', '$log', fu if (needsRequest.length) { // make the options request to reutrn the typeOptions - Rest.setUrl(needsRequest[0].basePath ? needsRequest[0].basePath : basePath); + Rest.setUrl(needsRequest[0].basePath ? GetBasePath(needsRequest[0].basePath) : basePath); Rest.options() .success(function (data) { try { diff --git a/awx/ui/client/src/shared/form-generator.js b/awx/ui/client/src/shared/form-generator.js index f967619935..d5d44b0be2 100644 --- a/awx/ui/client/src/shared/form-generator.js +++ b/awx/ui/client/src/shared/form-generator.js @@ -230,6 +230,11 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat this.scope[fld + '_field'].name = fld; } + for (fld in form.headerFields){ + this.scope[fld + '_field'] = form.headerFields[fld]; + this.scope[fld + '_field'].name = fld; + } + $compile(element)(this.scope); if (!options.html) { @@ -606,9 +611,26 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat return html; }, + buildHeaderField: function(key, field, options, form){ + var html = ''; + // extend these blocks to include elements similarly buildField() + if (field.type === 'toggle'){ + html += "