Skip to content

Commit

Permalink
remove dupe code
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkime committed Aug 4, 2021
1 parent 5be1a92 commit f77447d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export interface Props {
* Handler for the "cancel" footer button
*/
onCancel: () => void;
existingIndexPatterns: string[];
defaultTypeIsRollup?: boolean;
requireTimestampField?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import React, { useEffect, useState } from 'react';
import React from 'react';
import { i18n } from '@kbn/i18n';

import { IndexPattern, IndexPatternSpec, useKibana } from '../shared_imports';
Expand Down Expand Up @@ -53,27 +53,10 @@ export const IndexPatternFlyoutContentContainer = ({
await onSave(indexPattern);
};

const [existingIndexPatterns, setExistingIndexPatterns] = useState<string[]>([]);

useEffect(() => {
let isMounted = true;
const getTitles = async () => {
const indexPatternTitles = await indexPatternService.getTitles();
if (isMounted) {
setExistingIndexPatterns(indexPatternTitles);
}
};
getTitles();
return () => {
isMounted = false;
};
}, [indexPatternService]);

return (
<IndexPatternEditorFlyoutContent
onSave={onSaveClick}
onCancel={onCancel}
existingIndexPatterns={existingIndexPatterns}
defaultTypeIsRollup={defaultTypeIsRollup}
requireTimestampField={requireTimestampField}
/>
Expand Down

0 comments on commit f77447d

Please sign in to comment.