Skip to content

Commit

Permalink
Merge branch 'main' into table-fix-updateButton-pos
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuarrrr authored Apr 13, 2023
2 parents 60b09fe + 0a83c47 commit fbc5a52
Show file tree
Hide file tree
Showing 198 changed files with 1,140 additions and 605 deletions.
3 changes: 1 addition & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# This should match the owning team set up in https://github.com/orgs/opensearch-project/teams
* @opensearch-project/opensearch-dashboards-core
* @ananzh @kavilla @seanneumann @AMoo-Miki @ashwin-pc @joshuarrrr @abbyhu2000 @zengyan-amazon @kristenTian @zhongnansu @manasvinibs
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Use mirrors to download Node.js binaries to escape sporadic 404 errors ([#3619](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3619))
- [Multiple DataSource] Refactor dev tool console to use opensearch-js client to send requests ([#3544](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3544))
- [Data] Add geo shape filter field ([#3605](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3605))
- [Dashboard] Indicate that IE is no longer supported ([#3641](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3641))
- [UI] Add support for comma delimiters in the global filter bar ([#3686](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3686))
- [Multiple DataSource] Allow create and distinguish index pattern with same name but from different datasources ([#3571](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3571))
- [Multiple DataSource] Integrate multiple datasource with dev tool console ([#3754](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3754))

### 🐛 Bug Fixes

Expand Down Expand Up @@ -113,6 +117,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Vega] Add Filter custom label for opensearchDashboardsAddFilter ([#3640](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3640))
- [Timeline] Fix y-axis label color in dark mode ([#3698](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3698))
- [Table Visualization] Fix table rendering empty unused space ([#3797](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3797))
- [Table Visualization] Fix data table not adjusting height on the initial load ([#3816](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3816))

### 🚞 Infrastructure

Expand Down Expand Up @@ -144,6 +149,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Doc] Add docker dev set up instruction ([#3444](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3444))
- [Doc] UI actions explorer ([#3614](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3614))
- [Doc] Update SECURITY.md with instructions for nested dependencies and backporting ([#3497](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3497))
- [Doc] [Console] Fix/update documentation links in Dev Tools console ([#3724](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3724))
- [Doc] Update DEVELOPER_GUIDE.md with added manual bootstrap timeout solution and max virtual memory error solution with docker ([#3764](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3764))

### 🛠 Maintenance

Expand Down Expand Up @@ -221,6 +228,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixes management app breadcrumb error ([#2344](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2344))
- [BUG] Fix suggestion list cutoff issue ([#2607](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2607))
- [TSVB] Fixes undefined serial diff aggregation documentation link ([#3503](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3503))
- [Console] Fix dev tool console autocomplete not loading issue ([#3775](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3775))
- [Console] Fix dev tool console run command with query parameter error ([#3813](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3813))

### 🚞 Infrastructure

Expand Down
32 changes: 31 additions & 1 deletion DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,19 @@ The `osd bootstrap` command will install the project's dependencies and build al
$ yarn osd bootstrap
```

Note: If you experience a network timeout while bootstrapping, you can update the timeout by configuring it in the [`.yarnrc`](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/.yarnrc). For example:
Note: If you experience a network timeout while bootstrapping:

```
| There appears to be trouble with your network connection. Retrying...
```

You can run command with —network-timeout flag:

```
$ yarn osd bootstrap —network-timeout 1000000
```

Or use the timeout by configuring it in the [`.yarnrc`](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/.yarnrc). For example:

```
network-timeout 1000000
Expand Down Expand Up @@ -146,6 +158,24 @@ Note - it may take a couple minutes to generate all the necessary bundles. If th
[success][@osd/optimizer] 28 bundles compiled successfully after 145.9 sec, watching for changes
```

Note: If you run a docker image, an error may occur:

```
Error: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
```

This error is because there is not enough memory so more memory must be allowed to be used:

```
$ sudo sysctl -w vm.max_map_count=262144
```

For windows:

```
$ wsl -d docker-desktop
$ sysctl -w vm.max_map_count=262144
```
### Next Steps

Now that you have a development environment to play with, there are a number of different paths you may take next.
Expand Down
4 changes: 2 additions & 2 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ This document contains a list of maintainers in this repo. See [opensearch-proje
| Maintainer | GitHub ID | Affiliation |
| ------------------------- | --------------------------------------------------- | ----------- |
| Anan Zhuang | [ananzh](https://github.com/ananzh) | Amazon |
| Bishoy Boktor | [boktorbb](https://github.com/boktorbb) | Amazon |
| Mihir Soni | [mihirsoni](https://github.com/mihirsoni) | Amazon |
| Kawika (Rocky) Avilla | [kavilla](https://github.com/kavilla) | Amazon |
| Sean Neumann | [seanneumann](https://github.com/seanneumann) | Amazon |
| Miki Barahmand | [AMoo-Miki](https://github.com/AMoo-Miki) | Amazon |
Expand All @@ -25,3 +23,5 @@ This document contains a list of maintainers in this repo. See [opensearch-proje
| Maintainer | GitHub ID | Affiliation |
| ------------- | --------------------------------------- | ----------- |
| Tommy Markley | [tmarkley](https://github.com/tmarkley) | Amazon |
| Mihir Soni | [mihirsoni](https://github.com/mihirsoni) | Amazon |
| Bishoy Boktor | [boktorbb](https://github.com/boktorbb) | Amazon |
4 changes: 4 additions & 0 deletions src/core/public/application/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,10 @@ export interface AppMountParameters<HistoryLocationState = unknown> {
* ```
*/
setHeaderActionMenu: (menuMount: MountPoint | undefined) => void;
/**
* Optional datasource id to pass while mounting app
*/
dataSourceId?: string;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/core/public/chrome/chrome_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class ChromeService {
title: mountReactNode(
<FormattedMessage
id="core.chrome.browserDeprecationWarning"
defaultMessage="Support for Internet Explorer will be dropped in future versions of this software, please check {link}."
defaultMessage="Internet Explorer lacks features required for OpenSearch Dashboards to function correctly; please use one of {link}."
values={{
link: (
<EuiLink
Expand All @@ -219,7 +219,7 @@ export class ChromeService {
>
<FormattedMessage
id="core.chrome.browserDeprecationLink"
defaultMessage="the support matrix on our website"
defaultMessage="the supported browsers listed on our website"
/>
</EuiLink>
),
Expand Down
9 changes: 7 additions & 2 deletions src/plugins/console/opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"server": true,
"ui": true,
"requiredPlugins": ["devTools"],
"optionalPlugins": ["usageCollection", "home"],
"requiredBundles": ["opensearchUiShared", "opensearchDashboardsReact", "opensearchDashboardsUtils", "home"]
"optionalPlugins": ["usageCollection", "home", "dataSource"],
"requiredBundles": [
"opensearchUiShared",
"opensearchDashboardsReact",
"opensearchDashboardsUtils",
"home"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,50 @@
* under the License.
*/

import React, { useCallback, memo } from 'react';
import React, { useCallback, memo, useEffect } from 'react';
import { debounce } from 'lodash';
import { EuiProgress } from '@elastic/eui';

import { EditorContentSpinner } from '../../components';
import { Panel, PanelsContainer } from '../../../../../opensearch_dashboards_react/public';
import { Editor as EditorUI, EditorOutput } from './legacy/console_editor';
import { StorageKeys } from '../../../services';
import { useEditorReadContext, useServicesContext, useRequestReadContext } from '../../contexts';
import {
useEditorReadContext,
useServicesContext,
useRequestReadContext,
useRequestActionContext,
} from '../../contexts';

const INITIAL_PANEL_WIDTH = 50;
const PANEL_MIN_WIDTH = '100px';

interface Props {
loading: boolean;
dataSourceId?: string;
}

export const Editor = memo(({ loading }: Props) => {
export const Editor = memo(({ loading, dataSourceId }: Props) => {
const {
services: { storage },
} = useServicesContext();

const { currentTextObject } = useEditorReadContext();
const { requestInFlight } = useRequestReadContext();
const dispatch = useRequestActionContext();

const [firstPanelWidth, secondPanelWidth] = storage.get(StorageKeys.WIDTH, [
INITIAL_PANEL_WIDTH,
INITIAL_PANEL_WIDTH,
]);

useEffect(() => {
dispatch({
type: 'resetLastResult',
payload: undefined,
});
}, [dispatch, dataSourceId]);

/* eslint-disable-next-line react-hooks/exhaustive-deps */
const onPanelWidthChange = useCallback(
debounce((widths: number[]) => {
Expand All @@ -83,7 +97,7 @@ export const Editor = memo(({ loading }: Props) => {
{loading ? (
<EditorContentSpinner />
) : (
<EditorUI initialTextValue={currentTextObject.text} />
<EditorUI initialTextValue={currentTextObject.text} dataSourceId={dataSourceId} />
)}
</Panel>
<Panel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const { useUIAceKeyboardMode } = ace;

export interface EditorProps {
initialTextValue: string;
dataSourceId?: string;
}

interface QueryParams {
Expand All @@ -76,15 +77,15 @@ const DEFAULT_INPUT_VALUE = `GET _search

const inputId = 'ConAppInputTextarea';

function EditorUI({ initialTextValue }: EditorProps) {
function EditorUI({ initialTextValue, dataSourceId }: EditorProps) {
const {
services: { history, notifications, settings: settingsService, opensearchHostService },
services: { history, notifications, settings: settingsService, opensearchHostService, http },
docLinkVersion,
} = useServicesContext();

const { settings } = useEditorReadContext();
const setInputEditor = useSetInputEditor();
const sendCurrentRequestToOpenSearch = useSendCurrentRequestToOpenSearch();
const sendCurrentRequestToOpenSearch = useSendCurrentRequestToOpenSearch(dataSourceId);
const saveCurrentTextObject = useSaveCurrentTextObject();

const editorRef = useRef<HTMLDivElement | null>(null);
Expand Down Expand Up @@ -184,7 +185,12 @@ function EditorUI({ initialTextValue }: EditorProps) {
setInputEditor(editor);
setTextArea(editorRef.current!.querySelector('textarea'));

retrieveAutoCompleteInfo(settingsService, settingsService.getAutocomplete());
retrieveAutoCompleteInfo(
http,
settingsService,
settingsService.getAutocomplete(),
dataSourceId
);

const unsubscribeResizer = subscribeResizeChecker(editorRef.current!, editor);
setupAutosave();
Expand All @@ -197,7 +203,15 @@ function EditorUI({ initialTextValue }: EditorProps) {
editorInstanceRef.current.getCoreEditor().destroy();
}
};
}, [saveCurrentTextObject, initialTextValue, history, setInputEditor, settingsService]);
}, [
saveCurrentTextObject,
initialTextValue,
history,
setInputEditor,
settingsService,
http,
dataSourceId,
]);

useEffect(() => {
const { current: editor } = editorInstanceRef;
Expand Down
14 changes: 10 additions & 4 deletions src/plugins/console/public/application/containers/main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* under the License.
*/

import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import { i18n } from '@osd/i18n';
import { EuiFlexGroup, EuiFlexItem, EuiTitle, EuiPageContent } from '@elastic/eui';
import { ConsoleHistory } from '../console_history';
Expand All @@ -48,7 +48,11 @@ import { useDataInit } from '../../hooks';

import { getTopNavConfig } from './get_top_nav';

export function Main() {
interface MainProps {
dataSourceId?: string;
}

export function Main({ dataSourceId }: MainProps) {
const {
services: { storage },
} = useServicesContext();
Expand Down Expand Up @@ -130,7 +134,7 @@ export function Main() {
</EuiFlexItem>
{showingHistory ? <EuiFlexItem grow={false}>{renderConsoleHistory()}</EuiFlexItem> : null}
<EuiFlexItem>
<Editor loading={!done} />
<Editor loading={!done} dataSourceId={dataSourceId} />
</EuiFlexItem>
</EuiFlexGroup>

Expand All @@ -143,7 +147,9 @@ export function Main() {
/>
) : null}

{showSettings ? <Settings onClose={() => setShowSettings(false)} /> : null}
{showSettings ? (
<Settings onClose={() => setShowSettings(false)} dataSourceId={dataSourceId} />
) : null}

{showHelp ? <HelpPanel onClose={() => setShowHelp(false)} /> : null}
</div>
Expand Down
24 changes: 16 additions & 8 deletions src/plugins/console/public/application/containers/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import React from 'react';

import { HttpSetup } from 'opensearch-dashboards/public';
import { AutocompleteOptions, DevToolsSettingsModal } from '../components';

// @ts-ignore
Expand All @@ -44,11 +45,17 @@ const getAutocompleteDiff = (newSettings: DevToolsSettings, prevSettings: DevToo
});
};

const refreshAutocompleteSettings = (settings: SettingsService, selectedSettings: any) => {
retrieveAutoCompleteInfo(settings, selectedSettings);
const refreshAutocompleteSettings = (
http: HttpSetup,
settings: SettingsService,
selectedSettings: any,
dataSourceId?: string
) => {
retrieveAutoCompleteInfo(http, settings, selectedSettings, dataSourceId);
};

const fetchAutocompleteSettingsIfNeeded = (
http: HttpSetup,
settings: SettingsService,
newSettings: DevToolsSettings,
prevSettings: DevToolsSettings
Expand All @@ -73,28 +80,29 @@ const fetchAutocompleteSettingsIfNeeded = (
},
{}
);
retrieveAutoCompleteInfo(settings, changedSettings);
retrieveAutoCompleteInfo(http, settings, changedSettings, dataSourceId);
} else if (isPollingChanged && newSettings.polling) {
// If the user has turned polling on, then we'll fetch all selected autocomplete settings.
retrieveAutoCompleteInfo(settings, settings.getAutocomplete());
retrieveAutoCompleteInfo(http, settings, settings.getAutocomplete(), dataSourceId);
}
}
};

export interface Props {
onClose: () => void;
dataSourceId?: string;
}

export function Settings({ onClose }: Props) {
export function Settings({ onClose, dataSourceId }: Props) {
const {
services: { settings },
services: { settings, http },
} = useServicesContext();

const dispatch = useEditorActionContext();

const onSaveSettings = (newSettings: DevToolsSettings) => {
const prevSettings = settings.toJSON();
fetchAutocompleteSettingsIfNeeded(settings, newSettings, prevSettings);
fetchAutocompleteSettingsIfNeeded(http, settings, newSettings, prevSettings);

// Update the new settings in localStorage
settings.updateSettings(newSettings);
Expand All @@ -112,7 +120,7 @@ export function Settings({ onClose }: Props) {
onClose={onClose}
onSaveSettings={onSaveSettings}
refreshAutocompleteSettings={(selectedSettings: any) =>
refreshAutocompleteSettings(settings, selectedSettings)
refreshAutocompleteSettings(http, settings, selectedSettings, dataSourceId)
}
settings={settings.toJSON()}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { BaseResponseType } from '../../../types';
export interface OpenSearchRequestArgs {
http: HttpSetup;
requests: any;
dataSourceId?: string;
}

export interface OpenSearchRequestObject {
Expand Down Expand Up @@ -101,7 +102,8 @@ export function sendRequestToOpenSearch(
args.http,
opensearchMethod,
opensearchPath,
opensearchData
opensearchData,
args.dataSourceId
);
if (reqId !== CURRENT_REQ_ID) {
return;
Expand Down
Loading

0 comments on commit fbc5a52

Please sign in to comment.