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 {
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'
},

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() {
$state.go('inventories');
};

View File

@ -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'
}
}
};

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() {
$state.go('inventories');
};

View File

@ -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'
}
}

View File

@ -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'),