1
0
Fork 0
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:
Mumshad Mannambeth 2017-06-07 13:36:44 -04:00
commit c92f737237
273 changed files with 16964 additions and 0 deletions

View 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;

View file

@ -0,0 +1,17 @@
'use strict';
describe('Controller: NewFileCtrl', function() {
// load the controller's module
beforeEach(module('webAppApp.new_file'));
var NewFileCtrl;
// Initialize the controller and a mock scope
beforeEach(inject(function($controller) {
NewFileCtrl = $controller('NewFileCtrl', {});
}));
it('should ...', function() {
expect(1).to.equal(1);
});
});

View file

@ -0,0 +1,19 @@
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">{{title}}</h4>
</div>
<div class="modal-body">
<p class="form-group">
<label>File Name</label>
<input type="text" ng-model="newFile.name" class="form-control">
</p>
</div>
<div class="alert alert-danger" ng-if="err_msg">{{err_msg}}</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-disabled="!newFile.name" ng-click="createFile()">Create <span ng-if="createFileLoading" class="fa fa-spinner fa-spin"></span></button>
<button class="btn btn-default" type="button" ng-click="cancel()">Close</button>
</div>
</div>