Skip to content

Commit

Permalink
[8.x] Remove unused`kbn-ace` code (#195353) (#195727)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [Remove unused`kbn-ace` code
(#195353)](#195353)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Ignacio
Rivas","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-08T11:45:20Z","message":"Remove
unused`kbn-ace` code
(#195353)","sha":"83810ac9edba72f0bcad8f7e7e77a1bef89328cc","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Kibana
Management","release_note:skip","v9.0.0","backport:prev-minor","v8.16.0"],"title":"Remove
unused`kbn-ace`
code","number":195353,"url":"https://github.com/elastic/kibana/pull/195353","mergeCommit":{"message":"Remove
unused`kbn-ace` code
(#195353)","sha":"83810ac9edba72f0bcad8f7e7e77a1bef89328cc"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195353","number":195353,"mergeCommit":{"message":"Remove
unused`kbn-ace` code
(#195353)","sha":"83810ac9edba72f0bcad8f7e7e77a1bef89328cc"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Ignacio Rivas <[email protected]>
  • Loading branch information
kibanamachine and sabarasaba authored Oct 10, 2024
1 parent 950e073 commit cbef50e
Show file tree
Hide file tree
Showing 14 changed files with 5 additions and 40 deletions.
1 change: 0 additions & 1 deletion x-pack/plugins/data_visualizer/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"kibanaReact",
"kibanaUtils",
"maps",
"esUiShared",
"fieldFormats",
"uiActions",
"lens",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import type { FC } from 'react';
import React from 'react';

import { CodeEditor, type CodeEditorProps } from '@kbn/code-editor';
import { expandLiteralStrings, XJsonMode } from '../../../shared_imports';

export const EDITOR_MODE = { TEXT: 'text', JSON: 'json', XJSON: new XJsonMode() };
export const EDITOR_MODE = { TEXT: 'text', JSON: 'json' };

interface JobEditorProps {
value: string;
Expand All @@ -30,10 +29,6 @@ export const JsonEditor: FC<JobEditorProps> = ({
readOnly = false,
onChange = () => {},
}) => {
if (mode === EDITOR_MODE.XJSON) {
value = expandLiteralStrings(value);
}

return (
<CodeEditor
value={value}
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions x-pack/plugins/data_visualizer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"types/**/*"
],
"kbn_references": [
"@kbn/ace",
"@kbn/aiops-components",
"@kbn/charts-plugin",
"@kbn/cloud-plugin",
Expand All @@ -32,7 +31,6 @@
"@kbn/embeddable-plugin",
"@kbn/es-query",
"@kbn/es-types",
"@kbn/es-ui-shared-plugin",
"@kbn/esql-utils",
"@kbn/field-formats-plugin",
"@kbn/field-types",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { XJsonMode } from '@kbn/ace';
import { XJson } from '@kbn/es-ui-shared-plugin/public';
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
import { getCombinedRuntimeMappings, isRuntimeMappings } from '@kbn/ml-runtime-field-utils';
Expand Down Expand Up @@ -66,8 +65,6 @@ const RUNTIME_FIELDS_LABEL_TEXT = i18n.translate(
);

const { useXJsonMode } = XJson;
const xJsonMode = new XJsonMode();
export type XJsonModeType = ReturnType<typeof XJsonMode>;

interface Props {
actions: CreateAnalyticsFormProps['actions'];
Expand Down Expand Up @@ -176,7 +173,6 @@ export const RuntimeMappings: FC<Props> = ({ actions, state }) => {
}
setAdvancedRuntimeMappingsConfig={setAdvancedRuntimeMappingsConfig}
convertToJson={convertToJson}
xJsonMode={xJsonMode}
/>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,18 @@ import { i18n } from '@kbn/i18n';

import { CodeEditor } from '@kbn/code-editor';
import { isRuntimeMappings } from '@kbn/ml-runtime-field-utils';
import type { XJsonModeType } from './runtime_mappings';

interface Props {
convertToJson: (data: string) => string;
setAdvancedRuntimeMappingsConfig: React.Dispatch<string>;
setIsRuntimeMappingsEditorApplyButtonEnabled: React.Dispatch<React.SetStateAction<boolean>>;
advancedEditorRuntimeMappingsLastApplied: string | undefined;
advancedRuntimeMappingsConfig: string;
xJsonMode: XJsonModeType;
}

export const RuntimeMappingsEditor: FC<Props> = memo(
({
convertToJson,
xJsonMode,
setAdvancedRuntimeMappingsConfig,
setIsRuntimeMappingsEditorApplyButtonEnabled,
advancedEditorRuntimeMappingsLastApplied,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const DatafeedPreview: FC<{
const {
jobs: { datafeedPreview },
} = useMlApi();
// the ace editor requires a fixed height
// the editor requires a fixed height
const editorHeight = useMemo(
() => `${window.innerHeight - 230 - heightOffset}px`,
[heightOffset]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ const Contents: FC<{
heightOffset?: number;
schema?: object;
}> = ({ title, value, editJson, onChange, heightOffset = 0, schema }) => {
// the ace editor requires a fixed height
// the editor requires a fixed height
const editorHeight = useMemo(
() => `${window.innerHeight - 230 - heightOffset}px`,
[heightOffset]
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/ml/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"path": "../../../src/setup_node_env/tsconfig.json"
},
// add references to other TypeScript projects the plugin depends on
"@kbn/ace",
"@kbn/actions-plugin",
"@kbn/aiops-plugin",
"@kbn/alerting-plugin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type { StepDefineFormHook } from '../step_define';
export const AdvancedPivotEditor: FC<StepDefineFormHook['advancedPivotEditor']> = memo(
({
actions: { convertToJson, setAdvancedEditorConfig, setAdvancedPivotEditorApplyButtonEnabled },
state: { advancedEditorConfigLastApplied, advancedEditorConfig, xJsonMode },
state: { advancedEditorConfigLastApplied, advancedEditorConfig },
}) => {
return (
<EuiFormRow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const AdvancedRuntimeMappingsEditor: FC<StepDefineFormHook['runtimeMappin
setAdvancedRuntimeMappingsConfig,
setRuntimeMappingsEditorApplyButtonEnabled,
},
state: { advancedEditorRuntimeMappingsLastApplied, advancedRuntimeMappingsConfig, xJsonMode },
state: { advancedEditorRuntimeMappingsLastApplied, advancedRuntimeMappingsConfig },
}) => {
return (
<div data-test-subj="transformAdvancedRuntimeMappingsEditor">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import { useEffect, useState } from 'react';
import { XJsonMode } from '@kbn/ace';

import { XJson } from '@kbn/es-ui-shared-plugin/public';

Expand All @@ -15,7 +14,6 @@ import type { PostTransformsPreviewRequestSchema } from '../../../../../../../se
import type { StepDefineExposedState } from '../common';

const { useXJsonMode } = XJson;
const xJsonMode = new XJsonMode();

export const useAdvancedPivotEditor = (
defaults: StepDefineExposedState,
Expand Down Expand Up @@ -71,7 +69,6 @@ export const useAdvancedPivotEditor = (
isAdvancedEditorSwitchModalVisible,
isAdvancedPivotEditorApplyButtonEnabled,
isAdvancedPivotEditorEnabled,
xJsonMode,
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
*/

import { useState } from 'react';
import { XJsonMode } from '@kbn/ace';
import { XJson } from '@kbn/es-ui-shared-plugin/public';
import type { StepDefineExposedState } from '../common';

const { useXJsonMode } = XJson;
const xJsonMode = new XJsonMode();

export const useAdvancedRuntimeMappingsEditor = (defaults: StepDefineExposedState) => {
const stringifiedRuntimeMappings = JSON.stringify(defaults.runtimeMappings, null, 2);
Expand Down Expand Up @@ -81,7 +79,6 @@ export const useAdvancedRuntimeMappingsEditor = (defaults: StepDefineExposedStat
isRuntimeMappingsEditorSwitchModalVisible,
runtimeMappingsUpdated,
advancedRuntimeMappingsConfig,
xJsonMode,
runtimeMappings,
},
};
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/transform/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"@kbn/triggers-actions-ui-plugin",
"@kbn/i18n-react",
"@kbn/kibana-react-plugin",
"@kbn/ace",
"@kbn/es-ui-shared-plugin",
"@kbn/discover-plugin",
"@kbn/kibana-utils-plugin",
Expand Down

0 comments on commit cbef50e

Please sign in to comment.