Skip to content

Commit

Permalink
fix: Removed unused axios package (#4628)
Browse files Browse the repository at this point in the history
* fix: Removed unused axios package

Signed-off-by: Hrishav <[email protected]>

* chore: Added trivyignore file

Signed-off-by: Hrishav <[email protected]>

---------

Signed-off-by: Hrishav <[email protected]>
Co-authored-by: Namkyu Park <[email protected]>
  • Loading branch information
hrishavjha and namkyu1999 authored May 15, 2024
1 parent effdddf commit bd6c3cd
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 97 deletions.
2 changes: 2 additions & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Accept the risk (RedHat)
CVE-2024-2961
1 change: 0 additions & 1 deletion chaoscenter/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
"@visx/visx": "^2.18.0",
"ajv": "^8.12.0",
"anser": "2.0.1",
"axios": "^0.28.0",
"classnames": "^2.2.6",
"clipboard-copy": "^3.1.0",
"cron-parser": "^4.6.0",
Expand Down
24 changes: 0 additions & 24 deletions chaoscenter/web/src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import type {
SubscriptionResult,
LazyQueryHookOptions
} from '@apollo/client';
import type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';
import type { SWRConfiguration, SWRResponse } from 'swr';
import type { Identifiers } from './entities';

// GraphQL types
Expand Down Expand Up @@ -45,25 +43,3 @@ export type GqlAPISubscriptionRequest<TData, TVariables = OperationVariables> =
Omit<SubscriptionHookOptions<TData, TVariables>, 'variables'>;

export type GqlAPISubscriptionResponse<TData, TVariables = OperationVariables> = SubscriptionResult<TData, TVariables>;

// REST types
export type GetRequest = AxiosRequestConfig | null;

export interface Return<Data, Error>
extends Pick<SWRResponse<AxiosResponse<Data>, AxiosError<Error>>, 'isValidating' | 'error' | 'mutate'> {
data: Data | undefined;
loading: boolean;
response: AxiosResponse<Data> | undefined;
}

export interface Config<Data = unknown, Error = unknown>
extends Omit<SWRConfiguration<AxiosResponse<Data>, AxiosError<Error>>, 'fallbackData'> {
fallbackData?: Data;
}

export interface RestAPIResponse<Data> extends Omit<Partial<Return<Data, unknown>>, 'loading'> {
loading: boolean;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type RestError<T = unknown, D = any> = AxiosError<T, D> | undefined;
43 changes: 0 additions & 43 deletions chaoscenter/web/src/api/useRequest.ts

This file was deleted.

12 changes: 7 additions & 5 deletions chaoscenter/web/src/controllers/APITokens/APITokens.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useToaster } from '@harnessio/uicore';
import ApiTokensView from '@views/ApiTokens';
import { GetApiTokensResponse, useGetApiTokensQuery } from '@api/auth';
import { useGetApiTokensQuery } from '@api/auth';
import { getUserDetails } from '@utils';

interface APITokensControllerProps {
Expand All @@ -12,17 +12,19 @@ export default function APITokensController(props: APITokensControllerProps): Re
const { setApiTokensCount } = props;
const { showError } = useToaster();
const { accountID } = getUserDetails();
const [apiTokenData, setApiTokenData] = React.useState<GetApiTokensResponse | undefined>(undefined);

const { isLoading: apiTokensLoading, refetch: apiTokensRefetch } = useGetApiTokensQuery(
const {
data: apiTokenData,
isLoading: apiTokensLoading,
refetch: apiTokensRefetch
} = useGetApiTokensQuery(
{ user_id: accountID },
{
onError: error => {
showError(error.error);
},
onSuccess: data => {
setApiTokenData(data);
setApiTokensCount(data.apiTokens.length);
setApiTokensCount(data?.apiTokens?.length ?? 0);
}
}
);
Expand Down
25 changes: 1 addition & 24 deletions chaoscenter/web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2503,15 +2503,6 @@ atob@^2.1.2:
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==

axios@^0.28.0:
version "0.28.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.28.0.tgz#801a4d991d0404961bccef46800e1170f8278c89"
integrity sha512-Tu7NYoGY4Yoc7I+Npf9HhUMtEEpV7ZiLH9yndTCoNhcpBH0kwcvFbzYN9/u5QKI5A6uefjsNNWaz5olJVYS62Q==
dependencies:
follow-redirects "^1.15.0"
form-data "^4.0.0"
proxy-from-env "^1.1.0"

babel-jest@^27.5.1:
version "27.5.1"
resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-27.5.1.tgz#a1bf8d61928edfefd21da27eb86a695bfd691444"
Expand Down Expand Up @@ -4324,7 +4315,7 @@ flatted@^3.2.9:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a"
integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==

follow-redirects@^1.0.0, follow-redirects@^1.15.0:
follow-redirects@^1.0.0:
version "1.15.6"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b"
integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==
Expand Down Expand Up @@ -4357,15 +4348,6 @@ form-data@^3.0.0:
combined-stream "^1.0.8"
mime-types "^2.1.12"

form-data@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.8"
mime-types "^2.1.12"

formdata-polyfill@^4.0.10:
version "4.0.10"
resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423"
Expand Down Expand Up @@ -6900,11 +6882,6 @@ proxy-addr@~2.0.7:
forwarded "0.2.0"
ipaddr.js "1.9.1"

proxy-from-env@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==

ps-tree@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/ps-tree/-/ps-tree-1.2.0.tgz#5e7425b89508736cdd4f2224d028f7bb3f722ebd"
Expand Down

0 comments on commit bd6c3cd

Please sign in to comment.