Skip to content

Commit

Permalink
Add subscriptionPath option for WfoRelatedSubscriptions, WfoSubscript…
Browse files Browse the repository at this point in the history
…ionDetailTree (#1627)
  • Loading branch information
Georgi2704 authored Dec 12, 2024
1 parent 2fdb27a commit c7eaf69
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/thick-melons-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@orchestrator-ui/orchestrator-ui-components': minor
---

1620 Add subscriptionPath option for WfoRelatedSubscriptions, WfoSubscriptionDetailTree
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ export type RelatedSubscriptionListItem = Pick<

interface WfoRelatedSubscriptionsProps {
subscriptionId: string;
subscriptionPath?: string;
}

export const WfoRelatedSubscriptions = ({
subscriptionId,
subscriptionPath = PATH_SUBSCRIPTIONS,
}: WfoRelatedSubscriptionsProps) => {
const [hideTerminatedSubscriptions, setHideTerminatedSubscriptions] =
useState<boolean>(true);
Expand Down Expand Up @@ -109,7 +111,7 @@ export const WfoRelatedSubscriptions = ({
renderData: (value, record) => (
<Link
target="_blank"
href={`${PATH_SUBSCRIPTIONS}/${record.subscriptionId}`}
href={`${subscriptionPath}/${record.subscriptionId}`}
>
{value}
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTranslations } from 'next-intl';

import { EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';

import { WfoLoading, WfoTextAnchor } from '@/components';
import { PATH_SUBSCRIPTIONS, WfoLoading, WfoTextAnchor } from '@/components';
import { TreeContext, TreeContextType } from '@/contexts';
import { useOrchestratorTheme, useWithOrchestratorTheme } from '@/hooks';
import {
Expand All @@ -24,11 +24,13 @@ import { getProductBlockTitle } from './utils';
interface WfoSubscriptionDetailTreeProps {
productBlockInstances: ProductBlockInstance[];
subscriptionId: Subscription['subscriptionId'];
subscriptionPath?: string;
}

export const WfoSubscriptionDetailTree = ({
productBlockInstances,
subscriptionId,
subscriptionPath = PATH_SUBSCRIPTIONS,
}: WfoSubscriptionDetailTreeProps) => {
const t = useTranslations('subscriptions.detail');
const { theme } = useOrchestratorTheme();
Expand Down Expand Up @@ -210,6 +212,7 @@ export const WfoSubscriptionDetailTree = ({
key={id}
subscriptionId={subscriptionId}
productBlock={block}
subscriptionPath={subscriptionPath}
/>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ import {
EuiText,
} from '@elastic/eui';

import {
PATH_SUBSCRIPTIONS,
WfoProductBlockKeyValueRow,
WfoValueCell,
} from '@/components';
import { WfoProductBlockKeyValueRow, WfoValueCell } from '@/components';
import { useWithOrchestratorTheme } from '@/hooks';
import { ProductBlockInstance, Subscription } from '@/types';
import { getFirstUuidPart } from '@/utils';
Expand All @@ -32,13 +28,15 @@ import { getStyles } from './styles';
interface WfoSubscriptionProductBlockProps {
productBlock: ProductBlockInstance;
subscriptionId: Subscription['subscriptionId'];
subscriptionPath: string;
}

export const HIDDEN_KEYS = ['title', 'name', 'label', 'inUseByIds'];

export const WfoSubscriptionProductBlock = ({
productBlock,
subscriptionId,
subscriptionPath,
}: WfoSubscriptionProductBlockProps) => {
const t = useTranslations('subscriptions.detail');
const {
Expand Down Expand Up @@ -139,7 +137,7 @@ export const WfoSubscriptionProductBlock = ({
value={
<>
<a
href={`${PATH_SUBSCRIPTIONS}/${ownerSubscriptionId}`}
href={`${subscriptionPath}/${ownerSubscriptionId}`}
target="_blank"
>
{
Expand Down

0 comments on commit c7eaf69

Please sign in to comment.