Skip to content

[Cases] Add Generic Page attachment type for cases#224308

Closed
dominiqueclarke wants to merge 27 commits intoelastic:mainfrom
dominiqueclarke:feat/cases-page-attachment
Closed

[Cases] Add Generic Page attachment type for cases#224308
dominiqueclarke wants to merge 27 commits intoelastic:mainfrom
dominiqueclarke:feat/cases-page-attachment

Conversation

@dominiqueclarke
Copy link
Copy Markdown
Contributor

@dominiqueclarke dominiqueclarke commented Jun 17, 2025

Summary

This PR defines a generic "page" attachment type which can be used to attach any page in Kibana to a case.

This PR defines the base schema, with more features to be developed in the future.

image

Screenshot 2025-06-17 at 1 08 04 PM

Overview

The goal is to create an attachment type that is generic enough to use across Kibana, but useful enough to facilitate meaningful analysis during an investigation. As part of the goal, we are targeting the following features as part of the attachment.

  1. A link back to the attached page - This enables users save a relevant page while providing a mechanism to dive back into the in-app or platform experience as the incident progresses
  2. [Coming soon] A screenshot of the attached page - This provides with an "at a glance" view of what's behind the link, enabling quick understanding of the attachment. It also provides a snapshot of the page at the time of the incident, which is helpful is helpful when your data has been ILMed away
  3. [Coming soon] Screen context - Screen context provides helpful plain-language summaries of the page. This is what is used by our AI assistants in order to have context of what the user is looking at when interacting with the AI assistant. By persisting screen context we can provide LLMs with an understanding of the attachment that is not possible with just the link or screenshot. Since screen context is a developer constructed description pf the page, It's important to note that screen context can be saved without having access to an LLM (if a user has not enabled assistants). That way, if a user enables an AI connector at a later date, they can get the benefit from this screen context right away
  4. [Coming soon] Summary - An AI-generated summary of the page, which was constructed using the screen context at the time attachment was created
  5. TBD some way to register a custom component to render for certain pages (Not well defined yet)

Only bullet point 1 is included in this PR.

Background

This idea originally spawned from a desire to develop a Dashboard link attachment type. As we considered the Dashboards use-case, we wanted to expand to allow our attachment to support any link. Further, as we considered the value of this attachment type, we wanted to enrich the link with more helpful information such as a screenshot, screen context, and summary.

Because this idea spawned from a Dashboard link, Dashboards is the first place we implemented this. However, if the Dashboard team is not satisfied with the UX or dev implementation, we are happy to remove this feature for now in favor or merging just the attachment schema.

Technical details

  1. The type definition for the attachment persisted state
  2. The attachment spec
  3. The dashboard implementation
  4. Transitioned some types to generics for more type safety.
  5. The visualization attachment type was moved into a internal_attachments folder, alongside the new page attachment (Source of a lot of file changes
  6. Swapped out security.userProfiles for userProfile. (Also a large source of file changes)
  7. Removed an unused dashboard dependency from Triggers Actions UI to prevent circular dependencies.

Testing

  1. Create a dashboard. If you need a few handy, you can use this ndjson file to upload saved objects
  2. Visit a dashboard. Ensure you are in View mode
  3. Click the Add to Case Button
  4. Ensure the attachment is added successfully via toast. Click View Case
  5. You should see the name of the dashboard hyperlinked in the attachment comment. You should also see a Go to Dashboard button in the comment actions. Lastly, you should see a Go To Dashboard button in the actions dropdown.
  6. When you visit each link, you should be navigated back to the dashboard, with the time range as absolute value for the time range the user was viewing at the time they added the attachment.

Appendix

  1. Persistable state attachment type docs

@dominiqueclarke
Copy link
Copy Markdown
Contributor Author

/ci

@github-actions github-actions bot added the author:obs-ux-management PRs authored by the obs ux management team label Jun 17, 2025
@dominiqueclarke
Copy link
Copy Markdown
Contributor Author

/ci

@dominiqueclarke
Copy link
Copy Markdown
Contributor Author

/ci

@dominiqueclarke
Copy link
Copy Markdown
Contributor Author

/ci

@dominiqueclarke
Copy link
Copy Markdown
Contributor Author

/ci

@dominiqueclarke
Copy link
Copy Markdown
Contributor Author

/ci

1 similar comment
@dominiqueclarke
Copy link
Copy Markdown
Contributor Author

/ci

@dominiqueclarke dominiqueclarke force-pushed the feat/cases-page-attachment branch from 4d3ada9 to d81aec3 Compare June 18, 2025 16:05
@dominiqueclarke
Copy link
Copy Markdown
Contributor Author

/ci

@dominiqueclarke
Copy link
Copy Markdown
Contributor Author

/ci

@dominiqueclarke dominiqueclarke changed the title Feat/cases page attachment [Cases] [Dashboards] Add Generic Page attachment type and add Add to Case action to Dashboard Jun 18, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
cases 1022 1027 +5
dashboard 671 672 +1
total +6

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
cases 109 112 +3
triggersActionsUi 539 538 -1
total +2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
cases 1.3MB 1.3MB +2.0KB
dashboard 618.5KB 620.7KB +2.2KB
total +4.2KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
cases 134.6KB 135.6KB +1001.0B
dashboard 18.1KB 18.3KB +154.0B
triggersActionsUi 111.8KB 111.7KB -66.0B
total +1.1KB
Unknown metric groups

API count

id before after diff
cases 129 134 +5
triggersActionsUi 545 544 -1
total +4

async chunk count

id before after diff
cases 36 38 +2

ESLint disabled line counts

id before after diff
cases 69 72 +3

References to deprecated APIs

id before after diff
cases 32 26 -6

Total ESLint disabled count

id before after diff
cases 87 90 +3

History

@dominiqueclarke dominiqueclarke added release_note:skip Skip the PR/issue when compiling release notes Team:actionable-obs Formerly "obs-ux-management", responsible for SLO, o11y alerting, significant events, & synthetics. v9.1.0 v8.19.0 backport:version Backport to applied version labels labels Jun 18, 2025
@dominiqueclarke dominiqueclarke marked this pull request as ready for review June 18, 2025 20:04
@dominiqueclarke dominiqueclarke requested review from a team as code owners June 18, 2025 20:04
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)

security,
userProfile,
}: GetCurrentUserProfileArgs): Promise<UserProfile> => {
return security.userProfiles.getCurrent({ dataPath: 'avatar' });
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was getting a reference error when developing against security, and security.userProfiles was marked as deprecated with the suggestion to use userProfile instead.

</Routes>
</HashRouter>
</DashboardMountContext.Provider>
<KibanaContextProvider
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Needed to render the Add to Case modal

"dataViewEditor",
"alerting",
"actions",
"dashboard",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@dominiqueclarke Are we sure about this? I checked when this dependency was introduced and looks like it was introduced here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I checked with the Triggers Action team to confirm it's not in use. It was previously in use, but then some refactoring happened that removed the need for the dependency, but they forgot to remove it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's good news, because I faced a cycle dependency issue when I tried to add the cases plugin as a dependency of the dashboard plugin as part of this issue.

Copy link
Copy Markdown
Member

@gsoldevila gsoldevila left a comment

Choose a reason for hiding this comment

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

LGTM (config review only)

const attachmentViewProps: PersistableStateAttachmentViewProps<PageAttachmentPersistedState> = {
persistableStateAttachmentTypeId: PAGE_ATTACHMENT_TYPE,
persistableStateAttachmentState: {
pathname: '/test/path',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why pathname is not part of url?

persistableStateAttachmentState: {
pathname: '/test/path',
type: PAGE_ATTACHMENT_TYPE,
url: {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we handle external url or is it only kibana link?

@jasonrhodes jasonrhodes changed the title [Cases] [Dashboards] Add Generic Page attachment type and add Add to Case action to Dashboard [Cases] Add Generic Page attachment type for cases Jun 20, 2025
mgiota referenced this pull request in mgiota/kibana Jun 24, 2025
@dominiqueclarke
Copy link
Copy Markdown
Contributor Author

Closed in favor of #225295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author:obs-ux-management PRs authored by the obs ux management team backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:actionable-obs Formerly "obs-ux-management", responsible for SLO, o11y alerting, significant events, & synthetics. v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants