mirror of
https://github.com/getredash/redash.git
synced 2025-12-25 01:03:20 -05:00
Remove underscore usage from new files
This commit is contained in:
committed by
Allen Short
parent
d6011ede0c
commit
9eb51da7ce
@@ -1,4 +1,4 @@
|
||||
import { filter } from 'underscore';
|
||||
import { filter } from 'lodash';
|
||||
import settingsMenu from '@/lib/settings-menu';
|
||||
import { Paginator } from '@/lib/pagination';
|
||||
import template from './list.html';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { isFunction, isArray } from 'underscore';
|
||||
import { isFunction, isArray } from 'lodash';
|
||||
|
||||
export class Policy {
|
||||
constructor($injector) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import numberFormat from 'underscore.string/numberFormat';
|
||||
import * as _ from 'lodash';
|
||||
import { isNumber, chain } from 'lodash';
|
||||
|
||||
import counterTemplate from './counter.html';
|
||||
import counterEditorTemplate from './counter-editor.html';
|
||||
@@ -30,7 +30,7 @@ function CounterRenderer($timeout) {
|
||||
fontSize: parseFloat(window.getComputedStyle(rootNode).fontSize),
|
||||
};
|
||||
const rulers = rootNode.querySelectorAll('.ruler');
|
||||
const rulerMeasures = _.chain(rulers)
|
||||
const rulerMeasures = chain(rulers)
|
||||
.map(ruler => ({
|
||||
height: ruler.offsetHeight,
|
||||
fontSize: parseFloat(window.getComputedStyle(ruler).fontSize),
|
||||
@@ -43,8 +43,10 @@ function CounterRenderer($timeout) {
|
||||
|
||||
/* eslint-disable function-paren-newline */
|
||||
const fontSize = Math.floor(
|
||||
(rootMeasures.height / rulerMeasures.height * rulerMeasures.fontSize) /
|
||||
(rulerMeasures.fontSize / rootMeasures.fontSize),
|
||||
rootMeasures.height /
|
||||
rulerMeasures.height *
|
||||
rulerMeasures.fontSize /
|
||||
(rulerMeasures.fontSize / rootMeasures.fontSize),
|
||||
);
|
||||
/* eslint-enable function-paren-newline */
|
||||
$scope.fontSize = fontSize + 'px';
|
||||
@@ -54,8 +56,7 @@ function CounterRenderer($timeout) {
|
||||
const queryData = $scope.queryResult.getData();
|
||||
if (queryData) {
|
||||
const rowNumber = getRowNumber($scope.visualization.options.rowNumber, queryData.length);
|
||||
const targetRowNumber =
|
||||
getRowNumber($scope.visualization.options.targetRowNumber, queryData.length);
|
||||
const targetRowNumber = getRowNumber($scope.visualization.options.targetRowNumber, queryData.length);
|
||||
const counterColName = $scope.visualization.options.counterColName;
|
||||
const targetColName = $scope.visualization.options.targetColName;
|
||||
|
||||
@@ -75,7 +76,7 @@ function CounterRenderer($timeout) {
|
||||
$scope.targetValue = null;
|
||||
}
|
||||
|
||||
$scope.isNumber = _.isNumber($scope.counterValue);
|
||||
$scope.isNumber = isNumber($scope.counterValue);
|
||||
if ($scope.isNumber) {
|
||||
$scope.stringPrefix = $scope.visualization.options.stringPrefix;
|
||||
$scope.stringSuffix = $scope.visualization.options.stringSuffix;
|
||||
@@ -84,12 +85,7 @@ function CounterRenderer($timeout) {
|
||||
const stringDecChar = $scope.visualization.options.stringDecChar;
|
||||
const stringThouSep = $scope.visualization.options.stringThouSep;
|
||||
if (stringDecimal || stringDecChar || stringThouSep) {
|
||||
$scope.counterValue = numberFormat(
|
||||
$scope.counterValue,
|
||||
stringDecimal,
|
||||
stringDecChar,
|
||||
stringThouSep,
|
||||
);
|
||||
$scope.counterValue = numberFormat($scope.counterValue, stringDecimal, stringDecChar, stringThouSep);
|
||||
$scope.isNumber = false;
|
||||
}
|
||||
} else {
|
||||
@@ -130,22 +126,19 @@ function CounterEditor() {
|
||||
scope.counterValue = queryData[rowNumber][counterColName];
|
||||
}
|
||||
}
|
||||
return _.isNumber(scope.counterValue);
|
||||
return isNumber(scope.counterValue);
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export default function init(ngModule) {
|
||||
ngModule.directive('counterEditor', CounterEditor);
|
||||
ngModule.directive('counterRenderer', CounterRenderer);
|
||||
|
||||
ngModule.config((VisualizationProvider) => {
|
||||
const renderTemplate =
|
||||
'<counter-renderer ' +
|
||||
'options="visualization.options" query-result="queryResult">' +
|
||||
'</counter-renderer>';
|
||||
'<counter-renderer ' + 'options="visualization.options" query-result="queryResult">' + '</counter-renderer>';
|
||||
|
||||
const editTemplate = '<counter-editor></counter-editor>';
|
||||
const defaultOptions = {
|
||||
|
||||
Reference in New Issue
Block a user