mirror of
https://github.com/getredash/redash.git
synced 2026-05-10 15:00:16 -04:00
* Refine Auth service: remove dead code and fix race condition * Export services in CommonJS style * Refine Users, Events and OfflineListener services * Refactor Notifications service - rewrite to CommonJS * Replace Angular service injection with imports in React components * Fix Footer tests * Events service -> recordEvent function * CR1
32 lines
820 B
JavaScript
32 lines
820 B
JavaScript
export let Alert = null; // eslint-disable-line import/no-mutable-exports
|
|
|
|
function AlertService($resource, $http) {
|
|
const actions = {
|
|
save: {
|
|
method: 'POST',
|
|
transformRequest: [(data) => {
|
|
const newData = Object.assign({}, data);
|
|
if (newData.query_id === undefined) {
|
|
newData.query_id = newData.query.id;
|
|
newData.destination_id = newData.destinations;
|
|
delete newData.query;
|
|
delete newData.destinations;
|
|
}
|
|
|
|
return newData;
|
|
}].concat($http.defaults.transformRequest),
|
|
},
|
|
};
|
|
return $resource('api/alerts/:id', { id: '@id' }, actions);
|
|
}
|
|
|
|
export default function init(ngModule) {
|
|
ngModule.factory('Alert', AlertService);
|
|
|
|
ngModule.run(($injector) => {
|
|
Alert = $injector.get('Alert');
|
|
});
|
|
}
|
|
|
|
init.init = true;
|