Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add button link to ingest #70142

Merged
merged 23 commits into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ddc3f39
add button link to ingest
parkiino Jun 26, 2020
1c078cf
link does not do full refresh
parkiino Jun 29, 2020
604316a
use queryparam initially, navigate to correct url
parkiino Jun 30, 2020
460c5f8
hook to check ingest enabled
parkiino Jul 1, 2020
36b934f
Merge remote-tracking branch 'upstream/master' into task/onboarding-s…
parkiino Jul 1, 2020
71c9aac
Merge remote-tracking branch 'upstream/master' into task/onboarding-s…
parkiino Jul 1, 2020
2113b99
tests
parkiino Jul 1, 2020
415ae91
checks if metadata index is present
parkiino Jul 1, 2020
ac75c49
modify ingest url hook naming
parkiino Jul 1, 2020
55261bc
modify hook to be more robust
parkiino Jul 2, 2020
504f82b
Merge remote-tracking branch 'upstream/master' into task/onboarding-s…
parkiino Jul 2, 2020
b79f6d7
add beta to button
parkiino Jul 2, 2020
1844e6b
Merge remote-tracking branch 'upstream/master' into task/onboarding-s…
parkiino Jul 2, 2020
7c932c6
remove tertiary action, make secondary action
parkiino Jul 2, 2020
a65f1a5
comments
parkiino Jul 2, 2020
a443859
make network, hosts, alerts/detection use overview empty
parkiino Jul 2, 2020
295225e
Merge remote-tracking branch 'upstream/master' into task/onboarding-s…
parkiino Jul 2, 2020
e119a76
type check
parkiino Jul 2, 2020
613f90e
fix tests
parkiino Jul 6, 2020
e655571
Merge remote-tracking branch 'upstream/master' into task/onboarding-s…
parkiino Jul 6, 2020
a30978c
i18n
parkiino Jul 6, 2020
50307f8
text changes
parkiino Jul 6, 2020
7609a82
Merge branch 'master' into task/onboarding-splash
elasticmachine Jul 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React, { useState } from 'react';
import { useRouteMatch, Switch, Route } from 'react-router-dom';
import { useRouteMatch, Switch, Route, useLocation, useHistory } from 'react-router-dom';
import { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab';
import { i18n } from '@kbn/i18n';
import { PAGE_ROUTING_PATHS } from '../../../../constants';
Expand Down Expand Up @@ -114,7 +114,10 @@ function InstalledPackages() {

function AvailablePackages() {
useBreadcrumbs('integrations_all');
const [selectedCategory, setSelectedCategory] = useState('');
const history = useHistory();
const queryParams = new URLSearchParams(useLocation().search);
const initialCategory = queryParams.get('category') || '';
const [selectedCategory, setSelectedCategory] = useState(initialCategory);
const { data: categoryPackagesRes, isLoading: isLoadingPackages } = useGetPackages({
category: selectedCategory,
});
Expand All @@ -141,7 +144,13 @@ function AvailablePackages() {
isLoading={isLoadingCategories}
categories={categories}
selectedCategory={selectedCategory}
onCategoryChange={({ id }: CategorySummaryItem) => setSelectedCategory(id)}
onCategoryChange={({ id }: CategorySummaryItem) => {
// clear category query param in the url
if (queryParams.get('category')) {
history.push({});
}
setSelectedCategory(id);
}}
/>
) : null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { NoWriteAlertsCallOut } from '../../components/no_write_alerts_callout';
import { AlertsHistogramPanel } from '../../components/alerts_histogram_panel';
import { alertsHistogramOptions } from '../../components/alerts_histogram_panel/config';
import { useUserInfo } from '../../components/user_info';
import { DetectionEngineEmptyPage } from './detection_engine_empty_page';
import { OverviewEmpty } from '../../../overview/components/overview_empty';
import { DetectionEngineNoIndex } from './detection_engine_no_signal_index';
import { DetectionEngineHeaderPage } from '../../components/detection_engine_header_page';
import { DetectionEngineUserUnauthenticated } from './detection_engine_user_unauthenticated';
Expand Down Expand Up @@ -159,7 +159,7 @@ export const DetectionEnginePageComponent: React.FC<PropsFromRedux> = ({
) : (
<WrapperPage>
<DetectionEngineHeaderPage border title={i18n.PAGE_TITLE} />
<DetectionEngineEmptyPage />
<OverviewEmpty />
</WrapperPage>
)}
<SpyRoute pageName={SecurityPageName.alerts} />
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { DetectionEngineHeaderPage } from '../../../../components/detection_engi
import { AlertsHistogramPanel } from '../../../../components/alerts_histogram_panel';
import { AlertsTable } from '../../../../components/alerts_table';
import { useUserInfo } from '../../../../components/user_info';
import { DetectionEngineEmptyPage } from '../../detection_engine_empty_page';
import { OverviewEmpty } from '../../../../../overview/components/overview_empty';
import { useAlertInfo } from '../../../../components/alerts_info';
import { StepDefineRule } from '../../../../components/rules/step_define_rule';
import { StepScheduleRule } from '../../../../components/rules/step_schedule_rule';
Expand Down Expand Up @@ -426,7 +426,7 @@ export const RuleDetailsPageComponent: FC<PropsFromRedux> = ({
<WrapperPage>
<DetectionEngineHeaderPage border title={i18n.PAGE_TITLE} />

<DetectionEngineEmptyPage />
<OverviewEmpty />
</WrapperPage>
)}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { EuiButton, EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem, IconType } from '@elastic/eui';
import React from 'react';
import React, { MouseEventHandler, ReactNode } from 'react';
import styled from 'styled-components';

const EmptyPrompt = styled(EuiEmptyPrompt)`
Expand All @@ -19,12 +19,14 @@ interface EmptyPageProps {
actionPrimaryLabel: string;
actionPrimaryTarget?: string;
actionPrimaryUrl: string;
actionPrimaryFill?: boolean;
actionSecondaryIcon?: IconType;
actionSecondaryLabel?: string;
actionSecondaryTarget?: string;
actionSecondaryUrl?: string;
actionSecondaryOnClick?: MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;
'data-test-subj'?: string;
message?: string;
message?: ReactNode;
title: string;
}

Expand All @@ -34,23 +36,25 @@ export const EmptyPage = React.memo<EmptyPageProps>(
actionPrimaryLabel,
actionPrimaryTarget,
actionPrimaryUrl,
actionPrimaryFill = true,
actionSecondaryIcon,
actionSecondaryLabel,
actionSecondaryTarget,
actionSecondaryUrl,
actionSecondaryOnClick,
message,
title,
...rest
}) => (
<EmptyPrompt
iconType="securityAnalyticsApp"
iconType="logoSecurity"
title={<h2>{title}</h2>}
body={message && <p>{message}</p>}
actions={
<EuiFlexGroup justifyContent="center">
<EuiFlexItem grow={false}>
<EuiButton
fill
fill={actionPrimaryFill}
href={actionPrimaryUrl}
iconType={actionPrimaryIcon}
target={actionPrimaryTarget}
Expand All @@ -61,10 +65,13 @@ export const EmptyPage = React.memo<EmptyPageProps>(

{actionSecondaryLabel && actionSecondaryUrl && (
<EuiFlexItem grow={false}>
{/* eslint-disable-next-line @elastic/eui/href-or-on-click */}
<EuiButton
href={actionSecondaryUrl}
onClick={actionSecondaryOnClick}
iconType={actionSecondaryIcon}
target={actionSecondaryTarget}
data-test-subj="empty-page-secondary-action"
>
{actionSecondaryLabel}
</EuiButton>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { useKibana } from '../../../../../../../src/plugins/kibana_react/public';

/**
* Returns an object which ingest permissions are allowed
*/
export const useIngestEnabledCheck = (): {
allEnabled: boolean;
show: boolean;
write: boolean;
read: boolean;
} => {
const { services } = useKibana();

// Check if Ingest Manager is present in the configuration
const show = services.application.capabilities.ingestManager?.show ?? false;
const write = services.application.capabilities.ingestManager?.write ?? false;
const read = services.application.capabilities.ingestManager?.read ?? false;

// Check if all Ingest Manager permissions are enabled
const allEnabled = show && read && write ? true : false;

return {
allEnabled,
show,
write,
read,
};
};
14 changes: 8 additions & 6 deletions x-pack/plugins/security_solution/public/common/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ export const EMPTY_TITLE = i18n.translate('xpack.securitySolution.pages.common.e
defaultMessage: 'Welcome to Security Solution. Let’s get you started.',
});

export const EMPTY_MESSAGE = i18n.translate('xpack.securitySolution.pages.common.emptyMessage', {
defaultMessage:
'To begin using security information and event management (Security Solution), you’ll need to add security solution related data, in Elastic Common Schema (ECS) format, to the Elastic Stack. An easy way to get started is by installing and configuring our data shippers, called Beats. Let’s do that now!',
});

export const EMPTY_ACTION_PRIMARY = i18n.translate(
'xpack.securitySolution.pages.common.emptyActionPrimary',
{
Expand All @@ -25,6 +20,13 @@ export const EMPTY_ACTION_PRIMARY = i18n.translate(
export const EMPTY_ACTION_SECONDARY = i18n.translate(
'xpack.securitySolution.pages.common.emptyActionSecondary',
{
defaultMessage: 'View getting started guide',
defaultMessage: 'getting started guide.',
}
);

export const EMPTY_ACTION_ENDPOINT = i18n.translate(
'xpack.securitySolution.pages.common.emptyActionEndpoint',
{
defaultMessage: 'Add data with Elastic Agent (Beta)',
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { setAbsoluteRangeDatePicker as dispatchAbsoluteRangeDatePicker } from '.
import { SpyRoute } from '../../../common/utils/route/spy_routes';
import { esQuery, Filter } from '../../../../../../../src/plugins/data/public';

import { HostsEmptyPage } from '../hosts_empty_page';
import { OverviewEmpty } from '../../../overview/components/overview_empty';
import { HostDetailsTabs } from './details_tabs';
import { navTabsHostDetails } from './nav_tabs';
import { HostDetailsProps } from './types';
Expand Down Expand Up @@ -194,7 +194,7 @@ const HostDetailsComponent = React.memo<HostDetailsProps & PropsFromRedux>(
<WrapperPage>
<HeaderPage border title={detailName} />

<HostsEmptyPage />
<OverviewEmpty />
</WrapperPage>
)}

Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/security_solution/public/hosts/pages/hosts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { setAbsoluteRangeDatePicker as dispatchSetAbsoluteRangeDatePicker } from
import { SpyRoute } from '../../common/utils/route/spy_routes';
import { esQuery } from '../../../../../../src/plugins/data/public';
import { useMlCapabilities } from '../../common/components/ml_popover/hooks/use_ml_capabilities';
import { HostsEmptyPage } from './hosts_empty_page';
import { OverviewEmpty } from '../../overview/components/overview_empty';
import { HostsTabs } from './hosts_tabs';
import { navTabsHosts } from './nav_tabs';
import * as i18n from './translations';
Expand Down Expand Up @@ -141,7 +141,7 @@ export const HostsComponent = React.memo<HostsComponentProps & PropsFromRedux>(
<WrapperPage>
<HeaderPage border title={i18n.PAGE_TITLE} />

<HostsEmptyPage />
<OverviewEmpty />
</WrapperPage>
)}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ export function useHostSelector<TSelected>(selector: (state: HostState) => TSele
/**
* Returns an object that contains Ingest app and URL information
*/
export const useHostIngestUrl = (): { url: string; appId: string; appPath: string } => {
export const useIngestUrl = (subpath: string): { url: string; appId: string; appPath: string } => {
const { services } = useKibana();
return useMemo(() => {
const appPath = `#/fleet`;
const appPath = `#/${subpath}`;
return {
url: `${services.application.getUrlForApp('ingestManager')}${appPath}`,
appId: 'ingestManager',
appPath,
};
}, [services.application]);
}, [services.application, subpath]);
};

/**
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { State, inputsSelectors } from '../../../common/store';
import { setAbsoluteRangeDatePicker as dispatchAbsoluteRangeDatePicker } from '../../../common/store/inputs/actions';
import { setIpDetailsTablesActivePageToZero as dispatchIpDetailsTablesActivePageToZero } from '../../store/actions';
import { SpyRoute } from '../../../common/utils/route/spy_routes';
import { NetworkEmptyPage } from '../network_empty_page';
import { OverviewEmpty } from '../../../overview/components/overview_empty';
import { NetworkHttpQueryTable } from './network_http_query_table';
import { NetworkTopCountriesQueryTable } from './network_top_countries_query_table';
import { NetworkTopNFlowQueryTable } from './network_top_n_flow_query_table';
Expand Down Expand Up @@ -264,7 +264,7 @@ export const IPDetailsComponent: React.FC<IPDetailsComponentProps & PropsFromRed
<WrapperPage>
<HeaderPage border title={ip} />

<NetworkEmptyPage />
<OverviewEmpty />
</WrapperPage>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { SpyRoute } from '../../common/utils/route/spy_routes';
import { networkModel } from '../store';
import { navTabsNetwork, NetworkRoutes, NetworkRoutesLoading } from './navigation';
import { filterNetworkData } from './navigation/alerts_query_tab_body';
import { NetworkEmptyPage } from './network_empty_page';
import { OverviewEmpty } from '../../overview/components/overview_empty';
import * as i18n from './translations';
import { NetworkComponentProps } from './types';
import { NetworkRouteType } from './navigation/types';
Expand Down Expand Up @@ -164,7 +164,7 @@ const NetworkComponent = React.memo<NetworkComponentProps & PropsFromRedux>(
) : (
<WrapperPage>
<HeaderPage border title={i18n.PAGE_TITLE} />
<NetworkEmptyPage />
<OverviewEmpty />
</WrapperPage>
)}

Expand Down
Loading