webapp.js.controllerModalCustomFunction.js Maven / Gradle / Ivy
'use strict';
/* Controllers */
hadrianControllers.controller('ModalAddCustomFunctionCtrl', ['$scope', '$http', '$modalInstance', '$route', 'service', 'module',
function ($scope, $http, $modalInstance, $route, service, module) {
$scope.errorMsg = null;
$scope.service = service;
$scope.module = module;
$scope.formSaveCF = {};
$scope.formSaveCF.name = "";
$scope.formSaveCF.method = "GET";
$scope.formSaveCF.url = "";
$scope.formSaveCF.teamOnly = true;
$scope.save = function () {
var dataObject = {
serviceId: $scope.service.serviceId,
moduleId: $scope.module.moduleId,
name: $scope.formSaveCF.name,
method: $scope.formSaveCF.method,
url: $scope.formSaveCF.url,
teamOnly: $scope.formSaveCF.teamOnly
};
var responsePromise = $http.post("/v1/cf/create", dataObject, {});
responsePromise.success(function (dataFromServer, status, headers, config) {
$modalInstance.close();
$route.reload();
});
responsePromise.error(function (data, status, headers, config) {
$scope.errorMsg = data;
});
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
}]);
hadrianControllers.controller('ModalUpdateCustomFunctionCtrl', ['$scope', '$http', '$modalInstance', '$route', 'service', 'cf',
function ($scope, $http, $modalInstance, $route, service, cf) {
$scope.errorMsg = null;
$scope.service = service;
$scope.cf = cf;
$scope.formUpdateCF = {};
$scope.formUpdateCF.name = cf.name;
$scope.formUpdateCF.method = cf.method;
$scope.formUpdateCF.url = cf.url;
$scope.formUpdateCF.teamOnly = cf.teamOnly;
$scope.save = function () {
var dataObject = {
cfId: $scope.cf.customFunctionId,
serviceId: $scope.service.serviceId,
name: $scope.formUpdateCF.name,
method: $scope.formUpdateCF.method,
url: $scope.formUpdateCF.url,
teamOnly: $scope.formUpdateCF.teamOnly
};
var responsePromise = $http.put("/v1/cf/modify", dataObject, {});
responsePromise.success(function (dataFromServer, status, headers, config) {
$modalInstance.close();
$route.reload();
});
responsePromise.error(function (data, status, headers, config) {
$scope.errorMsg = data;
});
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
}]);
© 2015 - 2025 Weber Informatics LLC | Privacy Policy