Skip to content

Commit

Permalink
Bug fix in Indexes page and worked on comments on previous commit
Browse files Browse the repository at this point in the history
Signed-off-by: Kshitij Tandon <[email protected]>
  • Loading branch information
tandonks committed Aug 20, 2024
1 parent c4a5f3e commit fec4974
Show file tree
Hide file tree
Showing 10 changed files with 297 additions and 170 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function SearchControls(props: SearchControlsProps) {
}}
onChange={(val) => onChange("selectedTypes", val || [])}
value={state.selectedTypes}
useNewUx={props.useNewUX}
useNewUX={props.useNewUX}
options={[
{
label: IndicesUpdateMode.alias,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
import { DataStream, ManagedCatIndex } from "../../../../../server/models/interfaces";
import IndicesActions from "../../containers/IndicesActions";
import { getUISettings } from "../../../../services/Services";
import { RouteComponentProps } from "react-router-dom";

interface IndexControlsProps {
search: string;
Expand All @@ -28,6 +29,7 @@ interface IndexControlsProps {
getDataStreams: () => Promise<DataStream[]>;
toggleShowDataStreams: () => void;
selectedItems: ManagedCatIndex[];
history?: RouteComponentProps["history"];
}

interface IndexControlsState {
Expand All @@ -50,7 +52,7 @@ export default class IndexControls extends Component<IndexControlsProps, IndexCo
};

render() {
const { search, onSearchChange, showDataStreams, toggleShowDataStreams, onRefresh, selectedItems } = this.props;
const { search, onSearchChange, showDataStreams, toggleShowDataStreams, onRefresh, selectedItems, history } = this.props;

const schema = {
strict: true,
Expand Down Expand Up @@ -97,7 +99,7 @@ export default class IndexControls extends Component<IndexControlsProps, IndexCo
</EuiFlexItem>
<EuiFlexItem grow={false}>
<IndicesActions
{...this.props}
history={this.props.history}
onDelete={onRefresh}
onClose={onRefresh}
onShrink={onRefresh}
Expand Down
1 change: 1 addition & 0 deletions public/pages/Indices/containers/Indices/Indices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ export class Indices extends MDSEnabledComponent<IndicesProps, IndicesState> {
getDataStreams={this.getDataStreams}
toggleShowDataStreams={this.toggleShowDataStreams}
selectedItems={this.state.selectedItems}
history={this.props.history}
/>

<EuiBasicTable
Expand Down
1 change: 1 addition & 0 deletions public/pages/Indices/containers/IndicesActions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ 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 @@ -14,7 +14,6 @@ import {
EuiOverlayMask,
EuiCodeBlock,
} from "@elastic/eui";
import { size } from "lodash";

interface InfoModalProps {
info: object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ export class ManagedIndices extends MDSEnabledComponent<ManagedIndicesProps, Man
showEditModal,
isPopoverOpen,
} = this.state;
console.log(this.context);
const filterIsApplied = !!search;
const page = Math.floor(from / size);

Expand Down
17 changes: 17 additions & 0 deletions public/pages/Reindex/container/Reindex/Reindex.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@ 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({});

(getNavigationUI as jest.Mock).mockReturnValue({});
});

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

0 comments on commit fec4974

Please sign in to comment.