Commit 6f1a6d5a by Torkel Ödegaard

Changed name of emitAppEvent to just appEvent

parent 69e80fd1
...@@ -58,7 +58,7 @@ function (angular, $, config, _) { ...@@ -58,7 +58,7 @@ function (angular, $, config, _) {
$scope.setWindowTitleAndTheme(); $scope.setWindowTitleAndTheme();
$scope.emitAppEvent("dashboard-loaded", $scope.dashboard); $scope.appEvent("dashboard-loaded", $scope.dashboard);
}; };
$scope.setWindowTitleAndTheme = function() { $scope.setWindowTitleAndTheme = function() {
...@@ -113,7 +113,7 @@ function (angular, $, config, _) { ...@@ -113,7 +113,7 @@ function (angular, $, config, _) {
var editScope = $rootScope.$new(); var editScope = $rootScope.$new();
editScope.object = options.object; editScope.object = options.object;
editScope.updateHandler = options.updateHandler; editScope.updateHandler = options.updateHandler;
$scope.emitAppEvent('show-dash-editor', { src: 'app/partials/edit_json.html', scope: editScope }); $scope.appEvent('show-dash-editor', { src: 'app/partials/edit_json.html', scope: editScope });
}; };
$scope.checkFeatureToggles = function() { $scope.checkFeatureToggles = function() {
......
...@@ -69,7 +69,7 @@ function (angular, _, moment, config, store) { ...@@ -69,7 +69,7 @@ function (angular, _, moment, config, store) {
}; };
$scope.openSearch = function() { $scope.openSearch = function() {
$scope.emitAppEvent('show-dash-editor', { src: 'app/partials/search.html' }); $scope.appEvent('show-dash-editor', { src: 'app/partials/search.html' });
}; };
$scope.saveDashboard = function() { $scope.saveDashboard = function() {
...@@ -88,7 +88,7 @@ function (angular, _, moment, config, store) { ...@@ -88,7 +88,7 @@ function (angular, _, moment, config, store) {
$rootScope.$emit('dashboard-saved', $scope.dashboard); $rootScope.$emit('dashboard-saved', $scope.dashboard);
}, function(err) { }, function(err) {
$scope.emitAppEvent('alert-error', ['Save failed', err]); $scope.appEvent('alert-error', ['Save failed', err]);
}); });
}; };
...@@ -101,9 +101,9 @@ function (angular, _, moment, config, store) { ...@@ -101,9 +101,9 @@ function (angular, _, moment, config, store) {
var id = options.id; var id = options.id;
$scope.db.deleteDashboard(id).then(function(id) { $scope.db.deleteDashboard(id).then(function(id) {
alertSrv.set('Dashboard Deleted', id + ' has been deleted', 'success', 5000); $scope.appEvent('alert-success', ['Dashboard Deleted', id + ' has been deleted']);
}, function() { }, function(err) {
alertSrv.set('Dashboard Not Deleted', 'An error occurred deleting the dashboard', 'error', 5000); $scope.appEvent('alert-error', ['Deleted failed', err]);
}); });
}; };
...@@ -138,7 +138,7 @@ function (angular, _, moment, config, store) { ...@@ -138,7 +138,7 @@ function (angular, _, moment, config, store) {
}; };
$scope.editJson = function() { $scope.editJson = function() {
$scope.emitAppEvent('show-json-editor', { object: $scope.dashboard }); $scope.appEvent('show-json-editor', { object: $scope.dashboard });
}; };
$scope.openSaveDropdown = function() { $scope.openSaveDropdown = function() {
......
...@@ -41,7 +41,7 @@ function (angular, config, _, $, store) { ...@@ -41,7 +41,7 @@ function (angular, config, _, $, store) {
this.$on('$destroy', unbind); this.$on('$destroy', unbind);
}; };
$rootScope.emitAppEvent = function(name, payload) { $rootScope.appEvent = function(name, payload) {
$rootScope.$emit(name, payload); $rootScope.$emit(name, payload);
}; };
......
...@@ -29,7 +29,7 @@ function (angular, _, config, $) { ...@@ -29,7 +29,7 @@ function (angular, _, config, $) {
$scope.keyDown = function (evt) { $scope.keyDown = function (evt) {
if (evt.keyCode === 27) { if (evt.keyCode === 27) {
$scope.emitAppEvent('hide-dash-editor'); $scope.appEvent('hide-dash-editor');
} }
if (evt.keyCode === 40) { if (evt.keyCode === 40) {
$scope.moveSelection(1); $scope.moveSelection(1);
...@@ -121,7 +121,7 @@ function (angular, _, config, $) { ...@@ -121,7 +121,7 @@ function (angular, _, config, $) {
$scope.deleteDashboard = function(dash, evt) { $scope.deleteDashboard = function(dash, evt) {
evt.stopPropagation(); evt.stopPropagation();
$scope.emitAppEvent('delete-dashboard', { id: dash.id, title: dash.title }); $scope.appEvent('delete-dashboard', { id: dash.id, title: dash.title });
$scope.results.dashboards = _.without($scope.results.dashboards, dash); $scope.results.dashboards = _.without($scope.results.dashboards, dash);
}; };
......
...@@ -16,7 +16,7 @@ function (angular, $) { ...@@ -16,7 +16,7 @@ function (angular, $) {
elem.bind('click',function() { elem.bind('click',function() {
$timeout(function() { $timeout(function() {
var editorScope = attrs.editorScope === 'isolated' ? null : scope; var editorScope = attrs.editorScope === 'isolated' ? null : scope;
scope.emitAppEvent('show-dash-editor', { src: partial, scope: editorScope }); scope.appEvent('show-dash-editor', { src: partial, scope: editorScope });
}); });
}); });
} }
......
...@@ -79,7 +79,7 @@ function (angular, app, _, moment, kbn) { ...@@ -79,7 +79,7 @@ function (angular, app, _, moment, kbn) {
$scope.temptime.to.date = moment($scope.temptime.to.date).add('days',1).toDate(); $scope.temptime.to.date = moment($scope.temptime.to.date).add('days',1).toDate();
} }
$scope.emitAppEvent('show-dash-editor', {src: 'app/panels/timepicker/custom.html', scope: $scope }); $scope.appEvent('show-dash-editor', {src: 'app/panels/timepicker/custom.html', scope: $scope });
}; };
// Constantly validate the input of the fields. This function does not change any date variables // Constantly validate the input of the fields. This function does not change any date variables
......
...@@ -18,7 +18,7 @@ function (angular, _) { ...@@ -18,7 +18,7 @@ function (angular, _) {
self.set(alert[0], alert[1], 'warning', 5000); self.set(alert[0], alert[1], 'warning', 5000);
}); });
$rootScope.onAppEvent('alert-success', function(e, alert) { $rootScope.onAppEvent('alert-success', function(e, alert) {
self.set(alert[0], alert[0], 'success', 3000); self.set(alert[0], alert[1], 'success', 3000);
}); });
}; };
......
...@@ -22,7 +22,7 @@ function(angular, $) { ...@@ -22,7 +22,7 @@ function(angular, $) {
}); });
keyboardManager.bind('ctrl+f', function() { keyboardManager.bind('ctrl+f', function() {
scope.emitAppEvent('show-dash-editor', { src: 'app/partials/search.html' }); scope.appEvent('show-dash-editor', { src: 'app/partials/search.html' });
}, { inputDisabled: true }); }, { inputDisabled: true });
keyboardManager.bind('ctrl+h', function() { keyboardManager.bind('ctrl+h', function() {
...@@ -31,7 +31,7 @@ function(angular, $) { ...@@ -31,7 +31,7 @@ function(angular, $) {
}, { inputDisabled: true }); }, { inputDisabled: true });
keyboardManager.bind('ctrl+s', function(evt) { keyboardManager.bind('ctrl+s', function(evt) {
scope.emitAppEvent('save-dashboard', evt); scope.appEvent('save-dashboard', evt);
}, { inputDisabled: true }); }, { inputDisabled: true });
keyboardManager.bind('ctrl+r', function() { keyboardManager.bind('ctrl+r', function() {
...@@ -39,7 +39,7 @@ function(angular, $) { ...@@ -39,7 +39,7 @@ function(angular, $) {
}, { inputDisabled: true }); }, { inputDisabled: true });
keyboardManager.bind('ctrl+z', function(evt) { keyboardManager.bind('ctrl+z', function(evt) {
scope.emitAppEvent('zoom-out', evt); scope.appEvent('zoom-out', evt);
}, { inputDisabled: true }); }, { inputDisabled: true });
keyboardManager.bind('esc', function() { keyboardManager.bind('esc', function() {
...@@ -53,7 +53,7 @@ function(angular, $) { ...@@ -53,7 +53,7 @@ function(angular, $) {
modalData.$scope.dismiss(); modalData.$scope.dismiss();
} }
scope.emitAppEvent('hide-dash-editor'); scope.appEvent('hide-dash-editor');
scope.exitFullscreen(); scope.exitFullscreen();
}, { inputDisabled: true }); }, { inputDisabled: true });
......
...@@ -52,19 +52,19 @@ function (angular, _) { ...@@ -52,19 +52,19 @@ function (angular, _) {
$scope.toggleFullscreen(true); $scope.toggleFullscreen(true);
} }
else { else {
$scope.emitAppEvent('show-dash-editor', { src: 'app/partials/paneleditor.html', scope: $scope }); $scope.appEvent('show-dash-editor', { src: 'app/partials/paneleditor.html', scope: $scope });
} }
}; };
$scope.sharePanel = function() { $scope.sharePanel = function() {
$scope.emitAppEvent('show-modal', { $scope.appEvent('show-modal', {
src: './app/partials/share-panel.html', src: './app/partials/share-panel.html',
scope: $scope.$new() scope: $scope.$new()
}); });
}; };
$scope.editPanelJson = function() { $scope.editPanelJson = function() {
$scope.emitAppEvent('show-json-editor', { object: $scope.panel, updateHandler: $scope.replacePanel }); $scope.appEvent('show-json-editor', { object: $scope.panel, updateHandler: $scope.replacePanel });
}; };
$scope.updateColumnSpan = function(span) { $scope.updateColumnSpan = function(span) {
......
...@@ -91,7 +91,7 @@ define([ ...@@ -91,7 +91,7 @@ define([
this.old_refresh = null; this.old_refresh = null;
} }
$rootScope.emitAppEvent('time-range-changed', this.time); $rootScope.appEvent('time-range-changed', this.time);
$timeout(this.refreshDashboard, 0); $timeout(this.refreshDashboard, 0);
}; };
......
...@@ -68,7 +68,7 @@ define([ ...@@ -68,7 +68,7 @@ define([
self.$httpBackend = $httpBackend; self.$httpBackend = $httpBackend;
self.$rootScope.onAppEvent = function() {}; self.$rootScope.onAppEvent = function() {};
self.$rootScope.emitAppEvent = function() {}; self.$rootScope.appEvent = function() {};
self.service = $injector.get(name); self.service = $injector.get(name);
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment