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

[Security Solution] Modal for saving timeline #81205

Closed
wants to merge 10 commits into from

Conversation

angorayc
Copy link
Contributor

@angorayc angorayc commented Oct 20, 2020

Summary

save-timeline-modal

This is a button and modal to edit / update timeline's title / description.
This shouldn't change the existing behaviour of title and description field.

Please go to x-pack/plugins/security_solution/common/constants.ts Line 183 and change enableNewTimeline to true.
There will be a pencil icon appears next to description field. A modal appears after clicking on the button.
https://github.com/elastic/security-team/issues/426

  • Auto save is disabled when typing the name / description in the modal.
  • Timeline is only saved by clicking on the button.

Checklist

Delete any items that are not applicable to this PR.

@angorayc angorayc self-assigned this Oct 22, 2020
@angorayc angorayc added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team v7.11.0 labels Oct 22, 2020
@angorayc angorayc marked this pull request as ready for review October 22, 2020 16:02
@angorayc angorayc requested review from a team as code owners October 22, 2020 16:02
@@ -179,3 +179,5 @@ export const showAllOthersBucket: string[] = [
'destination.ip',
'user.name',
];

export const enableNewTimeline = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can use uppercase for the variable name?

Copy link
Contributor Author

@angorayc angorayc Oct 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, renamed it to ENABLE_NEW_TIMELINE


export const TimelineTitleAndDescription = React.memo<TimelineTitleAndDescriptionProps>(
({ timelineId, toggleSaveTimeline, onSaveTimeline, updateTitle, updateDescription }) => {
const timeline = useShallowEqualSelector((state) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const { description, isSaving, savedObjectId, title, timelineType } = ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I send the entire timeline to onSaveTimeline below, so I'm keeping this atm.

@@ -39,6 +40,7 @@ const StatefulFlyoutHeader = React.memo<Props>(
noteIds,
notesById,
status,
saveTimeline,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move saveTimeline action binding to the destination component to avoid unnecessary props drilling?

<EuiFlexItem grow={false}>
<EuiFlexGroup justifyContent="flexEnd">
<EuiFlexItem grow={false} component="span">
{savedObjectId == null ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if the behavior shown in the gif below, where the Discard Timeline button is displayed for a new, non-mutated timeline, is a product of Timeline being in the current "in between" state, where we're just starting to implement the new design, or potentially a bug:

discard-timeline

I think the intent of the Discard Timeline button shown in the gif above is to address the case when a user has performed an action that will result in unsaved changes being discarded, because the timeline was never given a name. I'm not sure if the Discard Timeline button should appear in the scenario shown above, because we created a new timeline, with no mutations.

@angorayc would you be willing to confirm the expected behavior with @marrasherrier?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@angorayc @andrew-goldstein I think it's best to keep the 'discard' option for consistency.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@monina-n looping you in as well for transparency!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what we've talked about before, this is the same modal that will also appear when you click 'X' to close an unsaved timeline. I agree with @andrew-goldstein that having "Discard timeline" would be an unexpected option when you click the pencil icon to add a name/description? If I click the pencil icon, I would expect the options to be "Save" and "Cancel" with cancel closing the modal instead of deleting the entire timeline.

I think we can potentially go with @andrew-goldstein's suggestion of not having the "discard button" on the pencil and only when we're closing the timeline. Another possible solution is having two modals: (1) clicking the pencil icon and having the options be "Save Timeline" and "Cancel" and (2) clicking the 'X' to close a timeline and having the options be "Save Timeline" and "Discard Timeline" with the "discard" button being in red and maybe having a note that if you don't save the timeline, it will delete it.

@marrasherrier @andrew-goldstein @angorayc what do you guys think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@monina-n thanks for clarifying, that makes sense to me. @angorayc here is the separate interaction more clearly mocked out: https://www.figma.com/file/QVxq6M4TFDJlcgFHGe9wYT/Timeline-Evolution?node-id=1034%3A27036

@angorayc angorayc requested a review from a team as a code owner October 27, 2020 14:54
@angorayc angorayc requested a review from a team October 27, 2020 14:54
@angorayc angorayc requested a review from a team as a code owner October 27, 2020 14:54
@angorayc angorayc requested a review from a team October 27, 2020 14:54
@angorayc angorayc requested a review from a team as a code owner October 27, 2020 14:54
@angorayc angorayc requested a review from a team October 27, 2020 14:54
@angorayc angorayc requested review from a team as code owners October 27, 2020 14:54
@botelastic botelastic bot added Feature:Embedding Embedding content via iFrame Team:APM All issues that need APM UI Team support Team:Fleet Team label for Observability Data Collection Fleet team Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability labels Oct 27, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

@angorayc angorayc removed request for a team October 27, 2020 15:09
@angorayc angorayc removed Feature:Embedding Embedding content via iFrame Team:Fleet Team label for Observability Data Collection Fleet team Team:APM All issues that need APM UI Team support Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability labels Oct 27, 2020
@cjcenizal
Copy link
Contributor

@angorayc In past cases where multiple teams have been accidentally pinged on a PR, I've seen authors close the PR and reopen a new one in order to avoid all of the pinged team-members having to manually unsubscribe from the PR. Otherwise those team-members will just keep getting pinged due to comments, reviews, stuff like that. Would you mind doing that in this case, too please?

@angorayc angorayc closed this Oct 27, 2020
@angorayc
Copy link
Contributor Author

Follow up in #81802

@MindyRS MindyRS added the Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. label Oct 27, 2020
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

@kbn/optimizer bundle module count

id before after diff
securitySolution 2063 2066 +3

async chunks size

id before after diff
securitySolution 8.1MB 8.2MB +15.6KB

page load bundle size

id before after diff
securitySolution 263.1KB 263.3KB +260.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting Security Solution Threat Hunting Team v7.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants