-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Slo overview embeddable instances api #245371
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
Merged
mgiota
merged 60 commits into
elastic:main
from
mgiota:slo-overview-embeddable-instances-api
Jan 26, 2026
Merged
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
bee87f8
select slo id first and then specific instances
mgiota 56a93af
fix clear issue
mgiota 4cf533f
remove initial input (edit configuration is not enabled)
mgiota 52ed5b3
fix remote type issue
mgiota 5a4bc4f
disable save button if no instanceId is selected
mgiota 6afe593
remove leftovers
mgiota f2bebf0
remove unused initialInstanceId
mgiota e7bd885
cleanup
mgiota c77f3ac
Merge branch 'main' into slo-overview-embeddable-instances-api
elasticmachine 9bec6e0
Merge branch 'main' into slo-overview-embeddable-instances-api
kdelemme db05036
DRAFT WIP
mgiota 45c7307
Changes from node scripts/eslint_all_files --no-cache --fix
kibanamachine 06621cb
Merge branch 'main' of github.com:elastic/kibana into slo-overview-em…
mgiota 39e7089
display remote instances in the instances dropdown
mgiota 4f2cc79
Merge branch 'main' into slo-overview-embeddable-instances-api
elasticmachine 7e88050
update esquery, use simple_query_string, add runtime_mappings
mgiota 4d8e281
read remoteName from fields
mgiota 1375638
fix eslint issues
mgiota d2495f7
more eslint fixes
mgiota 045985c
fix local group by slos
mgiota 8ab4d39
Update x-pack/solutions/observability/plugins/slo/public/embeddable/s…
mgiota 1ec76a6
Update x-pack/solutions/observability/plugins/slo/public/embeddable/s…
mgiota 9efc681
fix type issues
mgiota 5173b71
add component tests for slo instance selector
mgiota 7e8a496
Merge branch 'main' into slo-overview-embeddable-instances-api
mgiota b4efe1d
cleanup
mgiota 74070ec
use group by
mgiota 67dd0d2
fix eslint issues
mgiota 9d6bd34
fix type issues on test file
mgiota 13c0f04
cleanup
mgiota fec5a33
remove commented code
mgiota 0672e19
fix failing functional tests
mgiota 532d2f5
fix failing functional tests
mgiota dc045ac
proper use of runtime field for remoteName
mgiota c4e2792
remove unused searchAfter
mgiota a46a221
remove show all instances toggle in favor of all instances combobox o…
mgiota 7c4ec70
fix type issue
mgiota 7de73cc
Merge branch 'main' into slo-overview-embeddable-instances-api
mgiota 98602a6
clean up
mgiota 24141f2
remove useMemo
mgiota 226cf6a
refactor searchSLODefinitionsParamsSchema
mgiota 9c835df
remove unnecessary duplicate code
mgiota 6ca95ce
Merge branch 'main' into slo-overview-embeddable-instances-api
mgiota 0e20edd
fix failing tests
mgiota ad8bc67
add unit tests for search_slo_definition service
mgiota 95eeda8
deployment agnostic api tests for the new search slo definition api
mgiota a2c6151
fix failing unit tests
mgiota 062914c
Changes from node scripts/eslint_all_files --no-cache --fix
kibanamachine 861a8ac
fix type issues
mgiota 903d878
remove unit test, code was removed in another commit
mgiota c2c788b
Merge branch 'main' into slo-overview-embeddable-instances-api
mgiota 0d1e7f8
remove unused code
mgiota 7cd1e19
refactor types
mgiota cae8db4
Merge branch 'main' into slo-overview-embeddable-instances-api
mgiota a2f3ba1
Merge branch 'main' into slo-overview-embeddable-instances-api
mgiota 19a1631
Merge branch 'main' into slo-overview-embeddable-instances-api
mgiota b4ee543
Merge branch 'main' into slo-overview-embeddable-instances-api
mgiota 7d941d4
Merge branch 'main' of github.com:elastic/kibana into slo-overview-em…
mgiota a2aa6fc
fix failing unit test
mgiota 98d869f
Merge branch 'main' into slo-overview-embeddable-instances-api
mgiota File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...k/platform/packages/shared/kbn-slo-schema/src/rest_specs/routes/search_slo_definitions.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* | ||
| * 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 * as t from 'io-ts'; | ||
| import { toNumberRt } from '@kbn/io-ts-utils'; | ||
|
|
||
| const searchSLODefinitionsParamsSchema = t.partial({ | ||
| query: t.partial({ | ||
| search: t.string, | ||
| size: toNumberRt, | ||
| searchAfter: t.string, | ||
| remoteName: t.string, | ||
| }), | ||
| }); | ||
|
|
||
| type SearchSLODefinitionsParams = t.TypeOf<typeof searchSLODefinitionsParamsSchema.props.query>; | ||
|
|
||
| interface SearchSLODefinitionItem { | ||
| id: string; | ||
| name: string; | ||
| groupBy: string[]; | ||
| remote?: { remoteName: string; kibanaUrl: string }; | ||
| } | ||
|
|
||
| interface SearchSLODefinitionResponse { | ||
| results: SearchSLODefinitionItem[]; | ||
| searchAfter?: string; | ||
| } | ||
|
|
||
| export { searchSLODefinitionsParamsSchema }; | ||
| export type { SearchSLODefinitionsParams, SearchSLODefinitionResponse, SearchSLODefinitionItem }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
...ions/observability/plugins/slo/public/embeddable/slo/overview/slo_definition_selector.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| /* | ||
| * 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 React, { useMemo, useEffect, useState } from 'react'; | ||
| import type { EuiComboBoxOptionOption } from '@elastic/eui'; | ||
| import { EuiComboBox, EuiFormRow } from '@elastic/eui'; | ||
| import { i18n } from '@kbn/i18n'; | ||
| import { debounce } from 'lodash'; | ||
| import type { SearchSLODefinitionItem } from '@kbn/slo-schema'; | ||
| import { useFetchSloDefinitionsWithRemote } from '../../../hooks/use_fetch_slo_definitions_with_remote'; | ||
|
|
||
| interface Props { | ||
| onSelected: (slo: SearchSLODefinitionItem | undefined) => void; | ||
| hasError?: boolean; | ||
| remoteName?: string; | ||
| } | ||
|
|
||
| const SLO_REQUIRED = i18n.translate('xpack.slo.sloEmbeddable.config.errors.sloRequired', { | ||
| defaultMessage: 'SLO is required.', | ||
| }); | ||
|
|
||
| export function SloDefinitionSelector({ onSelected, hasError, remoteName }: Props) { | ||
| const [selectedOptions, setSelectedOptions] = useState<Array<EuiComboBoxOptionOption<string>>>( | ||
| [] | ||
| ); | ||
| const [searchValue, setSearchValue] = useState<string>(''); | ||
| const search = searchValue.trim(); | ||
|
|
||
| const { isLoading, data: definitionsData } = useFetchSloDefinitionsWithRemote({ | ||
| search, | ||
| size: 100, | ||
| remoteName, | ||
| }); | ||
|
|
||
| const options = useMemo(() => { | ||
| return ( | ||
| definitionsData?.results.map((slo) => ({ | ||
| label: slo.name, | ||
| value: slo.id, | ||
| })) ?? [] | ||
| ); | ||
| }, [definitionsData]); | ||
|
|
||
| const onChange = (opts: Array<EuiComboBoxOptionOption<string>>) => { | ||
| setSelectedOptions(opts); | ||
| if (opts.length === 0) { | ||
| onSelected(undefined); | ||
| return; | ||
| } | ||
|
|
||
| const selectedSloId = opts[0].value!; | ||
kdelemme marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const selectedSlo = definitionsData?.results.find((slo) => slo.id === selectedSloId); | ||
| onSelected(selectedSlo); | ||
| }; | ||
|
|
||
| const onSearchChange = useMemo( | ||
| () => | ||
| debounce((value: string) => { | ||
| setSearchValue(value); | ||
| }, 300), | ||
| [] | ||
| ); | ||
|
|
||
| useEffect(() => { | ||
| return () => { | ||
| onSearchChange.cancel(); | ||
| }; | ||
| }, [onSearchChange]); | ||
|
|
||
| return ( | ||
| <EuiFormRow | ||
| fullWidth | ||
| isInvalid={hasError} | ||
| error={hasError ? SLO_REQUIRED : undefined} | ||
| label={i18n.translate('xpack.slo.embeddable.sloDefinitionSelectorLabel', { | ||
| defaultMessage: 'SLO Definition', | ||
| })} | ||
| > | ||
| <EuiComboBox | ||
| aria-label={i18n.translate( | ||
| 'xpack.slo.sloEmbeddable.config.sloDefinitionSelector.ariaLabel', | ||
| { | ||
| defaultMessage: 'SLO Definition', | ||
| } | ||
| )} | ||
| placeholder={i18n.translate( | ||
| 'xpack.slo.sloEmbeddable.config.sloDefinitionSelector.placeholder', | ||
| { | ||
| defaultMessage: 'Select a SLO definition', | ||
| } | ||
| )} | ||
| data-test-subj="sloDefinitionSelector" | ||
| options={options} | ||
| selectedOptions={selectedOptions} | ||
| async | ||
| isLoading={isLoading} | ||
| onChange={onChange} | ||
| fullWidth | ||
| onSearchChange={onSearchChange} | ||
| isInvalid={hasError} | ||
| singleSelection={{ asPlainText: true }} | ||
| /> | ||
| </EuiFormRow> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.