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

[Exploratory view] Allow ability add extra actions in lens embeddable #123713

Merged
merged 10 commits into from
Jan 28, 2022

Conversation

shahzad31
Copy link
Contributor

@shahzad31 shahzad31 commented Jan 25, 2022

Summary

This requirement came out of while doing POC for security #120004

So extracting it from that PR into a separate PR.

Added ability to add extra actions in Lens embeddable and subsequently use that ability in exploratory view to add

Add to case
Save
Explore' actions

Updated the example to describe use case

Testing

Start kibana with yarn start --run-examples

find observability exploratory view example

You should be able to use Explore and Save Viz actions from the cog icon

image

@shahzad31 shahzad31 changed the title add lens extra actions [Exploratory view] Allow ability add extra actions in lens embeddable Jan 26, 2022
@shahzad31 shahzad31 marked this pull request as ready for review January 26, 2022 10:04
@shahzad31 shahzad31 requested review from a team as code owners January 26, 2022 10:04
@shahzad31 shahzad31 self-assigned this Jan 26, 2022
@shahzad31 shahzad31 added v8.1.0 release_note:skip Skip the PR/issue when compiling release notes labels Jan 26, 2022
Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, this seems like a super useful feature. Pinging @stacey-gammon and @ppisljar - could you have a look as well whether this is how actions are supposed to be used? For a bunch of things this kind of "local" actions which don't go through the global registry seem pretty helpful.

@@ -52,7 +52,7 @@ export type TypedLensByValueInput = Omit<LensByValueInput, 'attributes'> & {
};

export type EmbeddableComponentProps = (TypedLensByValueInput | LensByReferenceInput) & {
withActions?: boolean;
withActions?: boolean | Action[];
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems a bit weird to re-use the existing prop for this - what about splitting out extraActions on this level as well?

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 find using existing prop as a client to be honest cleaner. I mean now if use has to pass extra actions, they just passed it as an array.

Adding an extra prop means, we will have to withActions true and then pass extraActions prop.

Happy to amend it, if you feel strong about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's definitely a nit, I'm just a bit concerned people will be confused (I was initially). Maybe we can further disambiguate and call it withDefaultActions and extraActions? That what you can also only show your special extra actions and hide the default ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@botelastic botelastic bot added the Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability label Jan 26, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

Copy link
Contributor

@justinkambic justinkambic left a comment

Choose a reason for hiding this comment

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

From a smoke test perspective, I'm seeing an undefined description for the export viz option. Can we control this better?

image

appId
);

const hrefPath = createExploratoryViewUrl(
Copy link
Contributor

Choose a reason for hiding this comment

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

href and hrefPath seem to be equal to me when running this, is there a reason we need to call createExploratoryViewUrl twice? Are there cases where onlyPath being undefined will cause the first call to yield a divergent output?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@justinkambic i have removed the part about undefined description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hrefPath is actually a route path. i think there is some room for improvement, i will add another function instead of modifying the current one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@justinkambic i updated the code to make it bit more clear

@ppisljar
Copy link
Member

cc @vadimkibana

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
observability 349 350 +1

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
observability 316 319 +3

Async chunks

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

id before after diff
observability 388.1KB 390.8KB +2.7KB
uptime 704.2KB 704.2KB +29.0B
total +2.8KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
observability 25 26 +1

Page load bundle

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

id before after diff
lens 41.3KB 41.5KB +263.0B
observability 83.9KB 84.1KB +171.0B
total +434.0B
Unknown metric groups

API count

id before after diff
observability 319 322 +3

History

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

cc @shahzad31

Copy link
Contributor

@justinkambic justinkambic left a comment

Choose a reason for hiding this comment

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

Functionality LGTM - had one minor code mention, wanted to make sure it's desired.

return true;
},
execute: async (context: ActionExecutionContext<object>) => {
alert('I am an extra action');
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want this code here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is a lens embeddable example.

Copy link
Contributor

@justinkambic justinkambic left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

LGTM, didn't test again. Thanks for this addition!

@shahzad31 shahzad31 merged commit 5b8af6c into elastic:main Jan 28, 2022
@shahzad31 shahzad31 deleted the lens-extra-actions branch January 28, 2022 10:15
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jan 28, 2022
jloleysens added a commit to jloleysens/kibana that referenced this pull request Jan 28, 2022
…fix-potential-race-condition-when-screenshotting

* 'main' of github.com:elastic/kibana: (75 commits)
  [Reporting] Logging improvements while generating reports (elastic#123802)
  [Uptime] Default alert connectors email settings (elastic#123244)
  Update comparison series styles to match the main series (elastic#123858)
  [RAC][Uptime] remove extra dot from the uptime alert connector message (elastic#124000)
  [Exploratory view] Allow ability add extra actions in lens embeddable (elastic#123713)
  [SecuritySolution][Investigations] Add message about missing index in data view in analyzer (elastic#122859)
  [TSVB] Formatting in the left axis is not respected when I have two separate axis (elastic#123903)
  [Discover] Remove services from component dependencies (elastic#121691)
  Stop IM rule execution if there are no events (elastic#123811)
  [Security Solution][Endpoint] Update Fleet Trusted Apps and Host Isolation Exception cards to use exception list summary API (elastic#123900)
  [Security Solution][Exceptions] Switches modal to flyout component (elastic#123408)
  [Workplace Search] Fix bug where modal visible after deleting a group (elastic#123976)
  [Alerting] Remove state variables from action variable menu (elastic#123702)
  replace deprecated api usage (elastic#123970)
  Fix package policy merge logic for boolean values (elastic#123974)
  [Security Solution][Endpoint][Policy] Remove GET policy list api route (elastic#123873)
  Reenable alert_add test suite (elastic#123862)
  [Fleet] Remove usage of IFieldType in Fleet (elastic#123960)
  [Lists] Add an instance of `ExceptionListClient` with server extension points turned off to context object provided to callbacks (elastic#123885)
  [Maps] Add execution context (elastic#123651)
  ...

# Conflicts:
#	x-pack/plugins/screenshotting/server/browsers/chromium/driver_factory/index.ts
}: AddToCaseProps & { getToastText: (thaCase: Case | SubCase) => MountPoint<HTMLElement> }) => {
appId,
}: AddToCaseProps & {
appId?: 'security' | 'observability';
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @shahzad31 👋 Just curious as to why we need to specify security here?

I'm probably missing something but wouldn't appId always be set to observability when it is defined?

cc: @cnasikas

Copy link
Member

@cnasikas cnasikas Jan 31, 2022

Choose a reason for hiding this comment

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

You are right. The appId should be observability for Observability. Also, AddToCaseProps contains appId?: 'security' | 'observability';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants