Chore: Upgrades jQuery and @types/jQuery (#25651)

* Chore: upgrades jQuery and @types/jQuery

* Chore: reduce strict null errors

* Fixed issue in graphite func editor

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
This commit is contained in:
Hugo Häggmark
2020-06-25 08:45:15 +02:00
committed by Dominik Prokop
co-authored by Torkel Ödegaard
parent 69e989ea9d
commit ba06f38b16
29 changed files with 78 additions and 69 deletions
+2 -2
View File
@@ -85,7 +85,7 @@
"@types/hoist-non-react-statics": "3.3.0",
"@types/is-hotkey": "0.1.1",
"@types/jest": "26.0.0",
"@types/jquery": "3.3.32",
"@types/jquery": "3.3.38",
"@types/lodash": "4.14.149",
"@types/lru-cache": "^5.1.0",
"@types/marked": "0.6.5",
@@ -240,7 +240,7 @@
"hoist-non-react-statics": "3.3.0",
"immutable": "3.8.2",
"is-hotkey": "0.1.6",
"jquery": "3.4.1",
"jquery": "3.5.1",
"jsurl": "^0.1.5",
"lodash": "4.17.15",
"lru-cache": "^5.1.1",
+1 -1
View File
@@ -37,7 +37,7 @@
"@rollup/plugin-node-resolve": "7.1.1",
"@types/braintree__sanitize-url": "4.0.0",
"@types/jest": "23.3.14",
"@types/jquery": "1.10.35",
"@types/jquery": "3.3.38",
"@types/lodash": "4.14.123",
"@types/node": "10.14.1",
"@types/papaparse": "4.5.9",
+2 -2
View File
@@ -45,7 +45,7 @@
"d3": "5.15.0",
"emotion": "10.0.27",
"immutable": "3.8.2",
"jquery": "3.4.1",
"jquery": "3.5.1",
"lodash": "4.17.15",
"moment": "2.24.0",
"papaparse": "4.6.3",
@@ -84,7 +84,7 @@
"@types/common-tags": "^1.8.0",
"@types/d3": "5.7.2",
"@types/jest": "23.3.14",
"@types/jquery": "1.10.35",
"@types/jquery": "3.3.38",
"@types/lodash": "4.14.123",
"@types/node": "10.14.1",
"@types/papaparse": "4.5.9",
+2 -3
View File
@@ -1,6 +1,5 @@
import { createRootReducer, recursiveCleanState } from './root';
import { describe, expect } from '../../../test/lib/common';
import { NavModelItem } from '@grafana/data';
import { reducerTester } from '../../../test/core/redux/reducerTester';
import { StoreState } from '../../types/store';
import { Team } from '../../types';
@@ -8,10 +7,10 @@ import { cleanUpAction } from '../actions/cleanUp';
import { initialTeamsState, teamsLoaded } from '../../features/teams/state/reducers';
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
config: {
bootData: {
navTree: [] as NavModelItem[],
navTree: [],
user: {},
},
},
@@ -4,6 +4,10 @@ import { DashboardExporter } from './DashboardExporter';
import { DashboardModel } from '../../state/DashboardModel';
import { PanelPluginMeta } from '@grafana/data';
function getStub(arg: string) {
return Promise.resolve(stubs[arg || 'gfdb']);
}
jest.mock('app/core/store', () => {
return {
getBool: jest.fn(),
@@ -12,7 +16,7 @@ jest.mock('app/core/store', () => {
});
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getDataSourceSrv: () => ({
get: jest.fn(arg => getStub(arg)),
}),
@@ -261,7 +265,3 @@ stubs['-- Grafana --'] = {
builtIn: true,
},
};
function getStub(arg: string) {
return Promise.resolve(stubs[arg || 'gfdb']);
}
@@ -1,5 +1,5 @@
import { PayloadAction } from '@reduxjs/toolkit';
import { DataQuery, DefaultTimeZone, ExploreMode, LogsDedupStrategy, RawTimeRange, toUtc } from '@grafana/data';
import { DataQuery, DefaultTimeZone, ExploreMode, LogsDedupStrategy, toUtc } from '@grafana/data';
import * as Actions from './actions';
import { changeDatasource, loadDatasource, navigateToExplore, refreshExplore, cancelQueries } from './actions';
@@ -10,11 +10,11 @@ import {
InitializeExplorePayload,
loadDatasourcePendingAction,
loadDatasourceReadyAction,
scanStopAction,
setQueriesAction,
updateDatasourceInstanceAction,
updateUIStateAction,
cancelQueriesAction,
scanStopAction,
} from './actionTypes';
import { Emitter } from 'app/core/core';
import { makeInitialUpdateState } from './reducers';
@@ -57,8 +57,8 @@ const testRange = {
},
};
jest.mock('app/core/utils/explore', () => ({
...jest.requireActual('app/core/utils/explore'),
getTimeRangeFromUrl: (range: RawTimeRange) => testRange,
...((jest.requireActual('app/core/utils/explore') as unknown) as object),
getTimeRangeFromUrl: (range: any) => testRange,
}));
const setup = (updateOverides?: Partial<ExploreUpdateState>) => {
@@ -98,7 +98,7 @@ describe('ResultProcessor', () => {
const valueField = dataFrames[0].fields[1];
const theResult = resultProcessor.getGraphResult();
expect(theResult[0]).toEqual({
expect(theResult![0]).toEqual({
label: 'A-series',
color: '#7EB26D',
data: [
@@ -51,7 +51,11 @@ describe('getFieldLinksForExplore', () => {
'/explore?left={"range":{"from":"now-1h","to":"now"},"datasource":"test_ds","queries":[{"query":"query_1"}],"mode":"Metrics","ui":{"showingGraph":true,"showingTable":true,"showingLogs":true}}'
);
expect(links[0].title).toBe('test_ds');
links[0].onClick({});
if (links[0].onClick) {
links[0].onClick({});
}
expect(splitfn).toBeCalledWith({ datasourceUid: 'uid_1', query: 'query_1' });
});
});
@@ -14,7 +14,7 @@ describe('datasource', () => {
},
],
} as any)) as any;
expect(response.error.message).toBe('Log group is required');
expect(response.error?.message).toBe('Log group is required');
});
it('should return empty response if queries are hidden', async () => {
@@ -18,7 +18,7 @@ jest.mock('rxjs/operators', () => {
});
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => backendSrv,
}));
@@ -18,9 +18,12 @@ describe('DataLinks', () => {
it('renders correctly when no fields', async () => {
let wrapper: any;
await act(async () => {
wrapper = await mount(<DataLinks onChange={() => {}} />);
});
await act(
// @ts-ignore we shouldn't use Promises in act => the "void | undefined" is here to forbid any sneaky "Promise" returns.
async () => {
wrapper = await mount(<DataLinks onChange={() => {}} />);
}
);
expect(wrapper.find(Button).length).toBe(1);
expect(wrapper.find(Button).contains('Add')).toBeTruthy();
expect(wrapper.find(DataLink).length).toBe(0);
@@ -28,9 +31,12 @@ describe('DataLinks', () => {
it('renders correctly when there are fields', async () => {
let wrapper: any;
await act(async () => {
wrapper = await mount(<DataLinks value={testValue} onChange={() => {}} />);
});
await act(
// @ts-ignore we shouldn't use Promises in act => the "void | undefined" is here to forbid any sneaky "Promise" returns.
async () => {
wrapper = await mount(<DataLinks value={testValue} onChange={() => {}} />);
}
);
expect(wrapper.find(Button).filterWhere((button: any) => button.contains('Add')).length).toBe(1);
expect(wrapper.find(DataLink).length).toBe(2);
@@ -39,9 +45,12 @@ describe('DataLinks', () => {
it('adds new field', async () => {
const onChangeMock = jest.fn();
let wrapper: any;
await act(async () => {
wrapper = await mount(<DataLinks onChange={onChangeMock} />);
});
await act(
// @ts-ignore we shouldn't use Promises in act => the "void | undefined" is here to forbid any sneaky "Promise" returns.
async () => {
wrapper = await mount(<DataLinks onChange={onChangeMock} />);
}
);
const addButton = wrapper.find(Button).filterWhere((button: any) => button.contains('Add'));
addButton.simulate('click');
expect(onChangeMock.mock.calls[0][0].length).toBe(1);
@@ -50,9 +59,12 @@ describe('DataLinks', () => {
it('removes field', async () => {
const onChangeMock = jest.fn();
let wrapper: any;
await act(async () => {
wrapper = await mount(<DataLinks value={testValue} onChange={onChangeMock} />);
});
await act(
// @ts-ignore we shouldn't use Promises in act => the "void | undefined" is here to forbid any sneaky "Promise" returns.
async () => {
wrapper = await mount(<DataLinks value={testValue} onChange={onChangeMock} />);
}
);
const removeButton = wrapper
.find(DataLink)
.at(0)
@@ -1,16 +1,14 @@
import angular from 'angular';
import { CoreApp, DataQueryRequest, dateMath, Field } from '@grafana/data';
import { CoreApp, DataQueryRequest, DataSourceInstanceSettings, dateMath, dateTime, Field, toUtc } from '@grafana/data';
import _ from 'lodash';
import { ElasticDatasource } from './datasource';
import { toUtc, dateTime } from '@grafana/data';
import { backendSrv } from 'app/core/services/backend_srv'; // will use the version in __mocks__
import { TimeSrv } from 'app/features/dashboard/services/TimeSrv';
import { TemplateSrv } from 'app/features/templating/template_srv';
import { DataSourceInstanceSettings } from '@grafana/data';
import { ElasticsearchOptions, ElasticsearchQuery } from './types';
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => backendSrv,
}));
@@ -1,10 +1,10 @@
import Datasource from '../datasource';
import { DataFrame, toUtc, getFrameDisplayName } from '@grafana/data';
import { DataFrame, getFrameDisplayName, toUtc } from '@grafana/data';
import { TemplateSrv } from 'app/features/templating/template_srv';
import { backendSrv } from 'app/core/services/backend_srv'; // will use the version in __mocks__
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => backendSrv,
}));
@@ -6,7 +6,7 @@ import { toUtc, getFrameDisplayName } from '@grafana/data';
import { backendSrv } from 'app/core/services/backend_srv'; // will use the version in __mocks__
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => backendSrv,
}));
@@ -5,7 +5,7 @@ import { toUtc, DataFrame, getFrameDisplayName } from '@grafana/data';
import { backendSrv } from 'app/core/services/backend_srv'; // will use the version in __mocks__
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => backendSrv,
}));
@@ -4,7 +4,7 @@ import { backendSrv } from 'app/core/services/backend_srv'; // will use the vers
import { GrafanaDatasource } from '../datasource';
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => backendSrv,
}));
@@ -10,8 +10,9 @@ export function graphiteFuncEditor($compile: any, templateSrv: TemplateSrv) {
func="func"
onRemove="ctrl.handleRemoveFunction"
onMoveLeft="ctrl.handleMoveLeft"
onMoveRight="ctrl.handleMoveRight"
/><span>(</span>
onMoveRight="ctrl.handleMoveRight">
</function-editor>
<span>(</span>
`;
const paramTemplate =
'<input type="text" style="display:none"' + ' class="input-small tight-form-func-param"></input>';
@@ -6,7 +6,7 @@ import { dateTime, getFrameDisplayName } from '@grafana/data';
import { backendSrv } from 'app/core/services/backend_srv'; // will use the version in __mocks__
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => backendSrv,
}));
@@ -88,7 +88,7 @@ describe('when rendering func instance', () => {
it('should handle function with no metric param', () => {
const func = gfunc.createFuncInstance('randomWalk');
func.params[0] = 'test';
expect(func.render(undefined, replaceVariablesDummy)).toEqual("randomWalk('test')");
expect(func.render((undefined as unknown) as string, replaceVariablesDummy)).toEqual("randomWalk('test')");
});
it('should handle function multiple series params', () => {
@@ -4,7 +4,7 @@ import { TemplateSrvStub } from 'test/specs/helpers';
import { backendSrv } from 'app/core/services/backend_srv'; // will use the version in __mocks__
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => backendSrv,
}));
@@ -18,7 +18,7 @@ import omit from 'lodash/omit';
import { backendSrv } from 'app/core/services/backend_srv'; // will use the version in __mocks__
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => backendSrv,
}));
@@ -7,7 +7,7 @@ import { TemplateSrv } from 'app/features/templating/template_srv';
import { backendSrv } from 'app/core/services/backend_srv'; // will use the version in __mocks__
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => backendSrv,
}));
@@ -5,7 +5,7 @@ import { backendSrv } from 'app/core/services/backend_srv'; // will use the vers
import { TemplateSrv } from 'app/features/templating/template_srv';
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => backendSrv,
}));
@@ -2,7 +2,7 @@ import OpenTsDatasource from '../datasource';
import { backendSrv } from 'app/core/services/backend_srv'; // will use the version in __mocks__
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => backendSrv,
}));
@@ -5,7 +5,7 @@ import { backendSrv } from 'app/core/services/backend_srv'; // will use the vers
import { TemplateSrv } from 'app/features/templating/template_srv';
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => backendSrv,
}));
@@ -1,6 +1,6 @@
import { PrometheusDatasource } from './datasource';
import PrometheusMetricFindQuery from './metric_find_query';
import { toUtc, DataSourceInstanceSettings } from '@grafana/data';
import { DataSourceInstanceSettings, toUtc } from '@grafana/data';
import { backendSrv } from 'app/core/services/backend_srv'; // will use the version in __mocks__
import { PromOptions } from './types';
@@ -12,7 +12,7 @@ jest.mock('app/features/templating/template_srv', () => {
});
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => backendSrv,
}));
@@ -3,7 +3,7 @@ import { backendSrv } from 'app/core/services/backend_srv'; // will use the vers
import { SelectableValue } from '@grafana/data';
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => backendSrv,
}));
@@ -8,7 +8,7 @@ import { backendSrv } from 'app/core/services/backend_srv'; // will use the vers
import { TimeSrv } from 'app/features/dashboard/services/TimeSrv';
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
...((jest.requireActual('@grafana/runtime') as unknown) as object),
getBackendSrv: () => backendSrv,
}));
+8 -13
View File
@@ -6002,11 +6002,6 @@
dependencies:
"@types/sizzle" "*"
"@types/jquery@1.10.35":
version "1.10.35"
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-1.10.35.tgz#4e5c2b1e5b3bf0b863efb8c5e70081f52e6c9518"
integrity sha512-SVtqEcudm7yjkTwoRA1gC6CNMhGDdMx4Pg8BPdiqI7bXXdCn1BPmtxgeWYQOgDxrq53/5YTlhq5ULxBEAlWIBg==
"@types/jquery@3.3.31":
version "3.3.31"
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.3.31.tgz#27c706e4bf488474e1cb54a71d8303f37c93451b"
@@ -6014,10 +6009,10 @@
dependencies:
"@types/sizzle" "*"
"@types/jquery@3.3.32":
version "3.3.32"
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.3.32.tgz#93e27fdc45dd38ee07f2f0acf34b59c1ccee036f"
integrity sha512-UKoof2mnV/X1/Ix2g+V2Ny5sgHjV8nK/UJbiYxuo4zPwzGyFlZ/mp4KaePb2VqQrqJctmcDQNA57buU84/2uIw==
"@types/jquery@3.3.38":
version "3.3.38"
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.3.38.tgz#6385f1e1b30bd2bff55ae8ee75ea42a999cc3608"
integrity sha512-nkDvmx7x/6kDM5guu/YpXkGZ/Xj/IwGiLDdKM99YA5Vag7pjGyTJ8BNUh/6hxEn/sEu5DKtyRgnONJ7EmOoKrA==
dependencies:
"@types/sizzle" "*"
@@ -16689,10 +16684,10 @@ jju@~1.4.0:
resolved "https://registry.yarnpkg.com/jju/-/jju-1.4.0.tgz#a3abe2718af241a2b2904f84a625970f389ae32a"
integrity sha1-o6vicYryQaKykE+EpiWXDzia4yo=
jquery@3.4.1:
version "3.4.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.4.1.tgz#714f1f8d9dde4bdfa55764ba37ef214630d80ef2"
integrity sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==
jquery@3.5.1:
version "3.5.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.5.1.tgz#d7b4d08e1bfdb86ad2f1a3d039ea17304717abb5"
integrity sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==
js-base64@^2.1.8:
version "2.5.1"