webapp.js.controllerModalCustomFunction.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Hadrian Show documentation
Show all versions of Hadrian Show documentation
Hadrian is a DevOps UI, Inventory, and Auditing system that plugs into other tools to execute actions.
'use strict';
/* Controllers */
hadrianControllers.controller('ModalAddCustomFunctionCtrl', ['$scope', '$http', '$uibModalInstance', '$route', 'service', 'module',
function ($scope, $http, $uibModalInstance, $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.then(function (response) {
$uibModalInstance.close();
$route.reload();
});
responsePromise.catch(function (response) {
$scope.errorMsg = response.data;
});
};
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
}]);
hadrianControllers.controller('ModalUpdateCustomFunctionCtrl', ['$scope', '$http', '$uibModalInstance', '$route', 'service', 'cf',
function ($scope, $http, $uibModalInstance, $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.then(function (response) {
$uibModalInstance.close();
$route.reload();
});
responsePromise.catch(function (response) {
$scope.errorMsg = response.data;
});
};
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
}]);
© 2015 - 2025 Weber Informatics LLC | Privacy Policy