From 6f9d771714d31a9bff2ae382e69bddd7bb2ef98e Mon Sep 17 00:00:00 2001 From: Peter Pisljar Date: Wed, 13 Jul 2022 06:49:21 +0200 Subject: [PATCH] data view side panel explore button (#135224) --- .../public/components/data_view_editor.tsx | 2 + .../data_view_editor_flyout_content.tsx | 17 ++++-- .../data_view_flyout_content_container.tsx | 8 ++- .../public/components/footer/footer.tsx | 56 +++++++++++++++---- .../public/components/form_schema.ts | 7 +++ .../data_view_editor/public/open_editor.tsx | 2 + src/plugins/data_view_editor/public/types.ts | 5 ++ 7 files changed, 79 insertions(+), 18 deletions(-) diff --git a/src/plugins/data_view_editor/public/components/data_view_editor.tsx b/src/plugins/data_view_editor/public/components/data_view_editor.tsx index f984b8451b061..ff236e804c2b7 100644 --- a/src/plugins/data_view_editor/public/components/data_view_editor.tsx +++ b/src/plugins/data_view_editor/public/components/data_view_editor.tsx @@ -24,6 +24,7 @@ export const DataViewEditor = ({ defaultTypeIsRollup = false, requireTimestampField = false, editData, + allowAdHocDataView, }: DataViewEditorPropsWithServices) => { const { Provider: KibanaReactContextProvider } = createKibanaReactContext(services); @@ -37,6 +38,7 @@ export const DataViewEditor = ({ defaultTypeIsRollup={defaultTypeIsRollup} requireTimestampField={requireTimestampField} editData={editData} + allowAdHocDataView={allowAdHocDataView} /> diff --git a/src/plugins/data_view_editor/public/components/data_view_editor_flyout_content.tsx b/src/plugins/data_view_editor/public/components/data_view_editor_flyout_content.tsx index dc000de1e20fd..744e3824e3c68 100644 --- a/src/plugins/data_view_editor/public/components/data_view_editor_flyout_content.tsx +++ b/src/plugins/data_view_editor/public/components/data_view_editor_flyout_content.tsx @@ -20,6 +20,7 @@ import { useFormData, useKibana, GetFieldsOptions, + UseField, } from '../shared_imports'; import { ensureMinimumTime, getIndices, extractTimeFields, getMatchedIndices } from '../lib'; @@ -55,7 +56,7 @@ export interface Props { /** * Handler for the "save" footer button */ - onSave: (dataViewSpec: DataViewSpec) => void; + onSave: (dataViewSpec: DataViewSpec, persist: boolean) => void; /** * Handler for the "cancel" footer button */ @@ -63,6 +64,7 @@ export interface Props { defaultTypeIsRollup?: boolean; requireTimestampField?: boolean; editData?: DataView; + allowAdHoc: boolean; } const editorTitle = i18n.translate('indexPatternEditor.title', { @@ -79,6 +81,7 @@ const IndexPatternEditorFlyoutContentComponent = ({ defaultTypeIsRollup, requireTimestampField = false, editData, + allowAdHoc, }: Props) => { const { services: { http, dataViews, uiSettings, overlays }, @@ -88,6 +91,7 @@ const IndexPatternEditorFlyoutContentComponent = ({ // Prefill with data if editData exists defaultValue: { type: defaultTypeIsRollup ? INDEX_PATTERN_TYPE.ROLLUP : INDEX_PATTERN_TYPE.DEFAULT, + isAdHoc: false, ...(editData ? { title: editData.title, @@ -129,11 +133,11 @@ const IndexPatternEditorFlyoutContentComponent = ({ dataViewName: formData.name || formData.title, overlays, onEdit: async () => { - await onSave(indexPatternStub); + await onSave(indexPatternStub, !formData.isAdHoc); }, }); } else { - await onSave(indexPatternStub); + await onSave(indexPatternStub, !formData.isAdHoc); } }, }); @@ -371,6 +375,7 @@ const IndexPatternEditorFlyoutContentComponent = ({

{editData ? editorTitleEditMode : editorTitle}

+ {indexPatternTypeSelect} @@ -409,9 +414,13 @@ const IndexPatternEditorFlyoutContentComponent = ({