Skip to content

Commit

Permalink
Merge branch 'main' into kavilla/discovermultiplequeries
Browse files Browse the repository at this point in the history
  • Loading branch information
kavilla committed Sep 26, 2024
2 parents a1d23c7 + d1caa92 commit 6bf8299
Show file tree
Hide file tree
Showing 41 changed files with 370 additions and 249 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/delete_backport_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ on:
jobs:
delete-branch:
runs-on: ubuntu-latest
permissions:
contents: write
if: startsWith(github.event.pull_request.head.ref,'backport/')
steps:
- name: Delete merged branch
uses: SvanBoxel/delete-merged-branch@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete merged branch
uses: actions/github-script@v7
with:
script: |
github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `heads/${context.payload.pull_request.head.ref}`,
})
2 changes: 2 additions & 0 deletions changelogs/fragments/8222.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Update data explorer ui to use compressed components ([#8222](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8222))
2 changes: 2 additions & 0 deletions changelogs/fragments/8227.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Adjust semantics and sizing of page titles in application headers ([#8227](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8227))
2 changes: 2 additions & 0 deletions changelogs/fragments/8320.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Update osd to respect new oui breakpoints ([#8320](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8320))
2 changes: 2 additions & 0 deletions changelogs/fragments/8334.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
refactor:
- Move the render of query extension control buttons to extension component ([#8334](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8334))
2 changes: 2 additions & 0 deletions changelogs/fragments/8346.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
security:
- [CVE-2024-45801] Bump `dompurify` from 3.0.11 to 3.1.6 ([#8346](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8346))

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/core/public/chrome/ui/header/collapsible_nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export function CollapsibleNav({
))}

{/* Docking button only for larger screens that can support it*/}
<EuiShowFor sizes={['l', 'xl']}>
<EuiShowFor sizes={['l', 'xl', 'xxl', 'xxxl']}>
<EuiCollapsibleNavGroup>
<EuiListGroup flush>
<EuiListGroupItem
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/chrome/ui/header/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
}

/* Control flex items to wrap when the viewport is less than the medium size */
@media (max-width: 768px) {
@include euiBreakpoint("s", "xs") {
.secondaryPageHeaderFlexGroup {
display: flex;
flex-direction: column;
Expand Down
4 changes: 2 additions & 2 deletions src/core/public/chrome/ui/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,15 @@ export function Header({
},
{
items: [
<EuiShowFor sizes={['m', 'l', 'xl']}>
<EuiShowFor sizes={['m', 'l', 'xl', 'xxl', 'xxxl']}>
<HeaderNavControls navControls$={observables.navControlsExpandedCenter$} />
</EuiShowFor>,
],
borders: 'none',
},
{
items: [
<EuiHideFor sizes={['m', 'l', 'xl']}>
<EuiHideFor sizes={['m', 'l', 'xl', 'xxl', 'xxxl']}>
<HeaderNavControls navControls$={observables.navControlsExpandedCenter$} />
</EuiHideFor>,
<HeaderNavControls navControls$={observables.navControlsExpandedRight$} />,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@
* SPDX-License-Identifier: Apache-2.0
*/

import React from 'react';
import { EuiButtonIconProps, EuiSmallButtonIcon, EuiToolTip, EuiToolTipProps } from '@elastic/eui';
import { i18n } from '@osd/i18n';
import {
EuiSmallButtonIcon,
EuiButtonIconProps,
EuiText,
EuiToolTip,
EuiToolTipProps,
} from '@elastic/eui';
import React from 'react';

interface IDataSelectorRefresherProps {
tooltipText: string;
Expand All @@ -23,26 +17,24 @@ interface IDataSelectorRefresherProps {
export const DataSelectorRefresher: React.FC<IDataSelectorRefresherProps> = React.memo(
({ tooltipText, onRefresh, buttonProps, toolTipProps }) => {
return (
<EuiText size="s" className="sourceRefreshText">
<EuiToolTip
position="right"
content={i18n.translate('data.datasource.selector.refreshDataSources', {
defaultMessage: tooltipText,
})}
display="block"
data-test-subj="sourceRefreshButtonToolTip"
{...toolTipProps}
>
<EuiSmallButtonIcon
onClick={onRefresh}
iconType="refresh"
aria-label="sourceRefresh"
className="sourceRefreshButton"
data-test-subj="sourceRefreshButton"
{...buttonProps}
/>
</EuiToolTip>
</EuiText>
<EuiToolTip
position="right"
content={i18n.translate('data.datasource.selector.refreshDataSources', {
defaultMessage: tooltipText,
})}
display="block"
data-test-subj="sourceRefreshButtonToolTip"
{...toolTipProps}
>
<EuiSmallButtonIcon
onClick={onRefresh}
iconType="refresh"
aria-label="sourceRefresh"
className="sourceRefreshButton"
data-test-subj="sourceRefreshButton"
{...buttonProps}
/>
</EuiToolTip>
);
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
* SPDX-License-Identifier: Apache-2.0
*/

import React, { useEffect, useCallback, useMemo } from 'react';
import { EuiCompressedComboBox } from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { DataSource, DataSetWithDataSource, IndexPatternOption } from '../datasource';
import { DataSourceGroup, DataSourceOption, DataSourceSelectableProps } from './types';
import { DataSelectorRefresher } from './data_selector_refresher';
import React, { useCallback, useEffect, useMemo } from 'react';
import {
DATA_SELECTOR_DEFAULT_PLACEHOLDER,
DATA_SELECTOR_REFRESHER_POPOVER_TEXT,
DATA_SELECTOR_S3_DATA_SOURCE_GROUP_HINT_LABEL,
} from '../constants';
import { DataSetWithDataSource, DataSource, IndexPatternOption } from '../datasource';
import { DataSelectorRefresher } from './data_selector_refresher';
import { DataSourceGroup, DataSourceOption, DataSourceSelectableProps } from './types';

// Asynchronously retrieves and formats dataset from a given data source.
const getAndFormatDataSetFromDataSource = async (
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/data/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export class DataPublicPlugin
storage: this.storage,
sessionStorage: this.sessionStorage,
defaultSearchInterceptor: searchService.getDefaultSearchInterceptor(),
applicaton: core.application,
});

uiActions.registerAction(
Expand Down Expand Up @@ -224,6 +225,7 @@ export class DataPublicPlugin
savedObjectsClient: savedObjects.client,
uiSettings,
indexPatterns,
applicaton: core.application,
});
setQueryService(query);

Expand Down
7 changes: 6 additions & 1 deletion src/plugins/data/public/query/query_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export class QueryService {
storage,
uiSettings,
indexPatterns,
applicaton,
}: QueryServiceStartDependencies): IQueryStart {
this.queryStringManager.getDatasetService().init(indexPatterns);
return {
Expand All @@ -106,7 +107,11 @@ export class QueryService {
}),
filterManager: this.filterManager,
queryString: this.queryStringManager,
savedQueries: createSavedQueryService(savedObjectsClient),
savedQueries: createSavedQueryService(
savedObjectsClient,
this.queryStringManager,
applicaton
),
state$: this.state$,
timefilter: this.timefilter,
getOpenSearchQuery: (indexPattern: IndexPattern) => {
Expand Down
33 changes: 27 additions & 6 deletions src/plugins/data/public/query/saved_query/saved_query_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
*/

import { isObject } from 'lodash';
import { SavedObjectsClientContract, SavedObjectAttributes } from 'src/core/public';
import { SavedObjectsClientContract, SavedObjectAttributes, CoreStart } from 'src/core/public';
import { first } from 'rxjs/operators';
import { SavedQueryAttributes, SavedQuery, SavedQueryService } from './types';
import { QueryStringContract } from '../query_string';

type SerializedSavedQueryAttributes = SavedObjectAttributes &
SavedQueryAttributes & {
Expand All @@ -41,7 +43,9 @@ type SerializedSavedQueryAttributes = SavedObjectAttributes &
};

export const createSavedQueryService = (
savedObjectsClient: SavedObjectsClientContract
savedObjectsClient: SavedObjectsClientContract,
queryStringManager?: QueryStringContract,
application?: CoreStart['application']
): SavedQueryService => {
const saveQuery = async (attributes: SavedQueryAttributes, { overwrite = false } = {}) => {
if (!attributes.title.length) {
Expand Down Expand Up @@ -117,12 +121,29 @@ export const createSavedQueryService = (
page: activePage,
});

let queries = response.savedObjects.map(
(savedObject: { id: string; attributes: SerializedSavedQueryAttributes }) =>
parseSavedQueryObject(savedObject)
);

const currentAppId =
(await application?.currentAppId$?.pipe(first()).toPromise()) ?? Promise.resolve(undefined);
const languageService = queryStringManager?.getLanguageService();

// Filtering saved queries based on language supported by cirrent application
if (currentAppId && languageService) {
queries = queries.filter((query) => {
const languageId = query.attributes.query.language;
return (
languageService?.getLanguage(languageId)?.supportedAppNames?.includes(currentAppId) ??
true
);
});
}

return {
total: response.total,
queries: response.savedObjects.map(
(savedObject: { id: string; attributes: SerializedSavedQueryAttributes }) =>
parseSavedQueryObject(savedObject)
),
queries,
};
};

Expand Down
9 changes: 8 additions & 1 deletion src/plugins/data/public/query/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { IUiSettingsClient, SavedObjectsClientContract } from 'opensearch-dashboards/public';
import {
ApplicationSetup,
ApplicationStart,
IUiSettingsClient,
SavedObjectsClientContract,
} from 'opensearch-dashboards/public';
import { Observable } from 'rxjs';
import { DataStorage } from '../../common';
import { IndexPattern, IndexPatternsService } from '../index_patterns';
Expand Down Expand Up @@ -38,6 +43,7 @@ export interface QueryServiceSetupDependencies {
storage: DataStorage;
sessionStorage: DataStorage;
defaultSearchInterceptor: ISearchInterceptor;
applicaton: ApplicationSetup;
}

/** @internal */
Expand All @@ -46,4 +52,5 @@ export interface QueryServiceStartDependencies {
storage: DataStorage;
uiSettings: IUiSettingsClient;
indexPatterns: IndexPatternsService;
applicaton: ApplicationStart;
}
Loading

0 comments on commit 6bf8299

Please sign in to comment.