Skip to content

Commit

Permalink
Merge branch 'main' into console-docs-links-update
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuarrrr committed Apr 10, 2023
2 parents d95970f + 174756f commit 660e9fa
Show file tree
Hide file tree
Showing 56 changed files with 857 additions and 451 deletions.
14 changes: 9 additions & 5 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
### Description
[Describe what this change achieves]


<!-- Describe what this change achieves-->

### Issues Resolved
[List any issues this PR will resolve]


<!-- List any issues this PR will resolve. -->
<!-- Example: closes #1234 -->

### Check List

- [ ] All tests pass
- [ ] `yarn test:jest`
- [ ] `yarn test:jest_integration`
- [ ] `yarn test:ftr`
- [ ] New functionality includes testing.
- [ ] New functionality has been documented.
- [ ] Update [CHANGELOG.md](./../CHANGELOG.md)
- [ ] Commits are signed per the DCO using --signoff
- [ ] Commits are signed per the DCO using --signoff
21 changes: 21 additions & 0 deletions .github/workflows/github-workflow-badger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: github-merit-badger
on:
pull_request_target:
types:
- opened

jobs:
call-action:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: aws-github-ops/github-merit-badger@v0.0.98
id: merit-badger
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
badges: '[first-time-contributor,repeat-contributor,valued-contributor,seasoned-contributor,all-star-contributor,distinguished-contributor]'
thresholds: '[0,3,6,13,25,50]'
badge-type: 'achievement'
ignore-usernames: '[opensearch-ci-bot, dependabot, opensearch-trigger-bot]'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
.node_binaries
.native_modules
node_modules
opensearch-dashboards-docker-dev/
!/src/dev/npm/integration_tests/__fixtures__/fixture1/node_modules
!/src/dev/notice/__fixtures__/node_modules
trash
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ 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))
- [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 @@ -125,6 +127,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fix detection of Chrome's version on Darwin during CI ([#3296](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3296))
- Upgrade yarn version to be compatible with @openearch-project/opensearch ([#3443](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3443))
- [CI] Reduce redundancy by using matrix strategy on Windows and Linux workflows ([#3514](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3514))
- Add an achievement badger to the PR ([#3721](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3721))

### 📝 Documentation

Expand All @@ -143,6 +146,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [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 All @@ -167,6 +171,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Vis Builder] Removed Hard Coded Strings and Used i18n to transalte([#2867](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2867))
- [Console] Replace jQuery.ajax with core.http when calling OSD APIs in console ([#3080](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3080))
- [I18n] Fix Listr type errors and error handlers ([#3629](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3629))
- [Multiple DataSource] Present the authentication type choices in a drop-down ([#3693](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3693))

### 🔩 Tests

Expand Down Expand Up @@ -219,6 +224,7 @@ 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))

### 🚞 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: 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
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
Loading

0 comments on commit 660e9fa

Please sign in to comment.