Skip to content

Commit

Permalink
MGDCTRS-1926 chore: replace type references
Browse files Browse the repository at this point in the history
This change removes the remaining references to app-services-ui-shared
from the code as well as from the webpack config.  The entry in
package.json remains however as app-services-ui-components also has a
dependency on this package.
  • Loading branch information
gashcrumb committed Apr 7, 2023
1 parent 34c8144 commit 3512fcb
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 54 deletions.
3 changes: 1 addition & 2 deletions src/apis/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import _ from 'lodash';

import { Sender } from 'xstate';

import { KafkaInstance } from '@rhoas/app-services-ui-shared';
import {
Channel,
Configuration,
Expand Down Expand Up @@ -745,7 +744,7 @@ export const getKafkaInstanceById = ({
accessToken,
kafkaManagementBasePath,
KafkaInstanceId,
}: KafkaInstanceDetailProps): FetchCallbacks<KafkaInstance> => {
}: KafkaInstanceDetailProps): FetchCallbacks<KafkaRequest> => {
const connectorsAPI = new DefaultApi(
new Configuration({
accessToken,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import {
} from '@patternfly/react-icons';

import { useTranslation } from '@rhoas/app-services-ui-components';
import { KafkaInstance } from '@rhoas/app-services-ui-shared';
import { ConnectorNamespace } from '@rhoas/connector-management-sdk';
import { KafkaRequest } from '@rhoas/kafka-management-sdk';

import './ConnectorInfoTextList.css';

Expand All @@ -30,7 +30,7 @@ export type ConnectorInfoTextListProps = {
id: string;
type?: string;
bootstrapServer: string;
kafkaInstanceData: string | KafkaInstance | ReactNode;
kafkaInstanceData: string | KafkaRequest | ReactNode;
owner: string;
namespaceData: ConnectorNamespace | ReactNode;
createdAt: Date;
Expand Down Expand Up @@ -64,7 +64,7 @@ export const ConnectorInfoTextList: FunctionComponent<

const textListItem: (
title: string,
value?: string | KafkaInstance | ReactNode
value?: string | KafkaRequest | ReactNode
) => ReactNode = (title, value?) => (
<>
{value && (
Expand All @@ -76,19 +76,19 @@ export const ConnectorInfoTextList: FunctionComponent<
{(() => {
switch (title) {
case t('kafkaInstance'):
return (value as KafkaInstance)?.name ? (
return (value as KafkaRequest)?.name ? (
<Button
className="pf-u-p-0"
variant="link"
onClick={() => {
window.open(
'https://console.redhat.com/application-services/streams/kafkas/' +
(value as KafkaInstance).id,
(value as KafkaRequest).id,
'_blank'
);
}}
>
{(value as KafkaInstance).name}
{(value as KafkaRequest).name}
</Button>
) : typeof value === 'string' ? (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
import { KeyIcon, HelpIcon } from '@patternfly/react-icons';

import { useTranslation } from '@rhoas/app-services-ui-components';
import { ServiceAccount } from '@rhoas/app-services-ui-shared';
import { ServiceAccount } from '@rhoas/connector-management-sdk';

type CreateServiceAccountProps = {
isOpen: boolean;
Expand Down
37 changes: 12 additions & 25 deletions src/app/pages/ConnectorDetailsPage/ConnectorDetailsPage.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { rest } from 'msw';
import React from 'react';
import { MemoryRouter as Router, Route } from 'react-router-dom';

import { ConfigContext } from '@rhoas/app-services-ui-shared';

import { CosContextProvider } from '../../../hooks/useCos';
import { AlertsProvider } from '../../components/Alerts/Alerts';
import { ConnectorDetailsPage } from './ConnectorDetailsPage';
Expand Down Expand Up @@ -142,30 +140,19 @@ export default {
component: ConnectorDetailsPage,
decorators: [
(Story) => (
<ConfigContext.Provider
value={
{
cos: {
apiBasePath: API_BASE,
configurators: {},
},
} as any
}
<CosContextProvider
getToken={() => Promise.resolve('')}
connectorsApiBasePath={API_BASE}
kafkaManagementApiBasePath={API_BASE}
>
<CosContextProvider
getToken={() => Promise.resolve('')}
connectorsApiBasePath={API_BASE}
kafkaManagementApiBasePath={API_BASE}
>
<Router initialEntries={[`/${CONNECTOR_ID}`]}>
<Route path="/:id">
<AlertsProvider>
<Story />
</AlertsProvider>
</Route>
</Router>
</CosContextProvider>
</ConfigContext.Provider>
<Router initialEntries={[`/${CONNECTOR_ID}`]}>
<Route path="/:id">
<AlertsProvider>
<Story />
</AlertsProvider>
</Route>
</Router>
</CosContextProvider>
),
],
args: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ import React, {
} from 'react';
import { useParams } from 'react-router-dom';

import { KafkaInstance } from '@rhoas/app-services-ui-shared';
import { Connector, ConnectorType } from '@rhoas/connector-management-sdk';
import { KafkaRequest } from '@rhoas/kafka-management-sdk';

type ConnectorDetailsPageContextType = {
connectorData?: Connector;
kafkaInstanceDetails: KafkaInstance | string;
kafkaInstanceDetails: KafkaRequest | string;
connectorTypeDetails?: ConnectorType;
fetchError: string | boolean;
setKafkaInstanceDetails: React.Dispatch<
React.SetStateAction<string | KafkaInstance>
React.SetStateAction<string | KafkaRequest>
>;
};

Expand All @@ -34,7 +34,7 @@ export const ConnectorDetailsPageProvider: FunctionComponent = ({
const { connectorsApiBasePath, getToken } = useCos();
const [connectorData, setConnectorData] = useState<Connector>();
const [kafkaInstanceDetails, setKafkaInstanceDetails] = useState<
KafkaInstance | string
KafkaRequest | string
>('');
const [connectorTypeDetails, setConnectorTypeDetails] =
useState<ConnectorType>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ import {
} from '@patternfly/react-core';

import { useTranslation } from '@rhoas/app-services-ui-components';
import { KafkaInstance } from '@rhoas/app-services-ui-shared';
import {
Connector,
ConnectorType,
ConnectorTypeAllOf,
} from '@rhoas/connector-management-sdk';
import { KafkaRequest } from '@rhoas/kafka-management-sdk';

import { CommonStep } from './CommonStep';
import { ConfigurationStep } from './ConfigurationStep';
Expand All @@ -53,7 +53,7 @@ export type ConfigurationTabProps = {
editMode: boolean;
updateEditMode: (editEnable: boolean) => void;
connectorData: Connector;
kafkaInstanceDetails: KafkaInstance | string;
kafkaInstanceDetails: KafkaRequest | string;
connectorTypeDetails: ConnectorType;
};
export type connector = {
Expand Down Expand Up @@ -380,7 +380,7 @@ export const ConfigurationTab: FC<ConfigurationTabProps> = ({
}
configuration={errHandlerConfiguration}
kafkaId={
(kafkaInstanceDetails as KafkaInstance)?.id || ''
(kafkaInstanceDetails as KafkaRequest)?.id || ''
}
changeIsValid={setIsEditValid}
onUpdateConfiguration={onUpdateConfiguration}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import {
} from '@patternfly/react-core';

import { useTranslation } from '@rhoas/app-services-ui-components';
import { KafkaInstance } from '@rhoas/app-services-ui-shared';
import { Connector, ConnectorNamespace } from '@rhoas/connector-management-sdk';
import { KafkaRequest } from '@rhoas/kafka-management-sdk';

export interface OverviewTabProps {
connectorData: Connector;
setKafkaInstanceDetails: React.Dispatch<
React.SetStateAction<string | KafkaInstance>
React.SetStateAction<string | KafkaRequest>
>;
onDuplicateConnector: (id: string) => void;
}
Expand All @@ -30,7 +30,7 @@ export const OverviewTab: FC<OverviewTabProps> = ({
}) => {
const [namespaceData, setNamespaceData] = useState<ConnectorNamespace>();
const [kafkaInstanceData, setKafkaInstanceData] = useState<
KafkaInstance | string
KafkaRequest | string
>('');

const { connectorsApiBasePath, kafkaManagementApiBasePath, getToken } =
Expand All @@ -43,7 +43,7 @@ export const OverviewTab: FC<OverviewTabProps> = ({
}, []);

const getKIData = useCallback((data) => {
setKafkaInstanceData(data as KafkaInstance);
setKafkaInstanceData(data as KafkaRequest);
}, []);

const onError = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
} from '@patternfly/react-core';

import { useTranslation } from '@rhoas/app-services-ui-components';
import { KafkaInstance } from '@rhoas/app-services-ui-shared';
import { ConnectorNamespace } from '@rhoas/connector-management-sdk';
import { KafkaRequest } from '@rhoas/kafka-management-sdk';

import { ConnectorInfoTextList } from '../../../../components/ConnectorInfoTextList/ConnectorInfoTextList';

Expand All @@ -25,7 +25,7 @@ export type ConnectorDrawerContentProps = {
errorStateMessage?: string;
id: string;
kafkaBootstrapServer: string;
kafkaInstanceData: string | KafkaInstance | ReactNode;
kafkaInstanceData: string | KafkaRequest | ReactNode;
modifiedAt: string;
name: string;
namespaceData: ConnectorNamespace | ReactNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import React, {
import { AlertVariant, Spinner } from '@patternfly/react-core';

import { useTranslation } from '@rhoas/app-services-ui-components';
import { KafkaInstance } from '@rhoas/app-services-ui-shared';
import { ConnectorNamespace } from '@rhoas/connector-management-sdk';
import { KafkaRequest } from '@rhoas/kafka-management-sdk';

import { ConnectorDrawerContent } from './ConnectorDrawerContent';

Expand Down Expand Up @@ -51,7 +51,7 @@ export const ConnectorDrawerData: FunctionComponent<
null
);
const [kafkaInstanceData, setKafkaInstanceData] = useState<
KafkaInstance | string
KafkaRequest | string
>('');

const { connectorsApiBasePath, kafkaManagementApiBasePath, getToken } =
Expand All @@ -64,7 +64,7 @@ export const ConnectorDrawerData: FunctionComponent<
}, []);

const getKIData = useCallback((data) => {
setKafkaInstanceData(data as KafkaInstance);
setKafkaInstanceData(data as KafkaRequest);
}, []);

const onError = useCallback(
Expand Down
4 changes: 0 additions & 4 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,6 @@ module.exports = (env, argv) => {
singleton: false, // consoledot needs this to be off to be able to upgrade the router to v6. We don't need this to be a singleton, so let's keep this off
requiredVersion: dependencies['react-router-dom'],
},
'@rhoas/app-services-ui-shared': {
singleton: true,
requiredVersion: dependencies['@rhoas/app-services-ui-shared'],
},
'@scalprum/react-core': { requiredVersion: '*', singleton: true },
'@patternfly/quickstarts': {
singleton: true,
Expand Down

0 comments on commit 3512fcb

Please sign in to comment.