-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Snapshot + Restore] Add callout when restoring snapshot #95104
Changes from 3 commits
c616133
2e7e930
cfe342c
d733718
01aff28
a409aeb
990c414
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
|
||
import React, { Fragment, useState } from 'react'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import semverGt from 'semver/functions/gt'; | ||
import { | ||
EuiButtonEmpty, | ||
EuiDescribedFormGroup, | ||
|
@@ -38,6 +39,8 @@ import { DataStreamsGlobalStateCallOut } from './data_streams_global_state_call_ | |
|
||
import { DataStreamsAndIndicesListHelpText } from './data_streams_and_indices_list_help_text'; | ||
|
||
import { SystemIndicesOverwrittenCallOut } from './system_indices_overwritten_callout'; | ||
|
||
export const RestoreSnapshotStepLogistics: React.FunctionComponent<StepProps> = ({ | ||
snapshotDetails, | ||
restoreSettings, | ||
|
@@ -50,6 +53,7 @@ export const RestoreSnapshotStepLogistics: React.FunctionComponent<StepProps> = | |
indices: unfilteredSnapshotIndices, | ||
dataStreams: snapshotDataStreams = [], | ||
includeGlobalState: snapshotIncludeGlobalState, | ||
version, | ||
} = snapshotDetails; | ||
|
||
const snapshotIndices = unfilteredSnapshotIndices.filter( | ||
|
@@ -564,11 +568,24 @@ export const RestoreSnapshotStepLogistics: React.FunctionComponent<StepProps> = | |
</EuiTitle> | ||
} | ||
description={ | ||
<FormattedMessage | ||
id="xpack.snapshotRestore.restoreForm.stepLogistics.includeGlobalStateDescription" | ||
defaultMessage="Restores templates that don’t currently exist in the cluster and overrides | ||
templates with the same name. Also restores persistent settings." | ||
/> | ||
<> | ||
<FormattedMessage | ||
id="xpack.snapshotRestore.restoreForm.stepLogistics.includeGlobalStateDescription" | ||
defaultMessage="Restores templates that don’t currently exist in the cluster and overrides | ||
templates with the same name. Also restores persistent settings and all system indices." | ||
/> | ||
|
||
{/* Only display callout if include_global_state is enabled and the snapshot was created by ES 7.12+ | ||
* Note: Once we support features states in the UI, we will also need to add a check here for that | ||
* See https://github.com/elastic/kibana/issues/95128 more details | ||
*/} | ||
{includeGlobalState && semverGt(version, '7.12.0') && ( | ||
<> | ||
<EuiSpacer size="xs" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This spacing looked a little tight to me in the screenshot. Might be worth checking with Michael? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mdefazio would you mind taking a look? Screenshot in PR description. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've changed to spacing from Another idea - we could simplify the callout and only have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My apologies for the poor direction 🤦 . I was simply trying to say that yes, there should be more space between the text and the callout, and it should be a bit less than the space between the button and the callout. So I didn't mean to say you had to change the space between the button and the callout (but the new screenshots look fine) I like the callout with only the title. It's a bit less obtrusive and feels more straightforward. |
||
<SystemIndicesOverwrittenCallOut /> | ||
</> | ||
)} | ||
</> | ||
} | ||
fullWidth | ||
> | ||
|
@@ -594,6 +611,7 @@ export const RestoreSnapshotStepLogistics: React.FunctionComponent<StepProps> = | |
checked={includeGlobalState === undefined ? false : includeGlobalState} | ||
onChange={(e) => updateRestoreSettings({ includeGlobalState: e.target.checked })} | ||
disabled={!snapshotIncludeGlobalState} | ||
data-test-subj="includeGlobalStateSwitch" | ||
/> | ||
</EuiFormRow> | ||
</EuiDescribedFormGroup> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import React, { FunctionComponent } from 'react'; | ||
import { EuiCallOut, EuiLink } from '@elastic/eui'; | ||
|
||
import { useCore } from '../../../../app_context'; | ||
|
||
export const SystemIndicesOverwrittenCallOut: FunctionComponent = () => { | ||
const { docLinks } = useCore(); | ||
|
||
return ( | ||
<EuiCallOut | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thinking about accessibility, I wonder if screen-readers announce the content of this callout when the user enables the global state toggle? If not then I think we should consider rendering the callout even when the toggle is disabled. If the callout is too prominent to show at all times, maybe we could just present it as standard description text. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for bringing this up! I've added an
If there is a general concern that the callout is too prominent, I've also included an example of just using the |
||
data-test-subj="systemIndicesInfoCallOut" | ||
title={i18n.translate( | ||
'xpack.snapshotRestore.restoreForm.stepLogistics.systemIndicesCallOut.title', | ||
{ | ||
defaultMessage: 'System indices will be overwritten', | ||
} | ||
)} | ||
iconType="pin" | ||
size="s" | ||
> | ||
<FormattedMessage | ||
id="xpack.snapshotRestore.restoreForm.stepLogistics.systemIndicesCallOut.description" | ||
defaultMessage="When this snapshot is restored, system indices will be overwritten with data from the snapshot. {learnMoreLink}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original recommended text also included: |
||
values={{ | ||
learnMoreLink: ( | ||
<EuiLink target="_blank" href={docLinks.links.snapshotRestore.restoreSnapshotApi}> | ||
{i18n.translate( | ||
'xpack.snapshotRestore.restoreForm.stepLogistics.systemIndicesCallOut.learnMoreLink', | ||
{ defaultMessage: 'Learn more' } | ||
)} | ||
</EuiLink> | ||
), | ||
}} | ||
/> | ||
</EuiCallOut> | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the explanation about features states, it's very helpful to understand the code