Skip to content

Commit

Permalink
Making fit and finish changes for ISM policy & Composable template pa…
Browse files Browse the repository at this point in the history
…ges (#1150)

* Fit and finish changes ISM

Signed-off-by: Shubh Sahu <[email protected]>

* more fit changes

Signed-off-by: Shubh Sahu <[email protected]>

* final fit n finish changes

Signed-off-by: Shubh Sahu <[email protected]>

* final fit n finish changes

Signed-off-by: Shubh Sahu <[email protected]>

* few more small changes

Signed-off-by: Shubh Sahu <[email protected]>

* more fit changes

Signed-off-by: Shubh Sahu <[email protected]>

* final fit n finish changes

Signed-off-by: Shubh Sahu <[email protected]>

* final fitnfinsh changes complete

Signed-off-by: Shubh Sahu <[email protected]>

* adding plus icon

Signed-off-by: Shubh Sahu <[email protected]>

* rebaseing

Signed-off-by: Shubh Sahu <[email protected]>

* rebasing 2.0

Signed-off-by: Shubh Sahu <[email protected]>

---------

Signed-off-by: Shubh Sahu <[email protected]>
Co-authored-by: Shubh Sahu <[email protected]>
  • Loading branch information
astute-decipher and Shubh Sahu authored Sep 2, 2024
1 parent a7efceb commit 44260f6
Show file tree
Hide file tree
Showing 72 changed files with 2,867 additions and 2,564 deletions.
6 changes: 5 additions & 1 deletion public/components/BottomBar/BottomBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@ export default function BottomBar(props: CustomFormRowProps) {
};
}, []);

return <EuiBottomBar ref={bottomBarRef}>{props.children}</EuiBottomBar>;
return (
<EuiBottomBar ref={bottomBarRef} position="sticky">
{props.children}
</EuiBottomBar>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

exports[`<FormGenerator /> spec render the component 1`] = `
HTMLCollection [
<div />,
<div>
<section
aria-label="Page level controls"
class="euiBottomBar euiBottomBar--fixed euiBottomBar--paddingMedium"
class="euiBottomBar euiBottomBar--sticky euiBottomBar--paddingMedium"
>
<h2
class="euiScreenReaderOnly"
Expand Down
10 changes: 8 additions & 2 deletions public/components/CreatePolicyModal/CreatePolicyModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,20 @@ const CreatePolicyModal: React.SFC<CreatePolicyModalProps> = ({ isEdit = false,
// @ts-ignore */}
<EuiModal onCancel={onClose} onClose={onClose} maxWidth={600}>
<EuiModalHeader>
<EuiModalHeaderTitle>Configuration method</EuiModalHeaderTitle>
<EuiModalHeaderTitle>
<EuiText size="s">
<h2>Configuration method</h2>
</EuiText>
</EuiModalHeaderTitle>
</EuiModalHeader>

<EuiModalBody>
<EuiFlexGroup gutterSize="m" direction="column" style={{ margin: "-4px" }}>
<EuiFlexItem grow={false}>
<EuiText size="s" style={{ marginTop: 0 }}>
Choose how you would like to {isEdit ? "modify" : "define"} your policy, either using a visual editor or writing JSON.
<p>
Choose how you would like to {isEdit ? "modify" : "define"} your policy, either using a visual editor or writing JSON.
</p>
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ exports[`<CreatePolicyModal /> spec renders the component 1`] = `
<div
class="euiModalHeader__title"
>
Configuration method
<div
class="euiText euiText--small"
>
<h2>
Configuration method
</h2>
</div>
</div>
</div>
<div
Expand All @@ -55,9 +61,11 @@ exports[`<CreatePolicyModal /> spec renders the component 1`] = `
class="euiText euiText--small"
style="margin-top: 0px;"
>
Choose how you would like to
define
your policy, either using a visual editor or writing JSON.
<p>
Choose how you would like to
define
your policy, either using a visual editor or writing JSON.
</p>
</div>
</div>
<div
Expand Down Expand Up @@ -254,7 +262,13 @@ exports[`<CreatePolicyModal /> spec renders the component w/ edit 1`] = `
<div
class="euiModalHeader__title"
>
Configuration method
<div
class="euiText euiText--small"
>
<h2>
Configuration method
</h2>
</div>
</div>
</div>
<div
Expand All @@ -274,9 +288,11 @@ exports[`<CreatePolicyModal /> spec renders the component w/ edit 1`] = `
class="euiText euiText--small"
style="margin-top: 0px;"
>
Choose how you would like to
modify
your policy, either using a visual editor or writing JSON.
<p>
Choose how you would like to
modify
your policy, either using a visual editor or writing JSON.
</p>
</div>
</div>
<div
Expand Down
2 changes: 1 addition & 1 deletion public/components/IndexMapping/IndexMapping.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export * from "./helper";
export * from "./interfaces";

const IndexMapping = (
{ value: propsValue, onChange: propsOnChange, isEdit, oldValue, readonly, docVersion, useNewUx }: IndexMappingProps,
{ value: propsValue, onChange: propsOnChange, isEdit, oldValue, readonly, docVersion }: IndexMappingProps,
ref: Ref<IIndexMappingsRef>
) => {
const value = propsValue?.properties || [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,25 @@
*/

import React from "react";
import { render } from "@testing-library/react";
import { render, cleanup } from "@testing-library/react";
import UnsavedChangesBottomBar from "./index";

describe("<FormGenerator /> spec", () => {
let appWrapper: HTMLDivElement;

beforeEach(() => {
// Create a mock DOM element with the ID 'app-wrapper'
appWrapper = document.createElement("div");
appWrapper.setAttribute("id", "app-wrapper");
document.body.appendChild(appWrapper);
});

afterEach(() => {
// Clean up the mock DOM element after each test
document.body.removeChild(appWrapper);
cleanup();
});

it("render the component", () => {
render(<UnsavedChangesBottomBar unsavedCount={0} onClickCancel={async () => {}} onClickSubmit={async () => {}} />);
expect(document.body.children).toMatchSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { EuiButton, EuiFlexGroup, EuiFlexItem, EuiSmallButtonEmpty, EuiButtonPro
import classNames from "classnames";
import BottomBar from "../BottomBar";
import "./index.scss";
import { createPortal } from "react-dom";

export type CustomFormRowProps = {
unsavedCount: number;
Expand Down Expand Up @@ -67,7 +68,7 @@ export default function UnsavedChangesBottomBar(props: CustomFormRowProps) {
iconType="check"
color="primary"
fill
size="m"
size="s"
children="Save"
{...props.confirmButtonProps}
/>
Expand Down Expand Up @@ -116,9 +117,9 @@ export default function UnsavedChangesBottomBar(props: CustomFormRowProps) {
</>
));

return (
const bottomBar = (
<BottomBar>
<EuiFlexGroup alignItems="center">
<EuiFlexGroup alignItems="center" gutterSize="s" justifyContent="spaceBetween">
{renderProps({
renderCancel,
renderConfirm,
Expand All @@ -128,4 +129,6 @@ export default function UnsavedChangesBottomBar(props: CustomFormRowProps) {
</EuiFlexGroup>
</BottomBar>
);

return createPortal(bottomBar, document.getElementById("app-wrapper")!);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

exports[`<FormGenerator /> spec render the component 1`] = `
HTMLCollection [
<div />,
<div>
<div
id="app-wrapper"
>
<section
aria-label="Page level controls"
class="euiBottomBar euiBottomBar--fixed euiBottomBar--paddingMedium"
class="euiBottomBar euiBottomBar--sticky euiBottomBar--paddingMedium"
>
<h2
class="euiScreenReaderOnly"
>
Page level controls
</h2>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow euiFlexGroup--responsive"
class="euiFlexGroup euiFlexGroup--gutterSmall euiFlexGroup--alignItemsCenter euiFlexGroup--justifyContentSpaceBetween euiFlexGroup--directionRow euiFlexGroup--responsive"
>
<div
class="euiFlexItem euiFlexItem--flexGrowZero"
Expand All @@ -39,7 +40,7 @@ HTMLCollection [
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary euiButton--fill"
class="euiButton euiButton--primary euiButton--small euiButton--fill"
type="button"
>
<span
Expand All @@ -63,5 +64,6 @@ HTMLCollection [
There is a new region landmark with page level controls at the end of the document.
</p>
</div>,
<div />,
]
`;
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface SearchControlsProps {
selectedTypes: string[];
};
onSearchChange: (args: SearchControlsProps["value"]) => void;
useNewUx?: boolean;
}

export default function SearchControls(props: SearchControlsProps) {
Expand All @@ -29,10 +30,12 @@ export default function SearchControls(props: SearchControlsProps) {
useEffect(() => {
setState(props.value);
}, [props.value]);
const paddingStyle = props.useNewUx ? { padding: "0px 0px" } : { padding: "0px 5px" };
return (
<EuiFlexGroup style={{ padding: "0px 5px" }} alignItems="center">
<EuiFlexGroup gutterSize="s" alignItems="center" style={paddingStyle}>
<EuiFlexItem>
<EuiCompressedFieldSearch
autoFocus
fullWidth
placeholder="Search..."
value={state.search}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`<IndexControls /> spec renders the component 1`] = `
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow euiFlexGroup--responsive"
class="euiFlexGroup euiFlexGroup--gutterSmall euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow euiFlexGroup--responsive"
style="padding: 0px 5px;"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import {
EuiSmallButtonIcon,
EuiToolTip,
EuiBasicTableColumn,
EuiSpacer,
EuiPanel,
} from "@elastic/eui";
import { ContentPanel, ContentPanelActions } from "../../../../components/ContentPanel";
import { DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_QUERY_PARAMS } from "../../utils/constants";
Expand All @@ -42,7 +44,12 @@ import "./index.scss";
import { DataSourceMenuContext, DataSourceMenuProperties } from "../../../../services/DataSourceMenuContext";
import MDSEnabledComponent from "../../../../components/MDSEnabledComponent";
import { getApplication, getNavigationUI, getUISettings } from "../../../../services/Services";
import { TopNavControlButtonData, TopNavControlTextData } from "src/plugins/navigation/public";
import {
TopNavControlButtonData,
TopNavControlDescriptionData,
TopNavControlLinkData,
TopNavControlTextData,
} from "src/plugins/navigation/public";

interface ComposableTemplatesProps extends RouteComponentProps, DataSourceMenuProperties {
commonService: CommonService;
Expand Down Expand Up @@ -401,16 +408,18 @@ class ComposableTemplates extends MDSEnabledComponent<ComposableTemplatesProps,

const descriptionData = [
{
renderComponent: (
<EuiText size="s" color="subdued">
Component templates are reusable building blocks for composing index or data stream templates.
<br /> You can define component templates with common index configurations and associate them to an index template.{" "}
<EuiLink external target="_blank" href={(this.context as CoreStart).docLinks.links.opensearch.indexTemplates.composable}>
Learn more
</EuiLink>
</EuiText>
),
},
description:
"Component templates are reusable building blocks for composing index or data stream templates. You can define component templates with common index configurations and associate them to an index template.",
links: {
label: "Learn more",
href: (this.context as CoreStart).docLinks.links.opensearch.indexTemplates.composable,
iconType: "popout",
iconSide: "right",
controlType: "link",
target: "_blank",
flush: "both",
} as TopNavControlLinkData,
} as TopNavControlDescriptionData,
];

return useNewUX ? (
Expand All @@ -430,16 +439,16 @@ class ComposableTemplates extends MDSEnabledComponent<ComposableTemplatesProps,
]}
/>
<HeaderControl setMountPoint={setAppDescriptionControls} controls={descriptionData} />
<ContentPanel>
<EuiPanel>
<IndexControls
value={{
search: this.state.search,
selectedTypes: this.state.selectedTypes,
}}
onSearchChange={this.onSearchChange}
useNewUx={useNewUX}
/>
<EuiHorizontalRule margin="xs" />

<EuiSpacer size="m" />
<EuiBasicTable
className="ISM-component-templates-table"
data-test-subj="templatesTable"
Expand Down Expand Up @@ -472,6 +481,7 @@ class ComposableTemplates extends MDSEnabledComponent<ComposableTemplatesProps,
this.props.history.push(ROUTES.CREATE_COMPOSABLE_TEMPLATE);
}}
data-test-subj="CreateComponentTemplateWhenNoTemplateFound"
iconType="plus"
>
Create component template
</EuiSmallButton>,
Expand Down Expand Up @@ -500,7 +510,7 @@ class ComposableTemplates extends MDSEnabledComponent<ComposableTemplatesProps,
)
}
/>
</ContentPanel>
</EuiPanel>
</>
) : (
<>
Expand All @@ -515,9 +525,10 @@ class ComposableTemplates extends MDSEnabledComponent<ComposableTemplatesProps,
selectedTypes: this.state.selectedTypes,
}}
onSearchChange={this.onSearchChange}
useNewUx={useNewUX}
/>
<EuiHorizontalRule margin="xs" />

<EuiSpacer size="s" />
<EuiBasicTable
className="ISM-component-templates-table"
data-test-subj="templatesTable"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ exports[`<ComposableTemplates /> spec renders the component 1`] = `
style="padding: initial;"
>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow euiFlexGroup--responsive"
class="euiFlexGroup euiFlexGroup--gutterSmall euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow euiFlexGroup--responsive"
style="padding: 0px 5px;"
>
<div
Expand Down Expand Up @@ -183,6 +183,9 @@ exports[`<ComposableTemplates /> spec renders the component 1`] = `
<hr
class="euiHorizontalRule euiHorizontalRule--full euiHorizontalRule--marginXSmall"
/>
<div
class="euiSpacer euiSpacer--s"
/>
<div
class="euiBasicTable euiBasicTable-loading ISM-component-templates-table"
data-test-subj="templatesTable"
Expand Down
Loading

0 comments on commit 44260f6

Please sign in to comment.