Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes and retracting some formatting changes #1141

Merged
merged 13 commits into from
Aug 22, 2024
Merged
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={{ padding: "0px 5px" }} alignItems="center">
<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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ interface ChangeManagedIndicesProps {
onChangeManagedIndices: (selectedManagedIndices: { label: string; value?: ManagedIndexItem }[]) => void;
onChangeStateFilters: (stateFilter: { label: string }[]) => void;
managedIndicesError: string;
useUpdatedUX?: boolean;
}

interface ChangeManagedIndicesState {
Expand Down Expand Up @@ -72,7 +71,7 @@ export default class ChangeManagedIndices extends Component<ChangeManagedIndices

render() {
const { managedIndices, managedIndicesIsLoading, stateFilterSearchValue } = this.state;
const { selectedManagedIndices, selectedStateFilters, managedIndicesError, useUpdatedUX } = this.props;
const { selectedManagedIndices, selectedStateFilters, managedIndicesError } = this.props;
const uniqueStates = selectedManagedIndices.reduce(
(accu: Set<any>, selectedManagedIndex: { label: string; value?: ManagedIndexItem }) => {
if (!selectedManagedIndex.value) return accu;
Expand Down Expand Up @@ -109,7 +108,6 @@ export default class ChangeManagedIndices extends Component<ChangeManagedIndices
// @ts-ignore
onChange={this.props.onChangeManagedIndices}
onSearchChange={this.onManagedIndexSearchChange}
compressed={useUpdatedUX ? true : false}
/>
</EuiCompressedFormRow>

Expand All @@ -122,7 +120,6 @@ export default class ChangeManagedIndices extends Component<ChangeManagedIndices
// @ts-ignore
onChange={this.props.onChangeStateFilters}
onSearchChange={this.onStateFilterSearchChange}
compressed={useUpdatedUX ? true : false}
/>
</EuiCompressedFormRow>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ exports[`<ChangeManagedIndices /> spec renders the component 1`] = `
aria-describedby="some_html_id-help-0"
aria-expanded="false"
aria-haspopup="listbox"
class="euiComboBox"
class="euiComboBox euiComboBox--compressed"
role="combobox"
>
<div
class="euiFormControlLayout"
class="euiFormControlLayout euiFormControlLayout--compressed"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<div
class="euiComboBox__inputWrap euiComboBox__inputWrap-isClearable"
class="euiComboBox__inputWrap euiComboBox__inputWrap--compressed euiComboBox__inputWrap-isClearable"
data-test-subj="comboBoxInput"
tabindex="-1"
>
Expand Down Expand Up @@ -134,17 +134,17 @@ exports[`<ChangeManagedIndices /> spec renders the component 1`] = `
aria-describedby="some_html_id-help-0"
aria-expanded="false"
aria-haspopup="listbox"
class="euiComboBox euiComboBox-isDisabled"
class="euiComboBox euiComboBox--compressed euiComboBox-isDisabled"
role="combobox"
>
<div
class="euiFormControlLayout"
class="euiFormControlLayout euiFormControlLayout--compressed"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<div
class="euiComboBox__inputWrap"
class="euiComboBox__inputWrap euiComboBox__inputWrap--compressed"
data-test-subj="comboBoxInput"
tabindex="-1"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ interface NewPolicyProps {
onChangePolicy: (selectedPolicies: PolicyOption[]) => void;
onChangeStateRadio: (optionId: string) => void;
onStateSelectChange: (e: React.ChangeEvent<HTMLSelectElement>) => void;
useUpdatedUX?: boolean;
}

interface NewPolicyState {
Expand Down Expand Up @@ -123,7 +122,6 @@ export default class NewPolicy extends React.Component<NewPolicyProps, NewPolicy
// @ts-ignore
onChange={this.props.onChangePolicy}
onSearchChange={this.onPolicySearchChange}
compressed={useUpdatedUX ? true : false}
/>
</EuiCompressedFormRow>

Expand All @@ -140,7 +138,6 @@ export default class NewPolicy extends React.Component<NewPolicyProps, NewPolicy
value={stateSelected}
onChange={this.props.onStateSelectChange}
aria-label="Start state for new policy"
compressed={useUpdatedUX ? true : false}
/>
</EuiCompressedFormRow>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ exports[`<NewPolicy /> spec renders the component 1`] = `
<div
aria-expanded="false"
aria-haspopup="listbox"
class="euiComboBox"
class="euiComboBox euiComboBox--compressed"
role="combobox"
>
<div
class="euiFormControlLayout"
class="euiFormControlLayout euiFormControlLayout--compressed"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<div
class="euiComboBox__inputWrap euiComboBox__inputWrap--noWrap euiComboBox__inputWrap-isClearable"
class="euiComboBox__inputWrap euiComboBox__inputWrap--compressed euiComboBox__inputWrap--noWrap euiComboBox__inputWrap-isClearable"
data-test-subj="comboBoxInput"
tabindex="-1"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ export class ChangePolicy extends Component<ChangePolicyProps, ChangePolicyState
onChangeManagedIndices={this.onChangeManagedIndices}
onChangeStateFilters={this.onChangeStateFilters}
managedIndicesError={hasSubmitted ? managedIndicesError : ""}
useUpdatedUX={useUpdatedUX}
/>

<EuiSpacer />
Expand All @@ -187,7 +186,6 @@ export class ChangePolicy extends Component<ChangePolicyProps, ChangePolicyState
onChangeStateRadio={this.onChangeStateRadio}
onStateSelectChange={this.onStateSelectChange}
selectedPoliciesError={hasSubmitted ? selectedPoliciesError : ""}
useUpdatedUX={useUpdatedUX}
/>

<EuiSpacer />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ exports[`<ChangePolicy /> spec renders the component 1`] = `
aria-describedby="some_html_id-help-0"
aria-expanded="false"
aria-haspopup="listbox"
class="euiComboBox"
class="euiComboBox euiComboBox--compressed"
role="combobox"
>
<div
class="euiFormControlLayout"
class="euiFormControlLayout euiFormControlLayout--compressed"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<div
class="euiComboBox__inputWrap euiComboBox__inputWrap-isClearable"
class="euiComboBox__inputWrap euiComboBox__inputWrap--compressed euiComboBox__inputWrap-isClearable"
data-test-subj="comboBoxInput"
tabindex="-1"
>
Expand Down Expand Up @@ -145,17 +145,17 @@ exports[`<ChangePolicy /> spec renders the component 1`] = `
aria-describedby="some_html_id-help-0"
aria-expanded="false"
aria-haspopup="listbox"
class="euiComboBox euiComboBox-isDisabled"
class="euiComboBox euiComboBox--compressed euiComboBox-isDisabled"
role="combobox"
>
<div
class="euiFormControlLayout"
class="euiFormControlLayout euiFormControlLayout--compressed"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<div
class="euiComboBox__inputWrap"
class="euiComboBox__inputWrap euiComboBox__inputWrap--compressed"
data-test-subj="comboBoxInput"
tabindex="-1"
>
Expand Down Expand Up @@ -291,17 +291,17 @@ exports[`<ChangePolicy /> spec renders the component 1`] = `
<div
aria-expanded="false"
aria-haspopup="listbox"
class="euiComboBox"
class="euiComboBox euiComboBox--compressed"
role="combobox"
>
<div
class="euiFormControlLayout"
class="euiFormControlLayout euiFormControlLayout--compressed"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<div
class="euiComboBox__inputWrap euiComboBox__inputWrap--noWrap euiComboBox__inputWrap-isClearable"
class="euiComboBox__inputWrap euiComboBox__inputWrap--compressed euiComboBox__inputWrap--noWrap euiComboBox__inputWrap-isClearable"
data-test-subj="comboBoxInput"
tabindex="-1"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export interface SearchControlsProps {
search: string;
selectedTypes: string[];
};
useNewUX?: boolean;
onSearchChange: (args: SearchControlsProps["value"]) => void;
}

Expand Down Expand Up @@ -47,7 +46,6 @@ export default function SearchControls(props: SearchControlsProps) {
}}
onChange={(val) => onChange("selectedTypes", val || [])}
value={state.selectedTypes}
useNewUx={props.useNewUX}
options={[
{
label: IndicesUpdateMode.alias,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ class ComposableTemplates extends MDSEnabledComponent<ComposableTemplatesProps,
search: this.state.search,
selectedTypes: this.state.selectedTypes,
}}
useNewUX={useNewUX}
onSearchChange={this.onSearchChange}
/>
<EuiHorizontalRule margin="xs" />
Expand Down Expand Up @@ -515,7 +514,6 @@ class ComposableTemplates extends MDSEnabledComponent<ComposableTemplatesProps,
search: this.state.search,
selectedTypes: this.state.selectedTypes,
}}
useNewUX={useNewUX}
onSearchChange={this.onSearchChange}
/>
<EuiHorizontalRule margin="xs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import JobNameAndIndices from "../../components/JobNameAndIndices";
import ReviewDefinition from "../../components/ReviewDefinition";
import ReviewSchedule from "../../components/ReviewSchedule";
import { CoreServicesContext } from "../../../../components/core_services";
import { getUISettings } from "../../../../services/Services";

interface ReviewAndCreateStepProps extends RouteComponentProps {
transformService: TransformService;
Expand Down
Loading
Loading