Skip to content

Commit

Permalink
Token insights - remove MyDistribution query, drop synclist url
Browse files Browse the repository at this point in the history
reverts ansible#4198 / reapplies ansible#3708, ansible#3346, ansible#3893

(AAP 2.3 is EOL, no need to support it on cloud)

keep 2.4 synclist deprecation notice
  • Loading branch information
himdel committed May 31, 2024
1 parent 9ef597b commit 88e9856
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 59 deletions.
1 change: 0 additions & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
7 changes: 0 additions & 7 deletions src/api/my-distribution.ts

This file was deleted.

53 changes: 2 additions & 51 deletions src/containers/token/token-insights.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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;
Expand All @@ -44,14 +36,12 @@ class TokenInsights extends Component<RouteProps, IState> {

this.state = {
alerts: [],
synclistBasePath: null,
tokenData: null,
};
}

componentDidMount() {
this.getTokenData();
this.getSynclistBasePath();
}

getTokenData() {
Expand All @@ -67,34 +57,8 @@ class TokenInsights extends Component<RouteProps, IState> {
.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`;
Expand Down Expand Up @@ -200,21 +164,8 @@ class TokenInsights extends Component<RouteProps, IState> {
Synclists are deprecated in AAP 2.4 and will be removed in a
future release, use client-side <code>requirements.yml</code>{' '}
instead.
<br />
If you&apos;re using sync toggles with AAP 2.3 or older, you
will need to use a different URL:
</Trans>
</p>
{synclistBasePath ? (
<CopyURL url={getRepoURL(synclistBasePath)} />
) : (
<Alert
variant='danger'
isInline
title={t`Synclist distribution was not found.`}
className='hub-content-alert-fix'
/>
)}
</section>
<section className='body'>
<h2>{t`SSO URL`}</h2>
Expand Down

0 comments on commit 88e9856

Please sign in to comment.