Skip to content

Commit

Permalink
show empty prompts in page and don't auto-open flyout in DataViews (#…
Browse files Browse the repository at this point in the history
…134469)

* show empty prompts in page and don't auto-open flyout in DataViews

* changed flow based on comments

* fix for namespace issues

* fix for failed checks

* fixes for failed checks and tests

* fix failing tests

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
shivindera and kibanamachine authored Jun 28, 2022
1 parent f89efc7 commit c8520f9
Show file tree
Hide file tree
Showing 34 changed files with 200 additions and 477 deletions.
2 changes: 0 additions & 2 deletions packages/kbn-shared-ux-services/src/services/editors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ type DataView = unknown;
interface DataViewEditorOptions {
/** Handler to be invoked when the Data View Editor completes a save operation. */
onSave: (dataView: DataView) => void;
/** If set to false, will skip empty prompt in data view editor. */
showEmptyPrompt?: boolean;
}

/**
Expand Down
2 changes: 0 additions & 2 deletions packages/shared-ux/page/kibana_no_data/src/services.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ type DataView = unknown;
interface DataViewEditorOptions {
/** Handler to be invoked when the Data View Editor completes a save operation. */
onSave: (dataView: DataView) => void;
/** If set to false, will skip empty prompt in data view editor. */
showEmptyPrompt?: boolean;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const NoDataViewsPrompt = ({
onClick={onClickCreate}
iconType="plusInCircle"
fill={true}
data-test-subj="createDataViewButtonFlyout"
data-test-subj="createDataViewButton"
>
{createDataViewText}
</EuiButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export const NoDataViewsPrompt = ({ onDataViewCreated }: Props) => {
onSave: (dataView) => {
onDataViewCreated(dataView);
},
showEmptyPrompt: false,
});

if (setDataViewEditorRef) {
Expand Down
2 changes: 0 additions & 2 deletions packages/shared-ux/prompt/no_data_views/src/services.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ type DataView = unknown;
interface DataViewEditorOptions {
/** Handler to be invoked when the Data View Editor completes a save operation. */
onSave: (dataView: DataView) => void;
/** If set to false, will skip empty prompt in data view editor. */
showEmptyPrompt?: boolean;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const DataViewEditor = ({
defaultTypeIsRollup = false,
requireTimestampField = false,
editData,
showEmptyPrompt = true,
}: DataViewEditorPropsWithServices) => {
const { Provider: KibanaReactContextProvider } =
createKibanaReactContext<DataViewEditorContext>(services);
Expand All @@ -38,7 +37,6 @@ export const DataViewEditor = ({
defaultTypeIsRollup={defaultTypeIsRollup}
requireTimestampField={requireTimestampField}
editData={editData}
showEmptyPrompt={showEmptyPrompt}
/>
</EuiFlyout>
</KibanaReactContextProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import {
schema,
Footer,
AdvancedParamsContent,
EmptyPrompts,
PreviewPanel,
RollupBetaWarning,
} from '.';
Expand All @@ -62,7 +61,6 @@ export interface Props {
defaultTypeIsRollup?: boolean;
requireTimestampField?: boolean;
editData?: DataView;
showEmptyPrompt?: boolean;
}

const editorTitle = i18n.translate('indexPatternEditor.title', {
Expand All @@ -79,7 +77,6 @@ const IndexPatternEditorFlyoutContentComponent = ({
defaultTypeIsRollup,
requireTimestampField = false,
editData,
showEmptyPrompt = true,
}: Props) => {
const {
services: { http, dataViews, uiSettings, searchClient, overlays },
Expand Down Expand Up @@ -366,75 +363,68 @@ const IndexPatternEditorFlyoutContentComponent = ({
);

return (
<EmptyPrompts
onCancel={onCancel}
allSources={allSources}
loadSources={loadSources}
showEmptyPrompt={showEmptyPrompt}
>
<FlyoutPanels.Group flyoutClassName={'indexPatternEditorFlyout'} maxWidth={1180}>
<FlyoutPanels.Item className="fieldEditor__mainFlyoutPanel" border="right">
<EuiTitle data-test-subj="flyoutTitle">
<h2>{editData ? editorTitleEditMode : editorTitle}</h2>
</EuiTitle>
<Form form={form} className="indexPatternEditor__form">
{indexPatternTypeSelect}
<EuiSpacer size="l" />
<EuiFlexGroup>
<EuiFlexItem>
<NameField editData={editData} />
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="l" />
<EuiFlexGroup>
<EuiFlexItem>
<TitleField
isRollup={form.getFields().type?.value === INDEX_PATTERN_TYPE.ROLLUP}
existingIndexPatterns={existingIndexPatterns}
refreshMatchedIndices={reloadMatchedIndices}
matchedIndices={matchedIndices.exactMatchedIndices}
rollupIndicesCapabilities={rollupIndicesCapabilities}
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="l" />
<EuiFlexGroup>
<EuiFlexItem>
<TimestampField
options={timestampFieldOptions}
isLoadingOptions={isLoadingTimestampFields}
isExistingIndexPattern={existingIndexPatterns.includes(title)}
isLoadingMatchedIndices={isLoadingMatchedIndices}
hasMatchedIndices={!!matchedIndices.exactMatchedIndices.length}
/>
</EuiFlexItem>
</EuiFlexGroup>
<AdvancedParamsContent
disableAllowHidden={type === INDEX_PATTERN_TYPE.ROLLUP}
disableId={!!editData}
/>
</Form>
<Footer
onCancel={onCancel}
onSubmit={() => form.submit()}
submitDisabled={form.isSubmitted && !form.isValid}
isEdit={!!editData}
<FlyoutPanels.Group flyoutClassName={'indexPatternEditorFlyout'} maxWidth={1180}>
<FlyoutPanels.Item className="fieldEditor__mainFlyoutPanel" border="right">
<EuiTitle data-test-subj="flyoutTitle">
<h2>{editData ? editorTitleEditMode : editorTitle}</h2>
</EuiTitle>
<Form form={form} className="indexPatternEditor__form">
{indexPatternTypeSelect}
<EuiSpacer size="l" />
<EuiFlexGroup>
<EuiFlexItem>
<NameField editData={editData} />
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="l" />
<EuiFlexGroup>
<EuiFlexItem>
<TitleField
isRollup={form.getFields().type?.value === INDEX_PATTERN_TYPE.ROLLUP}
existingIndexPatterns={existingIndexPatterns}
refreshMatchedIndices={reloadMatchedIndices}
matchedIndices={matchedIndices.exactMatchedIndices}
rollupIndicesCapabilities={rollupIndicesCapabilities}
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="l" />
<EuiFlexGroup>
<EuiFlexItem>
<TimestampField
options={timestampFieldOptions}
isLoadingOptions={isLoadingTimestampFields}
isExistingIndexPattern={existingIndexPatterns.includes(title)}
isLoadingMatchedIndices={isLoadingMatchedIndices}
hasMatchedIndices={!!matchedIndices.exactMatchedIndices.length}
/>
</EuiFlexItem>
</EuiFlexGroup>
<AdvancedParamsContent
disableAllowHidden={type === INDEX_PATTERN_TYPE.ROLLUP}
disableId={!!editData}
/>
</FlyoutPanels.Item>
<FlyoutPanels.Item>
{isLoadingSources ? (
<></>
) : (
<PreviewPanel
type={type}
allowHidden={allowHidden}
title={title}
matched={matchedIndices}
/>
)}
</FlyoutPanels.Item>
</FlyoutPanels.Group>
</EmptyPrompts>
</Form>
<Footer
onCancel={onCancel}
onSubmit={() => form.submit()}
submitDisabled={form.isSubmitted && !form.isValid}
isEdit={!!editData}
/>
</FlyoutPanels.Item>
<FlyoutPanels.Item>
{isLoadingSources ? (
<></>
) : (
<PreviewPanel
type={type}
allowHidden={allowHidden}
title={title}
matched={matchedIndices}
/>
)}
</FlyoutPanels.Item>
</FlyoutPanels.Group>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const IndexPatternFlyoutContentContainer = ({
defaultTypeIsRollup,
requireTimestampField = false,
editData,
showEmptyPrompt = true,
}: DataViewEditorProps) => {
const {
services: { dataViews, notifications },
Expand Down Expand Up @@ -62,7 +61,6 @@ const IndexPatternFlyoutContentContainer = ({
defaultTypeIsRollup={defaultTypeIsRollup}
requireTimestampField={requireTimestampField}
editData={editData}
showEmptyPrompt={showEmptyPrompt}
/>
);
};
Expand Down

This file was deleted.

Loading

0 comments on commit c8520f9

Please sign in to comment.