File tree Expand file tree Collapse file tree 11 files changed +27
-26
lines changed
logs_shared/common/locators
solutions/observability/plugins
components/asset_details/tabs/logs
metrics/inventory_view/components/waffle
observability/public/pages/overview/components/observability_status Expand file tree Collapse file tree 11 files changed +27
-26
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export const CustomLogsAssetsExtension: PackageAssetsComponent = () => {
2424 const views : CustomAssetsAccordionProps [ 'views' ] = [
2525 {
2626 name : i18n . translate ( 'xpack.fleet.assets.customLogs.name' , { defaultMessage : 'Logs' } ) ,
27- url : logsLocator . getRedirectUrl ( { } ) ,
27+ url : logsLocator ? .getRedirectUrl ( { } ) ?? '' ,
2828 description : i18n . translate ( 'xpack.fleet.assets.customLogs.description' , {
2929 defaultMessage : 'View Custom logs data in Logs Explorer' ,
3030 } ) ,
Original file line number Diff line number Diff line change @@ -15,10 +15,10 @@ import { TRACE_LOGS_LOCATOR_ID } from './trace_logs_locator';
1515
1616export const getLogsLocatorsFromUrlService = ( urlService : UrlService ) => {
1717 const discoverLogsLocator =
18- urlService . locators . get < DiscoverLogsLocatorParams > ( DISCOVER_LOGS_LOCATOR_ID ) ! ;
19- const logsLocator = urlService . locators . get < LogsLocatorParams > ( LOGS_LOCATOR_ID ) ! ;
20- const nodeLogsLocator = urlService . locators . get < NodeLogsLocatorParams > ( NODE_LOGS_LOCATOR_ID ) ! ;
21- const traceLogsLocator = urlService . locators . get < TraceLogsLocatorParams > ( TRACE_LOGS_LOCATOR_ID ) ! ;
18+ urlService . locators . get < DiscoverLogsLocatorParams > ( DISCOVER_LOGS_LOCATOR_ID ) ;
19+ const logsLocator = urlService . locators . get < LogsLocatorParams > ( LOGS_LOCATOR_ID ) ;
20+ const nodeLogsLocator = urlService . locators . get < NodeLogsLocatorParams > ( NODE_LOGS_LOCATOR_ID ) ;
21+ const traceLogsLocator = urlService . locators . get < TraceLogsLocatorParams > ( TRACE_LOGS_LOCATOR_ID ) ;
2222
2323 return {
2424 discoverLogsLocator,
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ export function getMenuSections({
5050 onFilterByInstanceClick : ( ) => void ;
5151 metricsHref : string ;
5252 allDatasetsLocator : LocatorPublic < AllDatasetsLocatorParams > ;
53- nodeLogsLocator : LocatorPublic < NodeLogsLocatorParams > ;
53+ nodeLogsLocator ? : LocatorPublic < NodeLogsLocatorParams > ;
5454 assetDetailsLocator ?: AssetDetailsLocator ;
5555} ) {
5656 const podId = instanceDetails . kubernetes ?. pod ?. uid ;
@@ -60,13 +60,13 @@ export function getMenuSections({
6060 : undefined ;
6161 const infraMetricsQuery = getInfraMetricsQuery ( instanceDetails [ '@timestamp' ] ) ;
6262
63- const podLogsHref = nodeLogsLocator . getRedirectUrl ( {
63+ const podLogsHref = nodeLogsLocator ? .getRedirectUrl ( {
6464 nodeField : findInventoryFields ( 'pod' ) . id ,
6565 nodeId : podId ! ,
6666 time,
6767 } ) ;
6868
69- const containerLogsHref = nodeLogsLocator . getRedirectUrl ( {
69+ const containerLogsHref = nodeLogsLocator ? .getRedirectUrl ( {
7070 nodeField : findInventoryFields ( 'container' ) . id ,
7171 nodeId : containerId ! ,
7272 time,
Original file line number Diff line number Diff line change @@ -85,23 +85,23 @@ export const getSections = ({
8585 ) ;
8686
8787 // Logs hrefs
88- const podLogsHref = logsLocators . nodeLogsLocator . getRedirectUrl ( {
88+ const podLogsHref = logsLocators . nodeLogsLocator ? .getRedirectUrl ( {
8989 nodeField : findInventoryFields ( 'pod' ) . id ,
9090 nodeId : podId ! ,
9191 time,
9292 } ) ;
93- const containerLogsHref = logsLocators . nodeLogsLocator . getRedirectUrl ( {
93+ const containerLogsHref = logsLocators . nodeLogsLocator ? .getRedirectUrl ( {
9494 nodeField : findInventoryFields ( 'container' ) . id ,
9595 nodeId : containerId ! ,
9696 time,
9797 } ) ;
98- const hostLogsHref = logsLocators . nodeLogsLocator . getRedirectUrl ( {
98+ const hostLogsHref = logsLocators . nodeLogsLocator ? .getRedirectUrl ( {
9999 nodeField : findInventoryFields ( 'host' ) . id ,
100100 nodeId : hostName ! ,
101101 time,
102102 } ) ;
103103
104- const traceLogsHref = logsLocators . traceLogsLocator . getRedirectUrl ( {
104+ const traceLogsHref = logsLocators . traceLogsLocator ? .getRedirectUrl ( {
105105 traceId : transaction . trace . id ! ,
106106 time,
107107 } ) ;
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ const logThresholdDefaultRecoveryMessage = i18n.translate(
3434 'xpack.infra.logs.alerting.threshold.defaultRecoveryMessage' ,
3535 {
3636 defaultMessage : `Recovered: '{{context.reason}}'
37-
37+
3838 '{{rule.name}}' has recovered.
3939
4040[View alert details]('{{context.alertDetailsUrl}}')
@@ -73,7 +73,7 @@ export function createLogThresholdRuleType(
7373 defaultActionMessage : logThresholdDefaultActionMessage ,
7474 defaultRecoveryMessage : logThresholdDefaultRecoveryMessage ,
7575 requiresAppContext : false ,
76- format : createRuleFormatter ( logsLocator ) ,
76+ format : logsLocator ? createRuleFormatter ( logsLocator ) : ( ) => ( { reason : '' } ) ,
7777 priority : 30 ,
7878 } ;
7979}
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ export const Logs = () => {
4242 share : { url } ,
4343 } ,
4444 } = useKibanaContextForPlugin ( ) ;
45- const { logsLocator } = getLogsLocatorsFromUrlService ( url ) ! ;
45+ const { logsLocator } = getLogsLocatorsFromUrlService ( url ) ;
4646 const [ textQuery , setTextQuery ] = useState ( urlState ?. logsSearch ?? '' ) ;
4747 const [ textQueryDebounced , setTextQueryDebounced ] = useState ( urlState ?. logsSearch ?? '' ) ;
4848
@@ -87,7 +87,7 @@ export const Logs = () => {
8787 nodeId : asset . id ,
8888 filter : textQueryDebounced ,
8989 } ) ;
90- return logsLocator . getRedirectUrl ( {
90+ return logsLocator ? .getRedirectUrl ( {
9191 filter : nodeQuery . query ,
9292 timeRange : {
9393 startTime : state . startTimestamp ,
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export const RedirectToLogs = () => {
2323 const time = getTimeFromLocation ( location ) ;
2424
2525 useEffect ( ( ) => {
26- logsLocator . navigate (
26+ logsLocator ? .navigate (
2727 {
2828 time,
2929 filter,
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ export const RedirectToNodeLogs = ({
3535 const time = getTimeFromLocation ( location ) ;
3636
3737 useEffect ( ( ) => {
38- nodeLogsLocator . navigate (
38+ nodeLogsLocator ? .navigate (
3939 {
4040 nodeField : findInventoryFields ( nodeType ) . id ,
4141 nodeId,
Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ export const NodeContextMenu: React.FC<Props & { theme?: EuiTheme }> = withTheme
124124 defaultMessage : '{inventoryName} logs' ,
125125 values : { inventoryName : inventoryModel . singularDisplayName } ,
126126 } ) ,
127- href : nodeLogsLocator . getRedirectUrl ( {
127+ href : nodeLogsLocator ? .getRedirectUrl ( {
128128 nodeField : findInventoryFields ( nodeType ) . id ,
129129 nodeId : node . id ,
130130 time : currentTime ,
Original file line number Diff line number Diff line change @@ -70,12 +70,13 @@ export function getLogsOverviewDataFetcher(
7070 const { logsLocator } = getLogsLocatorsFromUrlService ( share . url ) ;
7171 const timeSpanInMinutes = ( params . absoluteTime . end - params . absoluteTime . start ) / ( 1000 * 60 ) ;
7272
73- const appLink = logsLocator . getRedirectUrl ( {
74- timeRange : {
75- startTime : params . absoluteTime . start ,
76- endTime : params . absoluteTime . end ,
77- } ,
78- } ) ;
73+ const appLink =
74+ logsLocator ?. getRedirectUrl ( {
75+ timeRange : {
76+ startTime : params . absoluteTime . start ,
77+ endTime : params . absoluteTime . end ,
78+ } ,
79+ } ) ?? '' ;
7980
8081 return {
8182 appLink,
You can’t perform that action at this time.
0 commit comments