Skip to content

Commit

Permalink
[ResponseOps][Maintenance Window] Remove MW scoped query feature flag (
Browse files Browse the repository at this point in the history
…elastic#172900)

## Summary
Removes the scoped query feature flag as it is no longer needed.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
3 people committed Sep 9, 2024
1 parent fc46cc3 commit 0b980d8
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export interface CreateMaintenanceWindowFormProps {
onSuccess: () => void;
initialValue?: FormProps;
maintenanceWindowId?: string;
scopedQueryFeatureFlag?: boolean;
}

const useDefaultTimezone = () => {
Expand All @@ -77,13 +76,7 @@ const useDefaultTimezone = () => {
const TIMEZONE_OPTIONS = UI_TIMEZONE_OPTIONS.map((n) => ({ label: n })) ?? [{ label: 'UTC' }];

export const CreateMaintenanceWindowForm = React.memo<CreateMaintenanceWindowFormProps>((props) => {
const {
onCancel,
onSuccess,
initialValue,
maintenanceWindowId,
scopedQueryFeatureFlag = true,
} = props;
const { onCancel, onSuccess, initialValue, maintenanceWindowId } = props;

const [defaultStartDateValue] = useState<string>(moment().toISOString());
const [defaultEndDateValue] = useState<string>(moment().add(30, 'minutes').toISOString());
Expand Down Expand Up @@ -125,7 +118,7 @@ export const CreateMaintenanceWindowForm = React.memo<CreateMaintenanceWindowFor
const { data: ruleTypes, isLoading: isLoadingRuleTypes } = useGetRuleTypes();

const scopedQueryPayload = useMemo(() => {
if (!isScopedQueryEnabled || !scopedQueryFeatureFlag) {
if (!isScopedQueryEnabled) {
return null;
}
if (!query && !filters.length) {
Expand All @@ -135,7 +128,7 @@ export const CreateMaintenanceWindowForm = React.memo<CreateMaintenanceWindowFor
kql: query,
filters,
};
}, [isScopedQueryEnabled, scopedQueryFeatureFlag, query, filters]);
}, [isScopedQueryEnabled, query, filters]);

const submitMaintenanceWindow = useCallback<FormSubmitHandler<FormProps>>(
async (formData, isValid) => {
Expand Down Expand Up @@ -434,19 +427,17 @@ export const CreateMaintenanceWindowForm = React.memo<CreateMaintenanceWindowFor
<RecurringSchedule data-test-subj="recurring-form" />
</EuiFlexItem>
)}
{scopedQueryFeatureFlag && (
<EuiFlexItem>
<EuiHorizontalRule margin="xl" />
<UseField path="scopedQuery">
{() => (
<MaintenanceWindowScopedQuerySwitch
checked={isScopedQueryEnabled}
onEnabledChange={onScopeQueryToggle}
/>
)}
</UseField>
</EuiFlexItem>
)}
<EuiFlexItem>
<EuiHorizontalRule margin="xl" />
<UseField path="scopedQuery">
{() => (
<MaintenanceWindowScopedQuerySwitch
checked={isScopedQueryEnabled}
onEnabledChange={onScopeQueryToggle}
/>
)}
</UseField>
</EuiFlexItem>
<EuiFlexItem>
<EuiHorizontalRule margin="xl" />
<UseField path="categoryIds">
Expand All @@ -462,24 +453,22 @@ export const CreateMaintenanceWindowForm = React.memo<CreateMaintenanceWindowFor
)}
</UseField>
</EuiFlexItem>
{scopedQueryFeatureFlag && (
<EuiFlexItem>
<UseField path="scopedQuery">
{() => (
<MaintenanceWindowScopedQuery
featureIds={featureIds}
query={query}
filters={filters}
isLoading={isLoadingRuleTypes}
isEnabled={isScopedQueryEnabled}
errors={scopedQueryErrors}
onQueryChange={onQueryChange}
onFiltersChange={setFilters}
/>
)}
</UseField>
</EuiFlexItem>
)}
<EuiFlexItem>
<UseField path="scopedQuery">
{() => (
<MaintenanceWindowScopedQuery
featureIds={featureIds}
query={query}
filters={filters}
isLoading={isLoadingRuleTypes}
isEnabled={isScopedQueryEnabled}
errors={scopedQueryErrors}
onQueryChange={onQueryChange}
onFiltersChange={setFilters}
/>
)}
</UseField>
</EuiFlexItem>
<EuiHorizontalRule margin="xl" />
</EuiFlexGroup>
{isEditMode && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,3 @@ export const STATUS_OPTIONS = [
{ value: MaintenanceWindowStatus.Finished, name: i18n.TABLE_STATUS_FINISHED },
{ value: MaintenanceWindowStatus.Archived, name: i18n.TABLE_STATUS_ARCHIVED },
];

export const IS_SCOPED_QUERY_ENABLED = true;
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import * as i18n from './translations';
import { PageHeader } from './components/page_header';
import { CreateMaintenanceWindowForm } from './components/create_maintenance_windows_form';
import { MAINTENANCE_WINDOW_DEEP_LINK_IDS } from '../../../common';
import { IS_SCOPED_QUERY_ENABLED } from './constants';

export const MaintenanceWindowsCreatePage = React.memo(() => {
useBreadcrumbs(MAINTENANCE_WINDOW_DEEP_LINK_IDS.maintenanceWindowsCreate);
Expand All @@ -31,7 +30,6 @@ export const MaintenanceWindowsCreatePage = React.memo(() => {
<CreateMaintenanceWindowForm
onCancel={navigateToMaintenanceWindows}
onSuccess={navigateToMaintenanceWindows}
scopedQueryFeatureFlag={IS_SCOPED_QUERY_ENABLED}
/>
</EuiPageSection>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { CreateMaintenanceWindowForm } from './components/create_maintenance_win
import { MAINTENANCE_WINDOW_DEEP_LINK_IDS } from '../../../common';
import { useGetMaintenanceWindow } from '../../hooks/use_get_maintenance_window';
import { CenterJustifiedSpinner } from './components/center_justified_spinner';
import { IS_SCOPED_QUERY_ENABLED } from './constants';

export const MaintenanceWindowsEditPage = React.memo(() => {
const { navigateToMaintenanceWindows } = useMaintenanceWindowsNavigation();
Expand All @@ -44,7 +43,6 @@ export const MaintenanceWindowsEditPage = React.memo(() => {
maintenanceWindowId={maintenanceWindowId}
onCancel={navigateToMaintenanceWindows}
onSuccess={navigateToMaintenanceWindows}
scopedQueryFeatureFlag={IS_SCOPED_QUERY_ENABLED}
/>
</EuiPageSection>
);
Expand Down

0 comments on commit 0b980d8

Please sign in to comment.