Skip to content

Commit 671b264

Browse files
kibanamachinealvarezmelissa87elasticmachine
authored
[8.19] [ML] Inference endpoints UI improvements (#218496) (#221149)
# Backport This will backport the following commits from `main` to `8.19`: - [[ML] Inference endpoints UI improvements (#218496)](#218496) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Melissa Alvarez","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-04-23T21:51:15Z","message":"[ML] Inference endpoints UI improvements (#218496)\n\n## Summary\nRelated meta issue: [[ML] [Meta] Inference endpoints UI\nenhancements](elastic/ml-team#1506) \n\nThis PR:\n- removes the Save button when the endpoint is preconfigured\n\n![image](https://github.com/user-attachments/assets/6ced2cb2-a662-4af9-a781-f4181b277af3)\n\n- displays filter items (in table filter controls) based on available\ntype and provider\n\n![image](https://github.com/user-attachments/assets/9dbd6c32-f651-473b-a1e3-cd3b64398266)\n\n\n![image](https://github.com/user-attachments/assets/0916bc74-11e0-4871-aaab-4bff0600aa3b)\n\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n---------\n\nCo-authored-by: Elastic Machine <[email protected]>","sha":"ce705f65ee322422e9a48cfa8d0adfbfc048aa26","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","release_note:skip","ci:project-deploy-elasticsearch","backport:version","v9.1.0","v8.19.0","Feature:Inference UI"],"title":"[ML] Inference endpoints UI improvements","number":218496,"url":"https://github.com/elastic/kibana/pull/218496","mergeCommit":{"message":"[ML] Inference endpoints UI improvements (#218496)\n\n## Summary\nRelated meta issue: [[ML] [Meta] Inference endpoints UI\nenhancements](elastic/ml-team#1506) \n\nThis PR:\n- removes the Save button when the endpoint is preconfigured\n\n![image](https://github.com/user-attachments/assets/6ced2cb2-a662-4af9-a781-f4181b277af3)\n\n- displays filter items (in table filter controls) based on available\ntype and provider\n\n![image](https://github.com/user-attachments/assets/9dbd6c32-f651-473b-a1e3-cd3b64398266)\n\n\n![image](https://github.com/user-attachments/assets/0916bc74-11e0-4871-aaab-4bff0600aa3b)\n\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n---------\n\nCo-authored-by: Elastic Machine <[email protected]>","sha":"ce705f65ee322422e9a48cfa8d0adfbfc048aa26"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/218496","number":218496,"mergeCommit":{"message":"[ML] Inference endpoints UI improvements (#218496)\n\n## Summary\nRelated meta issue: [[ML] [Meta] Inference endpoints UI\nenhancements](elastic/ml-team#1506) \n\nThis PR:\n- removes the Save button when the endpoint is preconfigured\n\n![image](https://github.com/user-attachments/assets/6ced2cb2-a662-4af9-a781-f4181b277af3)\n\n- displays filter items (in table filter controls) based on available\ntype and provider\n\n![image](https://github.com/user-attachments/assets/9dbd6c32-f651-473b-a1e3-cd3b64398266)\n\n\n![image](https://github.com/user-attachments/assets/0916bc74-11e0-4871-aaab-4bff0600aa3b)\n\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n---------\n\nCo-authored-by: Elastic Machine <[email protected]>","sha":"ce705f65ee322422e9a48cfa8d0adfbfc048aa26"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Melissa Alvarez <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
1 parent defd004 commit 671b264

File tree

6 files changed

+71
-43
lines changed

6 files changed

+71
-43
lines changed

x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/inference_flyout_wrapper.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ describe('InferenceFlyout', () => {
148148
});
149149
}, 10000);
150150

151-
it('disables submit button for preconfigured endpoints', () => {
151+
it('removes submit button for preconfigured endpoints', () => {
152152
const mockEndpoint = {
153153
config: {
154154
inferenceId: '.test-id',
@@ -162,7 +162,7 @@ describe('InferenceFlyout', () => {
162162
};
163163

164164
renderComponent({ isEdit: true, inferenceEndpoint: mockEndpoint });
165-
expect(screen.getByTestId('inference-endpoint-submit-button')).toBeDisabled();
165+
expect(screen.queryByTestId('inference-endpoint-submit-button')).not.toBeInTheDocument();
166166
});
167167

168168
it('disables the num_allocations field for preconfigured endpoints', () => {

x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/inference_flyout_wrapper.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,23 +101,23 @@ export const InferenceFlyoutWrapper: React.FC<InferenceFlyoutWrapperProps> = ({
101101
isPreconfigured={isPreconfigured}
102102
/>
103103
<EuiSpacer size="m" />
104-
<EuiFlexGroup justifyContent="flexStart">
105-
<EuiFlexItem grow={false}>
106-
<EuiButton
107-
fill
108-
color="success"
109-
size="m"
110-
isLoading={form.isSubmitting || isLoading}
111-
disabled={
112-
(!form.isValid && form.isSubmitted) || isLoading || isPreconfigured // Disable edit option for preconfigured endpoints
113-
}
114-
data-test-subj="inference-endpoint-submit-button"
115-
onClick={handleSubmit}
116-
>
117-
{LABELS.SAVE}
118-
</EuiButton>
119-
</EuiFlexItem>
120-
</EuiFlexGroup>
104+
{isPreconfigured ? null : (
105+
<EuiFlexGroup justifyContent="flexStart">
106+
<EuiFlexItem grow={false}>
107+
<EuiButton
108+
fill
109+
color="success"
110+
size="m"
111+
isLoading={form.isSubmitting || isLoading}
112+
disabled={(!form.isValid && form.isSubmitted) || isLoading}
113+
data-test-subj="inference-endpoint-submit-button"
114+
onClick={handleSubmit}
115+
>
116+
{LABELS.SAVE}
117+
</EuiButton>
118+
</EuiFlexItem>
119+
</EuiFlexGroup>
120+
)}
121121
</Form>
122122
</EuiFlyoutBody>
123123
<EuiFlyoutFooter>

x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/filter/service_provider_filter.tsx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* 2.0.
66
*/
77

8-
import React from 'react';
8+
import React, { useMemo } from 'react';
99
import { SERVICE_PROVIDERS, ServiceProviderKeys } from '@kbn/inference-endpoint-ui-common';
1010
import type { FilterOptions } from '../types';
1111
import { MultiSelectFilter, MultiSelectFilterOption } from './multi_select_filter';
@@ -14,14 +14,14 @@ import * as i18n from './translations';
1414
interface Props {
1515
optionKeys: ServiceProviderKeys[];
1616
onChange: (newFilterOptions: Partial<FilterOptions>) => void;
17+
uniqueProviders: Set<ServiceProviderKeys>;
1718
}
1819

19-
const options = Object.entries(SERVICE_PROVIDERS).map(([key, { name }]) => ({
20-
key,
21-
label: name,
22-
}));
23-
24-
export const ServiceProviderFilter: React.FC<Props> = ({ optionKeys, onChange }) => {
20+
export const ServiceProviderFilter: React.FC<Props> = ({
21+
optionKeys,
22+
onChange,
23+
uniqueProviders,
24+
}) => {
2525
const filterId: string = 'provider';
2626
const onSystemFilterChange = (newOptions: MultiSelectFilterOption[]) => {
2727
onChange({
@@ -31,11 +31,23 @@ export const ServiceProviderFilter: React.FC<Props> = ({ optionKeys, onChange })
3131
});
3232
};
3333

34+
const filteredOptions = useMemo(() => {
35+
const options: any = [];
36+
uniqueProviders.forEach((provider) => {
37+
const { name } = SERVICE_PROVIDERS[provider];
38+
options.push({
39+
key: provider,
40+
label: name,
41+
});
42+
});
43+
return options;
44+
}, [uniqueProviders]);
45+
3446
return (
3547
<MultiSelectFilter
3648
buttonLabel={i18n.SERVICE_PROVIDER}
3749
onChange={onSystemFilterChange}
38-
options={options}
50+
options={filteredOptions}
3951
renderOption={(option) => option.label}
4052
selectedOptionKeys={optionKeys}
4153
dataTestSubj="service-field-endpoints"

x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/filter/task_type_filter.tsx

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,19 @@
55
* 2.0.
66
*/
77

8-
import React from 'react';
8+
import React, { useMemo } from 'react';
99
import { InferenceTaskType } from '@elastic/elasticsearch/lib/api/types';
1010
import { FilterOptions } from '../types';
1111
import { MultiSelectFilter, MultiSelectFilterOption } from './multi_select_filter';
1212
import * as i18n from './translations';
1313

14-
enum TaskTypes {
15-
completion = 'completion',
16-
rerank = 'rerank',
17-
sparse_embedding = 'sparse_embedding',
18-
text_embedding = 'text_embedding',
19-
}
2014
interface Props {
2115
optionKeys: InferenceTaskType[];
2216
onChange: (newFilterOptions: Partial<FilterOptions>) => void;
17+
uniqueTaskTypes: Set<InferenceTaskType>;
2318
}
2419

25-
const options = Object.values(TaskTypes).map((option) => ({
26-
key: option,
27-
label: option,
28-
}));
29-
30-
export const TaskTypeFilter: React.FC<Props> = ({ optionKeys, onChange }) => {
20+
export const TaskTypeFilter: React.FC<Props> = ({ optionKeys, onChange, uniqueTaskTypes }) => {
3121
const filterId: string = 'type';
3222
const onSystemFilterChange = (newOptions: MultiSelectFilterOption[]) => {
3323
onChange({
@@ -37,11 +27,18 @@ export const TaskTypeFilter: React.FC<Props> = ({ optionKeys, onChange }) => {
3727
});
3828
};
3929

30+
const filteredOptions = useMemo(() => {
31+
return [...uniqueTaskTypes].map((type) => ({
32+
key: type,
33+
label: type,
34+
}));
35+
}, [uniqueTaskTypes]);
36+
4037
return (
4138
<MultiSelectFilter
4239
buttonLabel={i18n.TASK_TYPE}
4340
onChange={onSystemFilterChange}
44-
options={options}
41+
options={filteredOptions}
4542
renderOption={(option) => option.label}
4643
selectedOptionKeys={optionKeys}
4744
dataTestSubj="type-field-endpoints"

x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/tabular_page.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,20 @@ export const TabularPage: React.FC<TabularPageProps> = ({ inferenceEndpoints })
6060
[toasts]
6161
);
6262

63+
const uniqueProvidersAndTaskTypes = useMemo(() => {
64+
return inferenceEndpoints.reduce(
65+
(acc, { service, task_type: taskType }) => {
66+
acc.providers.add(service as ServiceProviderKeys);
67+
acc.taskTypes.add(taskType);
68+
return acc;
69+
},
70+
{
71+
providers: new Set<ServiceProviderKeys>(),
72+
taskTypes: new Set<InferenceTaskType>(),
73+
}
74+
);
75+
}, [inferenceEndpoints]);
76+
6377
const onCancelDeleteModal = useCallback(() => {
6478
setSelectedInferenceEndpoint(undefined);
6579
setShowDeleteAction(false);
@@ -211,11 +225,16 @@ export const TabularPage: React.FC<TabularPageProps> = ({ inferenceEndpoints })
211225
<EuiFlexItem grow={false}>
212226
<ServiceProviderFilter
213227
optionKeys={filterOptions.provider}
228+
uniqueProviders={uniqueProvidersAndTaskTypes.providers}
214229
onChange={onFilterChangedCallback}
215230
/>
216231
</EuiFlexItem>
217232
<EuiFlexItem grow={false}>
218-
<TaskTypeFilter optionKeys={filterOptions.type} onChange={onFilterChangedCallback} />
233+
<TaskTypeFilter
234+
optionKeys={filterOptions.type}
235+
onChange={onFilterChangedCallback}
236+
uniqueTaskTypes={uniqueProvidersAndTaskTypes.taskTypes}
237+
/>
219238
</EuiFlexItem>
220239
</EuiFlexGroup>
221240
</EuiFlexItem>

x-pack/test_serverless/functional/page_objects/svl_search_inference_management_page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export function SvlSearchInferenceManagementPageProvider({ getService }: FtrProv
137137
(await testSubjects.getVisibleText('provider-select')).includes('Elasticsearch');
138138
(await testSubjects.getVisibleText('model_id-input')).includes('.elser_model_2');
139139

140-
expect(await testSubjects.isEnabled('inference-endpoint-submit-button')).to.be(false);
140+
await testSubjects.missingOrFail('inference-endpoint-submit-button');
141141
},
142142
},
143143
};

0 commit comments

Comments
 (0)