Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
maryia-lapata committed Feb 3, 2020
1 parent 255b505 commit 0d6f078
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { i18n } from '@kbn/i18n';
import { SavedObjectMetaData } from 'src/plugins/saved_objects/public';
import { SavedObjectMetaData } from '../../../saved_objects/public';
import { SavedObjectAttributes } from '../../../../core/public';
import {
ContainerOutput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { SavedObjectAttributes } from 'src/core/public';
import { SavedObjectMetaData } from 'src/plugins/saved_objects/public';
import { SavedObjectMetaData } from '../../../../saved_objects/public';
import { EmbeddableInput, EmbeddableOutput, IEmbeddable } from './i_embeddable';
import { ErrorEmbeddable } from './error_embeddable';
import { IContainer } from '../containers/i_container';
Expand Down
1 change: 1 addition & 0 deletions src/plugins/saved_objects/public/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import './save_modal';
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import React from 'react';
import ReactDOM from 'react-dom';

import { I18nStart } from 'src/core/public';
import { I18nStart } from '../../../../core/public';

/**
* Represents the result of trying to persist the saved object.
Expand Down
22 changes: 5 additions & 17 deletions src/plugins/saved_objects/public/saved_object_finder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ import PropTypes from 'prop-types';
import React from 'react';

import {
CommonProps,
EuiContextMenuItem,
EuiContextMenuPanel,
EuiContextMenuPanelProps,
EuiEmptyPrompt,
EuiFieldSearch,
EuiFilterButton,
Expand All @@ -50,17 +48,7 @@ import {
CoreStart,
IUiSettingsClient,
SavedObjectsStart,
} from 'src/core/public';

// TODO the typings for EuiListGroup are incorrect - maxWidth is missing. This can be removed when the types are adjusted
const FixedEuiListGroup = (EuiListGroup as any) as React.FunctionComponent<
CommonProps & { maxWidth: boolean }
>;

// TODO the typings for EuiContextMenuPanel are incorrect - watchedItemProps is missing. This can be removed when the types are adjusted
const FixedEuiContextMenuPanel = (EuiContextMenuPanel as any) as React.FunctionComponent<
EuiContextMenuPanelProps & { watchedItemProps: string[] }
>;
} from '../../../core/public';

export interface SavedObjectMetaData<T extends SavedObjectAttributes> {
type: string;
Expand Down Expand Up @@ -393,7 +381,7 @@ class SavedObjectFinderUi extends React.Component<
</EuiFilterButton>
}
>
<FixedEuiContextMenuPanel
<EuiContextMenuPanel
watchedItemProps={['icon', 'disabled']}
items={this.getSortOptions()}
/>
Expand Down Expand Up @@ -425,7 +413,7 @@ class SavedObjectFinderUi extends React.Component<
</EuiFilterButton>
}
>
<FixedEuiContextMenuPanel
<EuiContextMenuPanel
watchedItemProps={['icon', 'disabled']}
items={this.props.savedObjectMetaData.map(metaData => (
<EuiContextMenuItem
Expand Down Expand Up @@ -469,7 +457,7 @@ class SavedObjectFinderUi extends React.Component<
</EuiFlexGroup>
)}
{items.length > 0 ? (
<FixedEuiListGroup data-test-subj="savedObjectFinderItemList" maxWidth={false}>
<EuiListGroup data-test-subj="savedObjectFinderItemList" maxWidth={false}>
{items.map(item => {
const currentSavedObjectMetaData = savedObjectMetaData.find(
metaData => metaData.type === item.type
Expand Down Expand Up @@ -500,7 +488,7 @@ class SavedObjectFinderUi extends React.Component<
/>
);
})}
</FixedEuiListGroup>
</EuiListGroup>
) : (
!this.state.isFetchingItems && <EuiEmptyPrompt body={this.props.noItemsMessage} />
)}
Expand Down

0 comments on commit 0d6f078

Please sign in to comment.