Skip to content

Commit

Permalink
Resolved a failing UT
Browse files Browse the repository at this point in the history
Signed-off-by: Kshitij Tandon <tandonks@amazon.com>
  • Loading branch information
tandonks committed Aug 28, 2024
1 parent b376363 commit 1bd9788
Showing 1 changed file with 20 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import UnsavedChangesBottomBar from "../../../../components/UnsavedChangesBottom
import { IndexForm } from "../../../../containers/IndexForm";
import { TABS_ENUM, tabs } from "../../constant";
import { getApplication, getNavigationUI, getUISettings } from "../../../../services/Services";
import { TopNavControlDescriptionData, TopNavControlLinkData } from "src/plugins/navigation/public";

export interface TemplateDetailProps {
templateName?: string;
Expand Down Expand Up @@ -201,17 +200,15 @@ const TemplateDetail = (props: TemplateDetailProps, ref: Ref<FieldInstance>) =>

const descriptionData = [
{
description: "Define an automated snapshot schedule and retention period with a snapshot policy.",
links: {
label: "Learn more",
href: coreServices.docLinks.links.opensearch.indexTemplates.base,
iconType: "popout",
iconSide: "right",
controlType: "link",
target: "_blank",
flush: "both",
} as TopNavControlLinkData,
} as TopNavControlDescriptionData,
renderComponent: (
<EuiText size="s" color="subdued">
Define an automated snapshot schedule and retention period with a snapshot policy.{" "}
<EuiLink external target="_blank" href={coreServices.docLinks.links.opensearch.indexTemplates.base}>
Learn more
</EuiLink>
</EuiText>
),
},
];

const HeaderRight = [
Expand All @@ -237,6 +234,7 @@ const TemplateDetail = (props: TemplateDetailProps, ref: Ref<FieldInstance>) =>
renderComponent: (
<EuiSmallButton
fill
style={{ marginRight: 20 }}
onClick={() => {
const showValue: TemplateItemRemote = {
...values,
Expand All @@ -250,13 +248,9 @@ const TemplateDetail = (props: TemplateDetailProps, ref: Ref<FieldInstance>) =>
width: 800,
},
"data-test-subj": "templateJSONDetailModal",
title: (
<EuiText size="s">
<h2>{values.name}</h2>
</EuiText>
),
title: values.name,
content: (
<EuiCodeBlock language="json" isCopyable fontSize="s">
<EuiCodeBlock language="json" isCopyable>
{JSON.stringify(showValue, null, 2)}
</EuiCodeBlock>
),
Expand Down Expand Up @@ -312,11 +306,7 @@ const TemplateDetail = (props: TemplateDetailProps, ref: Ref<FieldInstance>) =>
width: 800,
},
"data-test-subj": "templateJSONDetailModal",
title: (
<EuiText size="s">
<h2>{values.name}</h2>
</EuiText>
),
title: values.name,
content: (
<EuiCodeBlock language="json" isCopyable>
{JSON.stringify(showValue, null, 2)}
Expand Down Expand Up @@ -369,7 +359,7 @@ const TemplateDetail = (props: TemplateDetailProps, ref: Ref<FieldInstance>) =>
) : null}
{isEdit ? (
<>
<EuiTabs size="s">
<EuiTabs>
{tabs.map((item) => (
<EuiTab
onClick={() => {
Expand Down Expand Up @@ -400,19 +390,11 @@ const TemplateDetail = (props: TemplateDetailProps, ref: Ref<FieldInstance>) =>
) : null}
<ContentPanel
title={
isEdit && selectedTabId === TABS_ENUM.SUMMARY ? (
<EuiText size="s">
<h2>Preview template</h2>
</EuiText>
) : values._meta?.flow === FLOW_ENUM.COMPONENTS ? (
<EuiText size="s">
<h2>Override template definition</h2>
</EuiText>
) : (
<EuiText size="s">
<h2>Template definition</h2>
</EuiText>
)
isEdit && selectedTabId === TABS_ENUM.SUMMARY
? "Preview template"
: values._meta?.flow === FLOW_ENUM.COMPONENTS
? "Override template definition"
: "Template definition"
}
subTitleText={
(!isEdit || selectedTabId !== TABS_ENUM.SUMMARY) && values._meta?.flow === FLOW_ENUM.COMPONENTS
Expand Down Expand Up @@ -442,11 +424,7 @@ const TemplateDetail = (props: TemplateDetailProps, ref: Ref<FieldInstance>) =>
}}
maxWidth={false}
onClose={() => setPreviewFlyoutVisible(false)}
title={
<EuiText size="s">
<h2>Preview template</h2>
</EuiText>
}
title="Preview template"
content={<PreviewTemplate value={simulateField.getValues()} history={props.history} />}
/>
) : null}
Expand Down

0 comments on commit 1bd9788

Please sign in to comment.