zettapi_client
Version:
Admin panel and client-side CRUD operations in angular to use with zettapi_server rest api to get started quickly in any CMS project.
32 lines (25 loc) • 874 B
JavaScript
//manage tasks Controller
app.controller('taskCtrl', function ($scope, $rootScope, $date, $task, mySocket, blockUI, zapi) {
$scope.useInputLarge = zapi.useInputLarge;
$scope.taskTypes = [];
$scope.formatDatetime = $date.formatDatetime;
$scope.calculateTimespan = $date.calculateTimespan;
$scope.toggleState = $task.toggleState;
$scope.run = function (task) {
$task.run(task).then(function (response) {
blockUI.start('A executar...');
}).catch(function (response) {
swal('Ocorreu um erro ao iniciar a tarefa manualmente.', response.data, 'error');
});
};
initialize();
function initialize() {
mySocket.on($rootScope.login._id, function (data) {
swal('Tarefa executada com sucesso.', null, 'success');
blockUI.stop();
});
$task.getTypes(function (types) {
$scope.taskTypes = types;
});
}
});