Skip to content

Commit

Permalink
Fix typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipb committed Jun 26, 2020
1 parent 7a42a0b commit 0cf9199
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ interface Props<ViewState> {
viewState: ViewState;
}

export function SavedViewsToolbarControls<ViewState extends { id: string; name: string }>(
props: Props<ViewState>
) {
export function SavedViewsToolbarControls<ViewState>(props: Props<ViewState>) {
const kibana = useKibana();
const {
views,
Expand All @@ -56,6 +54,9 @@ export function SavedViewsToolbarControls<ViewState extends { id: string; name:
const [isSavedViewMenuOpen, setIsSavedViewMenuOpen] = useState(false);
const [createModalOpen, setCreateModalOpen] = useState(false);
const [updateModalOpen, setUpdateModalOpen] = useState(false);
const hideSavedViewMenu = useCallback(() => {
setIsSavedViewMenuOpen(false);
}, [setIsSavedViewMenuOpen]);
const openViewListModal = useCallback(() => {
hideSavedViewMenu();
find();
Expand Down Expand Up @@ -85,16 +86,13 @@ export function SavedViewsToolbarControls<ViewState extends { id: string; name:
const showSavedViewMenu = useCallback(() => {
setIsSavedViewMenuOpen(true);
}, [setIsSavedViewMenuOpen]);
const hideSavedViewMenu = useCallback(() => {
setIsSavedViewMenuOpen(false);
}, [setIsSavedViewMenuOpen]);
const save = useCallback(
(name: string, hasTime: boolean = false) => {
const currentState = {
...props.viewState,
...(!hasTime ? { time: undefined } : {}),
};
saveView({ name, ...currentState });
saveView({ ...currentState, name });
},
[props.viewState, saveView]
);
Expand All @@ -105,7 +103,7 @@ export function SavedViewsToolbarControls<ViewState extends { id: string; name:
...props.viewState,
...(!hasTime ? { time: undefined } : {}),
};
updateView(currentView.id, { name, ...currentState });
updateView(currentView.id, { ...currentState, name });
},
[props.viewState, updateView, currentView]
);
Expand Down Expand Up @@ -236,7 +234,7 @@ export function SavedViewsToolbarControls<ViewState extends { id: string; name:
)}

{viewListModalOpen && (
<SavedViewListModal<ViewState>
<SavedViewListModal<any>
currentView={currentView}
views={views}
close={closeViewListModal}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import { EuiButton, EuiErrorBoundary, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { useContext } from 'react';
import { Location } from 'history';

import { FilterBar } from './components/filter_bar';

Expand Down

0 comments on commit 0cf9199

Please sign in to comment.