mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +03:00
WIP working base case: inventory lookup state
This commit is contained in:
parent
50f0465094
commit
ed5fb05c17
@ -50,7 +50,7 @@ export default
|
||||
sourceField: 'name',
|
||||
list: 'OrganizationList',
|
||||
basePath: 'organization',
|
||||
//ngClick: 'lookUpInventory()',
|
||||
ngClick: 'lookUpInventory()',
|
||||
requiredErrorMsg: "Please select an Inventory.",
|
||||
column: 1,
|
||||
class: 'Form-formGroup--fullWidth',
|
||||
|
@ -136,11 +136,11 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
||||
}
|
||||
},
|
||||
views: {
|
||||
'modal@templates.editWorkflowJobTemplate.workflowMaker': {
|
||||
templateProvider: function(ListDefinition, generateList) {
|
||||
'related': {
|
||||
templateProvider: function(InventoryList, generateList) {
|
||||
let list_html = generateList.build({
|
||||
mode: 'lookup',
|
||||
list: ListDefinition,
|
||||
list: InventoryList,
|
||||
input_type: 'radio'
|
||||
});
|
||||
return `<lookup-modal>${list_html}</lookup-modal>`;
|
||||
@ -149,10 +149,9 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
// ListDefinition: [InventoryList, function(list) {
|
||||
// list.iterator = field.sourceModel;
|
||||
// return list;
|
||||
// }],
|
||||
ListDefinition: ['InventoryList', function(list) {
|
||||
return list;
|
||||
}],
|
||||
Dataset: ['InventoryList', 'QuerySet', '$stateParams', 'GetBasePath',
|
||||
(list, qs, $stateParams, GetBasePath) => {
|
||||
let path = GetBasePath(list.name) || GetBasePath(list.basePath);
|
||||
@ -184,7 +183,7 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
||||
}, [
|
||||
stateExtender.buildDefinition(jobTemplatesListRoute),
|
||||
workflowMaker,
|
||||
//inventoryLookup
|
||||
inventoryLookup
|
||||
])
|
||||
};
|
||||
});
|
||||
|
@ -3,44 +3,44 @@ export default ['CreateDialog', 'Wait', '$q', function(CreateDialog, Wait, $q){
|
||||
openDialog: function(params){
|
||||
// params.scope
|
||||
|
||||
let deferred = $q.defer();
|
||||
// let deferred = $q.defer();
|
||||
|
||||
if (params.scope.removeWorkflowDialogReady) {
|
||||
params.scope.removeWorkflowDialogReady();
|
||||
}
|
||||
params.scope.removeWorkflowDialogReady = params.scope.$on('WorkflowDialogReady', function() {
|
||||
$('#workflow-modal-dialog').dialog('open');
|
||||
// if (params.scope.removeWorkflowDialogReady) {
|
||||
// params.scope.removeWorkflowDialogReady();
|
||||
// }
|
||||
// params.scope.removeWorkflowDialogReady = params.scope.$on('WorkflowDialogReady', function() {
|
||||
// $('#workflow-modal-dialog').dialog('open');
|
||||
|
||||
deferred.resolve();
|
||||
});
|
||||
Wait('start');
|
||||
debugger;
|
||||
CreateDialog({
|
||||
id: 'workflow-modal-dialog',
|
||||
scope: params.scope,
|
||||
width: 1400,
|
||||
height: 720,
|
||||
draggable: false,
|
||||
dialogClass: 'SurveyMaker-dialog',
|
||||
position: ['center',20],
|
||||
onClose: function() {
|
||||
$('#workflow-modal-dialog').empty();
|
||||
},
|
||||
onOpen: function() {
|
||||
Wait('stop');
|
||||
// deferred.resolve();
|
||||
// });
|
||||
// Wait('start');
|
||||
// debugger;
|
||||
// CreateDialog({
|
||||
// id: 'workflow-modal-dialog',
|
||||
// scope: params.scope,
|
||||
// width: 1400,
|
||||
// height: 720,
|
||||
// draggable: false,
|
||||
// dialogClass: 'SurveyMaker-dialog',
|
||||
// position: ['center',20],
|
||||
// onClose: function() {
|
||||
// $('#workflow-modal-dialog').empty();
|
||||
// },
|
||||
// onOpen: function() {
|
||||
// Wait('stop');
|
||||
|
||||
// Let the modal height be variable based on the content
|
||||
// and set a uniform padding
|
||||
$('#workflow-modal-dialog').css({'padding': '20px'});
|
||||
// // Let the modal height be variable based on the content
|
||||
// // and set a uniform padding
|
||||
// $('#workflow-modal-dialog').css({'padding': '20px'});
|
||||
|
||||
},
|
||||
_allowInteraction: function(e) {
|
||||
return !!$(e.target).is('.select2-input') || this._super(e);
|
||||
},
|
||||
callback: 'WorkflowDialogReady'
|
||||
});
|
||||
// },
|
||||
// _allowInteraction: function(e) {
|
||||
// return !!$(e.target).is('.select2-input') || this._super(e);
|
||||
// },
|
||||
// callback: 'WorkflowDialogReady'
|
||||
// });
|
||||
|
||||
return deferred.promise;
|
||||
// return deferred.promise;
|
||||
},
|
||||
closeDialog: function() {
|
||||
$('#workflow-modal-dialog').dialog('destroy');
|
||||
|
@ -5,11 +5,11 @@
|
||||
*************************************************/
|
||||
|
||||
export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateList', 'ProjectList',
|
||||
'GetBasePath', 'Wait', 'JobTemplateService',
|
||||
'GetBasePath', 'Wait', 'JobTemplateService', '$state',
|
||||
'ProcessErrors', 'InventorySourcesList', 'CreateSelect2', 'WorkflowMakerForm',
|
||||
'GenerateForm', 'InventoryList', 'CredentialList', '$q', '$timeout',
|
||||
function($scope, WorkflowHelpService, GenerateList, JobTemplateList, ProjectList,
|
||||
GetBasePath, Wait, JobTemplateService,
|
||||
GetBasePath, Wait, JobTemplateService, $state,
|
||||
ProcessErrors, InventorySourcesList, CreateSelect2, WorkflowMakerForm,
|
||||
GenerateForm, InventoryList, CredentialList, $q, $timeout) {
|
||||
|
||||
@ -64,14 +64,8 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis
|
||||
|
||||
function init() {
|
||||
$scope.treeDataMaster = angular.copy($scope.treeData.data);
|
||||
WorkflowHelpService.openDialog({
|
||||
scope: $scope
|
||||
})
|
||||
.then(function() {
|
||||
$scope.$broadcast("refreshWorkflowChart");
|
||||
|
||||
//$scope.$broadcast("refreshWorkflowChart");
|
||||
|
||||
});
|
||||
$scope.$watchCollection('workflow_job_templates', function() {
|
||||
if ($scope.selectedTemplate) {
|
||||
// Loop across the inventories and see if one of them should be "checked"
|
||||
@ -149,6 +143,12 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis
|
||||
|
||||
}
|
||||
|
||||
|
||||
$scope.lookUpInventory = function(){
|
||||
console.log($state)
|
||||
$state.go('.inventory')
|
||||
};
|
||||
|
||||
$scope.closeWorkflowMaker = function() {
|
||||
// Revert the data to the master which was created when the dialog was opened
|
||||
$scope.treeData.data = angular.copy($scope.treeDataMaster);
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
import workflowMakerController from './workflow-maker.controller';
|
||||
|
||||
export default [ 'templateUrl',
|
||||
function(templateUrl) {
|
||||
export default ['templateUrl', 'CreateDialog', 'Wait',
|
||||
function(templateUrl, CreateDialog, Wait) {
|
||||
return {
|
||||
scope: {
|
||||
treeData: '='
|
||||
@ -15,6 +15,38 @@ export default [ 'templateUrl',
|
||||
restrict: 'E',
|
||||
templateUrl: templateUrl('job-templates/workflow-maker/workflow-maker'),
|
||||
controller: workflowMakerController,
|
||||
link: function(scope) {
|
||||
CreateDialog({
|
||||
id: 'workflow-modal-dialog',
|
||||
scope: scope,
|
||||
width: 1400,
|
||||
height: 720,
|
||||
draggable: false,
|
||||
dialogClass: 'SurveyMaker-dialog',
|
||||
position: ['center', 20],
|
||||
onClose: function() {
|
||||
$('#workflow-modal-dialog').empty();
|
||||
},
|
||||
onOpen: function() {
|
||||
Wait('stop');
|
||||
|
||||
// Let the modal height be variable based on the content
|
||||
// and set a uniform padding
|
||||
$('#workflow-modal-dialog').css({ 'padding': '20px' });
|
||||
|
||||
},
|
||||
_allowInteraction: function(e) {
|
||||
return !!$(e.target).is('.select2-input') || this._super(e);
|
||||
},
|
||||
callback: 'WorkflowDialogReady'
|
||||
});
|
||||
if (scope.removeWorkflowDialogReady) {
|
||||
scope.removeWorkflowDialogReady();
|
||||
}
|
||||
scope.removeWorkflowDialogReady = scope.$on('WorkflowDialogReady', function() {
|
||||
$('#workflow-modal-dialog').dialog('open');
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user