Skip to content

Commit

Permalink
[ML] Data Visualizer: Remove import reference for users without impor…
Browse files Browse the repository at this point in the history
…t privileges (#135905)
  • Loading branch information
peteharverson authored Jul 7, 2022
1 parent 8e027bf commit d779e53
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ import { WelcomeContent } from './welcome_content';

interface Props {
onFilePickerChange(files: FileList | null): void;
hasPermissionToImport: boolean;
}

export const AboutPanel: FC<Props> = ({ onFilePickerChange }) => {
export const AboutPanel: FC<Props> = ({ onFilePickerChange, hasPermissionToImport }) => {
return (
<EuiPageBody
paddingSize="none"
Expand All @@ -39,7 +40,7 @@ export const AboutPanel: FC<Props> = ({ onFilePickerChange }) => {
<EuiPageContent hasShadow={false} hasBorder>
<EuiFlexGroup gutterSize="xl">
<EuiFlexItem grow={true}>
<WelcomeContent />
<WelcomeContent hasPermissionToImport={hasPermissionToImport} />

<EuiHorizontalRule margin="l" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiSpacer, EuiText, EuiTitle } from

import { useDataVisualizerKibana } from '../../../kibana_context';

export const WelcomeContent: FC = () => {
interface Props {
hasPermissionToImport: boolean;
}

export const WelcomeContent: FC<Props> = ({ hasPermissionToImport }) => {
const {
services: {
fileUpload: { getMaxBytesFormatted },
Expand All @@ -37,10 +41,17 @@ export const WelcomeContent: FC = () => {
<EuiSpacer size="s" />
<EuiText>
<p>
<FormattedMessage
id="xpack.dataVisualizer.file.welcomeContent.visualizeDataFromLogFileDescription"
defaultMessage="Upload your file, analyze its data, and optionally import the data into an Elasticsearch index."
/>
{hasPermissionToImport ? (
<FormattedMessage
id="xpack.dataVisualizer.file.welcomeContent.visualizeAndImportDataFromLogFileDescription"
defaultMessage="Upload your file, analyze its data, and optionally import the data into an Elasticsearch index."
/>
) : (
<FormattedMessage
id="xpack.dataVisualizer.file.welcomeContent.visualizeDataFromLogFileDescription"
defaultMessage="Upload your file and analyze its data."
/>
)}
</p>
</EuiText>
<EuiSpacer size="s" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,12 @@ export class FileDataVisualizerView extends Component {
<div>
{mode === MODE.READ && (
<>
{!loading && !loaded && <AboutPanel onFilePickerChange={this.onFilePickerChange} />}
{!loading && !loaded && (
<AboutPanel
onFilePickerChange={this.onFilePickerChange}
hasPermissionToImport={hasPermissionToImport}
/>
)}

{loading && <LoadingPanel />}

Expand Down

0 comments on commit d779e53

Please sign in to comment.