Skip to content

Commit

Permalink
Merge pull request #2 from getredash/master
Browse files Browse the repository at this point in the history
pulling from upstream to SV fork
  • Loading branch information
alison985 authored Jun 27, 2018
2 parents f4b3224 + fa6e2cc commit 5846a57
Show file tree
Hide file tree
Showing 83 changed files with 978 additions and 253 deletions.
2 changes: 1 addition & 1 deletion client/.babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"presets": ["es2015", "stage-2"],
"presets": ["env", "react", "stage-2"],
"plugins": [
"angularjs-annotate",
"transform-object-assign",
Expand Down
2 changes: 2 additions & 0 deletions client/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
settings: {
"import/resolver": "webpack"
},
parser: "babel-eslint",
env: {
"browser": true,
"node": true
Expand All @@ -21,6 +22,7 @@ module.exports = {
"no-multi-assign": "off",
"no-lonely-if": "off",
"consistent-return": "off",
"no-control-regex": "off",
"max-len": ['error', 120, 2, {
ignoreUrls: true,
ignoreComments: false,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/app/assets/images/db-logos/yandex_metrika.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions client/app/components/alerts/alert-subscriptions/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { contains, without, compact } from 'underscore';
import { includes, without, compact } from 'lodash';
import template from './alert-subscriptions.html';

function controller($scope, $q, $sce, currentUser, AlertSubscription, Destination, toastr) {
Expand All @@ -23,9 +23,9 @@ function controller($scope, $q, $sce, currentUser, AlertSubscription, Destinatio

const subscribedUsers = compact(subscribers.map(s => !s.destination && s.user.id));

$scope.destinations = destinations.filter(d => !contains(subscribedDestinations, d.id));
$scope.destinations = destinations.filter(d => !includes(subscribedDestinations, d.id));

if (!contains(subscribedUsers, currentUser.id)) {
if (!includes(subscribedUsers, currentUser.id)) {
$scope.destinations.unshift({ user: { name: currentUser.name } });
}

Expand Down
2 changes: 1 addition & 1 deletion client/app/components/dashboards/add-widget-dialog.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { debounce } from 'underscore';
import { debounce } from 'lodash';
import template from './add-widget-dialog.html';
import './add-widget-dialog.less';

Expand Down
2 changes: 1 addition & 1 deletion client/app/components/dashboards/edit-dashboard-dialog.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isEmpty } from 'underscore';
import { isEmpty } from 'lodash';
import template from './edit-dashboard-dialog.html';

const EditDashboardDialog = {
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/dashboards/gridstack/gridstack.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import $ from 'jquery';
import _ from 'underscore';
import _ from 'lodash';
import 'jquery-ui/ui/widgets/draggable';
import 'jquery-ui/ui/widgets/droppable';
import 'jquery-ui/ui/widgets/resizable';
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/dashboards/gridstack/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import $ from 'jquery';
import _ from 'underscore';
import _ from 'lodash';
import './gridstack';
import './gridstack.less';

Expand Down
7 changes: 3 additions & 4 deletions client/app/components/dynamic-form.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { isUndefined, each, contains } from 'underscore';
import endsWith from 'underscore.string/endsWith';
import { isUndefined, each, includes } from 'lodash';
import template from './dynamic-form.html';

function orderedInputs(properties, order) {
Expand All @@ -22,15 +21,15 @@ function normalizeSchema(configurationSchema) {
prop.type = 'password';
}

if (endsWith(name, 'File')) {
if (name.endsWith('File')) {
prop.type = 'file';
}

if (prop.type === 'boolean') {
prop.type = 'checkbox';
}

prop.required = contains(configurationSchema.required, name);
prop.required = includes(configurationSchema.required, name);
});

configurationSchema.order = configurationSchema.order || [];
Expand Down
4 changes: 2 additions & 2 deletions client/app/components/dynamic-table/default-cell/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { contains, identity } from 'underscore';
import { includes, identity } from 'lodash';
import { renderDefault, renderImage, renderLink } from './utils';
import template from './template.html';

Expand Down Expand Up @@ -26,7 +26,7 @@ export default function init(ngModule) {
if ($scope.column.displayAs === 'string') {
$scope.allowHTML = $scope.column.allowHTML;
} else {
$scope.allowHTML = contains(['image', 'link'], $scope.column.displayAs);
$scope.allowHTML = includes(['image', 'link'], $scope.column.displayAs);
}

const sanitize = $scope.allowHTML ? $sanitize : identity;
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/dynamic-table/default-cell/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isFunction, extend } from 'underscore';
import { isFunction, extend } from 'lodash';
import { formatSimpleTemplate } from '@/lib/value-format';

function trim(str) {
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/dynamic-table/dynamic-table-row.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isFunction } from 'underscore';
import { isFunction } from 'lodash';

export default function init(ngModule) {
ngModule.directive('dynamicTableRow', () => ({
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/dynamic-table/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { find, filter, map, each } from 'underscore';
import { find, filter, map, each } from 'lodash';
import template from './dynamic-table.html';
import './dynamic-table.less';

Expand Down
2 changes: 1 addition & 1 deletion client/app/components/dynamic-table/json-cell/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isUndefined, isString } from 'underscore';
import { isUndefined, isString } from 'lodash';
import renderJsonView from './json-view-interactive';
import template from './template.html';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isFunction, isArray, isObject, isString, isNumber, isUndefined, each, keys, filter } from 'underscore';
import { isFunction, isArray, isObject, isString, isNumber, isUndefined, each, keys, filter } from 'lodash';
import $ from 'jquery';
import './json-view-interactive.less';

Expand Down
2 changes: 1 addition & 1 deletion client/app/components/edit-in-place.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import $ from 'jquery';
import { isEmpty } from 'underscore';
import { isEmpty } from 'lodash';

// From: http://jsfiddle.net/joshdmiller/NDFHg/
function EditInPlace() {
Expand Down
22 changes: 22 additions & 0 deletions client/app/components/footer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';
import { react2angular } from 'react2angular';

class Footer extends React.Component {
render() {
const version = this.props.clientConfig.version;
const newVersionAvailable = this.props.clientConfig.newVersionAvailable && this.props.currentUser.isAdmin;
return (
<div id="footer">
<a href="http://redash.io">Redash</a> {version}{ <small><a href="https://version.redash.io/">(New Redash version available)</a></small> ? newVersionAvailable : ''}
&#8226;
<a href="https://redash.io/help/">Documentation</a>
&#8226;
<a href="http://github.com/getredash/redash">Contribute</a>
</div>
);
}
}

export default function init(ngModule) {
ngModule.component('footer', react2angular(Footer, [], ['clientConfig', 'currentUser']));
}
7 changes: 0 additions & 7 deletions client/app/components/footer/footer.html

This file was deleted.

13 changes: 0 additions & 13 deletions client/app/components/footer/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion client/app/components/parameters.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { find } from 'underscore';
import { find } from 'lodash';
import template from './parameters.html';
import queryBasedParameterTemplate from './query-based-parameter.html';
import parameterSettingsTemplate from './parameter-settings.html';
Expand Down
4 changes: 2 additions & 2 deletions client/app/components/permissions-editor/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { contains, each } from 'underscore';
import { includes, each } from 'lodash';
import template from './permissions-editor.html';

const PermissionsEditorComponent = {
Expand Down Expand Up @@ -40,7 +40,7 @@ const PermissionsEditorComponent = {
if (this.foundUsers === undefined) {
User.query((users) => {
const existingIds = this.grantees.map(m => m.id);
users.forEach((user) => { user.alreadyGrantee = contains(existingIds, user.id); });
users.forEach((user) => { user.alreadyGrantee = includes(existingIds, user.id); });
this.foundUsers = users;
});
}
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/queries/query-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'brace/mode/python';
import 'brace/mode/sql';
import 'brace/mode/json';
import 'brace/ext/language_tools';
import { map } from 'underscore';
import { map } from 'lodash';

// By default Ace will try to load snippet files for the different modes and fail.
// We don't need them, so we use these placeholders until we define our own.
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/queries/schedule-dialog.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import moment from 'moment';
import { map, range, partial, each, isArray } from 'underscore';
import { map, range, partial, each, isArray } from 'lodash';
import { durationHumanize } from '@/filters';

import template from './schedule-dialog.html';
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/queries/visualization-embed.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { find } from 'underscore';
import { find } from 'lodash';
import logoUrl from '@/assets/images/redash_icon_small.png';
import template from './visualization-embed.html';

Expand Down
5 changes: 2 additions & 3 deletions client/app/components/settings-screen.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import settingsMenu from '@/lib/settings-menu';
import startsWith from 'underscore.string/startsWith';
import { isFunction } from 'underscore';
import { isFunction } from 'lodash';
import template from './settings-screen.html';

export default function init(ngModule) {
Expand All @@ -13,7 +12,7 @@ export default function init(ngModule) {
if (isFunction(menuItem.isActive)) {
return menuItem.isActive($location);
}
return startsWith($location.path(), menuItem.pathPrefix);
return $location.path().startsWith(menuItem.pathPrefix);
};
this.isAvailable = permission => permission === undefined || currentUser.hasPermission(permission);
},
Expand Down
4 changes: 1 addition & 3 deletions client/app/components/tab-nav/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import startsWith from 'underscore.string/startsWith';

function controller($location) {
this.tabs.forEach((tab) => {
if (tab.isActive) {
tab.active = tab.isActive($location.path());
} else {
tab.active = startsWith($location.path(), `/${tab.path}`);
tab.active = $location.path().startsWith(`/${tab.path}`);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion client/app/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import 'angular-moment';
import 'brace';
import 'angular-ui-ace';
import 'angular-resizable';
import { each, isFunction, extend } from 'underscore';
import { each, isFunction, extend } from 'lodash';

import '@/lib/sortable';

Expand Down
2 changes: 1 addition & 1 deletion client/app/directives/resizable-toggle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { find } from 'underscore';
import { find } from 'lodash';

function sameNumber(a, b) {
return (isNaN(a) && isNaN(b)) || (a === b);
Expand Down
4 changes: 2 additions & 2 deletions client/app/directives/resize-event.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'underscore';
import { findIndex } from 'lodash';

const items = new Map();

Expand Down Expand Up @@ -35,7 +35,7 @@ function resizeEvent() {
});

$scope.$on('$destroy', () => {
const index = _.findIndex(items, item => item.node === node);
const index = findIndex(items, item => item.node === node);
if (index >= 0) {
items.splice(index, 1); // remove item
}
Expand Down
3 changes: 1 addition & 2 deletions client/app/filters/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import moment from 'moment';
import _capitalize from 'underscore.string/capitalize';
import { isEmpty } from 'underscore';
import { capitalize as _capitalize, isEmpty } from 'lodash';

export function durationHumanize(duration) {
let humanized = '';
Expand Down
2 changes: 1 addition & 1 deletion client/app/lib/pagination/paginator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sortBy } from 'underscore';
import { sortBy } from 'lodash';

export default class Paginator {
constructor(rows, { page = 1, itemsPerPage = 20, totalCount = undefined } = {}) {
Expand Down
2 changes: 1 addition & 1 deletion client/app/lib/settings-menu.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sortBy } from 'underscore';
import { sortBy } from 'lodash';

const settingsMenu = {
menus: [],
Expand Down
2 changes: 1 addition & 1 deletion client/app/lib/value-format.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import moment from 'moment/moment';
import numeral from 'numeral';
import _ from 'underscore';
import _ from 'lodash';

numeral.options.scalePercentBy100 = false;

Expand Down
4 changes: 2 additions & 2 deletions client/app/lib/visualizations/sunburst.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as d3 from 'd3';
import _ from 'underscore';
import _ from 'lodash';
import angular from 'angular';

const exitNode = '<<<Exit>>>';
Expand Down Expand Up @@ -285,7 +285,7 @@ function Sunburst(scope, element) {
return {
size: value[0].value,
sequence: value[0].sequence,
nodes: _.pluck(sorted, 'node'),
nodes: _.map(sorted, i => i.node),
};
});
} else {
Expand Down
2 changes: 1 addition & 1 deletion client/app/pages/alert/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { template as templateBuilder } from 'underscore';
import { template as templateBuilder } from 'lodash';
import template from './alert.html';

function AlertCtrl($routeParams, $location, $sce, toastr, currentUser, Query, Events, Alert) {
Expand Down
4 changes: 2 additions & 2 deletions client/app/pages/dashboards/dashboard-list.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'underscore';
import _ from 'lodash';

import { Paginator } from '@/lib/pagination';
import template from './dashboard-list.html';
Expand Down Expand Up @@ -45,7 +45,7 @@ function DashboardListCtrl(Dashboard, $location) {
this.showEmptyState = true;
}
const out = data.map(dashboard => dashboard.name.match(TAGS_REGEX));
this.allTags = _.unique(_.flatten(out)).filter(e => e).map(tag => tag.replace(/:$/, ''));
this.allTags = _.uniq(_.flatten(out)).filter(e => e).map(tag => tag.replace(/:$/, ''));
this.allTags.sort();
});

Expand Down
2 changes: 1 addition & 1 deletion client/app/pages/dashboards/dashboard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'underscore';
import * as _ from 'lodash';
import PromiseRejectionError from '@/lib/promise-rejection-error';
import { durationHumanize } from '@/filters';
import template from './dashboard.html';
Expand Down
3 changes: 1 addition & 2 deletions client/app/pages/dashboards/public-dashboard-page.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as _ from 'underscore';
import logoUrl from '@/assets/images/redash_icon_small.png';
import template from './public-dashboard-page.html';
import './dashboard.less';
Expand All @@ -11,7 +10,7 @@ const PublicDashboardPage = {
controller(dashboardGridOptions, Dashboard) {
'ngInject';

this.dashboardGridOptions = _.extend({}, dashboardGridOptions, {
this.dashboardGridOptions = Object.assign({}, dashboardGridOptions, {
resizable: { enabled: false },
draggable: { enabled: false },
});
Expand Down
4 changes: 2 additions & 2 deletions client/app/pages/data-sources/show.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { findWhere } from 'underscore';
import { find } from 'lodash';
import debug from 'debug';
import template from './show.html';

Expand All @@ -13,7 +13,7 @@ function DataSourceCtrl(
$scope.dataSource = $route.current.locals.dataSource;
$scope.dataSourceId = $routeParams.dataSourceId;
$scope.types = $route.current.locals.types;
$scope.type = findWhere($scope.types, { type: $scope.dataSource.type });
$scope.type = find($scope.types, { type: $scope.dataSource.type });
$scope.canChangeType = $scope.dataSource.id === undefined;

$scope.helpLinks = {
Expand Down
Loading

0 comments on commit 5846a57

Please sign in to comment.