diff --git a/x-pack/plugins/index_management/public/application/sections/home/index_list/details_page/details_page_settings_content.tsx b/x-pack/plugins/index_management/public/application/sections/home/index_list/details_page/details_page_settings_content.tsx index be5acc1196da87..51ca47ba5c673b 100644 --- a/x-pack/plugins/index_management/public/application/sections/home/index_list/details_page/details_page_settings_content.tsx +++ b/x-pack/plugins/index_management/public/application/sections/home/index_list/details_page/details_page_settings_content.tsx @@ -25,6 +25,7 @@ import _ from 'lodash'; import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; import { CodeEditor } from '@kbn/code-editor'; +import { monaco as monacoEditor } from '@kbn/monaco'; import { IndexSettingsResponse } from '../../../../../../common'; import { Error } from '../../../../../shared_imports'; import { documentationService, updateIndexSettings } from '../../../../services'; @@ -143,6 +144,14 @@ export const DetailsPageSettingsContent: FunctionComponent = ({ }); } }, [originalSettings, editableSettings, indexName, reloadIndexSettings]); + const settingsSchemaProperties = {} as Record; + Object.keys(originalSettings).forEach( + // allow any type of value + (setting) => + (settingsSchemaProperties[setting] = { + type: ['null', 'boolean', 'object', 'array', 'number', 'string'], + }) + ); return ( // using "rowReverse" to keep the card on the left side to be on top of the code block on smaller screens = ({ {isEditMode ? ( { + monacoEditor.languages.json.jsonDefaults.setDiagnosticsOptions({ + validate: true, + schemas: [ + { + uri: editor.getModel()?.uri.toString() ?? '', + fileMatch: ['*'], + schema: { + type: 'object', + properties: settingsSchemaProperties, + }, + }, + ], + }); + }} value={editableSettings} data-test-subj="indexDetailsSettingsEditor" options={{ diff --git a/x-pack/plugins/index_management/tsconfig.json b/x-pack/plugins/index_management/tsconfig.json index e9e76a18f8fd0d..50181a03e3f195 100644 --- a/x-pack/plugins/index_management/tsconfig.json +++ b/x-pack/plugins/index_management/tsconfig.json @@ -43,6 +43,7 @@ "@kbn/ui-theme", "@kbn/core-application-browser", "@kbn/code-editor", + "@kbn/monaco", "@kbn/console-plugin", ], "exclude": [