Skip to content

Commit

Permalink
Merge pull request #9493 from vitessio/frances/update-react-scripts
Browse files Browse the repository at this point in the history
[VTAdmin] Update react-scripts, postcss
  • Loading branch information
deepthi committed Jan 11, 2022
2 parents de0e3ce + 1a5380c commit c2ba091
Show file tree
Hide file tree
Showing 12 changed files with 19,562 additions and 26,080 deletions.
2 changes: 1 addition & 1 deletion web/vtadmin/craco.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
style: {
postcss: {
postcssOptions: {
plugins: [
require('tailwindcss'),
// Required for tailwindcss
Expand Down
45,576 changes: 19,517 additions & 26,059 deletions web/vtadmin/package-lock.json

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions web/vtadmin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,20 @@
"highcharts-react-official": "^3.0.0",
"history": "^5.0.0",
"lodash-es": "^4.17.20",
"postcss": "^7.0.39",
"postcss": "^8.4.5",
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-preset-env": "^7.2.0",
"query-string": "^6.14.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-query": "^3.5.9",
"react-router-dom": "^5.2.0",
"react-scripts": "^4.0.3",
"react-scripts": "^5.0.0",
"react-tiny-popover": "^6.0.5",
"react-toastify": "^8.1.0",
"sass": "^1.43.4",
"source-map-explorer": "^2.5.2",
"svgo": "^2.8.0",
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17",
"typescript": "^4.5.4",
"web-vitals": "^0.2.4"
Expand Down
6 changes: 6 additions & 0 deletions web/vtadmin/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
23 changes: 17 additions & 6 deletions web/vtadmin/src/api/http.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ import { rest } from 'msw';
import { setupServer } from 'msw/node';

import * as api from './http';
import { HTTP_RESPONSE_NOT_OK_ERROR, MALFORMED_HTTP_RESPONSE_ERROR } from '../errors/errorTypes';
import {
HttpFetchError,
HttpResponseNotOkError,
HTTP_RESPONSE_NOT_OK_ERROR,
MalformedHttpResponseError,
MALFORMED_HTTP_RESPONSE_ERROR,
} from '../errors/errorTypes';
import * as errorHandler from '../errors/errorHandler';

jest.mock('../errors/errorHandler');
Expand Down Expand Up @@ -111,7 +117,8 @@ describe('api/http', () => {

try {
await api.fetchTablets();
} catch (e) {
} catch (error) {
let e: HttpResponseNotOkError = error as HttpResponseNotOkError;
/* eslint-disable jest/no-conditional-expect */
expect(e.name).toEqual(HTTP_RESPONSE_NOT_OK_ERROR);
expect(e.message).toEqual('[status 500] /api/tablets: oh_no something went wrong');
Expand All @@ -135,7 +142,8 @@ describe('api/http', () => {

try {
await api.vtfetch(endpoint);
} catch (e) {
} catch (error) {
let e: MalformedHttpResponseError = error as MalformedHttpResponseError;
/* eslint-disable jest/no-conditional-expect */
expect(e.name).toEqual(MALFORMED_HTTP_RESPONSE_ERROR);
expect(e.message).toEqual('[status 504] /api/tablets: Unexpected token < in JSON at position 0');
Expand All @@ -154,7 +162,8 @@ describe('api/http', () => {

try {
await api.vtfetch(endpoint);
} catch (e) {
} catch (error) {
let e: MalformedHttpResponseError = error as MalformedHttpResponseError;
/* eslint-disable jest/no-conditional-expect */
expect(e.name).toEqual(MALFORMED_HTTP_RESPONSE_ERROR);
/* eslint-enable jest/no-conditional-expect */
Expand Down Expand Up @@ -207,7 +216,8 @@ describe('api/http', () => {

try {
await api.vtfetch(endpoint);
} catch (e) {
} catch (error) {
let e: HttpFetchError = error as HttpFetchError;
/* eslint-disable jest/no-conditional-expect */
expect(e.message).toEqual(
'Invalid fetch credentials property: nope. Must be undefined or one of omit, same-origin, include'
Expand Down Expand Up @@ -237,7 +247,8 @@ describe('api/http', () => {
extract: (res) => res.result.foos,
transform: (e) => null, // doesn't matter
});
} catch (e) {
} catch (error) {
let e: HttpFetchError = error as HttpFetchError;
/* eslint-disable jest/no-conditional-expect */
expect(e.message).toMatch('expected entities to be an array, got null');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable jest/no-conditional-expect */
/**
* Copyright 2021 The Vitess Authors.
*
Expand Down
2 changes: 1 addition & 1 deletion web/vtadmin/src/components/routes/Tablets.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('Tablets', () => {
test.each(tests.map(Object.values))(
'%s',
(name: string, filter: string, tablets: pb.Tablet[], expected: { [k: string]: unknown }[]) => {
const result = formatRows(tablets, filter);
const result = formatRows(tablets, [], filter);
expect(result).toMatchObject(expected);
}
);
Expand Down
1 change: 1 addition & 0 deletions web/vtadmin/src/hooks/api.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ describe('useWorkflow', () => {
);

// Execute a useWorkflows query to populate the query cache.
// eslint-disable-next-line testing-library/render-result-naming-convention
const useWorkflowsCall = renderHook(() => api.useWorkflows(), { wrapper });
await useWorkflowsCall.waitFor(() => useWorkflowsCall.result.current.isSuccess);

Expand Down
1 change: 1 addition & 0 deletions web/vtadmin/src/hooks/useURLPagination.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable jest/no-conditional-expect */
/**
* Copyright 2021 The Vitess Authors.
*
Expand Down
1 change: 1 addition & 0 deletions web/vtadmin/src/util/tabletDebugVars.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable jest/no-conditional-expect */
/**
* Copyright 2021 The Vitess Authors.
*
Expand Down
20 changes: 10 additions & 10 deletions web/vtadmin/src/util/tokenize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Token, tokenizeSearch, SearchToken } from './tokenize';
import { Token, tokenizeSearch, SearchToken, SearchTokenTypes } from './tokenize';

describe('tokenize', () => {
describe('tokenizeSearch', () => {
Expand All @@ -25,34 +25,34 @@ describe('tokenize', () => {
{
name: 'parses fuzzy strings',
input: 'hello',
expected: [{ type: 'fuzzy', value: 'hello' }],
expected: [{ type: SearchTokenTypes.FUZZY, value: 'hello' }],
},
{
name: 'parses exact strings',
input: '"hello"',
expected: [{ type: 'exact', value: 'hello' }],
expected: [{ type: SearchTokenTypes.EXACT, value: 'hello' }],
},
{
name: 'parses key/values',
input: 'hello:moon',
expected: [{ type: 'keyValue', key: 'hello', value: 'moon' }],
expected: [{ type: SearchTokenTypes.KEY_VALUE, key: 'hello', value: 'moon' }],
},
{
name: 'parses multiple tokens',
input: 'hello "moon" goodbye:world',
expected: [
{ type: 'fuzzy', value: 'hello' },
{ type: 'exact', value: 'moon' },
{ type: 'keyValue', key: 'goodbye', value: 'world' },
{ type: SearchTokenTypes.FUZZY, value: 'hello' },
{ type: SearchTokenTypes.EXACT, value: 'moon' },
{ type: SearchTokenTypes.KEY_VALUE, key: 'goodbye', value: 'world' },
],
},
{
name: 'parses numbers and symbols',
input: 'hello-123 "moon-456" goodbye:world-789',
expected: [
{ type: 'fuzzy', value: 'hello-123' },
{ type: 'exact', value: 'moon-456' },
{ type: 'keyValue', key: 'goodbye', value: 'world-789' },
{ type: SearchTokenTypes.FUZZY, value: 'hello-123' },
{ type: SearchTokenTypes.EXACT, value: 'moon-456' },
{ type: SearchTokenTypes.KEY_VALUE, key: 'goodbye', value: 'world-789' },
],
},
];
Expand Down
2 changes: 1 addition & 1 deletion web/vtadmin/src/util/tokenize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

interface Token {
export interface Token {
matches: string[];
token: string;
type: string;
Expand Down

0 comments on commit c2ba091

Please sign in to comment.