Fixed adhoc command flow

This commit is contained in:
Michael Abashian
2016-12-22 14:00:13 -05:00
parent 193d924c20
commit c14612cd5d
3 changed files with 57 additions and 3 deletions

View File

@@ -25,7 +25,7 @@ angular.module('inventory', [
// This means inventoryManage states will not be registered correctly on page refresh, unless they're registered at the same time as the inventories state tree
let stateTree, inventories,
addGroup, editGroup, addHost, editHost,
listSchedules, addSchedule, editSchedule,
listSchedules, addSchedule, editSchedule, adhocCredentialLookup,
stateDefinitions = stateDefinitionsProvider.$get(),
stateExtender = $stateExtenderProvider.$get();
@@ -195,6 +195,60 @@ angular.module('inventory', [
},
});
adhocCredentialLookup = {
searchPrefix: 'credential',
name: 'inventoryManage.adhoc.credential',
url: '/credential',
data: {
formChildState: true
},
params: {
credential_search: {
value: {
page_size: '5'
},
squash: true,
dynamic: true
}
},
ncyBreadcrumb: {
skip: true
},
views: {
'related': {
templateProvider: function(ListDefinition, generateList) {
let list_html = generateList.build({
mode: 'lookup',
list: ListDefinition,
input_type: 'radio'
});
return `<lookup-modal>${list_html}</lookup-modal>`;
}
}
},
resolve: {
ListDefinition: ['CredentialList', function(CredentialList) {
let list = _.cloneDeep(CredentialList);
list.lookupConfirmText = 'SELECT';
return list;
}],
Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath',
(list, qs, $stateParams, GetBasePath) => {
let path = GetBasePath(list.name) || GetBasePath(list.basePath);
return qs.search(path, $stateParams[`${list.iterator}_search`]);
}
]
},
onExit: function($state) {
if ($state.transition) {
$('#form-modal').modal('hide');
$('.modal-backdrop').remove();
$('body').removeClass('modal-open');
}
},
};
return Promise.all([
inventories,
addGroup,
@@ -210,6 +264,7 @@ angular.module('inventory', [
stateExtender.buildDefinition(copyMoveGroupRoute),
stateExtender.buildDefinition(copyMoveHostRoute),
stateExtender.buildDefinition(adHocRoute),
stateExtender.buildDefinition(adhocCredentialLookup)
])
};

View File

@@ -64,7 +64,6 @@ export default function() {
basePath: 'credentials',
sourceModel: 'credential',
sourceField: 'name',
ngClick: 'lookUpCredential()',
class: 'squeeze',
awPopOver: '<p>Select the credential you want to use when ' +
'accessing the remote hosts to run the command. ' +

View File

@@ -30,7 +30,7 @@ export default
item: '=item'
},
require: '^multiSelectList',
template: '<input type="checkbox" data-multi-select-list-item ng-model="item.isSelected" ng-change="userInteractionSelect()">',
template: '<input type="checkbox" data-multi-select-list-item ng-model="isSelected" ng-change="userInteractionSelect()">',
link: function(scope, element, attrs, multiSelectList) {
scope.decoratedItem = multiSelectList.registerItem(scope.item);