Skip to content

Commit

Permalink
Merge branch 'main' into add-new-fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuarrrr committed Jun 29, 2023
2 parents 1815ae7 + f6e22cb commit e942c5b
Show file tree
Hide file tree
Showing 66 changed files with 1,059 additions and 3,616 deletions.
5 changes: 3 additions & 2 deletions .lycheeexclude
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ http://www.creedthoughts.gov
https://media-for-the-masses.theacademyofperformingartsandscience.org/
https://yarnpkg.com/latest.msi
https://forum.opensearch.org/
https://facebook.github.io/jest/
https://facebook.github.io/jest/docs/cli.html
https://facebook.github.io/jest/*
http://helpmenow.com/problem2
https://sass-lang.com/*
http://api.jquery.com/*
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [CVE-2022-37603] Bump loader-utils from `2.0.3` to `2.0.4` ([#3031](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3031)). Backwards-compatible fixes included in v2.6.0 and v1.3.7 releases.
- [WS-2021-0638] Bump mocha from `7.2.0` to `10.1.0` ([#2711](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2711))
- Bump `joi` to v14 to avoid the possibility of prototype poisoning in a nested dependency ([#3952](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3952))
- [CVE-2022-25883] Resolve `semver` to `7.5.3` and remove unused package ([#4411](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4411))

### 📈 Features/Enhancements

Expand All @@ -22,10 +23,13 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Hide any output from use_node checking for Node compatibility ([#4237](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4237))
- Add category option within groups for context menus ([#4144](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4144))
- [Saved Object Service] Add Repository Factory Provider ([#4149](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4149))
- [Sample Data] Add visual consistency dashboard to sample logs data ([#4339](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4339))
- [@osd/pm] Fix `file:`-linked dependencies' resolution to improve ability to test with local packages ([#4342](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4342))
- [Multiple DataSource] Backend support for adding sample data ([#4268](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4268))
- Add configurable defaults and overrides to uiSettings ([#4344](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4344))
- Introduce new fonts for the Next theme ([#4381](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4381))
- Add new fonts for the Next theme ([#4381](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4381))
- Bump OUI to `1.1.2` to make `anomalyDetection` icon available ([#4408](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4408))
- [Multiple DataSource] Frontend support for adding sample data ([#4412](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4412))

### 🐛 Bug Fixes

Expand All @@ -40,6 +44,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Add an achievement badger to the PR ([#3721](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3721))
- Upgrade the backport workflow ([#4343](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4343))
- [Lint] Add custom stylelint rules and config to prevent unintended style overrides ([#4290](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4290))
- [Lint] Add stylelint rule to define properties that are restricted from being used ([#4374](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4374))

### 📝 Documentation

Expand All @@ -61,10 +66,14 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fix EUI/OUI type errors ([#3798](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3798))
- Remove unused Sass in `tile_map` plugin ([#4110](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4110))
- [Table Visualization] Remove custom styling for text-align:center in favor of OUI utility class. ([#4164](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4164))
- Migrate from legacy elasticsearch client to opensearch-js client in `osd-opensearch-archiver` package([#4142](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4142))
- Replace the use of `bluebird` in `saved_objects` plugin ([#4026](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4026))
- [Vis Colors] Replace color maps with OUI color palettes ([#4293](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4293))
- [Vis Colors] [Maps] Replace hardcoded color to OUI color in `maps_legacy` plugin ([#4294](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4294))
- [Vis Colors] [TSVB] Update default color in `vis_type_timeseries` to use `ouiPaletteColorBlind()[0]`([#4363](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4363))
- [Vis Colors] [Timeline] Replace `vis_type_timeline` colors with `ouiPaletteColorBlind()` ([#4366](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4366))
- [Vis Colors] Update legacy seed colors to use `ouiPaletteColorBlind()` ([#4348](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4348))
- [Vis colors] Update legacy mapped colors in charts plugin to use `ouiPaletteColorBlind()`, Update default color in legacy visualizations to use `ouiPaletteColorBlind()[0]` ([#4398](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4398))

### 🔩 Tests

Expand Down Expand Up @@ -163,6 +172,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Monaco editor] Add json worker support ([#3424](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3424))
- [Multiple DataSource] Allow create and distinguish index pattern with same name but from different datasources ([#3604](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3604))
- [Multiple DataSource] Integrate multiple datasource with dev tool console ([#3754](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3754))
- [Navigation] Remove unused tags ([#3964](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3964))
- [Notifications] Add id to toast api for deduplication ([#3752](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3752))
- [UI] Add support for comma delimiters in the global filter bar ([#3686](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3686))
- [UI] Indicate that IE is no longer supported ([#3641](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3641))
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"**/unset-value": "^2.0.1",
"**/jest-config": "npm:@amoo-miki/jest-config@27.5.1",
"**/jest-jasmine2": "npm:@amoo-miki/jest-jasmine2@27.5.1",
"**/semver": "^7.5.3",
"**/set-value": "^4.1.0",
"**/xml2js": "^0.5.0",
"**/yaml": "^2.2.2"
Expand All @@ -121,7 +122,7 @@
"dependencies": {
"@aws-crypto/client-node": "^3.1.1",
"@elastic/datemath": "5.0.3",
"@elastic/eui": "npm:@opensearch-project/oui@1.1.1",
"@elastic/eui": "npm:@opensearch-project/oui@1.1.2",
"@elastic/good": "^9.0.1-kibana3",
"@elastic/numeral": "^2.5.0",
"@elastic/request-crypto": "2.0.0",
Expand Down Expand Up @@ -211,7 +212,7 @@
"require-in-the-middle": "^5.0.2",
"rison-node": "1.0.2",
"rxjs": "^6.5.5",
"semver": "^5.7.0",
"semver": "^7.5.3",
"set-value": "^4.1.0",
"source-map-support": "^0.5.19",
"symbol-observable": "^1.2.0",
Expand Down Expand Up @@ -322,7 +323,7 @@
"@types/react-virtualized": "^9.18.7",
"@types/recompose": "^0.30.6",
"@types/selenium-webdriver": "^4.0.9",
"@types/semver": "^5.5.0",
"@types/semver": "^7.5.0",
"@types/sinon": "^7.0.13",
"@types/strip-ansi": "^5.2.1",
"@types/styled-components": "^5.1.19",
Expand Down
6 changes: 2 additions & 4 deletions packages/osd-opensearch-archiver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
},
"dependencies": {
"@osd/dev-utils": "1.0.0",
"elasticsearch": "^16.7.0"
"@opensearch-project/opensearch": "^2.2.0"
},
"devDependencies": {
"@types/elasticsearch": "^5.0.33"
}
"devDependencies": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* under the License.
*/

import { Client } from 'elasticsearch';
import { Client } from '@opensearch-project/opensearch';
import { ToolingLog, OsdClient } from '@osd/dev-utils';

import {
Expand Down
4 changes: 2 additions & 2 deletions packages/osd-opensearch-archiver/src/actions/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { resolve } from 'path';
import { createReadStream } from 'fs';
import { Readable } from 'stream';
import { ToolingLog, OsdClient } from '@osd/dev-utils';
import { Client } from 'elasticsearch';
import { Client } from '@opensearch-project/opensearch';

import { createPromiseFromStreams, concatStreamProviders } from '../lib/streams';

Expand Down Expand Up @@ -114,7 +114,7 @@ export async function loadAction({

await client.indices.refresh({
index: '_all',
allowNoIndices: true,
allow_no_indices: true,
});

// If we affected the OpenSearch Dashboards index, we need to ensure it's migrated...
Expand Down
2 changes: 1 addition & 1 deletion packages/osd-opensearch-archiver/src/actions/save.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import { resolve } from 'path';
import { createWriteStream, mkdirSync } from 'fs';
import { Readable, Writable } from 'stream';
import { Client } from 'elasticsearch';
import { Client } from '@opensearch-project/opensearch';
import { ToolingLog } from '@osd/dev-utils';

import { createListStream, createPromiseFromStreams } from '../lib/streams';
Expand Down
2 changes: 1 addition & 1 deletion packages/osd-opensearch-archiver/src/actions/unload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import { resolve } from 'path';
import { createReadStream } from 'fs';
import { Readable, Writable } from 'stream';
import { Client } from 'elasticsearch';
import { Client } from '@opensearch-project/opensearch';
import { ToolingLog, OsdClient } from '@osd/dev-utils';

import { createPromiseFromStreams } from '../lib/streams';
Expand Down
13 changes: 7 additions & 6 deletions packages/osd-opensearch-archiver/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import Path from 'path';
import readline from 'readline';

import { RunWithCommands, createFlagError } from '@osd/dev-utils';
import { Client, ClientOptions } from '@opensearch-project/opensearch';
import { readConfigFile } from '@osd/test';
import legacyElasticsearch from 'elasticsearch';

import { OpenSearchArchiver } from './opensearch_archiver';

Expand All @@ -56,7 +56,7 @@ export function runCli() {
default: ${defaultConfigPath}
--opensearch-url url for OpenSearch, prefer the --config flag
--opensearch-dashboards-url url for OpenSearch Dashboards, prefer the --config flag
--dir where arechives are stored, prefer the --config flag
--dir where archives are stored, prefer the --config flag
`,
},
async extendContext({ log, flags, addCleanupTask }) {
Expand Down Expand Up @@ -99,10 +99,11 @@ export function runCli() {
throw createFlagError('--dir or --config must be defined');
}

const client = new legacyElasticsearch.Client({
host: opensearchUrl,
log: flags.verbose ? 'trace' : [],
});
const clientOptions: ClientOptions = {
node: opensearchUrl.toString(),
};

const client = new Client(clientOptions);
addCleanupTask(() => client.close());

const opensearchArchiver = new OpenSearchArchiver({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ describe('opensearchArchiver: createGenerateDocRecordsStream()', () => {
expect(params).to.have.property('index', 'logstash-*');
expect(params).to.have.property('size', 1000);
return {
hits: {
total: 0,
hits: [],
body: {
hits: {
total: 0,
hits: [],
},
},
};
},
Expand All @@ -74,9 +76,11 @@ describe('opensearchArchiver: createGenerateDocRecordsStream()', () => {
expect(params).to.have.property('scroll', '1m');
expect(params).to.have.property('rest_total_hits_as_int', true);
return {
hits: {
total: 0,
hits: [],
body: {
hits: {
total: 0,
hits: [],
},
},
};
},
Expand All @@ -101,25 +105,27 @@ describe('opensearchArchiver: createGenerateDocRecordsStream()', () => {
expect(params).to.have.property('index', 'index1');
await delay(200);
return {
_scroll_id: 'index1ScrollId',
hits: { total: 2, hits: [{ _id: 1, _index: '.opensearch_dashboards_1' }] },
body: {
_scroll_id: 'index1ScrollId',
hits: { total: 2, hits: [{ _id: 1, _index: '.opensearch_dashboards_1' }] },
},
};
},
async (name, params) => {
expect(name).to.be('scroll');
expect(params).to.have.property('scrollId', 'index1ScrollId');
expect(params).to.have.property('scroll_id', 'index1ScrollId');
expect(Date.now() - checkpoint).to.not.be.lessThan(200);
checkpoint = Date.now();
await delay(200);
return { hits: { total: 2, hits: [{ _id: 2, _index: 'foo' }] } };
return { body: { hits: { total: 2, hits: [{ _id: 2, _index: 'foo' }] } } };
},
async (name, params) => {
expect(name).to.be('search');
expect(params).to.have.property('index', 'index2');
expect(Date.now() - checkpoint).to.not.be.lessThan(200);
checkpoint = Date.now();
await delay(200);
return { hits: { total: 0, hits: [] } };
return { body: { hits: { total: 0, hits: [] } } };
},
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/

import { Transform } from 'stream';
import { Client, SearchParams, SearchResponse } from 'elasticsearch';
import { Client, ApiResponse } from '@opensearch-project/opensearch';
import { Stats } from '../stats';
import { Progress } from '../progress';

Expand All @@ -53,7 +53,7 @@ export function createGenerateDocRecordsStream({
async transform(index, enc, callback) {
try {
let remainingHits = 0;
let resp: SearchResponse<any> | null = null;
let resp: ApiResponse<any> | null = null;

while (!resp || remainingHits > 0) {
if (!resp) {
Expand All @@ -66,17 +66,17 @@ export function createGenerateDocRecordsStream({
query,
},
rest_total_hits_as_int: true, // not declared on SearchParams type
} as SearchParams);
remainingHits = resp.hits.total;
});
remainingHits = resp.body.hits.total;
progress.addToTotal(remainingHits);
} else {
resp = await client.scroll({
scrollId: resp._scroll_id!,
scroll_id: resp.body._scroll_id!,
scroll: SCROLL_TIMEOUT,
});
}

for (const hit of resp.hits.hits) {
for (const hit of resp.body?.hits.hits) {
remainingHits -= 1;
stats.archivedDoc(hit._index);
this.push({
Expand All @@ -94,7 +94,7 @@ export function createGenerateDocRecordsStream({
});
}

progress.addToComplete(resp.hits.hits.length);
progress.addToComplete(resp.body.hits.hits.length);
}

callback(undefined);
Expand Down
Loading

0 comments on commit e942c5b

Please sign in to comment.