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

[SECURITY SOLUTION] Rename to hosts and administration #70913

Merged
merged 10 commits into from
Jul 8, 2020
2 changes: 1 addition & 1 deletion x-pack/plugins/security_solution/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const APP_HOSTS_PATH = `${APP_PATH}/hosts`;
export const APP_NETWORK_PATH = `${APP_PATH}/network`;
export const APP_TIMELINES_PATH = `${APP_PATH}/timelines`;
export const APP_CASES_PATH = `${APP_PATH}/cases`;
export const APP_MANAGEMENT_PATH = `${APP_PATH}/management`;
export const APP_MANAGEMENT_PATH = `${APP_PATH}/administration`;

/** The comma-delimited list of Elasticsearch indices from which the SIEM app collects events */
export const DEFAULT_INDEX_PATTERN = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
CASES_URL,
HOSTS_URL,
KIBANA_HOME,
MANAGEMENT_URL,
ADMINISTRATION_URL,
NETWORK_URL,
OVERVIEW_URL,
TIMELINES_URL,
Expand All @@ -31,7 +31,7 @@ import {
ALERTS_PAGE,
CASES_PAGE,
HOSTS_PAGE,
MANAGEMENT_PAGE,
ADMINISTRATION_PAGE,
NETWORK_PAGE,
OVERVIEW_PAGE,
TIMELINES_PAGE,
Expand Down Expand Up @@ -72,9 +72,9 @@ describe('top-level navigation common to all pages in the Security app', () => {
cy.url().should('include', CASES_URL);
});

it('navigates to the Management page', () => {
it('navigates to the Administration page', () => {
navigateFromHeaderTo(MANAGEMENT);
cy.url().should('include', MANAGEMENT_URL);
cy.url().should('include', ADMINISTRATION_URL);
});
});

Expand Down Expand Up @@ -115,8 +115,8 @@ describe('Kibana navigation to all pages in the Security app ', () => {
cy.url().should('include', CASES_URL);
});

it('navigates to the Management page', () => {
navigateFromKibanaCollapsibleTo(MANAGEMENT_PAGE);
cy.url().should('include', MANAGEMENT_URL);
it('navigates to the Administration page', () => {
navigateFromKibanaCollapsibleTo(ADMINISTRATION_PAGE);
cy.url().should('include', ADMINISTRATION_URL);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export const HOSTS_PAGE = '[data-test-subj="collapsibleNavGroup-security"] [titl

export const KIBANA_NAVIGATION_TOGGLE = '[data-test-subj="toggleNavButton"]';

export const MANAGEMENT_PAGE =
'[data-test-subj="collapsibleNavGroup-security"] [title="Management"]';
export const ADMINISTRATION_PAGE =
'[data-test-subj="collapsibleNavGroup-security"] [title="Administration"]';

export const NETWORK_PAGE = '[data-test-subj="collapsibleNavGroup-security"] [title="Network"]';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const HOSTS_PAGE_TAB_URLS = {
uncommonProcesses: '/app/security/hosts/uncommonProcesses',
};
export const KIBANA_HOME = '/app/home#/';
export const MANAGEMENT_URL = '/app/security/management';
export const ADMINISTRATION_URL = '/app/security/administration';
export const NETWORK_URL = '/app/security/network';
export const OVERVIEW_URL = '/app/security/overview';
export const TIMELINES_URL = '/app/security/timelines';
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const navTabs: SiemNavTab = {
},
[SecurityPageName.alerts]: {
id: SecurityPageName.alerts,
name: i18n.Alerts,
name: i18n.ALERTS,
href: APP_ALERTS_PATH,
disabled: false,
urlKey: 'alerts',
Expand Down Expand Up @@ -63,7 +63,7 @@ export const navTabs: SiemNavTab = {
},
[SecurityPageName.management]: {
id: SecurityPageName.management,
name: i18n.MANAGEMENT,
name: i18n.ADMINISTRATION,
href: APP_MANAGEMENT_PATH,
disabled: false,
urlKey: SecurityPageName.management,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const DETECTION_ENGINE = i18n.translate(
}
);

export const Alerts = i18n.translate('xpack.securitySolution.navigation.alerts', {
export const ALERTS = i18n.translate('xpack.securitySolution.navigation.alerts', {
defaultMessage: 'Alerts',
});

Expand All @@ -37,6 +37,6 @@ export const CASE = i18n.translate('xpack.securitySolution.navigation.case', {
defaultMessage: 'Cases',
});

export const MANAGEMENT = i18n.translate('xpack.securitySolution.navigation.management', {
defaultMessage: 'Management',
export const ADMINISTRATION = i18n.translate('xpack.securitySolution.navigation.administration', {
defaultMessage: 'Administration',
});
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ describe('SIEM Navigation', () => {
},
management: {
disabled: false,
href: '/app/security/management',
href: '/app/security/administration',
id: 'management',
name: 'Management',
name: 'Administration',
urlKey: 'management',
},
hosts: {
Expand Down Expand Up @@ -220,9 +220,9 @@ describe('SIEM Navigation', () => {
},
management: {
disabled: false,
href: '/app/security/management',
href: '/app/security/administration',
id: 'management',
name: 'Management',
name: 'Administration',
urlKey: 'management',
},
network: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { SecurityPageName } from '../../app/types';
// --[ ROUTING ]---------------------------------------------------------------------------
export const MANAGEMENT_APP_ID = `${APP_ID}:${SecurityPageName.management}`;
export const MANAGEMENT_ROUTING_ROOT_PATH = '';
export const MANAGEMENT_ROUTING_ENDPOINTS_PATH = `${MANAGEMENT_ROUTING_ROOT_PATH}/:tabName(${ManagementSubTab.endpoints})`;
export const MANAGEMENT_ROUTING_HOSTS_PATH = `${MANAGEMENT_ROUTING_ROOT_PATH}/:tabName(${ManagementSubTab.hosts})`;
export const MANAGEMENT_ROUTING_POLICIES_PATH = `${MANAGEMENT_ROUTING_ROOT_PATH}/:tabName(${ManagementSubTab.policies})`;
export const MANAGEMENT_ROUTING_POLICY_DETAILS_PATH = `${MANAGEMENT_ROUTING_ROOT_PATH}/:tabName(${ManagementSubTab.policies})/:policyId`;

Expand All @@ -21,5 +21,5 @@ export const MANAGEMENT_STORE_GLOBAL_NAMESPACE: ManagementStoreGlobalNamespace =
export const MANAGEMENT_STORE_POLICY_LIST_NAMESPACE = 'policyList';
/** Namespace within the Management state where policy details state is maintained */
export const MANAGEMENT_STORE_POLICY_DETAILS_NAMESPACE = 'policyDetails';
/** Namespace within the Management state where endpoints state is maintained */
export const MANAGEMENT_STORE_ENDPOINTS_NAMESPACE = 'endpoints';
/** Namespace within the Management state where hosts state is maintained */
export const MANAGEMENT_STORE_HOSTS_NAMESPACE = 'hosts';
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { generatePath } from 'react-router-dom';
import querystring from 'querystring';

import {
MANAGEMENT_ROUTING_ENDPOINTS_PATH,
MANAGEMENT_ROUTING_HOSTS_PATH,
MANAGEMENT_ROUTING_POLICIES_PATH,
MANAGEMENT_ROUTING_POLICY_DETAILS_PATH,
} from './constants';
Expand All @@ -32,11 +32,11 @@ const querystringStringify: <ExpectedType extends object, ArgType>(
) => string = querystring.stringify;

/** Make `selected_host` required */
type EndpointDetailsUrlProps = Omit<HostIndexUIQueryParams, 'selected_host'> &
type HostDetailsUrlProps = Omit<HostIndexUIQueryParams, 'selected_host'> &
Required<Pick<HostIndexUIQueryParams, 'selected_host'>>;

export const getEndpointListPath = (
props: { name: 'default' | 'endpointList' } & HostIndexUIQueryParams,
export const getHostListPath = (
props: { name: 'default' | 'hostList' } & HostIndexUIQueryParams,
search?: string
) => {
const { name, ...queryParams } = props;
Expand All @@ -45,29 +45,27 @@ export const getEndpointListPath = (
);
const urlSearch = `${urlQueryParams && !isEmpty(search) ? '&' : ''}${search ?? ''}`;

if (name === 'endpointList') {
return `${generatePath(MANAGEMENT_ROUTING_ENDPOINTS_PATH, {
tabName: ManagementSubTab.endpoints,
if (name === 'hostList') {
return `${generatePath(MANAGEMENT_ROUTING_HOSTS_PATH, {
tabName: ManagementSubTab.hosts,
})}${appendSearch(`${urlQueryParams ? `${urlQueryParams}${urlSearch}` : urlSearch}`)}`;
}
return `${appendSearch(`${urlQueryParams ? `${urlQueryParams}${urlSearch}` : urlSearch}`)}`;
};

export const getEndpointDetailsPath = (
props: { name: 'endpointDetails' | 'endpointPolicyResponse' } & EndpointDetailsUrlProps,
export const getHostDetailsPath = (
props: { name: 'hostDetails' | 'hostPolicyResponse' } & HostDetailsUrlProps,
search?: string
) => {
const { name, ...queryParams } = props;
queryParams.show = (props.name === 'endpointPolicyResponse'
queryParams.show = (props.name === 'hostPolicyResponse'
? 'policy_response'
: '') as HostIndexUIQueryParams['show'];
const urlQueryParams = querystringStringify<EndpointDetailsUrlProps, typeof queryParams>(
queryParams
);
const urlQueryParams = querystringStringify<HostDetailsUrlProps, typeof queryParams>(queryParams);
const urlSearch = `${urlQueryParams && !isEmpty(search) ? '&' : ''}${search ?? ''}`;

return `${generatePath(MANAGEMENT_ROUTING_ENDPOINTS_PATH, {
tabName: ManagementSubTab.endpoints,
return `${generatePath(MANAGEMENT_ROUTING_HOSTS_PATH, {
tabName: ManagementSubTab.hosts,
})}${appendSearch(`${urlQueryParams ? `${urlQueryParams}${urlSearch}` : urlSearch}`)}`;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const PolicyEmptyState = React.memo<{
);
});

const EndpointsEmptyState = React.memo<{
const HostsEmptyState = React.memo<{
loading: boolean;
onActionClick: (event: MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void;
actionDisabled: boolean;
Expand All @@ -113,14 +113,14 @@ const EndpointsEmptyState = React.memo<{
const policySteps = useMemo(
() => [
{
title: i18n.translate('xpack.securitySolution.endpoint.endpointList.stepOneTitle', {
title: i18n.translate('xpack.securitySolution.endpoint.hostList.stepOneTitle', {
defaultMessage: 'Select a policy you created from the list below.',
}),
children: (
<>
<EuiText color="subdued" size="xs">
<FormattedMessage
id="xpack.securitySolution.endpoint.endpointList.stepOne"
id="xpack.securitySolution.endpoint.hostList.stepOne"
defaultMessage="These are existing policies."
/>
</EuiText>
Expand All @@ -138,15 +138,15 @@ const EndpointsEmptyState = React.memo<{
return loading ? (
<EuiSelectableMessage>
<FormattedMessage
id="xpack.securitySolution.endpoint.endpointList.loadingPolicies"
id="xpack.securitySolution.endpoint.hostList.loadingPolicies"
defaultMessage="Loading policy configs"
/>
</EuiSelectableMessage>
) : selectionOptions.length ? (
list
) : (
<FormattedMessage
id="xpack.securitySolution.endpoint.endpointList.noPolicies"
id="xpack.securitySolution.endpoint.hostList.noPolicies"
defaultMessage="There are no policies."
/>
);
Expand All @@ -156,14 +156,14 @@ const EndpointsEmptyState = React.memo<{
),
},
{
title: i18n.translate('xpack.securitySolution.endpoint.endpointList.stepTwoTitle', {
title: i18n.translate('xpack.securitySolution.endpoint.hostList.stepTwoTitle', {
defaultMessage:
'Head over to Ingest to deploy your Agent with Endpoint Security enabled.',
}),
children: (
<EuiText color="subdued" size="xs">
<FormattedMessage
id="xpack.securitySolution.endpoint.endpointList.stepTwo"
id="xpack.securitySolution.endpoint.hostList.stepTwo"
defaultMessage="You'll be given a command in Ingest to get you started."
/>
</EuiText>
Expand All @@ -178,18 +178,18 @@ const EndpointsEmptyState = React.memo<{
loading={loading}
onActionClick={onActionClick}
actionDisabled={actionDisabled}
dataTestSubj="emptyEndpointsTable"
dataTestSubj="emptyHostsTable"
steps={policySteps}
headerComponent={
<FormattedMessage
id="xpack.securitySolution.endpoint.endpointList.noEndpointsPrompt"
defaultMessage="You have a policy, but no Endpoints are deployed!"
id="xpack.securitySolution.endpoint.hostList.noHostsPrompt"
defaultMessage="You have a policy, but no hosts are deployed!"
/>
}
bodyComponent={
<FormattedMessage
id="xpack.securitySolution.endpoint.endpointList.noEndpointsInstructions"
defaultMessage="Elastic Endpoint Security gives you the power to keep your endpoints safe from attack, as well as unparalleled visibility into any threat in your environment."
id="xpack.securitySolution.endpoint.hostList.noHostsInstructions"
defaultMessage="Elastic Endpoint Security gives you the power to keep your hosts safe from attack, as well as unparalleled visibility into any threat in your environment."
/>
}
/>
Expand Down Expand Up @@ -271,7 +271,7 @@ const ManagementEmptyState = React.memo<{
);

PolicyEmptyState.displayName = 'PolicyEmptyState';
EndpointsEmptyState.displayName = 'EndpointsEmptyState';
HostsEmptyState.displayName = 'HostsEmptyState';
ManagementEmptyState.displayName = 'ManagementEmptyState';

export { PolicyEmptyState, EndpointsEmptyState, ManagementEmptyState };
export { PolicyEmptyState, HostsEmptyState, ManagementEmptyState };
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import { PageView, PageViewProps } from '../../common/components/endpoint/page_v
import { ManagementSubTab } from '../types';
import { SecurityPageName } from '../../app/types';
import { useFormatUrl } from '../../common/components/link_to';
import { getEndpointListPath, getPoliciesPath } from '../common/routing';
import { getHostListPath, getPoliciesPath } from '../common/routing';
import { useNavigateByRouterEventHandler } from '../../common/hooks/endpoint/use_navigate_by_router_event_handler';

export const ManagementPageView = memo<Omit<PageViewProps, 'tabs'>>((options) => {
const { formatUrl, search } = useFormatUrl(SecurityPageName.management);
const { tabName } = useParams<{ tabName: ManagementSubTab }>();

const goToEndpoint = useNavigateByRouterEventHandler(
getEndpointListPath({ name: 'endpointList' }, search)
getHostListPath({ name: 'hostList' }, search)
);

const goToPolicies = useNavigateByRouterEventHandler(getPoliciesPath(search));
Expand All @@ -31,11 +31,11 @@ export const ManagementPageView = memo<Omit<PageViewProps, 'tabs'>>((options) =>
return [
{
name: i18n.translate('xpack.securitySolution.managementTabs.endpoints', {
defaultMessage: 'Endpoints',
defaultMessage: 'Hosts',
}),
id: ManagementSubTab.endpoints,
isSelected: tabName === ManagementSubTab.endpoints,
href: formatUrl(getEndpointListPath({ name: 'endpointList' })),
id: ManagementSubTab.hosts,
isSelected: tabName === ManagementSubTab.hosts,
href: formatUrl(getHostListPath({ name: 'hostList' })),
onClick: goToEndpoint,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
import { Switch, Route } from 'react-router-dom';
import React, { memo } from 'react';
import { HostList } from './view';
import { MANAGEMENT_ROUTING_ENDPOINTS_PATH } from '../../common/constants';
import { MANAGEMENT_ROUTING_HOSTS_PATH } from '../../common/constants';
import { NotFoundPage } from '../../../app/404';

/**
* Provides the routing container for the endpoints related views
* Provides the routing container for the hosts related views
*/
export const EndpointsContainer = memo(() => {
export const HostsContainer = memo(() => {
return (
<Switch>
<Route path={MANAGEMENT_ROUTING_ENDPOINTS_PATH} exact component={HostList} />
<Route path={MANAGEMENT_ROUTING_HOSTS_PATH} exact component={HostList} />
<Route path="*" component={NotFoundPage} />
</Switch>
);
});

EndpointsContainer.displayName = 'EndpointsContainer';
HostsContainer.displayName = 'HostsContainer';
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
MiddlewareActionSpyHelper,
createSpyMiddleware,
} from '../../../../common/store/test_utils';
import { getEndpointListPath } from '../../../common/routing';
import { getHostListPath } from '../../../common/routing';

describe('host list pagination: ', () => {
let fakeCoreStart: jest.Mocked<CoreStart>;
Expand Down Expand Up @@ -56,7 +56,7 @@ describe('host list pagination: ', () => {
queryParams = () => uiQueryParams(store.getState());

historyPush = (nextQueryParams: HostIndexUIQueryParams): void => {
return history.push(getEndpointListPath({ name: 'endpointList', ...nextQueryParams }));
return history.push(getHostListPath({ name: 'hostList', ...nextQueryParams }));
};
});

Expand All @@ -70,7 +70,7 @@ describe('host list pagination: ', () => {
type: 'userChangedUrl',
payload: {
...history.location,
pathname: getEndpointListPath({ name: 'endpointList' }),
pathname: getHostListPath({ name: 'hostList' }),
},
});
await waitForAction('serverReturnedHostList');
Expand Down
Loading