From 2566a5f14fd95f21a19f8c88cb5ae50031554aeb Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Tue, 19 Jun 2018 14:43:22 -0700 Subject: [PATCH] Adds a button to the inventory form that links the user directly to hte Network UI --- .../src/inventories-hosts/inventories/inventory.list.js | 6 +++--- .../edit/smart-inventory-edit.controller.js | 4 ++++ .../inventories/smart-inventory/smart-inventory.form.js | 9 ++++++++- .../standard-inventory/edit/inventory-edit.controller.js | 4 ++++ .../inventories/standard-inventory/inventory.form.js | 9 +++++++-- awx/ui/client/src/network-ui/network.ui.strings.js | 8 ++++++-- 6 files changed, 32 insertions(+), 8 deletions(-) diff --git a/awx/ui/client/src/inventories-hosts/inventories/inventory.list.js b/awx/ui/client/src/inventories-hosts/inventories/inventory.list.js index 4e8a0efc61..8d6b8b7219 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/inventory.list.js +++ b/awx/ui/client/src/inventories-hosts/inventories/inventory.list.js @@ -5,7 +5,7 @@ *************************************************/ -export default ['i18n', function(i18n) { +export default ['i18n', 'awxNetStrings' , function(i18n, awxNetStrings) { return { name: 'inventories', @@ -102,9 +102,9 @@ export default ['i18n', function(i18n) { ngShow: '!inventory.pending_deletion && inventory.summary_fields.user_capabilities.edit' }, network: { - label: i18n._('Network Visualization'), + label: awxNetStrings.get('feature.ACTION_BUTTON'), ngClick: 'goToGraph(inventory)', - awToolTip: i18n._('Network Visualization'), + awToolTip: awxNetStrings.get('feature.ACTION_BUTTON'), dataPlacement: 'top', ngShow: '!inventory.pending_deletion' }, diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js index 7af348d0d1..be09299704 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js @@ -95,6 +95,10 @@ function SmartInventoryEdit($scope, $location, }); }; + $scope.goToGraph = function(){ + $state.go('inventories.editSmartInventory.networking', {smartinventory_id: $scope.inventory_obj.id, inventory_name: $scope.inventory_obj.name}); + }; + $scope.formCancel = function() { $state.go('inventories'); }; diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory.form.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory.form.js index 01a49b008b..62a58e4023 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory.form.js +++ b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/smart-inventory.form.js @@ -4,7 +4,7 @@ * All Rights Reserved *************************************************/ -export default ['i18n', function(i18n) { +export default ['i18n', 'awxNetStrings', function(i18n, awxNetStrings) { return { addTitle: i18n._('NEW SMART INVENTORY'), @@ -156,6 +156,13 @@ export default ['i18n', function(i18n) { skipGenerator: true, ngClick: "$state.go('inventories.editSmartInventory.completed_jobs')" } + }, + relatedButtons: { + network: { + ngClick: 'goToGraph()', + label: awxNetStrings.get('feature.ACTION_BUTTON'), + class: 'Form-primaryButton' + } } }; diff --git a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js index 8f96ae9f6f..65579c96b9 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js @@ -99,6 +99,10 @@ function InventoriesEdit($scope, $location, }); }; + $scope.goToGraph = function(){ + $state.go('inventories.edit.networking', {inventory_id: $scope.inventory_obj.id, inventory_name: $scope.inventory_obj.name}); + }; + $scope.formCancel = function() { $state.go('inventories'); }; diff --git a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js index 1c9f1dd13d..ea3d67d025 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js +++ b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/inventory.form.js @@ -10,8 +10,8 @@ * @description This form is for adding/editing an inventory */ -export default ['i18n', -function(i18n) { +export default ['i18n', 'awxNetStrings', +function(i18n, awxNetStrings) { return { addTitle: i18n._('NEW INVENTORY'), @@ -179,6 +179,11 @@ function(i18n) { ngShow: 'is_insights && mode !== "add" && canRemediate', label: i18n._('Remediate Inventory'), class: 'Form-primaryButton' + }, + network: { + ngClick: 'goToGraph()', + label: awxNetStrings.get('feature.ACTION_BUTTON'), + class: 'Form-primaryButton' } } diff --git a/awx/ui/client/src/network-ui/network.ui.strings.js b/awx/ui/client/src/network-ui/network.ui.strings.js index 3a847334a1..cc11a44153 100644 --- a/awx/ui/client/src/network-ui/network.ui.strings.js +++ b/awx/ui/client/src/network-ui/network.ui.strings.js @@ -4,6 +4,10 @@ function awxNetStrings (BaseString) { const { t } = this; const ns = this.awxNet; + ns.feature = { + ACTION_BUTTON: t.s('Network Visualizer') + }; + ns.state = { BREADCRUMB_LABEL: t.s('INVENTORIES') }; @@ -13,7 +17,7 @@ function awxNetStrings (BaseString) { }; ns.actions = { - ACTIONS: t.s('Actions'), + ACTIONS: t.s('ACTIONS'), EXPORT: t.s('Export'), EXPAND_PANEL: t.s('Expand Panel'), COLLAPSE_PANEL: t.s('Collapse Panel') @@ -29,7 +33,7 @@ function awxNetStrings (BaseString) { }; ns.search = { - SEARCH: t.s('Search'), + SEARCH: t.s('SEARCH'), HOST: t.s('Host'), SWITCH: t.s('Switch'), ROUTER: t.s('Router'),