Skip to content

Commit cfd3849

Browse files
committed
remove unecessary url from hooks
1 parent eac9035 commit cfd3849

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/host_details.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,9 @@ const LinkToExternalApp = styled(LinkToApp)`
4646
`;
4747

4848
export const HostDetails = memo(({ details }: { details: HostMetadata }) => {
49-
const { appId: logsAppId, appPath: logsAppPath, url: logsUrl } = useHostLogsUrl(details.host.id);
49+
const { appId: logsAppId, appPath: logsAppPath } = useHostLogsUrl(details.host.id);
5050
const endpointVersion = useHostSelector(latestEndpointVersion);
51-
const { appId: ingestAppId, appPath: ingestAppPath, url: ingestUrl } = useHostIngestUrl(
52-
endpointVersion
53-
);
51+
const { appId: ingestAppId, appPath: ingestAppPath } = useHostIngestUrl(endpointVersion);
5452
const queryParams = useHostSelector(uiQueryParams);
5553
const policyStatus = useHostSelector(
5654
policyResponseStatus
@@ -179,7 +177,6 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => {
179177
className="hostDetailsLinkToIngest"
180178
appId={ingestAppId}
181179
appPath={ingestAppPath}
182-
href={ingestUrl}
183180
data-test-subj="hostDetailsLinkToIngest"
184181
>
185182
<EuiIcon type="savedObjectsApp" className="linkToAppIcon" />
@@ -201,7 +198,6 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => {
201198
<LinkToExternalApp
202199
appId={logsAppId}
203200
appPath={logsAppPath}
204-
href={logsUrl}
205201
data-test-subj="hostDetailsLinkToLogs"
206202
>
207203
<EuiIcon type="logsApp" className="linkToAppIcon" />

x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/hooks.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
MANAGEMENT_STORE_ENDPOINTS_NAMESPACE,
1212
MANAGEMENT_STORE_GLOBAL_NAMESPACE,
1313
} from '../../../common/constants';
14-
import { useKibana } from '../../../../common/lib/kibana';
1514
import { State } from '../../../../common/store';
1615

1716
export function useHostSelector<TSelected>(selector: (state: HostState) => TSelected) {
@@ -26,34 +25,30 @@ export function useHostSelector<TSelected>(selector: (state: HostState) => TSele
2625
* Returns an object that contains Kibana Logs app and URL information for a given host id
2726
* @param hostId
2827
*/
29-
export const useHostLogsUrl = (hostId: string): { url: string; appId: string; appPath: string } => {
30-
const { services } = useKibana();
28+
export const useHostLogsUrl = (hostId: string): { appId: string; appPath: string } => {
3129
return useMemo(() => {
3230
const appPath = `/stream?logFilter=(expression:'host.id:${hostId}',kind:kuery)`;
3331
return {
34-
url: `${services.application.getUrlForApp('logs')}${appPath}`,
3532
appId: 'logs',
3633
appPath,
3734
};
38-
}, [hostId, services.application]);
35+
}, [hostId]);
3936
};
4037

4138
/**
4239
* Returns an object that contains Ingest app and URL information
4340
*/
4441
export const useHostIngestUrl = (
4542
latestEndpointVersion: string | undefined
46-
): { url: string; appId: string; appPath: string } => {
47-
const { services } = useKibana();
43+
): { appId: string; appPath: string } => {
4844
return useMemo(() => {
4945
let appPath = `#/integrations`;
5046
if (latestEndpointVersion !== undefined) {
5147
appPath = `#/integrations/endpoint-${latestEndpointVersion}/add-datasource`;
5248
}
5349
return {
54-
url: `${services.application.getUrlForApp('ingestManager')}${appPath}`,
5550
appId: 'ingestManager',
5651
appPath,
5752
};
58-
}, [latestEndpointVersion, services.application]);
53+
}, [latestEndpointVersion]);
5954
};

0 commit comments

Comments
 (0)