Skip to content

Commit

Permalink
fix: preload data service
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksii Orel <[email protected]>
  • Loading branch information
olexii4 committed Oct 17, 2023
1 parent f799e06 commit 7a14a75
Show file tree
Hide file tree
Showing 27 changed files with 286 additions and 112 deletions.
8 changes: 4 additions & 4 deletions .deps/EXCLUDED/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This file contains a manual contribution to .deps/dev.md and it's needed because
| `@sigstore/[email protected]` | transitive dependency |
| `@sigstore/[email protected]` | transitive dependency |
| `@sigstore/[email protected]` | transitive dependency |
| `@testing-library/[email protected]` | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/@testing-library/dom/7.31.2] |
| `@testing-library/[email protected]` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/@testing-library/dom/7.31.2) |
| `@typescript-eslint/[email protected]` | transitive dependency |
| `@typescript-eslint/[email protected]` | transitive dependency |
| `@typescript-eslint/[email protected]` | transitive dependency |
Expand All @@ -28,14 +28,14 @@ This file contains a manual contribution to .deps/dev.md and it's needed because
| `[email protected]` | transitive dependency |
| `[email protected]` | transitive dependency |
| `[email protected]` | transitive dependency |
| `[email protected]` | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/-/eslint-config-prettier/9.0.0] |
| `[email protected]` | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/-/eslint/8.47.0] |
| `[email protected]` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/eslint-config-prettier/9.0.0) |
| `[email protected]` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/eslint/8.47.0) |
| `[email protected]` | transitive dependency |
| `[email protected]` | transitive dependency |
| `[email protected]` | transitive dependency |
| `[email protected]` | transitive dependency |
| `[email protected]` | transitive dependency |
| `[email protected]` | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/-/prettier/3.0.2] |
| `[email protected]` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/prettier/3.0.2) |
| `[email protected]` | transitive dependency |
| `[email protected]` | transitive dependency |
| `[email protected]` | transitive dependency |
Expand Down
14 changes: 7 additions & 7 deletions .deps/EXCLUDED/prod.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ This file lists dependencies that do not need CQs or auto-detection does not wor

| Packages | Resolved CQs |
| --- | --- |
| `@patternfly/[email protected]` | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/@patternfly/react-core/4.276.11] |
| `@patternfly/[email protected]` | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/@patternfly/react-icons/4.93.7] |
| `[email protected]` | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/-/blueimp-md5/2.19.0] |
| `[email protected]` | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/-/codemirror/5.65.15] |
| `[email protected]` | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/-/fast-uri/2.2.0] |
| `[email protected]` | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/-/fastify/4.21.0] |
| `[email protected]` | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/-/real-require/0.2.0] |
| `@patternfly/[email protected]` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/@patternfly/react-core/4.276.11) |
| `@patternfly/[email protected]` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/@patternfly/react-icons/4.93.7) |
| `[email protected]` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/blueimp-md5/2.19.0) |
| `[email protected]` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/codemirror/5.65.15) |
| `[email protected]` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/fast-uri/2.2.0) |
| `[email protected]` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/fastify/4.21.0) |
| `[email protected]` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/real-require/0.2.0) |
12 changes: 6 additions & 6 deletions .deps/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
| [`@sinclair/[email protected]`](https://github.com/sinclairzx81/typebox) | MIT | clearlydefined |
| [`@sinonjs/[email protected]`](git+https://github.com/sinonjs/commons.git) | BSD-3-Clause | clearlydefined |
| [`@sinonjs/[email protected]`](https://github.com/sinonjs/fake-timers.git) | BSD-3-Clause | #9214 |
| [`@testing-library/[email protected]`](https://github.com/testing-library/dom-testing-library) | MIT | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/@testing-library/dom/7.31.2] |
| [`@testing-library/[email protected]`](https://github.com/testing-library/dom-testing-library) | MIT | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/@testing-library/dom/7.31.2) |
| [`@testing-library/[email protected]`](https://github.com/testing-library/jest-dom) | MIT | clearlydefined |
| [`@testing-library/[email protected]`](https://github.com/testing-library/react-testing-library) | MIT | clearlydefined |
| [`@testing-library/[email protected]`](https://github.com/testing-library/user-event) | MIT | clearlydefined |
Expand Down Expand Up @@ -171,7 +171,7 @@
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | #4131 |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | clearlydefined |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | #10839 |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | clearlydefined |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | #11004 |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | #10792 |
| [`@types/[email protected]`](https://www.github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | clearlydefined |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | clearlydefined |
Expand Down Expand Up @@ -399,7 +399,7 @@
| [`[email protected]`](git://github.com/ljharb/es-to-primitive.git) | MIT | clearlydefined |
| [`[email protected]`](https://github.com/lukeed/escalade.git) | MIT | clearlydefined |
| [`[email protected]`](http://github.com/estools/escodegen.git) | BSD-2-Clause | #9306 |
| [`[email protected]`](https://github.com/prettier/eslint-config-prettier.git) | MIT | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/-/eslint-config-prettier/9.0.0] |
| [`[email protected]`](https://github.com/prettier/eslint-config-prettier.git) | MIT | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/eslint-config-prettier/9.0.0) |
| [`[email protected]`](https://github.com/import-js/eslint-plugin-import) | MIT | #9923 |
| [`[email protected]`](git+https://github.com/import-js/eslint-plugin-import.git) | MIT | #8209 |
| [`[email protected]`](https://github.com/import-js/eslint-plugin-import) | MIT | #9927 |
Expand All @@ -412,7 +412,7 @@
| [`[email protected]`](https://github.com/eslint/eslint-scope.git) | BSD-2-Clause | clearlydefined |
| [`[email protected]`](https://github.com/eslint/eslint-visitor-keys.git) | Apache-2.0 | #7729 |
| [`[email protected]`](https://github.com/webpack-contrib/eslint-webpack-plugin.git) | MIT | clearlydefined |
| [`[email protected]`](https://github.com/eslint/eslint.git) | MIT | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/-/eslint/8.47.0] |
| [`[email protected]`](https://github.com/eslint/eslint.git) | MIT | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/eslint/8.47.0) |
| [`[email protected]`](https://github.com/eslint/espree.git) | BSD-2-Clause | #9308 |
| [`[email protected]`](https://github.com/jquery/esprima.git) | BSD-2-Clause | #995 |
| [`[email protected]`](https://github.com/estools/esquery.git) | BSD-3-Clause | #7469 |
Expand Down Expand Up @@ -653,7 +653,7 @@
| `[email protected]` | ISC | clearlydefined |
| [`[email protected]`](git+https://github.com/isaacs/minipass-sized.git) | ISC | clearlydefined |
| [`[email protected]`](git+https://github.com/isaacs/mkdirp-infer-owner) | ISC | clearlydefined |
| [`mock-socket@9.2.1`](https://github.com/thoov/mock-socket.git) | MIT | clearlydefined |
| [`mock-socket@9.3.1`](https://github.com/thoov/mock-socket.git) | MIT | clearlydefined |
| [`[email protected]`](https://github.com/sindresorhus/modify-values.git) | MIT | clearlydefined |
| [`[email protected]`](https://github.com/lukeed/mrmime.git) | MIT | clearlydefined |
| [`[email protected]`](https://github.com/vercel/ms.git) | MIT | #5895 |
Expand Down Expand Up @@ -764,7 +764,7 @@
| [`[email protected]`](https://github.com/TrySound/postcss-value-parser.git) | MIT | clearlydefined |
| [`[email protected]`](git://github.com/gkz/prelude-ls.git) | MIT | clearlydefined |
| [`[email protected]`](git+https://github.com/prettier/prettier-linter-helpers.git) | MIT | clearlydefined |
| [`[email protected]`](https://github.com/prettier/prettier.git) | MIT | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/-/prettier/3.0.2] |
| [`[email protected]`](https://github.com/prettier/prettier.git) | MIT | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/prettier/3.0.2) |
| [`[email protected]`](https://github.com/AriaMinaei/pretty-error.git) | MIT | clearlydefined |
| [`[email protected]`](https://github.com/jestjs/jest.git) | MIT | clearlydefined |
| [`[email protected]`](https://github.com/npm/proc-log.git) | ISC | clearlydefined |
Expand Down
18 changes: 9 additions & 9 deletions .deps/prod.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
| [`@hapi/[email protected]`](git://github.com/hapijs/wreck) | BSD-3-Clause | clearlydefined |
| [`@kubernetes/[email protected]`](https://github.com/kubernetes-client/javascript.git) | Apache-2.0 | clearlydefined |
| [`@lukeed/[email protected]`](https://github.com/lukeed/ms.git) | MIT | clearlydefined |
| [`@patternfly/[email protected]`](https://github.com/patternfly/patternfly-react.git) | MIT | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/@patternfly/react-core/4.276.11] |
| [`@patternfly/[email protected]`](https://github.com/patternfly/patternfly-react.git) | MIT | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/@patternfly/react-icons/4.93.7] |
| [`@patternfly/[email protected]`](https://github.com/patternfly/patternfly-react.git) | MIT | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/@patternfly/react-core/4.276.11) |
| [`@patternfly/[email protected]`](https://github.com/patternfly/patternfly-react.git) | MIT | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/@patternfly/react-icons/4.93.7) |
| `@patternfly/[email protected]` | MIT | clearlydefined |
| [`@patternfly/[email protected]`](https://github.com/patternfly/patternfly-react.git) | MIT | clearlydefined |
| [`@patternfly/[email protected]`](https://github.com/patternfly/patternfly-react.git) | MIT | clearlydefined |
Expand All @@ -46,7 +46,7 @@
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | clearlydefined |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | clearlydefined |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | clearlydefined |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | clearlydefined |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | #10970 |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | #8234 |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | clearlydefined |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | #7582 |
Expand Down Expand Up @@ -87,7 +87,7 @@
| [`[email protected]`](git://github.com/beatgammit/base64-js.git) | MIT | clearlydefined |
| [`[email protected]`](git://github.com/joyent/node-bcrypt-pbkdf.git) | BSD-3-Clause | #2725 |
| [`[email protected]`](git://github.com/petkaantonov/bluebird.git) | MIT | clearlydefined |
| [`[email protected]`](git://github.com/blueimp/JavaScript-MD5.git) | MIT | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/-/blueimp-md5/2.19.0] |
| [`[email protected]`](git://github.com/blueimp/JavaScript-MD5.git) | MIT | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/blueimp-md5/2.19.0) |
| [`[email protected]`]([email protected]:indutny/bn.js) | MIT | clearlydefined |
| [`[email protected]`](git://github.com/juliangruber/brace-expansion.git) | MIT | clearlydefined |
| [`[email protected]`]([email protected]:indutny/brorand) | MIT | clearlydefined |
Expand All @@ -106,7 +106,7 @@
| [`[email protected]`](https://github.com/chalk/chalk.git) | MIT | clearlydefined |
| [`[email protected]`](git://github.com/isaacs/chownr.git) | ISC | clearlydefined |
| [`[email protected]`](git+https://github.com/crypto-browserify/cipher-base.git) | MIT | clearlydefined |
| [`[email protected]`](https://github.com/codemirror/CodeMirror.git) | MIT | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/-/codemirror/5.65.15] |
| [`[email protected]`](https://github.com/codemirror/CodeMirror.git) | MIT | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/codemirror/5.65.15) |
| [`[email protected]`](https://github.com/Qix-/color-convert.git) | MIT | clearlydefined |
| [`[email protected]`]([email protected]:dfcreative/color-name.git) | MIT | clearlydefined |
| [`[email protected]`](git://github.com/felixge/node-combined-stream.git) | MIT | clearlydefined |
Expand Down Expand Up @@ -156,9 +156,9 @@
| [`[email protected]`](git+https://github.com/fastify/fast-json-stringify.git) | MIT | clearlydefined |
| [`[email protected]`](git+https://github.com/anonrig/fast-querystring.git) | MIT | clearlydefined |
| [`[email protected]`](git+https://github.com/davidmarkclements/fast-redact.git) | MIT | clearlydefined |
| [`[email protected]`](https://github.com/fastify/fast-uri) | MIT | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/-/fast-uri/2.2.0] |
| [`[email protected]`](https://github.com/fastify/fast-uri) | MIT | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/fast-uri/2.2.0) |
| [`[email protected]`](git+https://github.com/fastify/fastify-plugin.git) | MIT | clearlydefined |
| [`[email protected]`](git+https://github.com/fastify/fastify.git) | MIT | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/-/fastify/4.21.0] |
| [`[email protected]`](git+https://github.com/fastify/fastify.git) | MIT | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/fastify/4.21.0) |
| [`[email protected]`](git+https://github.com/mcollina/fastq.git) | ISC | #6021 |
| [`[email protected]`](https://github.com/react-dropzone/file-selector.git) | MIT | [CQ22350](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=22350) |
| [`[email protected]`](git+https://github.com/delvedor/find-my-way.git) | MIT | clearlydefined |
Expand All @@ -170,7 +170,7 @@
| [`[email protected]`](https://github.com/jprichardson/node-fs-extra) | MIT | #5742 |
| [`[email protected]`](git+https://github.com/npm/fs-minipass.git) | ISC | clearlydefined |
| [`[email protected]`](git+https://github.com/isaacs/fs.realpath.git) | ISC | clearlydefined |
| [`[email protected]`](git://github.com/Raynos/function-bind.git) | MIT | clearlydefined |
| [`[email protected]`](git://github.com/Raynos/function-bind.git) | MIT | #11063 |
| [`[email protected]`](git+https://github.com/ljharb/get-intrinsic.git) | MIT | #8453 |
| [`[email protected]`](https://github.com/arekinath/node-getpass.git) | MIT | clearlydefined |
| [`[email protected]`](git://github.com/isaacs/node-glob.git) | ISC | #7145 |
Expand Down Expand Up @@ -303,7 +303,7 @@
| [`[email protected]`](https://github.com/ReactTooltip/react-tooltip) | MIT | #5006 |
| [`[email protected]`](git+https://github.com/facebook/react.git) | MIT | clearlydefined |
| [`[email protected]`](git://github.com/nodejs/readable-stream) | MIT | [CQ22627](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=22627) |
| [`[email protected]`](git+https://github.com/pinojs/real-require.git) | MIT | (clearlydefined)[https://clearlydefined.io/definitions/npm/npmjs/-/real-require/0.2.0] |
| [`[email protected]`](git+https://github.com/pinojs/real-require.git) | MIT | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/real-require/0.2.0) |
| [`[email protected]`](git+https://github.com/pladaria/reconnecting-websocket.git) | MIT | #940 |
| [`[email protected]`](https://github.com/reduxjs/redux-thunk.git) | MIT | clearlydefined |
| [`[email protected]`](https://github.com/reduxjs/redux.git) | MIT | #7046 |
Expand Down
2 changes: 1 addition & 1 deletion packages/dashboard-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"identity-obj-proxy": "^3.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.6.4",
"jest-websocket-mock": "^2.4.1",
"jest-websocket-mock": "2.4.1",
"loader-utils": "^3.2.1",
"mini-css-extract-plugin": "^2.7.6",
"null-loader": "^4.0.1",
Expand Down
7 changes: 4 additions & 3 deletions packages/dashboard-frontend/src/services/assets/branding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
* Red Hat, Inc. - initial API and implementation
*/

import axios from 'axios';
import { BrandingData } from '../bootstrap/branding.constant';
import { getAxiosInstance } from '@/services/axios-wrapper/getAxiosInstance';
import { BrandingData } from '@/services/bootstrap/branding.constant';

export async function fetchBranding(url: string): Promise<BrandingData> {
const axiosInstance = getAxiosInstance();
try {
const response = await axios.get<BrandingData>(url);
const response = await axiosInstance.get<BrandingData>(url);
return response.data;
} catch (e) {
throw new Error(`Failed to fetch branding data by URL: ${url}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import mockAxios, { AxiosInstance } from 'axios';
import {
AxiosWrapper,
bearerTokenAuthorizationIsRequiredErrorMsg,
} from '@/services/backend-client/axiosWrapper';
} from '@/services/axios-wrapper/axiosWrapper';

// mute console logs
console.log = jest.fn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
* Red Hat, Inc. - initial API and implementation
*/

import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';

import { getAxiosInstance } from '@/services/axios-wrapper/getAxiosInstance';
import { delay } from '@/services/helpers/delay';

type AxiosFunc = (url: string, config?: AxiosRequestConfig) => Promise<any>;
Expand All @@ -31,11 +32,11 @@ export class AxiosWrapper {
}

static createToRetryMissedBearerTokenError(): AxiosWrapper {
return new AxiosWrapper(axios.create(), bearerTokenAuthorizationIsRequiredErrorMsg);
return new AxiosWrapper(getAxiosInstance(), bearerTokenAuthorizationIsRequiredErrorMsg);
}

static createToRetryAnyErrors(): AxiosWrapper {
return new AxiosWrapper(axios.create());
return new AxiosWrapper(getAxiosInstance());
}

get<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright (c) 2018-2023 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/

import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';

export function getAxiosInstance(config: AxiosRequestConfig = {}): AxiosInstance {
if (!config.timeout) {
config.timeout = 5000;
}
return axios.create(config);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { api, helpers } from '@eclipse-che/common';
import axios from 'axios';
import { JSONSchema7 } from 'json-schema';

import { AxiosWrapper } from '@/services/backend-client/axiosWrapper';
import { AxiosWrapper } from '@/services/axios-wrapper/axiosWrapper';
import { dashboardBackendPrefix } from '@/services/backend-client/const';
import devfileApi, { IDevWorkspacesList } from '@/services/devfileApi';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import common, { api } from '@eclipse-che/common';

import { AxiosWrapper } from '@/services/backend-client/axiosWrapper';
import { AxiosWrapper } from '@/services/axios-wrapper/axiosWrapper';
import { dashboardBackendPrefix } from '@/services/backend-client/const';
import devfileApi from '@/services/devfileApi';

Expand Down
Loading

0 comments on commit 7a14a75

Please sign in to comment.