Adds a button to the inventory form that links the user directly to hte

Network UI
This commit is contained in:
Jared Tabor
2018-06-19 14:43:22 -07:00
parent c02c92890c
commit 2566a5f14f
6 changed files with 32 additions and 8 deletions

View File

@@ -5,7 +5,7 @@
*************************************************/ *************************************************/
export default ['i18n', function(i18n) { export default ['i18n', 'awxNetStrings' , function(i18n, awxNetStrings) {
return { return {
name: 'inventories', name: 'inventories',
@@ -102,9 +102,9 @@ export default ['i18n', function(i18n) {
ngShow: '!inventory.pending_deletion && inventory.summary_fields.user_capabilities.edit' ngShow: '!inventory.pending_deletion && inventory.summary_fields.user_capabilities.edit'
}, },
network: { network: {
label: i18n._('Network Visualization'), label: awxNetStrings.get('feature.ACTION_BUTTON'),
ngClick: 'goToGraph(inventory)', ngClick: 'goToGraph(inventory)',
awToolTip: i18n._('Network Visualization'), awToolTip: awxNetStrings.get('feature.ACTION_BUTTON'),
dataPlacement: 'top', dataPlacement: 'top',
ngShow: '!inventory.pending_deletion' ngShow: '!inventory.pending_deletion'
}, },

View File

@@ -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() { $scope.formCancel = function() {
$state.go('inventories'); $state.go('inventories');
}; };

View File

@@ -4,7 +4,7 @@
* All Rights Reserved * All Rights Reserved
*************************************************/ *************************************************/
export default ['i18n', function(i18n) { export default ['i18n', 'awxNetStrings', function(i18n, awxNetStrings) {
return { return {
addTitle: i18n._('NEW SMART INVENTORY'), addTitle: i18n._('NEW SMART INVENTORY'),
@@ -156,6 +156,13 @@ export default ['i18n', function(i18n) {
skipGenerator: true, skipGenerator: true,
ngClick: "$state.go('inventories.editSmartInventory.completed_jobs')" ngClick: "$state.go('inventories.editSmartInventory.completed_jobs')"
} }
},
relatedButtons: {
network: {
ngClick: 'goToGraph()',
label: awxNetStrings.get('feature.ACTION_BUTTON'),
class: 'Form-primaryButton'
}
} }
}; };

View File

@@ -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() { $scope.formCancel = function() {
$state.go('inventories'); $state.go('inventories');
}; };

View File

@@ -10,8 +10,8 @@
* @description This form is for adding/editing an inventory * @description This form is for adding/editing an inventory
*/ */
export default ['i18n', export default ['i18n', 'awxNetStrings',
function(i18n) { function(i18n, awxNetStrings) {
return { return {
addTitle: i18n._('NEW INVENTORY'), addTitle: i18n._('NEW INVENTORY'),
@@ -179,6 +179,11 @@ function(i18n) {
ngShow: 'is_insights && mode !== "add" && canRemediate', ngShow: 'is_insights && mode !== "add" && canRemediate',
label: i18n._('Remediate Inventory'), label: i18n._('Remediate Inventory'),
class: 'Form-primaryButton' class: 'Form-primaryButton'
},
network: {
ngClick: 'goToGraph()',
label: awxNetStrings.get('feature.ACTION_BUTTON'),
class: 'Form-primaryButton'
} }
} }

View File

@@ -4,6 +4,10 @@ function awxNetStrings (BaseString) {
const { t } = this; const { t } = this;
const ns = this.awxNet; const ns = this.awxNet;
ns.feature = {
ACTION_BUTTON: t.s('Network Visualizer')
};
ns.state = { ns.state = {
BREADCRUMB_LABEL: t.s('INVENTORIES') BREADCRUMB_LABEL: t.s('INVENTORIES')
}; };
@@ -13,7 +17,7 @@ function awxNetStrings (BaseString) {
}; };
ns.actions = { ns.actions = {
ACTIONS: t.s('Actions'), ACTIONS: t.s('ACTIONS'),
EXPORT: t.s('Export'), EXPORT: t.s('Export'),
EXPAND_PANEL: t.s('Expand Panel'), EXPAND_PANEL: t.s('Expand Panel'),
COLLAPSE_PANEL: t.s('Collapse Panel') COLLAPSE_PANEL: t.s('Collapse Panel')
@@ -29,7 +33,7 @@ function awxNetStrings (BaseString) {
}; };
ns.search = { ns.search = {
SEARCH: t.s('Search'), SEARCH: t.s('SEARCH'),
HOST: t.s('Host'), HOST: t.s('Host'),
SWITCH: t.s('Switch'), SWITCH: t.s('Switch'),
ROUTER: t.s('Router'), ROUTER: t.s('Router'),