##// END OF EJS Templates
elasticsearch: replace "filtered" with "bool" clause
elasticsearch: replace "filtered" with "bool" clause

File last commit:

r147:bb4c1b51
r156:ba532c17
Show More
report_alert_action.js
115 lines | 4.0 KiB | application/javascript | JavascriptLexer
license: change the license to Apache 2.0
r112 // Copyright 2010 - 2017 RhodeCode GmbH and the AppEnlight project authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
project: initial commit
r0
angular.module('appenlight.directives.reportAlertAction', []).directive('reportAlertAction', ['userSelfPropertyResource', function (userSelfPropertyResource) {
return {
scope: {},
frontend: angular 1.7.7
r147 bindToController: {
project: initial commit
r0 action: '=',
applications: '=',
possibleChannels: '=',
actions: '=',
ruleDefinitions: '='
},
frontend: angular 1.7.7
r147 controller: reportAlertActionController,
controllerAs: 'ctrl',
project: initial commit
r0 restrict: 'E',
angular: reorganize files
r72 templateUrl: 'directives/report_alert_action/report_alert_action.html'
project: initial commit
r0 };
frontend: angular 1.7.7
r147
function reportAlertActionController() {
project: initial commit
r0 var vm = this;
frontend: angular 1.7.7
r147 vm.$onInit = function () {
vm.possibleNotifications = [
['always', 'Always'],
['only_first', 'Only New'],
];
vm.possibleChannels = _.filter(vm.possibleChannels, function (c) {
return c.supports_report_alerting
}
);
if (vm.possibleChannels.length > 0) {
vm.channelToBind = vm.possibleChannels[0];
}
}
project: initial commit
r0 vm.deleteAction = function (actions, action) {
var get = {
key: 'alert_channels_rules',
pkey: action.pkey
};
userSelfPropertyResource.remove(get, function (data) {
actions.splice(actions.indexOf(action), 1);
});
};
frontend: angular 1.7.7
r147 vm.bindChannel = function () {
project: initial commit
r0 var post = {
channel_pkey: vm.channelToBind.pkey,
action_pkey: vm.action.pkey
};
console.log(post);
userSelfPropertyResource.save({key: 'alert_channels_actions_binds'}, post,
function (data) {
vm.action.channels = [];
vm.action.channels = data.channels;
}, function (response) {
if (response.status == 422) {
console.log('scope', response);
}
});
};
frontend: angular 1.7.7
r147 vm.unBindChannel = function (channel) {
project: initial commit
r0 userSelfPropertyResource.delete({
key: 'alert_channels_actions_binds',
channel_pkey: channel.pkey,
action_pkey: vm.action.pkey
},
function (data) {
vm.action.channels = [];
vm.action.channels = data.channels;
}, function (response) {
if (response.status == 422) {
console.log('scope', response);
}
});
};
vm.saveAction = function () {
var params = {
key: 'alert_channels_rules',
pkey: vm.action.pkey
};
userSelfPropertyResource.update(params, vm.action,
function (data) {
vm.action.dirty = false;
vm.errors = [];
}, function (response) {
if (response.status == 422) {
var errorDict = angular.fromJson(response.data);
vm.errors = _.values(errorDict);
}
});
};
frontend: angular 1.7.7
r147 vm.setDirty = function () {
project: initial commit
r0 vm.action.dirty = true;
console.log('set dirty');
};
}
}]);