diff --git a/ui/src/shared/components/AddResourceDropdown.tsx b/ui/src/shared/components/AddResourceDropdown.tsx index 2807577b6d..af678e3b00 100644 --- a/ui/src/shared/components/AddResourceDropdown.tsx +++ b/ui/src/shared/components/AddResourceDropdown.tsx @@ -32,13 +32,14 @@ export default class AddResourceDropdown extends PureComponent { } private get optionItems(): JSX.Element[] { + const importOption = this.importOption + const newOption = this.newOption return [ - - {this.newOption} + + {newOption} + , + + {importOption} , ] } @@ -53,11 +54,12 @@ export default class AddResourceDropdown extends PureComponent { private handleSelect = (selection: string): void => { const {onSelectNew, onSelectImport} = this.props - switch (selection) { - case this.newOption: - onSelectNew() - case this.importOption: - onSelectImport() + + if (selection === this.newOption) { + onSelectNew() + } + if (selection === this.importOption) { + onSelectImport() } } } diff --git a/ui/src/shared/components/ImportOverlay.tsx b/ui/src/shared/components/ImportOverlay.tsx index 03adf022e1..22e083b89a 100644 --- a/ui/src/shared/components/ImportOverlay.tsx +++ b/ui/src/shared/components/ImportOverlay.tsx @@ -13,31 +13,22 @@ import { } from 'src/clockface' import {Button, ComponentColor} from '@influxdata/clockface' -// Constants -import {importSucceeded, importFailed} from 'src/shared/copy/notifications' - // Styles import 'src/shared/components/ImportOverlay.scss' // Types -import {Notification} from 'src/types/notifications' import TextArea from 'src/clockface/components/inputs/TextArea' enum ImportOption { Upload = 'upload', Paste = 'paste', - // Url = 'url', } interface Props { - isVisible: boolean onDismissOverlay: () => void resourceName: string - isResourceValid: (resource: any) => boolean - onImport: (resource: any) => void - notify: (message: Notification) => void - successNotification?: Notification - failureNotification?: Notification + onSubmit: (importString: string) => void + isVisible?: boolean } interface State { @@ -47,9 +38,9 @@ interface State { export default class ImportOverlay extends PureComponent { public static defaultProps: Partial = { - successNotification: importSucceeded(), - failureNotification: importFailed(), + isVisible: true, } + public state: State = { selectedImportOption: ImportOption.Upload, importContent: '', @@ -126,40 +117,19 @@ export default class ImportOverlay extends PureComponent { return (