mirror of
https://github.com/mmumshad/ansible-playable.git
synced 2025-03-09 23:38:54 +00:00
Initial Commit
This commit is contained in:
commit
c92f737237
273 changed files with 16964 additions and 0 deletions
58
client/app/designer/roles/new_file/new_file.controller.js
Normal file
58
client/app/designer/roles/new_file/new_file.controller.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
'use strict';
|
||||
const angular = require('angular');
|
||||
|
||||
/*@ngInject*/
|
||||
export function newFileController($scope,$uibModalInstance,ansible,selectedDirectory,copyFile,selectedFileName) {
|
||||
$scope.newFile = {name:null};
|
||||
$scope.createFileLoading = false;
|
||||
$scope.title = 'New File';
|
||||
|
||||
var parentDirectory = selectedDirectory;
|
||||
|
||||
// If copyFile use selectedFileName to create new role from
|
||||
// else nullify selectedFileName
|
||||
if(!copyFile){
|
||||
selectedFileName = null;
|
||||
}
|
||||
else {
|
||||
$scope.title = 'Copy File';
|
||||
$scope.newFile.name = 'Copy of ' + selectedFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create/Copy File - Either a new role or copy an existing role
|
||||
*/
|
||||
$scope.createFile = function(){
|
||||
|
||||
$scope.createFileLoading = true;
|
||||
ansible.createFile(parentDirectory + '/' + $scope.newFile.name,
|
||||
function(response){
|
||||
$scope.createFileLoading = false;
|
||||
$scope.ok();
|
||||
},
|
||||
function(response){
|
||||
$scope.createFileLoading = false;
|
||||
$scope.err_msg = response.data;
|
||||
},
|
||||
selectedFileName
|
||||
)
|
||||
};
|
||||
|
||||
/**
|
||||
* Close create/copy modal
|
||||
*/
|
||||
$scope.ok = function () {
|
||||
$uibModalInstance.close(null);
|
||||
};
|
||||
|
||||
/**
|
||||
* Cancel modal
|
||||
*/
|
||||
$scope.cancel = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
}
|
||||
|
||||
export default angular.module('webAppApp.new_file', [])
|
||||
.controller('NewFileController', newFileController)
|
||||
.name;
|
Loading…
Add table
Add a link
Reference in a new issue