Address lint issues

This commit is contained in:
Arik Fraimovich 2016-11-20 13:02:14 +02:00
parent 0ab815ba9c
commit 0ced011f0f
8 changed files with 29 additions and 14 deletions

View File

@ -5,7 +5,7 @@ function AdminStatusCtrl($scope, $http, $timeout, currentUser, Events) {
Events.record(currentUser, 'view', 'page', 'admin/status');
// $scope.$parent.pageTitle = 'System Status';
const refresh = function () {
const refresh = () => {
$http.get('/status.json').success((data) => {
$scope.workers = data.workers;
delete data.workers;

View File

@ -1,6 +1,10 @@
import debug from 'debug';
import template from './show.html';
function DataSourceCtrl($scope, $routeParams, $http, $location, toastr, currentUser, Events, DataSource) {
const logger = debug('redash:http');
function DataSourceCtrl($scope, $routeParams, $http, $location, toastr,
currentUser, Events, DataSource) {
Events.record(currentUser, 'view', 'page', 'admin/data_source');
// $scope.$parent.pageTitle = 'Data Sources';
@ -25,7 +29,7 @@ function DataSourceCtrl($scope, $routeParams, $http, $location, toastr, currentU
toastr.success('Data source deleted successfully.');
$location.path('/data_sources/');
}, (httpResponse) => {
console.log('Failed to delete data source: ', httpResponse.status, httpResponse.statusText, httpResponse.data);
logger('Failed to delete data source: ', httpResponse.status, httpResponse.statusText, httpResponse.data);
toastr.error('Failed to delete data source.');
});
}
@ -41,7 +45,7 @@ function DataSourceCtrl($scope, $routeParams, $http, $location, toastr, currentU
}
callback();
}, (httpResponse) => {
console.log('Failed to test data source: ', httpResponse.status, httpResponse.statusText, httpResponse);
logger('Failed to test data source: ', httpResponse.status, httpResponse.statusText, httpResponse);
toastr.error('Unknown error occurred while performing connection test. Please try again later.', 'Connection Test Failed:', { timeOut: 10000 });
callback();
});

View File

@ -1,5 +1,9 @@
import debug from 'debug';
import template from './show.html';
const logger = debug('redash:http');
function DestinationCtrl($scope, $routeParams, $http, $location, toastr,
currentUser, Events, Destination) {
Events.record(currentUser, 'view', 'page', 'admin/destination');
@ -26,7 +30,7 @@ function DestinationCtrl($scope, $routeParams, $http, $location, toastr,
toastr.success('Destination deleted successfully.');
$location.path('/destinations/');
}, (httpResponse) => {
console.log('Failed to delete destination: ', httpResponse.status, httpResponse.statusText, httpResponse.data);
logger('Failed to delete destination: ', httpResponse.status, httpResponse.statusText, httpResponse.data);
toastr.error('Failed to delete destination.');
});
};

View File

@ -17,8 +17,6 @@ function HomeCtrl($scope, $uibModal, currentUser, Events, Dashboard, Query) {
resolve: {
dashboard: () => ({ name: null, layout: null }),
},
}).result.then((dashboard) => {
});
};
}

View File

@ -6,7 +6,6 @@ const EmbedCodeDialog = {
this.visualization = this.resolve.visualization;
this.embedUrl = `${clientConfig.basePath}embed/query/${this.query.id}/visualization/${this.visualization.id}?api_key=${this.query.api_key}`;
console.log(window.snapshotUrl);
if (window.snapshotUrlBuilder) {
this.snapshotUrl = window.snapshotUrlBuilder(this.query, this.visualization);
}

View File

@ -8,12 +8,12 @@ function schemaBrowser() {
},
template,
link($scope) {
$scope.showTable = function (table) {
$scope.showTable = (table) => {
table.collapsed = !table.collapsed;
$scope.$broadcast('vsRepeatTrigger');
};
$scope.getSize = function (table) {
$scope.getSize = (table) => {
let size = 18;
if (!table.collapsed) {

View File

@ -1,7 +1,7 @@
import template from './query.html';
function QuerySourceCtrl(Events, toastr, $controller, $scope, $location, $http, $q,
currentUser, Query, Visualization, KeyboardShortcuts) {
AlertDialog, currentUser, Query, Visualization, KeyboardShortcuts) {
// extends QueryViewCtrl
$controller('QueryViewCtrl', { $scope });
// TODO:
@ -89,7 +89,12 @@ function QuerySourceCtrl(Events, toastr, $controller, $scope, $location, $http,
$scope.deleteVisualization = ($e, vis) => {
$e.preventDefault();
if (confirm(`Are you sure you want to delete ${vis.name} ?`)) {
const title = undefined;
const message = `Are you sure you want to delete ${vis.name} ?`;
const confirm = { class: 'btn-danger', title: 'Delete' };
AlertDialog.open(title, message, confirm).then(() => {
Events.record(currentUser, 'delete', 'visualization', vis.id);
Visualization.delete(vis, () => {
@ -101,7 +106,7 @@ function QuerySourceCtrl(Events, toastr, $controller, $scope, $location, $http,
}, () => {
toastr.error("Error deleting visualization. Maybe it's used in a dashboard?");
});
}
});
};
$scope.$watch('query.query', (newQueryText) => {

View File

@ -1,3 +1,7 @@
import debug from 'debug';
const logger = debug('redash:notifications');
function Notifications(currentUser, Events) {
const notificationService = { pageVisible: true };
@ -34,7 +38,8 @@ function Notifications(currentUser, Events) {
if ('Notification' in window) {
return true;
}
console.log('HTML5 notifications are not supported.');
logger('HTML5 notifications are not supported.');
return false;
};