From 42081077c5144314dc3d0774dbf811a5d97beb62 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Wed, 11 Mar 2015 13:30:03 -0400 Subject: [PATCH 1/7] Moving inventory pages the view that displayed the groups/hosts is now mapped to inventories/id/manage and the page for editing an inventory is an inventories/id --- awx/ui/static/js/app.js | 9 +- awx/ui/static/js/controllers/Inventories.js | 114 +++++++++++++- awx/ui/static/js/lists/Inventories.js | 5 +- awx/ui/static/partials/inventory-edit.html | 159 -------------------- 4 files changed, 121 insertions(+), 166 deletions(-) delete mode 100644 awx/ui/static/partials/inventory-edit.html diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js index 53736eda28..802fc4762d 100644 --- a/awx/ui/static/js/app.js +++ b/awx/ui/static/js/app.js @@ -39,7 +39,7 @@ import {JobTemplatesList, JobTemplatesAdd, JobTemplatesEdit} from 'tower/control import {ScheduleEditController} from 'tower/controllers/Schedules'; import {ProjectsList, ProjectsAdd, ProjectsEdit} from 'tower/controllers/Projects'; import {OrganizationsList, OrganizationsAdd, OrganizationsEdit} from 'tower/controllers/Organizations'; -import {InventoriesList, InventoriesAdd, InventoriesEdit} from 'tower/controllers/Inventories'; +import {InventoriesList, InventoriesAdd, InventoriesEdit, InventoriesManage} from 'tower/controllers/Inventories'; import {AdminsList} from 'tower/controllers/Admins'; import {UsersList, UsersAdd, UsersEdit} from 'tower/controllers/Users'; import {TeamsList, TeamsAdd, TeamsEdit} from 'tower/controllers/Teams'; @@ -258,10 +258,15 @@ var tower = angular.module('Tower', [ }). when('/inventories/:inventory_id', { - templateUrl: urlPrefix + 'partials/inventory-edit.html', + templateUrl: urlPrefix + 'partials/inventories.html', controller: InventoriesEdit }). + when('/inventories/:inventory_id/manage', { + templateUrl: urlPrefix + 'partials/inventory-manage.html', + controller: InventoriesManage + }). + when('/organizations', { templateUrl: urlPrefix + 'partials/organizations.html', controller: OrganizationsList diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index e0ff5c5e4e..8263ad04a4 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -476,9 +476,117 @@ InventoriesAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log 'PaginateInit', 'LookUpInit', 'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON' ]; +export function InventoriesEdit($scope, $rootScope, $compile, $location, $log, $routeParams, InventoryForm, GenerateForm, Rest, + Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, GenerateList, OrganizationList, SearchInit, PaginateInit, + LookUpInit, GetBasePath, ParseTypeChange, Wait, ToJSON) { + + ClearScope(); + + // Inject dynamic view + var defaultUrl = GetBasePath('inventory'), + form = InventoryForm, + generator = GenerateForm; + + form.well = true; + form.formLabelSize = null; + form.formFieldSize = null; + + generator.inject(form, { mode: 'add', related: false, scope: $scope }); + + generator.reset(); + LoadBreadCrumbs(); + + $scope.parseType = 'yaml'; + ParseTypeChange({ + scope: $scope, + variable: 'variables', + parse_variable: 'parseType', + field_id: 'inventory_variables' + }); + + LookUpInit({ + scope: $scope, + form: form, + current_item: ($routeParams.organization_id) ? $routeParams.organization_id : null, + list: OrganizationList, + field: 'organization', + input_type: 'radio' + }); + + // Save + $scope.formSave = function () { + generator.clearApiErrors(); + Wait('start'); + try { + var fld, json_data, data; + + json_data = ToJSON($scope.parseType, $scope.variables, true); + + data = {}; + for (fld in form.fields) { + if (fld !== 'variables') { + if (form.fields[fld].realName) { + data[form.fields[fld].realName] = $scope[fld]; + } else { + data[fld] = $scope[fld]; + } + } + } + + if ($scope.removeUpdateInventoryVariables) { + $scope.removeUpdateInventoryVariables(); + } + $scope.removeUpdateInventoryVariables = $scope.$on('UpdateInventoryVariables', function(e, data) { + var inventory_id = data.id; + Rest.setUrl(data.related.variable_data); + Rest.put(json_data) + .success(function () { + Wait('stop'); + $location.path('/inventories/' + inventory_id + '/'); + }) + .error(function (data, status) { + ProcessErrors( $scope, data, status, null, { hdr: 'Error!', + msg: 'Failed to update inventory varaibles. PUT returned status: ' + status + }); + }); + }); + + Rest.setUrl(defaultUrl); + Rest.post(data) + .success(function (data) { + var inventory_id = data.id; + if ($scope.variables) { + $scope.$emit('UpdateInventoryVariables', data); + } else { + Wait('stop'); + $location.path('/inventories/' + inventory_id + '/'); + } + }) + .error(function (data, status) { + ProcessErrors( $scope, data, status, form, { hdr: 'Error!', + msg: 'Failed to add new inventory. Post returned status: ' + status }); + }); + } catch (err) { + Wait('stop'); + Alert("Error", "Error parsing inventory variables. Parser returned: " + err); + } + + }; + + // Reset + $scope.formReset = function () { + generator.reset(); + }; +} + +InventoriesEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'InventoryForm', 'GenerateForm', + 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'GenerateList', 'OrganizationList', 'SearchInit', + 'PaginateInit', 'LookUpInit', 'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON' +]; -export function InventoriesEdit ($log, $scope, $location, $routeParams, $compile, GenerateList, ClearScope, Empty, Wait, Rest, Alert, LoadBreadCrumbs, GetBasePath, ProcessErrors, + +export function InventoriesManage ($log, $scope, $location, $routeParams, $compile, GenerateList, ClearScope, Empty, Wait, Rest, Alert, LoadBreadCrumbs, GetBasePath, ProcessErrors, Breadcrumbs, InventoryGroups, InjectHosts, Find, HostsReload, SearchInit, PaginateInit, GetSyncStatusMsg, GetHostsStatusMsg, GroupsEdit, InventoryUpdate, GroupsCancelUpdate, ViewUpdateStatus, GroupsDelete, Store, HostsEdit, HostsDelete, EditInventoryProperties, ToggleHostEnabled, Stream, ShowJobSummary, InventoryGroupsHelp, HelpDialog, ViewJob, WatchInventoryWindowResize, GetHostContainerRows, GetGroupContainerRows, GetGroupContainerHeight, @@ -1021,9 +1129,9 @@ export function InventoriesEdit ($log, $scope, $location, $routeParams, $compile }); } -InventoriesEdit.$inject = ['$log', '$scope', '$location', '$routeParams', '$compile', 'GenerateList', 'ClearScope', 'Empty', 'Wait', 'Rest', 'Alert', 'LoadBreadCrumbs', +InventoriesManage.$inject = ['$log', '$scope', '$location', '$routeParams', '$compile', 'GenerateList', 'ClearScope', 'Empty', 'Wait', 'Rest', 'Alert', 'LoadBreadCrumbs', 'GetBasePath', 'ProcessErrors', 'Breadcrumbs', 'InventoryGroups', 'InjectHosts', 'Find', 'HostsReload', 'SearchInit', 'PaginateInit', 'GetSyncStatusMsg', 'GetHostsStatusMsg', 'GroupsEdit', 'InventoryUpdate', 'GroupsCancelUpdate', 'ViewUpdateStatus', 'GroupsDelete', 'Store', 'HostsEdit', 'HostsDelete', 'EditInventoryProperties', 'ToggleHostEnabled', 'Stream', 'ShowJobSummary', 'InventoryGroupsHelp', 'HelpDialog', 'ViewJob', 'WatchInventoryWindowResize', 'GetHostContainerRows', 'GetGroupContainerRows', 'GetGroupContainerHeight', 'GroupsCopy', 'HostsCopy', 'Socket' - ]; \ No newline at end of file + ]; diff --git a/awx/ui/static/js/lists/Inventories.js b/awx/ui/static/js/lists/Inventories.js index 602f7007b4..99b3d1d123 100644 --- a/awx/ui/static/js/lists/Inventories.js +++ b/awx/ui/static/js/lists/Inventories.js @@ -48,7 +48,8 @@ export default key: true, label: 'Name', columnClass: 'col-md-4 col-sm-6 col-xs-6', - modalColumnClass: 'col-md-8' + modalColumnClass: 'col-md-8', + linkTo: '/#/inventories/{{inventory.id}}/manage' }, organization: { label: 'Organization', @@ -105,7 +106,7 @@ export default }, edit: { label: 'Edit', - ngClick: 'editInventoryProperties(inventory.id)', + ngClick: 'editInventory(inventory.id)', //'editInventoryProperties(inventory.id)', awToolTip: 'Edit inventory', dataPlacement: 'top' }, diff --git a/awx/ui/static/partials/inventory-edit.html b/awx/ui/static/partials/inventory-edit.html deleted file mode 100644 index 3116445ec1..0000000000 --- a/awx/ui/static/partials/inventory-edit.html +++ /dev/null @@ -1,159 +0,0 @@ -
-
- - - -
-
-
-
-
-
- -
- - - - - - - - - - - -
- -
- -
-
\ No newline at end of file From 286fd044987f2b32e2e3f42bf073dd48e26b0520 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Wed, 11 Mar 2015 13:37:07 -0400 Subject: [PATCH 2/7] changing name of inv manage partial --- awx/ui/static/partials/inventory-manage.html | 159 +++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 awx/ui/static/partials/inventory-manage.html diff --git a/awx/ui/static/partials/inventory-manage.html b/awx/ui/static/partials/inventory-manage.html new file mode 100644 index 0000000000..3116445ec1 --- /dev/null +++ b/awx/ui/static/partials/inventory-manage.html @@ -0,0 +1,159 @@ +
+
+ + + +
+
+
+
+
+
+ +
+ + + + + + + + + + + +
+ +
+ +
+
\ No newline at end of file From 8e91c3659325581e464a3b2a70324d7205212f45 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Wed, 11 Mar 2015 18:14:50 -0400 Subject: [PATCH 3/7] Inventory edit properties Adding the methods for filling the form with data from the API, resetting the form, saving variables, and for saving the form to the API. Also ensured activity stream worked. --- awx/ui/static/js/controllers/Inventories.js | 203 +++++++++++++------- 1 file changed, 129 insertions(+), 74 deletions(-) diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index 8263ad04a4..a34ac0ee8d 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -478,110 +478,164 @@ InventoriesAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log export function InventoriesEdit($scope, $rootScope, $compile, $location, $log, $routeParams, InventoryForm, GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, GenerateList, OrganizationList, SearchInit, PaginateInit, - LookUpInit, GetBasePath, ParseTypeChange, Wait, ToJSON) { + LookUpInit, GetBasePath, ParseTypeChange, Wait, ToJSON, ParseVariableString, Stream) { ClearScope(); // Inject dynamic view var defaultUrl = GetBasePath('inventory'), form = InventoryForm, - generator = GenerateForm; + generator = GenerateForm, + inventory_id = $routeParams.inventory_id, + master = {}, + fld, json_data, data; form.well = true; form.formLabelSize = null; form.formFieldSize = null; - generator.inject(form, { mode: 'add', related: false, scope: $scope }); + generator.inject(form, { mode: 'edit', related: false, scope: $scope }); generator.reset(); LoadBreadCrumbs(); - $scope.parseType = 'yaml'; - ParseTypeChange({ - scope: $scope, - variable: 'variables', - parse_variable: 'parseType', - field_id: 'inventory_variables' - }); + // $scope.parseType = 'yaml'; + // ParseTypeChange({ + // scope: $scope, + // variable: 'variables', + // parse_variable: 'parseType', + // field_id: 'inventory_variables' + // }); - LookUpInit({ - scope: $scope, - form: form, - current_item: ($routeParams.organization_id) ? $routeParams.organization_id : null, - list: OrganizationList, - field: 'organization', - input_type: 'radio' - }); - - // Save - $scope.formSave = function () { - generator.clearApiErrors(); - Wait('start'); - try { - var fld, json_data, data; - - json_data = ToJSON($scope.parseType, $scope.variables, true); - - data = {}; + // LookUpInit({ + // scope: $scope, + // form: form, + // current_item: ($routeParams.organization_id) ? $routeParams.organization_id : null, + // list: OrganizationList, + // field: 'organization', + // input_type: 'radio' + // }); + Wait('start'); + Rest.setUrl(GetBasePath('inventory') + inventory_id + '/'); + Rest.get() + .success(function (data) { + var fld; for (fld in form.fields) { - if (fld !== 'variables') { - if (form.fields[fld].realName) { - data[form.fields[fld].realName] = $scope[fld]; - } else { - data[fld] = $scope[fld]; - } + if (fld === 'variables') { + $scope.variables = ParseVariableString(data.variables); + master.variables = $scope.variables; + } else if (fld === 'inventory_name') { + $scope[fld] = data.name; + master[fld] = $scope[fld]; + } else if (fld === 'inventory_description') { + $scope[fld] = data.description; + master[fld] = $scope[fld]; + } else if (data[fld]) { + $scope[fld] = data[fld]; + master[fld] = $scope[fld]; + } + if (form.fields[fld].sourceModel && data.summary_fields && + data.summary_fields[form.fields[fld].sourceModel]) { + $scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] = + data.summary_fields[form.fields[fld].sourceModel][form.fields[fld].sourceField]; + master[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] = + data.summary_fields[form.fields[fld].sourceModel][form.fields[fld].sourceField]; } } - - if ($scope.removeUpdateInventoryVariables) { - $scope.removeUpdateInventoryVariables(); - } - $scope.removeUpdateInventoryVariables = $scope.$on('UpdateInventoryVariables', function(e, data) { - var inventory_id = data.id; - Rest.setUrl(data.related.variable_data); - Rest.put(json_data) - .success(function () { - Wait('stop'); - $location.path('/inventories/' + inventory_id + '/'); - }) - .error(function (data, status) { - ProcessErrors( $scope, data, status, null, { hdr: 'Error!', - msg: 'Failed to update inventory varaibles. PUT returned status: ' + status - }); - }); - }); - - Rest.setUrl(defaultUrl); - Rest.post(data) - .success(function (data) { - var inventory_id = data.id; - if ($scope.variables) { - $scope.$emit('UpdateInventoryVariables', data); - } else { - Wait('stop'); - $location.path('/inventories/' + inventory_id + '/'); - } - }) - .error(function (data, status) { - ProcessErrors( $scope, data, status, form, { hdr: 'Error!', - msg: 'Failed to add new inventory. Post returned status: ' + status }); - }); - } catch (err) { Wait('stop'); - Alert("Error", "Error parsing inventory variables. Parser returned: " + err); - } + $scope.parseType = 'yaml'; + ParseTypeChange({ + scope: $scope, + variable: 'variables', + parse_variable: 'parseType', + field_id: 'inventory_variables' + }); + LookUpInit({ + scope: $scope, + form: form, + current_item: $scope.organization, + list: OrganizationList, + field: 'organization', + input_type: 'radio' + }); + }) + .error(function (data, status) { + ProcessErrors($scope, data, status, null, { hdr: 'Error!', + msg: 'Failed to get inventory: ' + inventory_id + '. GET returned: ' + status }); + }); + // Save + $scope.formSave = function () { + Wait('start'); + // Make sure we have valid variable data + json_data = ToJSON($scope.parseType, $scope.variables); + + data = {}; + for (fld in form.fields) { + if (fld !== 'variables') { + if (form.fields[fld].realName) { + data[form.fields[fld].realName] = $scope[fld]; + } else { + data[fld] = $scope[fld]; + } + } + } + + if ($scope.removeUpdateInventoryVariables) { + $scope.removeUpdateInventoryVariables(); + } + $scope.removeUpdateInventoryVariables = $scope.$on('UpdateInventoryVariables', function(e, data) { + Rest.setUrl(data.related.variable_data); + Rest.put(json_data) + .success(function () { + Wait('stop'); + $location.path('/inventories/'); + }) + .error(function (data, status) { + ProcessErrors($scope, data, status, form, { hdr: 'Error!', + msg: 'Failed to update inventory varaibles. PUT returned status: ' + status + }); + }); + }); + + Rest.setUrl(defaultUrl + inventory_id + '/'); + Rest.put(data) + .success(function (data) { + if ($scope.variables) { + $scope.$emit('UpdateInventoryVariables', data); + } else { + $location.path('/inventories/'); + } + }) + .error(function (data, status) { + ProcessErrors($scope, data, status, form, { hdr: 'Error!', + msg: 'Failed to update inventory. PUT returned status: ' + status }); + }); + }; + + $scope.showActivity = function () { + Stream({ scope: $scope }); }; // Reset $scope.formReset = function () { generator.reset(); + for (var fld in master) { + $scope[fld] = master[fld]; + } + $scope.parseType = 'yaml'; + ParseTypeChange({ + scope: $scope, + variable: 'variables', + parse_variable: 'parseType', + field_id: 'inventory_variables' + }); }; } InventoriesEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'InventoryForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'GenerateList', 'OrganizationList', 'SearchInit', - 'PaginateInit', 'LookUpInit', 'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON' + 'PaginateInit', 'LookUpInit', 'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON', 'ParseVariableString', 'Stream' ]; @@ -970,7 +1024,8 @@ export function InventoriesManage ($log, $scope, $location, $routeParams, $compi }; $scope.editInventoryProperties = function () { - EditInventoryProperties({ scope: $scope, inventory_id: $scope.inventory.id }); + // EditInventoryProperties({ scope: $scope, inventory_id: $scope.inventory.id }); + $location.path('/inventories/' + $scope.inventory.id + '/'); }; hostScope.createHost = function () { From c2b5d2733393a42cc103a1207686478c4f79f317 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Thu, 12 Mar 2015 10:41:43 -0400 Subject: [PATCH 4/7] Inventory manage row height and icon col width adjusted the heights of the rows for the groups/hosts on the manage view, and made the column width greater for icons on the page too --- awx/ui/static/js/helpers/inventory.js | 8 ++++---- awx/ui/static/js/lists/InventoryGroups.js | 6 +++--- awx/ui/static/js/lists/InventoryHosts.js | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/awx/ui/static/js/helpers/inventory.js b/awx/ui/static/js/helpers/inventory.js index f6c44525fc..4626334d83 100644 --- a/awx/ui/static/js/helpers/inventory.js +++ b/awx/ui/static/js/helpers/inventory.js @@ -44,8 +44,8 @@ export default return function() { var height, rows; height = $('#hosts-container .list-well').height() - $('#hosts-constainer .list-well .row').height() - $('#hosts_table thead').height(); - rows = Math.floor(height / 30) - 2; - rows = (rows < 20) ? 20 : rows; + rows = Math.floor(height / 44) - 2; + // rows = (rows < 20) ? 20 : rows; return rows; }; }]) @@ -54,8 +54,8 @@ export default return function() { var height, rows; height = $('#groups-container .list-table-container').height(); - rows = Math.floor(height / 31) - 2; - rows = (rows < 20) ? 20 : rows; + rows = Math.floor(height / 44) - 2; + // rows = (rows < 20) ? 20 : rows; return rows; }; }]) diff --git a/awx/ui/static/js/lists/InventoryGroups.js b/awx/ui/static/js/lists/InventoryGroups.js index 2e3483d6fa..ef88713e4d 100644 --- a/awx/ui/static/js/lists/InventoryGroups.js +++ b/awx/ui/static/js/lists/InventoryGroups.js @@ -23,7 +23,7 @@ export default key: true, ngClick: "groupSelect(group.id)", columnClick: "groupSelect(group.id)", - columnClass: 'col-lg-8 col-md-8 col-sm-8 col-xs-6' + columnClass: 'col-lg-6 col-md-6 col-sm-6 col-xs-6' }, source: { label: 'Source', @@ -109,7 +109,7 @@ export default fieldActions: { - columnClass: 'col-lg-4 col-md-4 col-sm-4 col-xs-6 text-right', + columnClass: 'col-lg-6 col-md-6 col-sm-6 col-xs-6 text-right', label: false, sync_status: { @@ -169,4 +169,4 @@ export default dataPlacement: "top" } } - }); \ 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..0d6d8a882d 100644 --- a/awx/ui/static/js/lists/InventoryHosts.js +++ b/awx/ui/static/js/lists/InventoryHosts.js @@ -28,7 +28,7 @@ export default key: true, label: 'Hosts', ngClick: "editHost(host.id)", - columnClass: 'col-lg-8 col-md-9 col-sm-9 col-xs-7', + columnClass: 'col-lg-6 col-md-9 col-sm-9 col-xs-7', dataHostId: "{{ host.id }}", dataType: "host" }, @@ -50,7 +50,7 @@ export default fieldActions: { - columnClass: 'col-lg-4 col-md-3 col-sm-3 col-xs-5 text-right', + columnClass: 'col-lg-6 col-md-3 col-sm-3 col-xs-5 text-right', label: false, enabled_flag: { @@ -111,4 +111,4 @@ export default } } - }); \ No newline at end of file + }); From 9ed89f96222c85bbd4d7f49c9430019bf2345bfd Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Thu, 12 Mar 2015 11:41:36 -0400 Subject: [PATCH 5/7] fixing breadcrumbs for new inventory page/manage fixing breadcrumbs to reflect the level of nesting of hte manage page. --- awx/ui/static/js/controllers/Inventories.js | 10 +++++----- awx/ui/static/partials/inventory-manage.html | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index a34ac0ee8d..acdf7c5de1 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -722,11 +722,11 @@ export function InventoriesManage ($log, $scope, $location, $routeParams, $compi $scope.removeInventoryLoaded = $scope.$on('InventoryLoaded', function() { var e, rows; - LoadBreadCrumbs({ - path: $location.path(), - title: '{{ inventory.name }}' - }); - $scope.group_breadcrumbs[0].name = $scope.inventory.name; + LoadBreadCrumbs(); + // path: $location.path(), + // title: 'All Groups'//'{{ inventory.name }}' + // }); + $scope.group_breadcrumbs[0].name = "All Groups"; // $scope.inventory.name; // Build page breadcrumbs e = angular.element(document.getElementById('breadcrumbs')); diff --git a/awx/ui/static/partials/inventory-manage.html b/awx/ui/static/partials/inventory-manage.html index 3116445ec1..54840e4562 100644 --- a/awx/ui/static/partials/inventory-manage.html +++ b/awx/ui/static/partials/inventory-manage.html @@ -3,7 +3,7 @@ @@ -156,4 +156,4 @@
- \ No newline at end of file + From 698f2e7b8ff5aaba08160b418f5ad98f09045641 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Thu, 12 Mar 2015 12:16:47 -0400 Subject: [PATCH 6/7] Added icon on inventories view for manage inventory With the Manage Inventory page being essentially nested below the Edit Inventory page, I have added a new icon and a new button for getting to these pages. --- awx/ui/static/js/controllers/Inventories.js | 8 ++++++++ awx/ui/static/js/forms/Inventories.js | 9 +++++++++ awx/ui/static/js/lists/Inventories.js | 20 +++++++++++++------- awx/ui/static/js/lists/InventoryGroups.js | 10 +++++----- awx/ui/static/js/shared/generator-helpers.js | 3 +++ 5 files changed, 38 insertions(+), 12 deletions(-) diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index acdf7c5de1..1911fbdb0d 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -318,6 +318,10 @@ export function InventoriesList($scope, $rootScope, $location, $log, $routeParam $location.path($location.path() + '/' + id); }; + $scope.manageInventory = function(id){ + $location.path($location.path() + '/' + id + '/manage'); + } + $scope.deleteInventory = function (id, name) { var action = function () { @@ -613,6 +617,10 @@ export function InventoriesEdit($scope, $rootScope, $compile, $location, $log, $ }); }; + $scope.manageInventory = function(){ + $location.path($location.path() + '/manage'); + } + $scope.showActivity = function () { Stream({ scope: $scope }); }; diff --git a/awx/ui/static/js/forms/Inventories.js b/awx/ui/static/js/forms/Inventories.js index b5a9fca1f3..b6c598b819 100644 --- a/awx/ui/static/js/forms/Inventories.js +++ b/awx/ui/static/js/forms/Inventories.js @@ -22,6 +22,15 @@ export default well: true, actions: { + manage: { + 'class': "btn-primary btn-xs activity-btn", + ngClick: "manageInventory()", + awToolTip: "Manage Inventory", + dataPlacement: "top", + icon: "icon-sitemap", + mode: 'edit', + iconSize: 'large' + }, stream: { 'class': "btn-primary btn-xs activity-btn", ngClick: "showActivity()", diff --git a/awx/ui/static/js/lists/Inventories.js b/awx/ui/static/js/lists/Inventories.js index 99b3d1d123..012d0bc701 100644 --- a/awx/ui/static/js/lists/Inventories.js +++ b/awx/ui/static/js/lists/Inventories.js @@ -49,7 +49,7 @@ export default label: 'Name', columnClass: 'col-md-4 col-sm-6 col-xs-6', modalColumnClass: 'col-md-8', - linkTo: '/#/inventories/{{inventory.id}}/manage' + linkTo: '/#/inventories/{{inventory.id}}' }, organization: { label: 'Organization', @@ -97,12 +97,18 @@ export default }, fieldActions: { - failed_hosts: { - //label: 'Failures', - ngHref: "{{ inventory.failed_hosts_link }}", - iconClass: "{{ 'fa icon-failures-' + inventory.failed_hosts_class }}", - awToolTip: "{{ inventory.failed_hosts_tip }}", - dataPlacement: "top" + // failed_hosts: { + // //label: 'Failures', + // ngHref: "{{ inventory.failed_hosts_link }}", + // iconClass: "{{ 'fa icon-failures-' + inventory.failed_hosts_class }}", + // awToolTip: "{{ inventory.failed_hosts_tip }}", + // dataPlacement: "top" + // }, + manage: { + label: 'Manage', + ngClick: 'manageInventory(inventory.id)', + awToolTip: 'Manage Inventory', + dataPlacement: 'top' }, edit: { label: 'Edit', diff --git a/awx/ui/static/js/lists/InventoryGroups.js b/awx/ui/static/js/lists/InventoryGroups.js index ef88713e4d..99cea4e5c7 100644 --- a/awx/ui/static/js/lists/InventoryGroups.js +++ b/awx/ui/static/js/lists/InventoryGroups.js @@ -83,11 +83,11 @@ export default ngClick: "createGroup()", awToolTip: "Create a new group" }, - properties: { - mode: 'all', - awToolTip: "Edit inventory properties", - ngClick: 'editInventoryProperties()' - }, + // properties: { + // mode: 'all', + // awToolTip: "Edit inventory properties", + // ngClick: 'editInventoryProperties()' + // }, refresh: { mode: 'all', awToolTip: "Refresh the page", diff --git a/awx/ui/static/js/shared/generator-helpers.js b/awx/ui/static/js/shared/generator-helpers.js index 085e9df298..d33c5dc6e2 100644 --- a/awx/ui/static/js/shared/generator-helpers.js +++ b/awx/ui/static/js/shared/generator-helpers.js @@ -162,6 +162,9 @@ angular.module('GeneratorHelpers', [systemStatus.name]) case 'copy': icon = "fa-copy"; break; + case 'manage': + icon = "fa-sitemap"; + break; } icon += (size) ? " " + size : ""; return Icon(icon); From 5e22c86c452ece64ea52a6d2f5b16c8e3e37c3cc Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Thu, 12 Mar 2015 14:32:41 -0400 Subject: [PATCH 7/7] link to manage page from inv list --- awx/ui/static/js/controllers/Inventories.js | 10 +++++----- awx/ui/static/js/forms/Inventories.js | 9 --------- awx/ui/static/js/lists/Inventories.js | 15 +-------------- awx/ui/static/js/lists/InventoryGroups.js | 10 +++++----- awx/ui/static/js/shared/generator-helpers.js | 5 +---- awx/ui/static/partials/inventory-manage.html | 2 +- 6 files changed, 13 insertions(+), 38 deletions(-) diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index 1911fbdb0d..2e45d00c5c 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -730,11 +730,11 @@ export function InventoriesManage ($log, $scope, $location, $routeParams, $compi $scope.removeInventoryLoaded = $scope.$on('InventoryLoaded', function() { var e, rows; - LoadBreadCrumbs(); - // path: $location.path(), - // title: 'All Groups'//'{{ inventory.name }}' - // }); - $scope.group_breadcrumbs[0].name = "All Groups"; // $scope.inventory.name; + LoadBreadCrumbs({ + path: $location.path(), + title: '{{ inventory.name }}' + }); + $scope.group_breadcrumbs[0].name = $scope.inventory.name; // Build page breadcrumbs e = angular.element(document.getElementById('breadcrumbs')); diff --git a/awx/ui/static/js/forms/Inventories.js b/awx/ui/static/js/forms/Inventories.js index b6c598b819..b5a9fca1f3 100644 --- a/awx/ui/static/js/forms/Inventories.js +++ b/awx/ui/static/js/forms/Inventories.js @@ -22,15 +22,6 @@ export default well: true, actions: { - manage: { - 'class': "btn-primary btn-xs activity-btn", - ngClick: "manageInventory()", - awToolTip: "Manage Inventory", - dataPlacement: "top", - icon: "icon-sitemap", - mode: 'edit', - iconSize: 'large' - }, stream: { 'class': "btn-primary btn-xs activity-btn", ngClick: "showActivity()", diff --git a/awx/ui/static/js/lists/Inventories.js b/awx/ui/static/js/lists/Inventories.js index 012d0bc701..6fc95a4b50 100644 --- a/awx/ui/static/js/lists/Inventories.js +++ b/awx/ui/static/js/lists/Inventories.js @@ -49,7 +49,7 @@ export default label: 'Name', columnClass: 'col-md-4 col-sm-6 col-xs-6', modalColumnClass: 'col-md-8', - linkTo: '/#/inventories/{{inventory.id}}' + linkTo: '/#/inventories/{{inventory.id}}/manage' }, organization: { label: 'Organization', @@ -97,19 +97,6 @@ export default }, fieldActions: { - // failed_hosts: { - // //label: 'Failures', - // ngHref: "{{ inventory.failed_hosts_link }}", - // iconClass: "{{ 'fa icon-failures-' + inventory.failed_hosts_class }}", - // awToolTip: "{{ inventory.failed_hosts_tip }}", - // dataPlacement: "top" - // }, - manage: { - label: 'Manage', - ngClick: 'manageInventory(inventory.id)', - awToolTip: 'Manage Inventory', - dataPlacement: 'top' - }, edit: { label: 'Edit', ngClick: 'editInventory(inventory.id)', //'editInventoryProperties(inventory.id)', diff --git a/awx/ui/static/js/lists/InventoryGroups.js b/awx/ui/static/js/lists/InventoryGroups.js index 99cea4e5c7..ef88713e4d 100644 --- a/awx/ui/static/js/lists/InventoryGroups.js +++ b/awx/ui/static/js/lists/InventoryGroups.js @@ -83,11 +83,11 @@ export default ngClick: "createGroup()", awToolTip: "Create a new group" }, - // properties: { - // mode: 'all', - // awToolTip: "Edit inventory properties", - // ngClick: 'editInventoryProperties()' - // }, + properties: { + mode: 'all', + awToolTip: "Edit inventory properties", + ngClick: 'editInventoryProperties()' + }, refresh: { mode: 'all', awToolTip: "Refresh the page", diff --git a/awx/ui/static/js/shared/generator-helpers.js b/awx/ui/static/js/shared/generator-helpers.js index d33c5dc6e2..9ed657e46f 100644 --- a/awx/ui/static/js/shared/generator-helpers.js +++ b/awx/ui/static/js/shared/generator-helpers.js @@ -136,7 +136,7 @@ angular.module('GeneratorHelpers', [systemStatus.name]) icon = 'fa-check-square-o'; break; case 'properties': - icon = "fa-wrench"; + icon = "fa-pencil"; break; case 'reset': icon = "fa-undo"; @@ -162,9 +162,6 @@ angular.module('GeneratorHelpers', [systemStatus.name]) case 'copy': icon = "fa-copy"; break; - case 'manage': - icon = "fa-sitemap"; - break; } icon += (size) ? " " + size : ""; return Icon(icon); diff --git a/awx/ui/static/partials/inventory-manage.html b/awx/ui/static/partials/inventory-manage.html index 54840e4562..0ec23f3107 100644 --- a/awx/ui/static/partials/inventory-manage.html +++ b/awx/ui/static/partials/inventory-manage.html @@ -3,7 +3,7 @@