Skip to content

Commit

Permalink
[Discover-next] toggle enhancements (#7314)
Browse files Browse the repository at this point in the history
* enable toggle

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* turn query enhancement off for functional tests

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* set the query to be valid

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* Changeset file for PR #7314 created/updated

---------

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Co-authored-by: abbyhu2000 <abigailhu2000@gmail.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 19, 2024
1 parent 3bb4170 commit bff0d4a
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cypress_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ env:
TEST_REPO: ${{ inputs.test_repo != '' && inputs.test_repo || 'opensearch-project/opensearch-dashboards-functional-test' }}
TEST_BRANCH: "${{ inputs.test_branch != '' && inputs.test_branch || github.base_ref }}"
FTR_PATH: 'ftr'
START_CMD: 'node ../scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true --csp.warnLegacyBrowsers=false'
START_CMD: 'node ../scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true --csp.warnLegacyBrowsers=false --uiSettings.overrides["query:enhancements:enabled"]=false'
OPENSEARCH_SNAPSHOT_CMD: 'node ../scripts/opensearch snapshot -E cluster.routing.allocation.disk.threshold_enabled=false'
CYPRESS_BROWSER: 'chromium'
CYPRESS_VISBUILDER_ENABLED: true
Expand Down
2 changes: 2 additions & 0 deletions changelogs/fragments/7314.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Unused config setting and remove data sources as a required plugin. ([#7314](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7314))
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"start": "scripts/use_node scripts/opensearch_dashboards --dev",
"start:docker": "scripts/use_node scripts/opensearch_dashboards --dev --opensearch.hosts=$OPENSEARCH_HOSTS --opensearch.ignoreVersionMismatch=true --server.host=$SERVER_HOST",
"start:security": "scripts/use_node scripts/opensearch_dashboards --dev --security",
"start:enhancements": "scripts/use_node scripts/opensearch_dashboards --dev --data_source.enabled=true --uiSettings.overrides['query:enhancements:enabled']=true",
"start:enhancements": "scripts/use_node scripts/opensearch_dashboards --dev --uiSettings.overrides['query:enhancements:enabled']=true",
"debug": "scripts/use_node --nolazy --inspect scripts/opensearch_dashboards --dev",
"debug-break": "scripts/use_node --nolazy --inspect-brk scripts/opensearch_dashboards --dev",
"lint": "yarn run lint:es && yarn run lint:style",
Expand Down
11 changes: 1 addition & 10 deletions src/plugins/data/public/ui/query_editor/query_editor_top_row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,7 @@ export default function QueryEditorTopRow(props: QueryEditorTopRowProps) {
}

function isValidQuery(query: Query | undefined) {
if (!query || !query.query) return false;
return (
!Array.isArray(props.indexPatterns!) ||
compact(props.indexPatterns!).length === 0 ||
fromUser(query!.query).includes(
typeof props.indexPatterns[0] === 'string'
? props.indexPatterns[0]
: props.indexPatterns[0].title
)
);
if (query && query.query) return true;
}

function getQueryStringInitialValue(language: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/ui/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class Settings {
private readonly queryEnhancements: Map<string, QueryEnhancement>,
private readonly queryEditorExtensionMap: Record<string, QueryEditorExtensionConfig>
) {
this.isEnabled = false;
this.isEnabled = true;
this.setUserQueryEnhancementsEnabled(this.isEnabled);
this.enhancedAppNames = this.isEnabled ? this.config.supportedAppNames : [];
}
Expand Down
1 change: 0 additions & 1 deletion src/plugins/data/public/ui/ui_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export class UiService implements Plugin<IUiSetup, IUiStart> {
return {
__enhance: (enhancements?: UiEnhancements) => {
if (!enhancements) return;
if (!this.enhancementsConfig.enabled) return;
if (enhancements.query && enhancements.query.language) {
this.queryEnhancements.set(enhancements.query.language, enhancements.query);
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/server/ui_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ export function getUiSettings(): Record<string, UiSettingsParams<unknown>> {
name: i18n.translate('data.advancedSettings.query.enhancements.enableTitle', {
defaultMessage: 'Enable query enhancements',
}),
value: false,
value: true,
description: i18n.translate('data.advancedSettings.query.enhancements.enableText', {
defaultMessage: `
<strong>Experimental</strong>:
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/query_enhancements/opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "opensearchDashboards",
"server": true,
"ui": true,
"requiredPlugins": ["data", "opensearchDashboardsReact", "opensearchDashboardsUtils", "dataSource", "dataSourceManagement", "savedObjects", "uiActions"],
"optionalPlugins": []
"requiredPlugins": ["data", "opensearchDashboardsReact", "opensearchDashboardsUtils", "dataSourceManagement", "savedObjects", "uiActions"],
"optionalPlugins": ["dataSource"]
}

1 change: 1 addition & 0 deletions test/common/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default function () {
`--opensearchDashboards.branding.mark.defaultUrl=https://opensearch.org/assets/brand/SVG/Mark/opensearch_mark_default.svg`,
`--opensearchDashboards.branding.mark.darkModeUrl=https://opensearch.org/assets/brand/SVG/Mark/opensearch_mark_darkmode.svg`,
`--opensearchDashboards.branding.applicationTitle=OpenSearch`,
`--uiSettings.overrides['query:enhancements:enabled']=false`,
],
},
services,
Expand Down

0 comments on commit bff0d4a

Please sign in to comment.