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

[Synthetics] introduce new spaces field for synthetics api keys #211816

Merged
merged 7 commits into from
Feb 21, 2025

Conversation

baileycash-elastic
Copy link
Contributor

@baileycash-elastic baileycash-elastic commented Feb 19, 2025

Summary

  • Resolves [Synthetics] Allow per space project API key !! #211049
  • Adds the ability for a user to create an API Key in synthetics settings that applies to specified space(s)
  • Reuses existing spaces combo box from private locations, enhances the component to incorporate a generic interface and help text prop to enable additional uses
  • Modifies functionality of Generate API Key button to consider a blank spaces field before creating the key
    • Currently, in private locations, if the spaces field is blank, the save button has no functionality, so this was copied here.

Screenshot 2025-02-19 at 3 59 24 PM

Screenshot 2025-02-19 at 4 00 44 PM

Release Notes

Adds the ability for a user to create an API Key in synthetics settings that applies only to specified space(s)

@baileycash-elastic baileycash-elastic changed the title introduce new spaces field for synthetics api keys [DRAFT] introduce new spaces field for synthetics api keys Feb 19, 2025
@baileycash-elastic baileycash-elastic changed the title [DRAFT] introduce new spaces field for synthetics api keys [WIP] introduce new spaces field for synthetics api keys Feb 19, 2025
const { services } = useKibana<ClientPluginsStart>();
const [spacesList, setSpacesList] = React.useState<Array<{ id: string; label: string }>>([]);
const data = services.spaces?.ui.useSpaces();

const HELP_TEXT = module === 'location' ? LOCATION_HELP_TEXT : API_KEY_HELP_TEXT;
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of passing the module name, I'd just pass the help text. That way the parent components can be responsible for defining the content.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Done ✅

@baileycash-elastic baileycash-elastic marked this pull request as ready for review February 19, 2025 20:55
@baileycash-elastic baileycash-elastic requested a review from a team as a code owner February 19, 2025 20:55
@baileycash-elastic baileycash-elastic added backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) Team:obs-ux-management Observability Management User Experience Team labels Feb 19, 2025
@elasticmachine
Copy link
Contributor

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

@baileycash-elastic baileycash-elastic changed the title [WIP] introduce new spaces field for synthetics api keys [Synthetics] introduce new spaces field for synthetics api keys Feb 19, 2025
Copy link
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

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

Can you please make sure to test one use-cases, so if user select * or ALL_SPACES, and if the user creating API key don't have access to * ALL SPACES, it should thrown an error.

Copy link
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

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

LGTM !!

Seems like user can create an API key in all spaces or any spaces to which they don't have permission to, it would be nice to add a validation to inform user that they don't have permission to in a space they are creating an API key.

though could be a follow up issue as well.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
synthetics 788.9KB 789.6KB +720.0B

History

@baileycash-elastic baileycash-elastic merged commit de7d33d into elastic:main Feb 21, 2025
9 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x, 9.0

https://github.com/elastic/kibana/actions/runs/13463814459

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Feb 21, 2025
…tic#211816)

### Summary

- Resolves elastic#211049
- Adds the ability for a user to create an API Key in synthetics
settings that applies to specified space(s)
- Reuses existing spaces combo box from private locations, enhances the
component to incorporate a generic interface and help text prop to
enable additional uses
- Modifies functionality of Generate API Key button to consider a blank
spaces field before creating the key
- Currently, in private locations, if the spaces field is blank, the
save button has no functionality, so this was copied here.

![Screenshot 2025-02-19 at 3 59
24 PM](https://github.com/user-attachments/assets/4bd7cf33-636a-4bba-a7fd-97b2315fcff1)

![Screenshot 2025-02-19 at 4 00
44 PM](https://github.com/user-attachments/assets/21b7cab6-8f95-44e9-b91d-f06e15cbac0c)

### Release Notes
Adds the ability for a user to create an API Key in synthetics settings
that applies only to specified space(s)

---------

Co-authored-by: Shahzad <shahzad31comp@gmail.com>
(cherry picked from commit de7d33d)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Feb 21, 2025
…tic#211816)

### Summary

- Resolves elastic#211049
- Adds the ability for a user to create an API Key in synthetics
settings that applies to specified space(s)
- Reuses existing spaces combo box from private locations, enhances the
component to incorporate a generic interface and help text prop to
enable additional uses
- Modifies functionality of Generate API Key button to consider a blank
spaces field before creating the key
- Currently, in private locations, if the spaces field is blank, the
save button has no functionality, so this was copied here.

![Screenshot 2025-02-19 at 3 59
24 PM](https://github.com/user-attachments/assets/4bd7cf33-636a-4bba-a7fd-97b2315fcff1)

![Screenshot 2025-02-19 at 4 00
44 PM](https://github.com/user-attachments/assets/21b7cab6-8f95-44e9-b91d-f06e15cbac0c)

### Release Notes
Adds the ability for a user to create an API Key in synthetics settings
that applies only to specified space(s)

---------

Co-authored-by: Shahzad <shahzad31comp@gmail.com>
(cherry picked from commit de7d33d)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x
9.0

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Feb 21, 2025
…#211816) (#212150)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[Synthetics] introduce new spaces field for synthetics api keys
(#211816)](#211816)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Bailey
Cash","email":"bailey.cash@elastic.co"},"sourceCommit":{"committedDate":"2025-02-21T19:25:54Z","message":"[Synthetics]
introduce new spaces field for synthetics api keys (#211816)\n\n###
Summary\n\n- Resolves #211049\n- Adds the ability for a user to create
an API Key in synthetics\nsettings that applies to specified space(s)\n-
Reuses existing spaces combo box from private locations, enhances
the\ncomponent to incorporate a generic interface and help text prop
to\nenable additional uses\n- Modifies functionality of Generate API Key
button to consider a blank\nspaces field before creating the key\n-
Currently, in private locations, if the spaces field is blank, the\nsave
button has no functionality, so this was copied here.\n\n![Screenshot
2025-02-19 at 3
59\n24 PM](https://github.com/user-attachments/assets/4bd7cf33-636a-4bba-a7fd-97b2315fcff1)\n\n![Screenshot
2025-02-19 at 4
00\n44 PM](https://github.com/user-attachments/assets/21b7cab6-8f95-44e9-b91d-f06e15cbac0c)\n\n###
Release Notes\nAdds the ability for a user to create an API Key in
synthetics settings\nthat applies only to specified
space(s)\n\n---------\n\nCo-authored-by: Shahzad
<shahzad31comp@gmail.com>","sha":"de7d33dec296a491ae9abd9f3b74859c0c8e78c7","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","v9.0.0","backport:prev-minor","Team:obs-ux-management","v9.1.0","v8.19.0"],"title":"[Synthetics]
introduce new spaces field for synthetics api
keys","number":211816,"url":"https://github.com/elastic/kibana/pull/211816","mergeCommit":{"message":"[Synthetics]
introduce new spaces field for synthetics api keys (#211816)\n\n###
Summary\n\n- Resolves #211049\n- Adds the ability for a user to create
an API Key in synthetics\nsettings that applies to specified space(s)\n-
Reuses existing spaces combo box from private locations, enhances
the\ncomponent to incorporate a generic interface and help text prop
to\nenable additional uses\n- Modifies functionality of Generate API Key
button to consider a blank\nspaces field before creating the key\n-
Currently, in private locations, if the spaces field is blank, the\nsave
button has no functionality, so this was copied here.\n\n![Screenshot
2025-02-19 at 3
59\n24 PM](https://github.com/user-attachments/assets/4bd7cf33-636a-4bba-a7fd-97b2315fcff1)\n\n![Screenshot
2025-02-19 at 4
00\n44 PM](https://github.com/user-attachments/assets/21b7cab6-8f95-44e9-b91d-f06e15cbac0c)\n\n###
Release Notes\nAdds the ability for a user to create an API Key in
synthetics settings\nthat applies only to specified
space(s)\n\n---------\n\nCo-authored-by: Shahzad
<shahzad31comp@gmail.com>","sha":"de7d33dec296a491ae9abd9f3b74859c0c8e78c7"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/211816","number":211816,"mergeCommit":{"message":"[Synthetics]
introduce new spaces field for synthetics api keys (#211816)\n\n###
Summary\n\n- Resolves #211049\n- Adds the ability for a user to create
an API Key in synthetics\nsettings that applies to specified space(s)\n-
Reuses existing spaces combo box from private locations, enhances
the\ncomponent to incorporate a generic interface and help text prop
to\nenable additional uses\n- Modifies functionality of Generate API Key
button to consider a blank\nspaces field before creating the key\n-
Currently, in private locations, if the spaces field is blank, the\nsave
button has no functionality, so this was copied here.\n\n![Screenshot
2025-02-19 at 3
59\n24 PM](https://github.com/user-attachments/assets/4bd7cf33-636a-4bba-a7fd-97b2315fcff1)\n\n![Screenshot
2025-02-19 at 4
00\n44 PM](https://github.com/user-attachments/assets/21b7cab6-8f95-44e9-b91d-f06e15cbac0c)\n\n###
Release Notes\nAdds the ability for a user to create an API Key in
synthetics settings\nthat applies only to specified
space(s)\n\n---------\n\nCo-authored-by: Shahzad
<shahzad31comp@gmail.com>","sha":"de7d33dec296a491ae9abd9f3b74859c0c8e78c7"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Bailey Cash <bailey.cash@elastic.co>
kibanamachine added a commit that referenced this pull request Feb 21, 2025
…#211816) (#212149)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Synthetics] introduce new spaces field for synthetics api keys
(#211816)](#211816)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Bailey
Cash","email":"bailey.cash@elastic.co"},"sourceCommit":{"committedDate":"2025-02-21T19:25:54Z","message":"[Synthetics]
introduce new spaces field for synthetics api keys (#211816)\n\n###
Summary\n\n- Resolves #211049\n- Adds the ability for a user to create
an API Key in synthetics\nsettings that applies to specified space(s)\n-
Reuses existing spaces combo box from private locations, enhances
the\ncomponent to incorporate a generic interface and help text prop
to\nenable additional uses\n- Modifies functionality of Generate API Key
button to consider a blank\nspaces field before creating the key\n-
Currently, in private locations, if the spaces field is blank, the\nsave
button has no functionality, so this was copied here.\n\n![Screenshot
2025-02-19 at 3
59\n24 PM](https://github.com/user-attachments/assets/4bd7cf33-636a-4bba-a7fd-97b2315fcff1)\n\n![Screenshot
2025-02-19 at 4
00\n44 PM](https://github.com/user-attachments/assets/21b7cab6-8f95-44e9-b91d-f06e15cbac0c)\n\n###
Release Notes\nAdds the ability for a user to create an API Key in
synthetics settings\nthat applies only to specified
space(s)\n\n---------\n\nCo-authored-by: Shahzad
<shahzad31comp@gmail.com>","sha":"de7d33dec296a491ae9abd9f3b74859c0c8e78c7","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","v9.0.0","backport:prev-minor","Team:obs-ux-management","v9.1.0","v8.19.0"],"title":"[Synthetics]
introduce new spaces field for synthetics api
keys","number":211816,"url":"https://github.com/elastic/kibana/pull/211816","mergeCommit":{"message":"[Synthetics]
introduce new spaces field for synthetics api keys (#211816)\n\n###
Summary\n\n- Resolves #211049\n- Adds the ability for a user to create
an API Key in synthetics\nsettings that applies to specified space(s)\n-
Reuses existing spaces combo box from private locations, enhances
the\ncomponent to incorporate a generic interface and help text prop
to\nenable additional uses\n- Modifies functionality of Generate API Key
button to consider a blank\nspaces field before creating the key\n-
Currently, in private locations, if the spaces field is blank, the\nsave
button has no functionality, so this was copied here.\n\n![Screenshot
2025-02-19 at 3
59\n24 PM](https://github.com/user-attachments/assets/4bd7cf33-636a-4bba-a7fd-97b2315fcff1)\n\n![Screenshot
2025-02-19 at 4
00\n44 PM](https://github.com/user-attachments/assets/21b7cab6-8f95-44e9-b91d-f06e15cbac0c)\n\n###
Release Notes\nAdds the ability for a user to create an API Key in
synthetics settings\nthat applies only to specified
space(s)\n\n---------\n\nCo-authored-by: Shahzad
<shahzad31comp@gmail.com>","sha":"de7d33dec296a491ae9abd9f3b74859c0c8e78c7"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/211816","number":211816,"mergeCommit":{"message":"[Synthetics]
introduce new spaces field for synthetics api keys (#211816)\n\n###
Summary\n\n- Resolves #211049\n- Adds the ability for a user to create
an API Key in synthetics\nsettings that applies to specified space(s)\n-
Reuses existing spaces combo box from private locations, enhances
the\ncomponent to incorporate a generic interface and help text prop
to\nenable additional uses\n- Modifies functionality of Generate API Key
button to consider a blank\nspaces field before creating the key\n-
Currently, in private locations, if the spaces field is blank, the\nsave
button has no functionality, so this was copied here.\n\n![Screenshot
2025-02-19 at 3
59\n24 PM](https://github.com/user-attachments/assets/4bd7cf33-636a-4bba-a7fd-97b2315fcff1)\n\n![Screenshot
2025-02-19 at 4
00\n44 PM](https://github.com/user-attachments/assets/21b7cab6-8f95-44e9-b91d-f06e15cbac0c)\n\n###
Release Notes\nAdds the ability for a user to create an API Key in
synthetics settings\nthat applies only to specified
space(s)\n\n---------\n\nCo-authored-by: Shahzad
<shahzad31comp@gmail.com>","sha":"de7d33dec296a491ae9abd9f3b74859c0c8e78c7"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Bailey Cash <bailey.cash@elastic.co>
JoseLuisGJ pushed a commit to JoseLuisGJ/kibana that referenced this pull request Feb 27, 2025
…tic#211816)

### Summary

- Resolves elastic#211049
- Adds the ability for a user to create an API Key in synthetics
settings that applies to specified space(s)
- Reuses existing spaces combo box from private locations, enhances the
component to incorporate a generic interface and help text prop to
enable additional uses
- Modifies functionality of Generate API Key button to consider a blank
spaces field before creating the key
- Currently, in private locations, if the spaces field is blank, the
save button has no functionality, so this was copied here.

![Screenshot 2025-02-19 at 3 59
24 PM](https://github.com/user-attachments/assets/4bd7cf33-636a-4bba-a7fd-97b2315fcff1)

![Screenshot 2025-02-19 at 4 00
44 PM](https://github.com/user-attachments/assets/21b7cab6-8f95-44e9-b91d-f06e15cbac0c)

### Release Notes
Adds the ability for a user to create an API Key in synthetics settings
that applies only to specified space(s)

---------

Co-authored-by: Shahzad <shahzad31comp@gmail.com>
SoniaSanzV pushed a commit to SoniaSanzV/kibana that referenced this pull request Mar 4, 2025
…elastic#211816) (elastic#212149)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Synthetics] introduce new spaces field for synthetics api keys
(elastic#211816)](elastic#211816)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Bailey
Cash","email":"bailey.cash@elastic.co"},"sourceCommit":{"committedDate":"2025-02-21T19:25:54Z","message":"[Synthetics]
introduce new spaces field for synthetics api keys (elastic#211816)\n\n###
Summary\n\n- Resolves elastic#211049\n- Adds the ability for a user to create
an API Key in synthetics\nsettings that applies to specified space(s)\n-
Reuses existing spaces combo box from private locations, enhances
the\ncomponent to incorporate a generic interface and help text prop
to\nenable additional uses\n- Modifies functionality of Generate API Key
button to consider a blank\nspaces field before creating the key\n-
Currently, in private locations, if the spaces field is blank, the\nsave
button has no functionality, so this was copied here.\n\n![Screenshot
2025-02-19 at 3
59\n24 PM](https://github.com/user-attachments/assets/4bd7cf33-636a-4bba-a7fd-97b2315fcff1)\n\n![Screenshot
2025-02-19 at 4
00\n44 PM](https://github.com/user-attachments/assets/21b7cab6-8f95-44e9-b91d-f06e15cbac0c)\n\n###
Release Notes\nAdds the ability for a user to create an API Key in
synthetics settings\nthat applies only to specified
space(s)\n\n---------\n\nCo-authored-by: Shahzad
<shahzad31comp@gmail.com>","sha":"de7d33dec296a491ae9abd9f3b74859c0c8e78c7","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","v9.0.0","backport:prev-minor","Team:obs-ux-management","v9.1.0","v8.19.0"],"title":"[Synthetics]
introduce new spaces field for synthetics api
keys","number":211816,"url":"https://github.com/elastic/kibana/pull/211816","mergeCommit":{"message":"[Synthetics]
introduce new spaces field for synthetics api keys (elastic#211816)\n\n###
Summary\n\n- Resolves elastic#211049\n- Adds the ability for a user to create
an API Key in synthetics\nsettings that applies to specified space(s)\n-
Reuses existing spaces combo box from private locations, enhances
the\ncomponent to incorporate a generic interface and help text prop
to\nenable additional uses\n- Modifies functionality of Generate API Key
button to consider a blank\nspaces field before creating the key\n-
Currently, in private locations, if the spaces field is blank, the\nsave
button has no functionality, so this was copied here.\n\n![Screenshot
2025-02-19 at 3
59\n24 PM](https://github.com/user-attachments/assets/4bd7cf33-636a-4bba-a7fd-97b2315fcff1)\n\n![Screenshot
2025-02-19 at 4
00\n44 PM](https://github.com/user-attachments/assets/21b7cab6-8f95-44e9-b91d-f06e15cbac0c)\n\n###
Release Notes\nAdds the ability for a user to create an API Key in
synthetics settings\nthat applies only to specified
space(s)\n\n---------\n\nCo-authored-by: Shahzad
<shahzad31comp@gmail.com>","sha":"de7d33dec296a491ae9abd9f3b74859c0c8e78c7"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/211816","number":211816,"mergeCommit":{"message":"[Synthetics]
introduce new spaces field for synthetics api keys (elastic#211816)\n\n###
Summary\n\n- Resolves elastic#211049\n- Adds the ability for a user to create
an API Key in synthetics\nsettings that applies to specified space(s)\n-
Reuses existing spaces combo box from private locations, enhances
the\ncomponent to incorporate a generic interface and help text prop
to\nenable additional uses\n- Modifies functionality of Generate API Key
button to consider a blank\nspaces field before creating the key\n-
Currently, in private locations, if the spaces field is blank, the\nsave
button has no functionality, so this was copied here.\n\n![Screenshot
2025-02-19 at 3
59\n24 PM](https://github.com/user-attachments/assets/4bd7cf33-636a-4bba-a7fd-97b2315fcff1)\n\n![Screenshot
2025-02-19 at 4
00\n44 PM](https://github.com/user-attachments/assets/21b7cab6-8f95-44e9-b91d-f06e15cbac0c)\n\n###
Release Notes\nAdds the ability for a user to create an API Key in
synthetics settings\nthat applies only to specified
space(s)\n\n---------\n\nCo-authored-by: Shahzad
<shahzad31comp@gmail.com>","sha":"de7d33dec296a491ae9abd9f3b74859c0c8e78c7"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Bailey Cash <bailey.cash@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) release_note:enhancement Team:obs-ux-management Observability Management User Experience Team v8.19.0 v9.0.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Synthetics] Allow per space project API key !!
5 participants