Skip to content

Commit 579ca1b

Browse files
Merge branch 'main' into feature-remove-deprecated-apis
2 parents eef3ee2 + 8ab30f5 commit 579ca1b

File tree

36 files changed

+946
-2727
lines changed

36 files changed

+946
-2727
lines changed

test/api_integration/apis/home/sample_data.ts

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ export default function ({ getService }: FtrProviderContext) {
2424
* @see {@link src/plugins/home/server/services/sample_data/data_sets/flights/index.ts}
2525
*/
2626
const FLIGHTS_OVERVIEW_DASHBOARD_ID = '7adfa750-4c81-11e8-b3d7-01146121b73d';
27-
const FLIGHTS_CANVAS_APPLINK_PATH =
28-
'/app/canvas#/workpad/workpad-a474e74b-aedc-47c3-894a-db77e62c41e0'; // includes default ID of the flights canvas applink path
29-
30-
const includesPathInAppLinks = (appLinks: Array<{ path: string }>, path: string): boolean => {
31-
return appLinks.some((item) => item.path === path);
32-
};
3327

3428
describe('sample data apis', () => {
3529
before(async () => {
@@ -52,12 +46,7 @@ export default function ({ getService }: FtrProviderContext) {
5246

5347
const flightsData = findFlightsData(resp);
5448
expect(flightsData.status).to.be('not_installed');
55-
// Check and make sure the sample dataset reflects the default object IDs, because no sample data objects exist.
56-
// Instead of checking each object ID, we check the dashboard and canvas app link as representatives.
5749
expect(flightsData.overviewDashboard).to.be(FLIGHTS_OVERVIEW_DASHBOARD_ID);
58-
expect(includesPathInAppLinks(flightsData.appLinks, FLIGHTS_CANVAS_APPLINK_PATH)).to.be(
59-
true
60-
);
6150
});
6251
});
6352

@@ -79,7 +68,7 @@ export default function ({ getService }: FtrProviderContext) {
7968

8069
expect(resp.body).to.eql({
8170
elasticsearchIndicesCreated: { kibana_sample_data_flights: 13014 },
82-
kibanaSavedObjectsLoaded: 8,
71+
kibanaSavedObjectsLoaded: 7,
8372
});
8473
});
8574

@@ -136,19 +125,11 @@ export default function ({ getService }: FtrProviderContext) {
136125

137126
const flightsData = findFlightsData(resp);
138127
expect(flightsData.status).to.be('installed');
139-
// Check and make sure the sample dataset reflects the existing object IDs in each space.
140-
// Instead of checking each object ID, we check the dashboard and canvas app link as representatives.
141128
if (space === 'default') {
142129
expect(flightsData.overviewDashboard).to.be(FLIGHTS_OVERVIEW_DASHBOARD_ID);
143-
expect(includesPathInAppLinks(flightsData.appLinks, FLIGHTS_CANVAS_APPLINK_PATH)).to.be(
144-
true
145-
);
146130
} else {
147131
// the sample data objects installed in the 'other' space had their IDs regenerated upon import
148132
expect(flightsData.overviewDashboard).not.to.be(FLIGHTS_OVERVIEW_DASHBOARD_ID);
149-
expect(includesPathInAppLinks(flightsData.appLinks, FLIGHTS_CANVAS_APPLINK_PATH)).to.be(
150-
false
151-
);
152133
}
153134
});
154135
});
@@ -186,12 +167,7 @@ export default function ({ getService }: FtrProviderContext) {
186167

187168
const flightsData = findFlightsData(resp);
188169
expect(flightsData.status).to.be('not_installed');
189-
// Check and make sure the sample dataset reflects the default object IDs, because no sample data objects exist.
190-
// Instead of checking each object ID, we check the dashboard and canvas app link as representatives.
191170
expect(flightsData.overviewDashboard).to.be(FLIGHTS_OVERVIEW_DASHBOARD_ID);
192-
expect(includesPathInAppLinks(flightsData.appLinks, FLIGHTS_CANVAS_APPLINK_PATH)).to.be(
193-
true
194-
);
195171
});
196172
});
197173
}

test/functional/apps/console/_misc_console_behavior.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
154154
await PageObjects.console.openConsole();
155155
});
156156

157-
// Failing: See https://github.com/elastic/kibana/issues/193868
158-
describe.skip('customizable font size', () => {
157+
describe('customizable font size', () => {
159158
it('should allow the font size to be customized', async () => {
160159
await PageObjects.console.openConfig();
161160
await PageObjects.console.setFontSizeSetting(20);

test/functional/page_objects/console_page.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import { Key } from 'selenium-webdriver';
1111
import { asyncForEach } from '@kbn/std';
12+
import expect from '@kbn/expect';
1213
import { FtrService } from '../ftr_provider_context';
1314

1415
export class ConsolePageObject extends FtrService {
@@ -368,10 +369,12 @@ export class ConsolePageObject extends FtrService {
368369
public async setFontSizeSetting(newSize: number) {
369370
// while the settings form opens/loads this may fail, so retry for a while
370371
await this.retry.try(async () => {
372+
const newSizeString = String(newSize);
371373
const fontSizeInput = await this.testSubjects.find('setting-font-size-input');
372374
await fontSizeInput.clearValue({ withJS: true });
373375
await fontSizeInput.click();
374-
await fontSizeInput.type(String(newSize));
376+
await fontSizeInput.type(newSizeString);
377+
expect(await fontSizeInput.getAttribute('value')).to.be(newSizeString);
375378
});
376379
}
377380

x-pack/packages/kbn-ai-assistant/src/chat/chat_flyout.tsx

Lines changed: 70 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ export function ChatFlyout({
4747
isOpen,
4848
onClose,
4949
navigateToConversation,
50+
hideConversationList,
5051
}: {
5152
initialTitle: string;
5253
initialMessages: Message[];
5354
initialFlyoutPositionMode?: FlyoutPositionMode;
5455
isOpen: boolean;
5556
onClose: () => void;
5657
navigateToConversation?: (conversationId?: string) => void;
58+
hideConversationList?: boolean;
5759
}) {
5860
const { euiTheme } = useEuiTheme();
5961
const breakpoint = useCurrentEuiBreakpoint();
@@ -174,84 +176,86 @@ export function ChatFlyout({
174176
}}
175177
>
176178
<EuiFlexGroup gutterSize="none" className={containerClassName}>
177-
<EuiFlexItem className={breakpoint === 'xs' ? hideClassName : sidebarClass}>
178-
<EuiPopover
179-
anchorPosition="downLeft"
180-
className={expandButtonContainerClassName}
181-
button={
182-
<EuiToolTip
183-
content={
184-
conversationsExpanded
185-
? i18n.translate(
186-
'xpack.aiAssistant.chatFlyout.euiToolTip.collapseConversationListLabel',
187-
{ defaultMessage: 'Collapse conversation list' }
188-
)
189-
: i18n.translate(
190-
'xpack.aiAssistant.chatFlyout.euiToolTip.expandConversationListLabel',
191-
{ defaultMessage: 'Expand conversation list' }
192-
)
193-
}
194-
display="block"
195-
>
196-
<EuiButtonIcon
197-
aria-label={i18n.translate(
198-
'xpack.aiAssistant.chatFlyout.euiButtonIcon.expandConversationListLabel',
199-
{ defaultMessage: 'Expand conversation list' }
200-
)}
201-
className={expandButtonClassName}
202-
color="text"
203-
data-test-subj="observabilityAiAssistantChatFlyoutButton"
204-
iconType={conversationsExpanded ? 'transitionLeftIn' : 'transitionLeftOut'}
205-
onClick={() => setConversationsExpanded(!conversationsExpanded)}
206-
/>
207-
</EuiToolTip>
208-
}
209-
/>
210-
211-
{conversationsExpanded ? (
212-
<ConversationList
213-
conversations={conversationList.conversations}
214-
isLoading={conversationList.isLoading}
215-
selectedConversationId={conversationId}
216-
onConversationDeleteClick={(deletedConversationId) => {
217-
conversationList.deleteConversation(deletedConversationId).then(() => {
218-
if (deletedConversationId === conversationId) {
219-
setConversationId(undefined);
220-
}
221-
});
222-
}}
223-
onConversationSelect={(nextConversationId) => {
224-
setConversationId(nextConversationId);
225-
}}
226-
/>
227-
) : (
179+
{!hideConversationList ? (
180+
<EuiFlexItem className={breakpoint === 'xs' ? hideClassName : sidebarClass}>
228181
<EuiPopover
229182
anchorPosition="downLeft"
183+
className={expandButtonContainerClassName}
230184
button={
231185
<EuiToolTip
232-
content={i18n.translate(
233-
'xpack.aiAssistant.chatFlyout.euiToolTip.newChatLabel',
234-
{ defaultMessage: 'New chat' }
235-
)}
186+
content={
187+
conversationsExpanded
188+
? i18n.translate(
189+
'xpack.aiAssistant.chatFlyout.euiToolTip.collapseConversationListLabel',
190+
{ defaultMessage: 'Collapse conversation list' }
191+
)
192+
: i18n.translate(
193+
'xpack.aiAssistant.chatFlyout.euiToolTip.expandConversationListLabel',
194+
{ defaultMessage: 'Expand conversation list' }
195+
)
196+
}
236197
display="block"
237198
>
238-
<NewChatButton
199+
<EuiButtonIcon
239200
aria-label={i18n.translate(
240-
'xpack.aiAssistant.chatFlyout.euiButtonIcon.newChatLabel',
241-
{ defaultMessage: 'New chat' }
201+
'xpack.aiAssistant.chatFlyout.euiButtonIcon.expandConversationListLabel',
202+
{ defaultMessage: 'Expand conversation list' }
242203
)}
243-
collapsed
244-
data-test-subj="observabilityAiAssistantNewChatFlyoutButton"
245-
onClick={() => {
246-
setConversationId(undefined);
247-
}}
204+
className={expandButtonClassName}
205+
color="text"
206+
data-test-subj="observabilityAiAssistantChatFlyoutButton"
207+
iconType={conversationsExpanded ? 'transitionLeftIn' : 'transitionLeftOut'}
208+
onClick={() => setConversationsExpanded(!conversationsExpanded)}
248209
/>
249210
</EuiToolTip>
250211
}
251-
className={newChatButtonClassName}
252212
/>
253-
)}
254-
</EuiFlexItem>
213+
214+
{conversationsExpanded ? (
215+
<ConversationList
216+
conversations={conversationList.conversations}
217+
isLoading={conversationList.isLoading}
218+
selectedConversationId={conversationId}
219+
onConversationDeleteClick={(deletedConversationId) => {
220+
conversationList.deleteConversation(deletedConversationId).then(() => {
221+
if (deletedConversationId === conversationId) {
222+
setConversationId(undefined);
223+
}
224+
});
225+
}}
226+
onConversationSelect={(nextConversationId) => {
227+
setConversationId(nextConversationId);
228+
}}
229+
/>
230+
) : (
231+
<EuiPopover
232+
anchorPosition="downLeft"
233+
button={
234+
<EuiToolTip
235+
content={i18n.translate(
236+
'xpack.aiAssistant.chatFlyout.euiToolTip.newChatLabel',
237+
{ defaultMessage: 'New chat' }
238+
)}
239+
display="block"
240+
>
241+
<NewChatButton
242+
aria-label={i18n.translate(
243+
'xpack.aiAssistant.chatFlyout.euiButtonIcon.newChatLabel',
244+
{ defaultMessage: 'New chat' }
245+
)}
246+
collapsed
247+
data-test-subj="observabilityAiAssistantNewChatFlyoutButton"
248+
onClick={() => {
249+
setConversationId(undefined);
250+
}}
251+
/>
252+
</EuiToolTip>
253+
}
254+
className={newChatButtonClassName}
255+
/>
256+
)}
257+
</EuiFlexItem>
258+
) : null}
255259

256260
<EuiFlexItem className={chatBodyContainerClassName}>
257261
<ChatBody

x-pack/plugins/actions/kibana.jsonc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"spaces",
2727
"security",
2828
"monitoringCollection",
29-
"serverless"
29+
"serverless",
30+
"cloud"
3031
],
3132
"extraPublicDirs": [
3233
"common"

x-pack/plugins/actions/server/actions_client/actions_client.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import { OAuthParams } from '../routes/get_oauth_access_token';
5151
import { eventLogClientMock } from '@kbn/event-log-plugin/server/event_log_client.mock';
5252
import { GetGlobalExecutionKPIParams, GetGlobalExecutionLogParams } from '../../common';
5353
import { estypes } from '@elastic/elasticsearch';
54+
import { DEFAULT_USAGE_API_URL } from '../config';
5455

5556
jest.mock('@kbn/core-saved-objects-utils-server', () => {
5657
const actual = jest.requireActual('@kbn/core-saved-objects-utils-server');
@@ -588,6 +589,9 @@ describe('create()', () => {
588589
microsoftGraphApiUrl: DEFAULT_MICROSOFT_GRAPH_API_URL,
589590
microsoftGraphApiScope: DEFAULT_MICROSOFT_GRAPH_API_SCOPE,
590591
microsoftExchangeUrl: DEFAULT_MICROSOFT_EXCHANGE_URL,
592+
usage: {
593+
url: DEFAULT_USAGE_API_URL,
594+
},
591595
});
592596

593597
const localActionTypeRegistryParams = {

x-pack/plugins/actions/server/actions_config.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import { ByteSizeValue } from '@kbn/config-schema';
9-
import { ActionsConfig } from './config';
9+
import { ActionsConfig, DEFAULT_USAGE_API_URL } from './config';
1010
import {
1111
DEFAULT_MICROSOFT_EXCHANGE_URL,
1212
DEFAULT_MICROSOFT_GRAPH_API_SCOPE,
@@ -42,6 +42,9 @@ const defaultActionsConfig: ActionsConfig = {
4242
microsoftGraphApiUrl: DEFAULT_MICROSOFT_GRAPH_API_URL,
4343
microsoftGraphApiScope: DEFAULT_MICROSOFT_GRAPH_API_SCOPE,
4444
microsoftExchangeUrl: DEFAULT_MICROSOFT_EXCHANGE_URL,
45+
usage: {
46+
url: DEFAULT_USAGE_API_URL,
47+
},
4548
};
4649

4750
describe('ensureUriAllowed', () => {

x-pack/plugins/actions/server/config.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ describe('config validation', () => {
3838
"proxyRejectUnauthorizedCertificates": true,
3939
"rejectUnauthorized": true,
4040
"responseTimeout": "PT1M",
41+
"usage": Object {
42+
"url": "https://usage-api.usage-api/api/v1/usage",
43+
},
4144
}
4245
`);
4346
});
@@ -85,6 +88,9 @@ describe('config validation', () => {
8588
"proxyRejectUnauthorizedCertificates": false,
8689
"rejectUnauthorized": false,
8790
"responseTimeout": "PT1M",
91+
"usage": Object {
92+
"url": "https://usage-api.usage-api/api/v1/usage",
93+
},
8894
}
8995
`);
9096
});
@@ -225,6 +231,9 @@ describe('config validation', () => {
225231
"proxyVerificationMode": "none",
226232
"verificationMode": "none",
227233
},
234+
"usage": Object {
235+
"url": "https://usage-api.usage-api/api/v1/usage",
236+
},
228237
}
229238
`);
230239
});

x-pack/plugins/actions/server/config.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ const connectorTypeSchema = schema.object({
7272
maxAttempts: schema.maybe(schema.number({ min: MIN_MAX_ATTEMPTS, max: MAX_MAX_ATTEMPTS })),
7373
});
7474

75+
export const DEFAULT_USAGE_API_URL = 'https://usage-api.usage-api/api/v1/usage';
76+
7577
// We leverage enabledActionTypes list by allowing the other plugins to overwrite it by using "setEnabledConnectorTypes" in the plugin setup.
7678
// The list can be overwritten only if it's not already been set in the config.
7779
const enabledConnectorTypesSchema = schema.arrayOf(
@@ -145,15 +147,14 @@ export const configSchema = schema.object({
145147
max: schema.maybe(schema.number({ min: MIN_QUEUED_MAX, defaultValue: DEFAULT_QUEUED_MAX })),
146148
})
147149
),
148-
usage: schema.maybe(
149-
schema.object({
150-
ca: schema.maybe(
151-
schema.object({
152-
path: schema.string(),
153-
})
154-
),
155-
})
156-
),
150+
usage: schema.object({
151+
url: schema.string({ defaultValue: DEFAULT_USAGE_API_URL }),
152+
ca: schema.maybe(
153+
schema.object({
154+
path: schema.string(),
155+
})
156+
),
157+
}),
157158
});
158159

159160
export type ActionsConfig = TypeOf<typeof configSchema>;

x-pack/plugins/actions/server/integration_tests/axios_utils_connection.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { ByteSizeValue } from '@kbn/config-schema';
2020
import { Logger } from '@kbn/core/server';
2121
import { loggingSystemMock } from '@kbn/core/server/mocks';
2222
import { createReadySignal } from '@kbn/event-log-plugin/server/lib/ready_signal';
23-
import { ActionsConfig } from '../config';
23+
import { ActionsConfig, DEFAULT_USAGE_API_URL } from '../config';
2424
import { ActionsConfigurationUtilities, getActionsConfigurationUtilities } from '../actions_config';
2525
import { resolveCustomHosts } from '../lib/custom_host_settings';
2626
import {
@@ -691,6 +691,9 @@ const BaseActionsConfig: ActionsConfig = {
691691
microsoftGraphApiUrl: DEFAULT_MICROSOFT_GRAPH_API_URL,
692692
microsoftGraphApiScope: DEFAULT_MICROSOFT_GRAPH_API_SCOPE,
693693
microsoftExchangeUrl: DEFAULT_MICROSOFT_EXCHANGE_URL,
694+
usage: {
695+
url: DEFAULT_USAGE_API_URL,
696+
},
694697
};
695698

696699
function getACUfromConfig(config: Partial<ActionsConfig> = {}): ActionsConfigurationUtilities {

0 commit comments

Comments
 (0)