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

[ResponseOps][Maintenance Window] Remove MW scoped query feature flag #172900

Merged
merged 5 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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