Skip to content

Commit

Permalink
Merge branch 'main' into fix/kb-semantic-text
Browse files Browse the repository at this point in the history
  • Loading branch information
peluja1012 authored Oct 30, 2024
2 parents 811f540 + f102ace commit 5efe3ac
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ describe('IndexPatternsApiClient', () => {
expect(fetchSpy).toHaveBeenCalledWith(expectedPath, {
// not sure what asResponse is but the rest of the results are useful
asResponse: true,
headers: {
'user-hash': '',
},
query: {
allow_hidden: undefined,
allow_no_index: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class DataViewsApiClient implements IDataViewsApiClient {
const userId = await this.getCurrentUserId();

const userHash = userId ? await sha1(userId) : '';
const headers = userHash ? { 'user-hash': userHash } : undefined;

const request = body
? this.http.post<T>(url, { query, body, version, asResponse })
Expand All @@ -64,7 +65,7 @@ export class DataViewsApiClient implements IDataViewsApiClient {
version,
...cacheOptions,
asResponse,
headers: { 'user-hash': userHash },
headers,
});

return request.catch((resp) => {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { VideoToast } from './video_toast';
import { VIDEO_PAGE, VideoToast } from './video_toast';

describe('VideoToast', () => {
const onCloseMock = jest.fn();
Expand All @@ -32,19 +32,13 @@ describe('VideoToast', () => {
it('should open the video in a new tab when the gif is clicked', async () => {
const videoGif = screen.getByTestId('video-gif');
await userEvent.click(videoGif);
expect(window.open).toHaveBeenCalledWith(
'https://videos.elastic.co/watch/BrDaDBAAvdygvemFKNAkBW',
'_blank'
);
expect(window.open).toHaveBeenCalledWith(VIDEO_PAGE, '_blank');
});

it('should open the video in a new tab when the "Watch overview video" button is clicked', async () => {
const watchVideoButton = screen.getByRole('button', { name: 'Watch overview video' });
await userEvent.click(watchVideoButton);
expect(window.open).toHaveBeenCalledWith(
'https://videos.elastic.co/watch/BrDaDBAAvdygvemFKNAkBW',
'_blank'
);
expect(window.open).toHaveBeenCalledWith(VIDEO_PAGE, '_blank');
});

it('should call the onClose callback when the close button is clicked', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ import React, { useCallback } from 'react';
import * as i18n from './translations';
import theGif from './overview.gif';

const VIDEO_CONTENT_WIDTH = 250;
// TODO before removing assistantKnowledgeBaseByDefault feature flag
// update the VIDEO_PAGE to the correct URL
const VIDEO_PAGE = `https://videos.elastic.co/watch/BrDaDBAAvdygvemFKNAkBW`;
const VIDEO_CONTENT_WIDTH = 330;
export const VIDEO_PAGE = `https://ela.st/seckb`;

const VideoComponent: React.FC<{ onClose: () => void }> = ({ onClose }) => {
const openVideoInNewTab = useCallback(() => {
Expand Down

0 comments on commit 5efe3ac

Please sign in to comment.