Skip to content

Commit

Permalink
Resolved comments
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 22, 2024
1 parent ed67afc commit 3d4a350
Show file tree
Hide file tree
Showing 13 changed files with 222 additions and 233 deletions.
63 changes: 33 additions & 30 deletions public/pages/Aliases/components/IndexControls/IndexControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import React, { useEffect, useState } from "react";
import { EuiCompressedComboBox, EuiCompressedFieldSearch, EuiFlexGroup, EuiFlexItem } from "@elastic/eui";
import { EuiCompressedComboBox, EuiCompressedFieldSearch, EuiFlexGroup, EuiFlexItem, EuiSpacer } from "@elastic/eui";
import { ALIAS_STATUS_OPTIONS, IndicesUpdateMode } from "../../../../utils/constants";
import { getUISettings } from "../../../../services/Services";
import AliasesActions from "../../containers/AliasActions";
Expand Down Expand Up @@ -42,35 +42,38 @@ export default function SearchControls(props: SearchControlsProps) {
const useUpdatedUX = uiSettings.get("home:useNewHomePage");

return useUpdatedUX ? (
<EuiFlexGroup style={{ paddingBottom: "16px" }} alignItems="center" gutterSize="s">
<EuiFlexItem>
<EuiCompressedFieldSearch
fullWidth
placeholder="Search"
value={state.search}
onChange={(e) => onChange("search", e.target.value)}
/>
</EuiFlexItem>
<EuiFlexItem style={{ flexBasis: "100px" }} grow={false}>
<FilterGroup
filterButtonProps={{
children: "Status",
}}
onChange={(val) => onChange("status", (val || []).map((item) => item).join(","))}
value={state.status ? state.status.split(",").map((label) => label) : []}
options={ALIAS_STATUS_OPTIONS}
useNewUX={useUpdatedUX}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<AliasesActions
onUpdateAlias={props.onUpdateAlias}
selectedItems={props.value.selectedItems}
onDelete={props.onDelete}
history={props.history}
/>
</EuiFlexItem>
</EuiFlexGroup>
<>
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem>
<EuiCompressedFieldSearch
fullWidth
placeholder="Search"
value={state.search}
onChange={(e) => onChange("search", e.target.value)}
/>
</EuiFlexItem>
<EuiFlexItem style={{ flexBasis: "100px" }} grow={false}>
<FilterGroup
filterButtonProps={{
children: "Status",
}}
onChange={(val) => onChange("status", (val || []).map((item) => item).join(","))}
value={state.status ? state.status.split(",").map((label) => label) : []}
options={ALIAS_STATUS_OPTIONS}
useNewUX={useUpdatedUX}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<AliasesActions
onUpdateAlias={props.onUpdateAlias}
selectedItems={props.value.selectedItems}
onDelete={props.onDelete}
history={props.history}
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="m" />
</>
) : (
<EuiFlexGroup style={{ padding: "0px 5px" }} alignItems="center">
<EuiFlexItem>
Expand Down
67 changes: 35 additions & 32 deletions public/pages/Indices/components/IndexControls/IndexControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,38 +84,41 @@ export default class IndexControls extends Component<IndexControlsProps, IndexCo
const useUpdatedUX = uiSettings.get("home:useNewHomePage");

return useUpdatedUX ? (
<EuiFlexGroup style={{ paddingBottom: "16px" }} alignItems="center" gutterSize="s">
<EuiFlexItem>
<EuiSearchBar
compressed
query={search}
box={{ placeholder: "Search", schema, incremental: true, compressed: true }}
onChange={onSearchChange}
filters={filters}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon iconType="refresh" data-test-subj="refreshButton" display="base" size="s" />
</EuiFlexItem>
<EuiFlexItem grow={false}>
<IndicesActions
history={this.props.history}
onDelete={onRefresh}
onClose={onRefresh}
onShrink={onRefresh}
selectedItems={selectedItems}
getIndices={onRefresh}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiCompressedSwitch
label="Show data stream indexes"
checked={showDataStreams}
onChange={toggleShowDataStreams}
data-test-subj="toggleShowDataStreams"
/>
</EuiFlexItem>
</EuiFlexGroup>
<>
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem>
<EuiSearchBar
compressed
query={search}
box={{ placeholder: "Search", schema, incremental: true, compressed: true }}
onChange={onSearchChange}
filters={filters}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon iconType="refresh" data-test-subj="refreshButton" display="base" size="s" />
</EuiFlexItem>
<EuiFlexItem grow={false}>
<IndicesActions
history={this.props.history}
onDelete={onRefresh}
onClose={onRefresh}
onShrink={onRefresh}
selectedItems={selectedItems}
getIndices={onRefresh}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiCompressedSwitch
label="Show data stream indexes"
checked={showDataStreams}
onChange={toggleShowDataStreams}
data-test-subj="toggleShowDataStreams"
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="m" />
</>
) : (
<EuiFlexGroup style={{ padding: "0px 5px" }} alignItems="center">
<EuiFlexItem>
Expand Down
1 change: 0 additions & 1 deletion public/pages/Indices/containers/IndicesActions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export interface IndicesActionsProps extends Pick<RouteComponentProps, "history"
onDelete: () => void;
onClose: () => void;
onShrink: () => void;
history: RouteComponentProps["history"];
}

export default function IndicesActions(props: IndicesActionsProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
EuiContextMenuPanel,
EuiButtonIcon,
EuiButtonEmpty,
EuiSpacer,
} from "@elastic/eui";
import { DataStream } from "../../../../../server/models/interfaces";
import { ManagedIndices } from "../../containers/ManagedIndices/ManagedIndices";
Expand Down Expand Up @@ -88,29 +89,32 @@ export default class ManagedIndexControls extends Component<ManagedIndexControls
const useUpdatedUX = uiSettings.get("home:useNewHomePage");

return useUpdatedUX ? (
<EuiFlexGroup style={{ paddingBottom: "16px" }} alignItems="center" gutterSize="s">
<EuiFlexItem>
<EuiSearchBar
query={search}
box={{ placeholder: "Search", schema, incremental: true, compressed: true }}
compressed
onChange={onSearchChange}
filters={filters}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon iconType="refresh" data-test-subj="refreshButton" display="base" size="s" />
</EuiFlexItem>
<EuiFlexItem grow={false}>{Actions}</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiCompressedSwitch
label="Show data stream indexes"
checked={showDataStreams}
onChange={toggleShowDataStreams}
data-test-subj="toggleShowDataStreams"
/>
</EuiFlexItem>
</EuiFlexGroup>
<>
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem>
<EuiSearchBar
query={search}
box={{ placeholder: "Search", schema, incremental: true, compressed: true }}
compressed
onChange={onSearchChange}
filters={filters}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon iconType="refresh" data-test-subj="refreshButton" display="base" size="s" />
</EuiFlexItem>
<EuiFlexItem grow={false}>{Actions}</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiCompressedSwitch
label="Show data stream indexes"
checked={showDataStreams}
onChange={toggleShowDataStreams}
data-test-subj="toggleShowDataStreams"
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="m" />
</>
) : (
<EuiFlexGroup style={{ padding: "0px 5px" }} alignItems="center">
<EuiFlexItem>
Expand Down
18 changes: 3 additions & 15 deletions public/pages/Reindex/container/Reindex/Reindex.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,10 @@ import { CoreServicesConsumer, CoreServicesContext } from "../../../../component
import Reindex from "./Reindex";
import { ModalProvider, ModalRoot } from "../../../../components/Modal";
import { BrowserServices } from "../../../../models/interfaces";
import { getApplication, getNavigationUI, getUISettings } from "../../../../services/Services";

jest.mock("../../../../services/Services", () => ({
...jest.requireActual("../../../../services/Services"),
getUISettings: jest.fn(),
getApplication: jest.fn(),
getNavigationUI: jest.fn(),
}));

beforeEach(() => {
(getUISettings as jest.Mock).mockReturnValue({
get: jest.fn().mockReturnValue(false), // or false, depending on your test case
});
(getApplication as jest.Mock).mockReturnValue({});
import { setupCoreStart } from "../../../../../test/helper";

(getNavigationUI as jest.Mock).mockReturnValue({});
beforeAll(() => {
setupCoreStart();
});

function renderWithRouter(initialEntries = [ROUTES.REINDEX] as string[]) {
Expand Down
Loading

0 comments on commit 3d4a350

Please sign in to comment.