Skip to content

Commit

Permalink
279-subscription-general: PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben van Leeuwen committed Oct 9, 2023
1 parent 49a66ac commit 20787a6
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useOrchestratorTheme } from '../../hooks';

import { KeyValue, SubscriptionStatus } from '../../types';

export const RenderField = (
export const getRenderField = (
key: string,
value: unknown,
theme: EuiThemeComputed,
Expand Down Expand Up @@ -55,7 +55,7 @@ export const SubscriptionKeyValueBlock = ({
const subscriptionKeyValues: WFOKeyValueTableDataType[] = keyValues.map(
(keyValue) => ({
key: keyValue.key,
value: RenderField(keyValue.key, keyValue.value, theme),
value: getRenderField(keyValue.key, keyValue.value, theme),
}),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { SubscriptionTabIds, tabs } from './utils';

import { GET_SUBSCRIPTION_DETAIL_GRAPHQL_QUERY } from '../../graphqlQueries';
import { WFOLoading } from '../WFOLoading';
import { SubscriptionActions } from './SubscriptionActions';
import { SubscriptionGeneral } from './SubscriptionGeneral';
import { SubscriptionDetailTree } from './SubscriptionDetailTree';
import { WFOSubscriptionActions } from './WFOSubscriptionActions';
import { WFOSubscriptionGeneral } from './WFOSubscriptionGeneral';
import { WFOSubscriptionDetailTree } from './WFOSubscriptionDetailTree';
import { ProcessesTimeline } from './WFOProcessesTimeline';

type WFOSubscriptionProps = {
Expand Down Expand Up @@ -53,6 +53,7 @@ export const WFOSubscription = ({ subscriptionId }: WFOSubscriptionProps) => {
</EuiTab>
));

// Todo #97: Find out if pre fetch can be used again. The shape of table cache seems to have changed
const subscriptionResult =
data && data.subscriptions && data.subscriptions.page;
const subscriptionDetail = subscriptionResult
Expand All @@ -74,7 +75,7 @@ export const WFOSubscription = ({ subscriptionId }: WFOSubscriptionProps) => {
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<SubscriptionActions
<WFOSubscriptionActions
subscriptionId={subscriptionId}
/>
</EuiFlexItem>
Expand All @@ -84,13 +85,13 @@ export const WFOSubscription = ({ subscriptionId }: WFOSubscriptionProps) => {
</>

{selectedTabId === SubscriptionTabIds.GENERAL_TAB && (
<SubscriptionGeneral
<WFOSubscriptionGeneral
subscriptionDetail={subscriptionDetail}
/>
)}
{selectedTabId ===
SubscriptionTabIds.SERVICE_CONFIGURATION_TAB && (
<SubscriptionDetailTree
<WFOSubscriptionDetailTree
productBlockInstances={
subscriptionDetail.productBlockInstances
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ const MenuBlock: FC<MenuBlockProps> = ({ title }) => (
</EuiTitle>
);

export type SubscriptionActionsProps = {
export type WFOSubscriptionActionsProps = {
subscriptionId: string;
};

export const SubscriptionActions: FC<SubscriptionActionsProps> = ({
export const WFOSubscriptionActions: FC<WFOSubscriptionActionsProps> = ({
subscriptionId,
}) => {
const MenuItem: FC<MenuItemProps> = ({ icon, action, key }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ import {
getFieldFromProductBlockInstanceValues,
getProductBlockTitle,
} from './utils';
import { SubscriptionProductBlock } from './SubscriptionProductBlock';
import { WFOSubscriptionProductBlock } from './WFOSubscriptionProductBlock';

type NodeMap = { [key: number]: TreeBlock };

const MAX_EXPAND_ALL = 100;

interface SubscriptionDetailTreeProps {
interface WFOSubscriptionDetailTreeProps {
productBlockInstances: ProductBlockInstance[];
}

export const SubscriptionDetailTree = ({
export const WFOSubscriptionDetailTree = ({
productBlockInstances,
}: SubscriptionDetailTreeProps) => {
}: WFOSubscriptionDetailTreeProps) => {
const t = useTranslations('subscriptions.detail');
const [expandAllActive, setExpandAllActive] = useState(false);
const [, setSelectedTreeNode] = useState(-1);
Expand Down Expand Up @@ -151,7 +151,7 @@ export const SubscriptionDetailTree = ({
{selectedIds.length !== 0 &&
selectedIds.reverse().map((id, index) => {
return (
<SubscriptionProductBlock
<WFOSubscriptionProductBlock
key={index}
productBlockInstanceValues={
productBlockInstances[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { useTranslations } from 'next-intl';
import { SubscriptionKeyValueBlock } from './SubscriptionKeyValueBlock';
import { SubscriptionDetail, KeyValue } from '../../types';

interface SubscriptionGeneralProps {
interface WFOSubscriptionGeneralProps {
subscriptionDetail: SubscriptionDetail;
}

export const SubscriptionGeneral = ({
export const WFOSubscriptionGeneral = ({
subscriptionDetail,
}: SubscriptionGeneralProps) => {
}: WFOSubscriptionGeneralProps) => {
const t = useTranslations('subscriptions.detail');

const getSubscriptionDetailBlockData = (): KeyValue[] => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import { TreeContext, TreeContextType } from '../../contexts';
import { FieldValue } from '../../types';
import { getProductBlockTitle } from './utils';

interface SubscriptionProductBlock {
interface WFOSubscriptionProductBlockProps {
productBlockInstanceValues: FieldValue[];
id: number;
}

export const SubscriptionProductBlock = ({
export const WFOSubscriptionProductBlock = ({
productBlockInstanceValues,
id,
}: SubscriptionProductBlock) => {
}: WFOSubscriptionProductBlockProps) => {
const { toggleSelectedId } = React.useContext(
TreeContext,
) as TreeContextType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export * from './utils';
export * from './WFOProcessesTimeline';
export * from './SubscriptionProductBlock';
export * from './SubscriptionActions';
export * from './WFOSubscriptionProductBlock';
export * from './WFOSubscriptionActions';
export * from './SubscriptionKeyValueBlock';
export * from './SubscriptionDetailTree';
export * from './SubscriptionGeneral';
export * from './WFOSubscriptionDetailTree';
export * from './WFOSubscriptionGeneral';
export * from './WFOSubscription';
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import {
WFOTableControlColumnConfig,
WFOTableWithFilter,
} from '../WFOTable';
import { SubscriptionListItem } from '../../types';

import { SubscriptionListItem } from './mapGrapghQlSubscriptionsResultToSubscriptionListItems';
import { FilterQuery } from '../WFOFilterTabs';
import { DataDisplayParams } from '../../hooks/useDataDisplayParams';
import { useOrchestratorTheme } from '../../hooks/useOrchestratorTheme';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import { SubscriptionsResult, SubscriptionListItem } from '../../types';
import { SubscriptionsResult, Subscription } from '../../types';
import { parseDate } from '../../utils';

export type SubscriptionListItem = Pick<
Subscription,
'subscriptionId' | 'description' | 'status' | 'insync' | 'note'
> & {
startDate: Date | null;
endDate: Date | null;
productName: string;
tag: string | null;
};

export function mapGrapghQlSubscriptionsResultToSubscriptionListItems(
graphqlResponse: SubscriptionsResult,
): SubscriptionListItem[] {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { WFOFilterTab } from '../../components';
import { SubscriptionListItem } from '../../types';
import { SubscriptionListItem } from './mapGrapghQlSubscriptionsResultToSubscriptionListItems';

export enum WFOSubscriptionsTabType {
ACTIVE = 'ACTIVE',
TERMINATED = 'TERMINATED',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
WFOSubscriptionsList,
WFOSubscriptionsTabType,
} from '../../components/WFOSubscriptionsList';
import { SortOrder, SubscriptionListItem } from '../../types';

import { SortOrder } from '../../types';
import { SubscriptionListItem } from '../../components/WFOSubscriptionsList';
import { StoredTableConfig } from '../../components/WFOTable';
import { SUBSCRIPTIONS_TABLE_LOCAL_STORAGE_KEY } from '../../components/WFOTable';
import {
Expand Down
13 changes: 1 addition & 12 deletions packages/orchestrator-ui-components/src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,6 @@ export type Subscription = {
product: Pick<ProductDefinition, 'name' | 'tag' | 'productType'>;
};

export type SubscriptionListItem = Pick<
Subscription,
'subscriptionId' | 'description' | 'status' | 'insync' | 'note'
> & {
startDate: Date | null;
endDate: Date | null;
productName: string;
tag: string | null;
};

export type SubscriptionDetail = {
subscriptionId: string;
description: string;
Expand All @@ -381,6 +371,5 @@ export type SubscriptionDetail = {
export type ExternalService = {
externalServiceKey: string;
externalServiceId: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
externalServiceData: any;
externalServiceData: object;
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import {
ProductBlockDefinition,
ProductDefinition,
WorkflowDefinition,
SubscriptionListItem,
} from '../types';

import { SubscriptionListItem } from '../components/WFOSubscriptionsList';

import { ProcessListItem } from '../components/WFOProcessesList/WFOProcessList';

function getTableConfig<T>(
Expand Down

0 comments on commit 20787a6

Please sign in to comment.