Skip to content

Commit

Permalink
[Discover-next] remove plugin config toggle for data enhancements (op…
Browse files Browse the repository at this point in the history
…ensearch-project#7291) (opensearch-project#7293)

* [Discover-next] remove plugin config toggle for data enhancements

Remove the data config toggle for enhancements and rely on the
UI settings for being enabled.

(cherry picked from commit 5761207)

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored and abbyhu2000 committed Jul 23, 2024
1 parent fac8667 commit 9224956
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 40 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/7291.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deprecate:
- Remove data enhancements config and readonly flag. Removes dead url link, ([#7291](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7291))
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))
3 changes: 0 additions & 3 deletions config/opensearch_dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,6 @@
# This publishes the Application Usage and UI Metrics into the saved object, which can be accessed by /api/stats?extended=true&legacy=true&exclude_usage=false
# usageCollection.uiMetric.enabled: false

# Set the value to true to enable enhancements for the data plugin
# data.enhancements.enabled: false

# Set the backend roles in groups or users, whoever has the backend roles or exactly match the user ids defined in this config will be regard as dashboard admin.
# Dashboard admin will have the access to all the workspaces(workspace.enabled: true) and objects inside OpenSearch Dashboards.
# opensearchDashboards.dashboardAdmin.groups: ["dashboard_admin"]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,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.enhancements.enabled=true --data_source.enabled=true --uiSettings.overrides['query:enhancements:enabled']=true --uiSettings.overrides['query:dataSource:readOnly']=false",
"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
2 changes: 0 additions & 2 deletions src/core/server/rendering/views/template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ export const Template: FunctionComponent<Props> = ({
* ToDo: Custom branded favicons will not work correctly across all browsers with
* these `link` elements and single type. Try to guess the image and use only one.
*
* Favicons (generated from https://realfavicongenerator.net/)
*
* For user customized favicon using yml file:
* If user inputs a valid URL, we guarantee basic favicon customization, such as
* browser favicon(Chrome, Firefox, Safari, and Edge), apple touch icon, safari
Expand Down
1 change: 0 additions & 1 deletion src/plugins/data/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,5 @@ export const UI_SETTINGS = {
FILTERS_EDITOR_SUGGEST_VALUES: 'filterEditor:suggestValues',
QUERY_ENHANCEMENTS_ENABLED: 'query:enhancements:enabled',
QUERY_DATAFRAME_HYDRATION_STRATEGY: 'query:dataframe:hydrationStrategy',
QUERY_DATA_SOURCE_READONLY: 'query:dataSource:readOnly',
SEARCH_QUERY_LANGUAGE_BLOCKLIST: 'search:queryLanguageBlocklist',
} as const;
1 change: 0 additions & 1 deletion src/plugins/data/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { schema, TypeOf } from '@osd/config-schema';

export const configSchema = schema.object({
enhancements: schema.object({
enabled: schema.boolean({ defaultValue: false }),
supportedAppNames: schema.arrayOf(schema.string(), {
defaultValue: ['discover'],
}),
Expand Down
14 changes: 1 addition & 13 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 @@ -75,8 +75,6 @@ export default function QueryEditorTopRow(props: QueryEditorTopRowProps) {
const opensearchDashboards = useOpenSearchDashboards<IDataPluginServices>();
const { uiSettings, storage, appName } = opensearchDashboards.services;

const isDataSourceReadOnly = uiSettings.get(UI_SETTINGS.QUERY_DATA_SOURCE_READONLY);

const queryLanguage = props.query && props.query.language;
const queryUiEnhancement =
(queryLanguage &&
Expand Down Expand Up @@ -193,17 +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 ||
!isDataSourceReadOnly ||
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 = this.config.enabled;
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
15 changes: 1 addition & 14 deletions 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 Expand Up @@ -750,19 +750,6 @@ export function getUiSettings(): Record<string, UiSettingsParams<unknown>> {
category: ['search'],
schema: schema.string(),
},
[UI_SETTINGS.QUERY_DATA_SOURCE_READONLY]: {
name: i18n.translate('data.advancedSettings.query.dataSource.readOnlyTitle', {
defaultMessage: 'Read-only data source in query editor',
}),
value: true,
description: i18n.translate('data.advancedSettings.query.dataSource.readOnlyText', {
defaultMessage:
'When enabled, the search bar prevents modifying the data source in the query input. ' +
'<strong>Experimental</strong>: Requires query enhancements enabled.',
}),
category: ['search'],
schema: schema.boolean(),
},
[UI_SETTINGS.SEARCH_QUERY_LANGUAGE_BLOCKLIST]: {
name: i18n.translate('data.advancedSettings.searchQueryLanguageBlocklistTitle', {
defaultMessage: 'Additional query languages blocklist',
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 @@ -79,6 +79,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 9224956

Please sign in to comment.