+
+
+ Ansible Version:{{selectedProject.ansibleVersion}}
+
+
+
+
+
+ An inventory file to work with
+
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/client/app/designer/tasks/new_task/new_task.controller.js b/client/app/designer/tasks/new_task/new_task.controller.js
index 153328c..413b34b 100644
--- a/client/app/designer/tasks/new_task/new_task.controller.js
+++ b/client/app/designer/tasks/new_task/new_task.controller.js
@@ -55,8 +55,9 @@ export function newTaskController($window, $scope, $sce, $uibModal, ansi2html, a
selectedTask = angular.copy(selectedTask);
$scope.newTask = selectedTask;
if(selectedTask.tags)$scope.newTask.tags = $scope.newTask.tags.join(',');
- var module = $scope.getModuleFromTask(selectedTask);
- $scope.getModuleDescription(module,true)
+ $scope.getModuleFromTask(selectedTask, module => {
+ $scope.getModuleDescription(module,true)
+ });
}
}, function(response){
@@ -180,66 +181,68 @@ export function newTaskController($window, $scope, $sce, $uibModal, ansi2html, a
* @param task - Single task object containing task properties
* @returns {{}}
*/
- $scope.getModuleFromTask = function(task){
+ $scope.getModuleFromTask = function(task, successCallback){
var moduleObject = {};
$scope.local_action = false;
var task_properties = null;
- var module = ansible.getModuleFromTask(task);
-
- if(module === 'include'){
- module = null;
- task.tags = task.include.replace(/.*tags=(.*)/,"$1")
- return;
- }else if(module === 'local_action'){
- $scope.local_action = true;
- module = task.local_action.module;
- task_properties = task.local_action;
- delete task_properties.module;
- }else{
- task_properties = task[module];
- }
-
- angular.forEach($scope.modules, function(item,index) {
- if(item.name == module){
- moduleObject = item;
- $scope.newTask.module = item;
+ ansible.getModuleFromTask(task, module => {
+ if(module === 'include'){
+ module = null;
+ task.tags = task.include.replace(/.*tags=(.*)/,"$1")
+ return;
+ }else if(module === 'local_action'){
+ $scope.local_action = true;
+ module = task.local_action.module;
+ task_properties = task.local_action;
+ delete task_properties.module;
+ }else{
+ task_properties = task[module];
}
+
+ angular.forEach($scope.modules, function(item,index) {
+ if(item.name == module){
+ moduleObject = item;
+ $scope.newTask.module = item;
+ }
+ });
+
+
+ if(!(moduleObject && moduleObject.name)){
+ $scope.err_msg = "Unable to find module " + module + " in Ansible controller";
+ return
+ }
+
+ //moduleObject.name = module;
+ moduleObject.variables = [];
+ if(typeof task_properties == "string"){
+ moduleObject.variables.push({'name':'free_form','value':task_properties});
+
+ var re = /\b(\w+)=\s*([^=]*\S)\b\s*(?=\w+=|$)/g;
+ var m;
+
+ while ((m = re.exec(task_properties)) !== null) {
+ if (m.index === re.lastIndex) {
+ re.lastIndex++;
+ }
+ // View your result using the m-variable.
+ // eg m[0] etc.
+ var k=m[1];
+ var v=m[2];
+ moduleObject.variables.push({'name':k,'value':v})
+ }
+
+ }else if(typeof task_properties == "object"){
+
+ angular.forEach(task_properties,function(value,key){
+ this.push({'name':key,'value':value,'complexValue':value})
+ },moduleObject.variables)
+
+ }
+ successCallback(moduleObject);
});
- if(!(moduleObject && moduleObject.name)){
- $scope.err_msg = "Unable to find module " + module + " in Ansible controller";
- return
- }
-
- //moduleObject.name = module;
- moduleObject.variables = [];
- if(typeof task_properties == "string"){
- moduleObject.variables.push({'name':'free_form','value':task_properties});
-
- var re = /\b(\w+)=\s*([^=]*\S)\b\s*(?=\w+=|$)/g;
- var m;
-
- while ((m = re.exec(task_properties)) !== null) {
- if (m.index === re.lastIndex) {
- re.lastIndex++;
- }
- // View your result using the m-variable.
- // eg m[0] etc.
- var k=m[1];
- var v=m[2];
- moduleObject.variables.push({'name':k,'value':v})
- }
-
- }else if(typeof task_properties == "object"){
-
- angular.forEach(task_properties,function(value,key){
- this.push({'name':key,'value':value,'complexValue':value})
- },moduleObject.variables)
-
- }
- return moduleObject
};
diff --git a/client/app/designer/tasks/tasks.directive.js b/client/app/designer/tasks/tasks.directive.js
index 0d1921e..939b009 100644
--- a/client/app/designer/tasks/tasks.directive.js
+++ b/client/app/designer/tasks/tasks.directive.js
@@ -27,14 +27,15 @@ export default angular.module('webAppApp.tasks', [])
scope.tasksMetaData = [];
angular.forEach(scope.tasksList,function(task){
- var taskModule = ansible.getModuleFromTask(task);
- var taskName = task.name;
+ ansible.getModuleFromTask(task, taskModule => {
+ var taskName = task.name;
- if(taskModule === 'include'){
- taskName = task[taskModule].replace(/(.*yml) .*/,"$1")
- }
+ if(taskModule === 'include'){
+ taskName = task[taskModule].replace(/(.*yml) .*/,"$1")
+ }
- scope.tasksMetaData.push({taskModule:taskModule,taskName:taskName,selected:false})
+ scope.tasksMetaData.push({taskModule:taskModule,taskName:taskName,selected:false})
+ });
})
},true);
diff --git a/client/app/designer/tasks/tasks.html b/client/app/designer/tasks/tasks.html
index f05d002..2c65f1c 100644
--- a/client/app/designer/tasks/tasks.html
+++ b/client/app/designer/tasks/tasks.html
@@ -13,7 +13,12 @@
|
{{tasksMetaData[$index].taskName}} |
-
{{tasksMetaData[$index].taskModule}} |
+
+ {{tasksMetaData[$index].taskModule}}
+ |
+
+ Unidentified
+ |
|