From 88e98569a50c6ec50821f447a3767951a8110a69 Mon Sep 17 00:00:00 2001 From: Martin Hradil Date: Tue, 9 Jan 2024 22:19:52 +0000 Subject: [PATCH] Token insights - remove MyDistribution query, drop synclist url reverts #4198 / reapplies #3708, #3346, #3893 (AAP 2.3 is EOL, no need to support it on cloud) keep 2.4 synclist deprecation notice --- src/api/index.ts | 1 - src/api/my-distribution.ts | 7 ---- src/containers/token/token-insights.tsx | 53 +------------------------ 3 files changed, 2 insertions(+), 59 deletions(-) delete mode 100644 src/api/my-distribution.ts diff --git a/src/api/index.ts b/src/api/index.ts index 7c128e839c..f172509abd 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -24,7 +24,6 @@ export { LegacyImportAPI } from './legacy-import'; export { LegacyNamespaceAPI } from './legacy-namespace'; export { LegacyRoleAPI } from './legacy-role'; export { LegacySyncAPI } from './legacy-sync'; -export { MyDistributionAPI } from './my-distribution'; export { MyNamespaceAPI } from './my-namespace'; export { MySyncListAPI } from './my-synclist'; export { NamespaceAPI } from './namespace'; diff --git a/src/api/my-distribution.ts b/src/api/my-distribution.ts deleted file mode 100644 index 03f1fdecab..0000000000 --- a/src/api/my-distribution.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { HubAPI } from './hub'; - -class API extends HubAPI { - apiPath = '_ui/v1/my-distributions/'; -} - -export const MyDistributionAPI = new API(); diff --git a/src/containers/token/token-insights.tsx b/src/containers/token/token-insights.tsx index e3267c9d9d..2480483894 100644 --- a/src/containers/token/token-insights.tsx +++ b/src/containers/token/token-insights.tsx @@ -1,9 +1,7 @@ import { Trans, t } from '@lingui/macro'; import { Button } from '@patternfly/react-core'; import React, { Component } from 'react'; -import { MyDistributionAPI } from 'src/api'; import { - Alert, AlertList, type AlertType, BaseHeader, @@ -14,16 +12,10 @@ import { closeAlert, } from 'src/components'; import { AppContext } from 'src/loaders/app-context'; -import { - type RouteProps, - getRepoURL, - jsxErrorMessage, - withRouter, -} from 'src/utilities'; +import { type RouteProps, getRepoURL, withRouter } from 'src/utilities'; interface IState { alerts: AlertType[]; - synclistBasePath?: string; tokenData?: { access_token: string; expires_in: number; @@ -44,14 +36,12 @@ class TokenInsights extends Component { this.state = { alerts: [], - synclistBasePath: null, tokenData: null, }; } componentDidMount() { this.getTokenData(); - this.getSynclistBasePath(); } getTokenData() { @@ -67,34 +57,8 @@ class TokenInsights extends Component { .then(({ data: tokenData }) => this.setState({ tokenData })); } - getSynclistBasePath() { - MyDistributionAPI.list() - .then(({ data }) => { - const syncDistro = data.data.find(({ base_path }) => - base_path.includes('synclist'), - ); - this.setState({ - synclistBasePath: syncDistro?.base_path, - }); - }) - .catch((e) => { - const { status, statusText } = e.response; - this.setState({ - synclistBasePath: null, - alerts: [ - ...this.state.alerts, - { - variant: 'danger', - title: t`Server URL could not be displayed.`, - description: jsxErrorMessage(status, statusText), - }, - ], - }); - }); - } - render() { - const { alerts, synclistBasePath, tokenData } = this.state; + const { alerts, tokenData } = this.state; const renewTokenCmd = `curl https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token -d grant_type=refresh_token -d client_id="cloud-services" -d refresh_token="${ tokenData?.refresh_token ?? '{{ user_token }}' }" --fail --silent --show-error --output /dev/null`; @@ -200,21 +164,8 @@ class TokenInsights extends Component { Synclists are deprecated in AAP 2.4 and will be removed in a future release, use client-side requirements.yml{' '} instead. -
- If you're using sync toggles with AAP 2.3 or older, you - will need to use a different URL:

- {synclistBasePath ? ( - - ) : ( - - )}

{t`SSO URL`}