diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/policy_add.test.ts b/x-pack/plugins/snapshot_restore/__jest__/client_integration/policy_add.test.ts
index 4bce8aad05c8b..1007e0d583b52 100644
--- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/policy_add.test.ts
+++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/policy_add.test.ts
@@ -251,7 +251,7 @@ describe('', () => {
expect(exists('featureStatesDropdown')).toBe(false);
});
- test('include all features', async () => {
+ test('include all features by default', async () => {
const { actions } = testBed;
// Complete step 2
@@ -269,6 +269,7 @@ describe('', () => {
expect(requestUrl).toBe(`${API_BASE_PATH}policies`);
expect(parsedReqBody.config).toEqual({
+ includeGlobalState: true,
featureStates: [],
});
});
@@ -293,6 +294,7 @@ describe('', () => {
expect(requestUrl).toBe(`${API_BASE_PATH}policies`);
expect(parsedReqBody.config).toEqual({
+ includeGlobalState: true,
featureStates: ['kibana'],
});
});
@@ -320,7 +322,10 @@ describe('', () => {
const parsedReqBody = JSON.parse((requestBody as Record).body);
expect(requestUrl).toBe(`${API_BASE_PATH}policies`);
- expect(parsedReqBody.config).toEqual({ featureStates: [FEATURE_STATES_NONE_OPTION] });
+ expect(parsedReqBody.config).toEqual({
+ includeGlobalState: true,
+ featureStates: [FEATURE_STATES_NONE_OPTION],
+ });
});
});
@@ -358,7 +363,7 @@ describe('', () => {
snapshotName: SNAPSHOT_NAME,
schedule: DEFAULT_POLICY_SCHEDULE,
repository: repository.name,
- config: { featureStates: [] },
+ config: { featureStates: [], includeGlobalState: true },
retention: {
expireAfterValue: Number(EXPIRE_AFTER_VALUE),
expireAfterUnit: 'd', // default
diff --git a/x-pack/plugins/snapshot_restore/__jest__/client_integration/policy_list.test.tsx b/x-pack/plugins/snapshot_restore/__jest__/client_integration/policy_list.test.tsx
index 31bc523a42e7a..3404a4f6d0350 100644
--- a/x-pack/plugins/snapshot_restore/__jest__/client_integration/policy_list.test.tsx
+++ b/x-pack/plugins/snapshot_restore/__jest__/client_integration/policy_list.test.tsx
@@ -9,7 +9,7 @@ import { setupEnvironment } from './helpers';
import { getPolicy } from '../../test/fixtures';
import { setupPoliciesListPage, PoliciesListTestBed } from './helpers/policy_list.helpers';
-const POLICY_WITH_GLOBAL_STATE = getPolicy({
+const POLICY_WITH_GLOBAL_STATE_AND_FEATURES = getPolicy({
name: 'with_state',
retention: { minCount: 1 },
config: { includeGlobalState: true, featureStates: ['kibana'] },
@@ -33,13 +33,13 @@ describe('', () => {
beforeEach(async () => {
httpRequestsMockHelpers.setLoadPoliciesResponse({
policies: [
- POLICY_WITH_GLOBAL_STATE,
+ POLICY_WITH_GLOBAL_STATE_AND_FEATURES,
POLICY_WITHOUT_GLOBAL_STATE,
POLICY_WITH_JUST_GLOBAL_STATE,
],
});
- httpRequestsMockHelpers.setGetPolicyResponse(POLICY_WITH_GLOBAL_STATE.name, {
- policy: POLICY_WITH_GLOBAL_STATE,
+ httpRequestsMockHelpers.setGetPolicyResponse(POLICY_WITH_GLOBAL_STATE_AND_FEATURES.name, {
+ policy: POLICY_WITH_GLOBAL_STATE_AND_FEATURES,
});
testBed = await setupPoliciesListPage(httpSetup);
@@ -61,7 +61,7 @@ describe('', () => {
test('should show feature states if include global state is enabled', async () => {
const { find, actions } = testBed;
- // Assert against first resutl shown in the table, which should have includeGlobalState enabled
+ // Assert against first result shown in the table, which should have includeGlobalState enabled
await actions.clickPolicyAt(0);
expect(find('includeGlobalState.value').text()).toEqual('Yes');
@@ -93,7 +93,7 @@ describe('', () => {
policy: POLICY_WITH_JUST_GLOBAL_STATE,
});
- // Assert against third resutl shown in the table, which should have just includeGlobalState enabled
+ // Assert against third result shown in the table, which should have just includeGlobalState enabled
await actions.clickPolicyAt(2);
expect(find('includeGlobalState.value').text()).toEqual('Yes');
diff --git a/x-pack/plugins/snapshot_restore/public/application/components/policy_form/policy_form.tsx b/x-pack/plugins/snapshot_restore/public/application/components/policy_form/policy_form.tsx
index 32bbc5eb7f8a7..140e38ae12738 100644
--- a/x-pack/plugins/snapshot_restore/public/application/components/policy_form/policy_form.tsx
+++ b/x-pack/plugins/snapshot_restore/public/application/components/policy_form/policy_form.tsx
@@ -72,6 +72,9 @@ export const PolicyForm: React.FunctionComponent = ({
// when creating the local state for the form and also set featureStates to be an empty array, which
// for the API it means that it will include all featureStates.
featureStates: [],
+ // IncludeGlobalState is set as default by the api, so we want to replicate that behaviour in our
+ // form state so that it gets explicitly represented in the request.
+ includeGlobalState: true,
...(originalPolicy.config || {}),
},
retention: {
diff --git a/x-pack/plugins/snapshot_restore/public/application/components/restore_snapshot_form/steps/step_logistics/step_logistics.tsx b/x-pack/plugins/snapshot_restore/public/application/components/restore_snapshot_form/steps/step_logistics/step_logistics.tsx
index 3c3c295971b00..e9fd9559deecf 100644
--- a/x-pack/plugins/snapshot_restore/public/application/components/restore_snapshot_form/steps/step_logistics/step_logistics.tsx
+++ b/x-pack/plugins/snapshot_restore/public/application/components/restore_snapshot_form/steps/step_logistics/step_logistics.tsx
@@ -647,6 +647,7 @@ export const RestoreSnapshotStepLogistics: React.FunctionComponent =
defaultMessage="Restores the configuration, history, and other data stored in Elasticsearch by a feature such as Elasticsearch security."
/>
+ {/* Only display callout if includeFeatureState is enabled and the snapshot was created by ES 7.12+ */}
{semverGt(version, '7.12.0') && isFeatureStatesToggleEnabled && (
<>
diff --git a/x-pack/plugins/snapshot_restore/public/application/components/summaries/policies/policy_feature_states_summary.tsx b/x-pack/plugins/snapshot_restore/public/application/components/summaries/policies/policy_feature_states_summary.tsx
index 3e56e9ed6d4c4..8fee2ea802505 100644
--- a/x-pack/plugins/snapshot_restore/public/application/components/summaries/policies/policy_feature_states_summary.tsx
+++ b/x-pack/plugins/snapshot_restore/public/application/components/summaries/policies/policy_feature_states_summary.tsx
@@ -31,7 +31,8 @@ export const PolicyFeatureStatesSummary: React.FunctionComponent
@@ -48,13 +49,7 @@ export const PolicyFeatureStatesSummary: React.FunctionComponent
/>
)}
{!hasNoFeatureStates && !hasAllFeatureStates && (
- <>
- {' '}
-
- >
+
)}
diff --git a/x-pack/plugins/snapshot_restore/public/application/components/summaries/snapshots/snapshot_feature_states_summary.tsx b/x-pack/plugins/snapshot_restore/public/application/components/summaries/snapshots/snapshot_feature_states_summary.tsx
index 7bd88ddaeceaa..57b624416c6a2 100644
--- a/x-pack/plugins/snapshot_restore/public/application/components/summaries/snapshots/snapshot_feature_states_summary.tsx
+++ b/x-pack/plugins/snapshot_restore/public/application/components/summaries/snapshots/snapshot_feature_states_summary.tsx
@@ -30,7 +30,8 @@ export const SnapshotFeatureStatesSummary: React.FunctionComponent
@@ -40,13 +41,7 @@ export const SnapshotFeatureStatesSummary: React.FunctionComponent
) : (
- <>
- {' '}
-
- >
+
)}