-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Transforms: Single Column Wizard. (#64436)
Rearranges the layout of the transform wizard pivot configuration step into a single-column. This allows us to have the data grids for source index and pivot preview having the full width. The advanced editors for source query and pivot configuration also cover a wider width.
- Loading branch information
Showing
45 changed files
with
1,823 additions
and
1,197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
.../app/sections/create_transform/components/advanced_pivot_editor/advanced_pivot_editor.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { isEqual } from 'lodash'; | ||
import React, { memo, FC } from 'react'; | ||
|
||
import { EuiCodeEditor, EuiFormRow } from '@elastic/eui'; | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
import { StepDefineFormHook } from '../step_define'; | ||
|
||
export const AdvancedPivotEditor: FC<StepDefineFormHook['advancedPivotEditor']> = memo( | ||
({ | ||
actions: { convertToJson, setAdvancedEditorConfig, setAdvancedPivotEditorApplyButtonEnabled }, | ||
state: { advancedEditorConfigLastApplied, advancedEditorConfig, xJsonMode }, | ||
}) => { | ||
return ( | ||
<EuiFormRow | ||
fullWidth | ||
label={i18n.translate('xpack.transform.stepDefineForm.advancedEditorLabel', { | ||
defaultMessage: 'Pivot configuration object', | ||
})} | ||
> | ||
<EuiCodeEditor | ||
data-test-subj="transformAdvancedPivotEditor" | ||
style={{ border: '1px solid #e3e6ef' }} | ||
height="250px" | ||
width="100%" | ||
mode={xJsonMode} | ||
value={advancedEditorConfig} | ||
onChange={(d: string) => { | ||
setAdvancedEditorConfig(d); | ||
|
||
// Disable the "Apply"-Button if the config hasn't changed. | ||
if (advancedEditorConfigLastApplied === d) { | ||
setAdvancedPivotEditorApplyButtonEnabled(false); | ||
return; | ||
} | ||
|
||
// Try to parse the string passed on from the editor. | ||
// If parsing fails, the "Apply"-Button will be disabled | ||
try { | ||
JSON.parse(convertToJson(d)); | ||
setAdvancedPivotEditorApplyButtonEnabled(true); | ||
} catch (e) { | ||
setAdvancedPivotEditorApplyButtonEnabled(false); | ||
} | ||
}} | ||
setOptions={{ | ||
fontSize: '12px', | ||
}} | ||
theme="textmate" | ||
aria-label={i18n.translate('xpack.transform.stepDefineForm.advancedEditorAriaLabel', { | ||
defaultMessage: 'Advanced pivot editor', | ||
})} | ||
/> | ||
</EuiFormRow> | ||
); | ||
}, | ||
(prevProps, nextProps) => isEqual(pickProps(prevProps), pickProps(nextProps)) | ||
); | ||
|
||
function pickProps(props: StepDefineFormHook['advancedPivotEditor']) { | ||
return [props.state.advancedEditorConfigLastApplied, props.state.advancedEditorConfig]; | ||
} |
7 changes: 7 additions & 0 deletions
7
.../transform/public/app/sections/create_transform/components/advanced_pivot_editor/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export { AdvancedPivotEditor } from './advanced_pivot_editor'; |
Oops, something went wrong.