Changed name of emitAppEvent to just appEvent

This commit is contained in:
Torkel Ödegaard 2014-09-24 16:26:39 +02:00
parent 69e80fd11c
commit 6f1a6d5a56
11 changed files with 23 additions and 23 deletions

View File

@ -58,7 +58,7 @@ function (angular, $, config, _) {
$scope.setWindowTitleAndTheme();
$scope.emitAppEvent("dashboard-loaded", $scope.dashboard);
$scope.appEvent("dashboard-loaded", $scope.dashboard);
};
$scope.setWindowTitleAndTheme = function() {
@ -113,7 +113,7 @@ function (angular, $, config, _) {
var editScope = $rootScope.$new();
editScope.object = options.object;
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() {

View File

@ -69,7 +69,7 @@ function (angular, _, moment, config, store) {
};
$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() {
@ -88,7 +88,7 @@ function (angular, _, moment, config, store) {
$rootScope.$emit('dashboard-saved', $scope.dashboard);
}, 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) {
var id = options.id;
$scope.db.deleteDashboard(id).then(function(id) {
alertSrv.set('Dashboard Deleted', id + ' has been deleted', 'success', 5000);
}, function() {
alertSrv.set('Dashboard Not Deleted', 'An error occurred deleting the dashboard', 'error', 5000);
$scope.appEvent('alert-success', ['Dashboard Deleted', id + ' has been deleted']);
}, function(err) {
$scope.appEvent('alert-error', ['Deleted failed', err]);
});
};
@ -138,7 +138,7 @@ function (angular, _, moment, config, store) {
};
$scope.editJson = function() {
$scope.emitAppEvent('show-json-editor', { object: $scope.dashboard });
$scope.appEvent('show-json-editor', { object: $scope.dashboard });
};
$scope.openSaveDropdown = function() {

View File

@ -41,7 +41,7 @@ function (angular, config, _, $, store) {
this.$on('$destroy', unbind);
};
$rootScope.emitAppEvent = function(name, payload) {
$rootScope.appEvent = function(name, payload) {
$rootScope.$emit(name, payload);
};

View File

@ -29,7 +29,7 @@ function (angular, _, config, $) {
$scope.keyDown = function (evt) {
if (evt.keyCode === 27) {
$scope.emitAppEvent('hide-dash-editor');
$scope.appEvent('hide-dash-editor');
}
if (evt.keyCode === 40) {
$scope.moveSelection(1);
@ -121,7 +121,7 @@ function (angular, _, config, $) {
$scope.deleteDashboard = function(dash, evt) {
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);
};

View File

@ -16,7 +16,7 @@ function (angular, $) {
elem.bind('click',function() {
$timeout(function() {
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 });
});
});
}

View File

@ -79,7 +79,7 @@ function (angular, app, _, moment, kbn) {
$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

View File

@ -18,7 +18,7 @@ function (angular, _) {
self.set(alert[0], alert[1], 'warning', 5000);
});
$rootScope.onAppEvent('alert-success', function(e, alert) {
self.set(alert[0], alert[0], 'success', 3000);
self.set(alert[0], alert[1], 'success', 3000);
});
};

View File

@ -22,7 +22,7 @@ function(angular, $) {
});
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 });
keyboardManager.bind('ctrl+h', function() {
@ -31,7 +31,7 @@ function(angular, $) {
}, { inputDisabled: true });
keyboardManager.bind('ctrl+s', function(evt) {
scope.emitAppEvent('save-dashboard', evt);
scope.appEvent('save-dashboard', evt);
}, { inputDisabled: true });
keyboardManager.bind('ctrl+r', function() {
@ -39,7 +39,7 @@ function(angular, $) {
}, { inputDisabled: true });
keyboardManager.bind('ctrl+z', function(evt) {
scope.emitAppEvent('zoom-out', evt);
scope.appEvent('zoom-out', evt);
}, { inputDisabled: true });
keyboardManager.bind('esc', function() {
@ -53,7 +53,7 @@ function(angular, $) {
modalData.$scope.dismiss();
}
scope.emitAppEvent('hide-dash-editor');
scope.appEvent('hide-dash-editor');
scope.exitFullscreen();
}, { inputDisabled: true });

View File

@ -52,19 +52,19 @@ function (angular, _) {
$scope.toggleFullscreen(true);
}
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.emitAppEvent('show-modal', {
$scope.appEvent('show-modal', {
src: './app/partials/share-panel.html',
scope: $scope.$new()
});
};
$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) {

View File

@ -91,7 +91,7 @@ define([
this.old_refresh = null;
}
$rootScope.emitAppEvent('time-range-changed', this.time);
$rootScope.appEvent('time-range-changed', this.time);
$timeout(this.refreshDashboard, 0);
};

View File

@ -68,7 +68,7 @@ define([
self.$httpBackend = $httpBackend;
self.$rootScope.onAppEvent = function() {};
self.$rootScope.emitAppEvent = function() {};
self.$rootScope.appEvent = function() {};
self.service = $injector.get(name);
});