Skip to content

Commit

Permalink
typecheck fix, mgmt -> admin
Browse files Browse the repository at this point in the history
  • Loading branch information
parkiino committed Jul 9, 2020
1 parent 661c4ad commit 4df5aa7
Show file tree
Hide file tree
Showing 18 changed files with 27 additions and 24 deletions.
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 @@ -42,7 +42,7 @@ export enum SecurityPageName {
network = 'network',
timelines = 'timelines',
case = 'case',
management = 'management',
administration = 'administration',
}

export const APP_OVERVIEW_PATH = `${APP_PATH}/overview`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ export const navTabs: SiemNavTab = {
disabled: false,
urlKey: 'case',
},
[SecurityPageName.management]: {
id: SecurityPageName.management,
[SecurityPageName.administration]: {
id: SecurityPageName.administration,
name: i18n.ADMINISTRATION,
href: APP_MANAGEMENT_PATH,
disabled: false,
urlKey: SecurityPageName.management,
urlKey: SecurityPageName.administration,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
HostRouteSpyState,
NetworkRouteSpyState,
TimelineRouteSpyState,
AdministrationRouteSpyState,
} from '../../../utils/route/types';
import { getAppOverviewUrl } from '../../link_to';

Expand Down Expand Up @@ -62,8 +63,8 @@ const isCaseRoutes = (spyState: RouteSpyState): spyState is RouteSpyState =>
const isAlertsRoutes = (spyState: RouteSpyState) =>
spyState != null && spyState.pageName === SecurityPageName.detections;

const isAdminRoutes = (spyState: RouteSpyState) =>
spyState != null && spyState.pageName === SecurityPageName.management;
const isAdminRoutes = (spyState: RouteSpyState): spyState is AdministrationRouteSpyState =>
spyState != null && spyState.pageName === SecurityPageName.administration;

// eslint-disable-next-line complexity
export const getBreadcrumbsForRoute = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export type SiemNavTabKey =
| SecurityPageName.detections
| SecurityPageName.timelines
| SecurityPageName.case
| SecurityPageName.management;
| SecurityPageName.administration;

export type SiemNavTab = Record<SiemNavTabKey, NavTab>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ export type UrlStateType =
| 'network'
| 'overview'
| 'timeline'
| 'management';
| 'administration';
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ export const getUrlType = (pageName: string): UrlStateType => {
return 'timeline';
} else if (pageName === SecurityPageName.case) {
return 'case';
} else if (pageName === SecurityPageName.administration) {
return 'administration';
}
return 'overview';
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const URL_STATE_KEYS: Record<UrlStateType, KeyUrlState[]> = {
CONSTANTS.timerange,
CONSTANTS.timeline,
],
management: [],
administration: [],
network: [
CONSTANTS.appQuery,
CONSTANTS.filters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { APP_ID } from '../../../common/constants';
import { SecurityPageName } from '../../app/types';

// --[ ROUTING ]---------------------------------------------------------------------------
export const MANAGEMENT_APP_ID = `${APP_ID}:${SecurityPageName.management}`;
export const MANAGEMENT_APP_ID = `${APP_ID}:${SecurityPageName.administration}`;
export const MANAGEMENT_ROUTING_ROOT_PATH = '';
export const MANAGEMENT_ROUTING_HOSTS_PATH = `${MANAGEMENT_ROUTING_ROOT_PATH}/:tabName(${AdministrationSubTab.hosts})`;
export const MANAGEMENT_ROUTING_POLICIES_PATH = `${MANAGEMENT_ROUTING_ROOT_PATH}/:tabName(${AdministrationSubTab.policies})`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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 { formatUrl, search } = useFormatUrl(SecurityPageName.administration);
const { tabName } = useParams<{ tabName: AdministrationSubTab }>();

const goToEndpoint = useNavigateByRouterEventHandler(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => {
const policyStatus = useHostSelector(
policyResponseStatus
) as keyof typeof POLICY_STATUS_TO_HEALTH_COLOR;
const { formatUrl } = useFormatUrl(SecurityPageName.management);
const { formatUrl } = useFormatUrl(SecurityPageName.administration);

const detailsResultsUpper = useMemo(() => {
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const PolicyResponseFlyoutPanel = memo<{
const responseAttentionCount = useHostSelector(policyResponseFailedOrWarningActionCount);
const loading = useHostSelector(policyResponseLoading);
const error = useHostSelector(policyResponseError);
const { formatUrl } = useFormatUrl(SecurityPageName.management);
const { formatUrl } = useFormatUrl(SecurityPageName.administration);
const [detailsUri, detailsRoutePath] = useMemo(
() => [
formatUrl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const HostList = () => {
policyItemsLoading,
endpointPackageVersion,
} = useHostSelector(selector);
const { formatUrl, search } = useFormatUrl(SecurityPageName.management);
const { formatUrl, search } = useFormatUrl(SecurityPageName.administration);

const dispatch = useDispatch<(a: HostAction) => void>();

Expand Down Expand Up @@ -408,7 +408,7 @@ export const HostList = () => {
</>
)}
{renderTableOrEmptyState}
<SpyRoute pageName={SecurityPageName.management} />
<SpyRoute pageName={SecurityPageName.administration} />
</ManagementPageView>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const getBreadcrumbs = (
let breadcrumb = [
{
text: ADMINISTRATION,
href: getUrlForApp(`${APP_ID}:${SecurityPageName.management}`, {
href: getUrlForApp(`${APP_ID}:${SecurityPageName.administration}`, {
path: !isEmpty(search[0]) ? search[0] : '',
}),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const PolicyDetails = React.memo(() => {
application: { navigateToApp },
},
} = useKibana();
const { formatUrl, search } = useFormatUrl(SecurityPageName.management);
const { formatUrl, search } = useFormatUrl(SecurityPageName.administration);
const { state: locationRouteState } = useLocation<PolicyDetailsRouteState>();

// Store values
Expand Down Expand Up @@ -149,7 +149,7 @@ export const PolicyDetails = React.memo(() => {
<span data-test-subj="policyDetailsIdNotFoundMessage">{policyApiError?.message}</span>
</EuiCallOut>
) : null}
<SpyRoute pageName={SecurityPageName.management} />
<SpyRoute pageName={SecurityPageName.administration} />
</ManagementPageView>
);
}
Expand Down Expand Up @@ -251,7 +251,7 @@ export const PolicyDetails = React.memo(() => {
<EuiSpacer size="l" />
<LinuxEvents />
</ManagementPageView>
<SpyRoute pageName={SecurityPageName.management} />
<SpyRoute pageName={SecurityPageName.administration} />
</>
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const PolicyList = React.memo(() => {
const { services, notifications } = useKibana();
const history = useHistory();
const location = useLocation();
const { formatUrl, search } = useFormatUrl(SecurityPageName.management);
const { formatUrl, search } = useFormatUrl(SecurityPageName.administration);

const [showDelete, setShowDelete] = useState<boolean>(false);
const [policyIdToDelete, setPolicyIdToDelete] = useState<string>('');
Expand Down Expand Up @@ -464,7 +464,7 @@ export const PolicyList = React.memo(() => {
handleTableChange,
paginationSetup,
])}
<SpyRoute pageName={SecurityPageName.management} />
<SpyRoute pageName={SecurityPageName.administration} />
</ManagementPageView>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export enum AdministrationSubTab {
* The URL route params for the Management Policy List section
*/
export interface ManagementRoutePolicyListParams {
pageName: SecurityPageName.management;
pageName: SecurityPageName.administration;
tabName: AdministrationSubTab.policies;
}

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/security_solution/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
});

core.application.register({
id: `${APP_ID}:${SecurityPageName.management}`,
id: `${APP_ID}:${SecurityPageName.administration}`,
title: ADMINISTRATION,
order: 9002,
euiIconType: APP_ICON,
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/security_solution/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const securitySubPlugins = [
`${APP_ID}:${SecurityPageName.network}`,
`${APP_ID}:${SecurityPageName.timelines}`,
`${APP_ID}:${SecurityPageName.case}`,
`${APP_ID}:${SecurityPageName.management}`,
`${APP_ID}:${SecurityPageName.administration}`,
];

export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, StartPlugins> {
Expand Down

0 comments on commit 4df5aa7

Please sign in to comment.