diff --git a/src/components/Assets/index.tsx b/src/components/Assets/index.tsx
index 8d22a2973..630d8b1a8 100644
--- a/src/components/Assets/index.tsx
+++ b/src/components/Assets/index.tsx
@@ -122,7 +122,10 @@ export const Assets = () => {
);
}
- if (!selectedFilters && !selectedServices) {
+ if (
+ !config.environments?.length ||
+ (!selectedFilters && !selectedServices)
+ ) {
return ;
}
diff --git a/src/components/Insights/index.tsx b/src/components/Insights/index.tsx
index 9c139af13..733f7cd92 100644
--- a/src/components/Insights/index.tsx
+++ b/src/components/Insights/index.tsx
@@ -155,6 +155,34 @@ const renderInsightTicket = (
return null;
};
+const NoDataYet = () => {
+ const handleTroubleshootingLinkClick = () => {
+ sendTrackingEvent(globalTrackingEvents.TROUBLESHOOTING_LINK_CLICKED, {
+ origin: "insights"
+ });
+
+ sendMessage(globalActions.OPEN_TROUBLESHOOTING_GUIDE);
+ };
+
+ return (
+
+
+ Trigger actions that call this application to learn more about its
+ runtime behavior
+
+
+ Not seeing your application data?
+
+ >
+ }
+ />
+ );
+};
+
const sendMessage = (action: string, data?: object) => {
return window.sendMessageToDigma({
action,
@@ -282,6 +310,10 @@ export const Insights = (props: InsightsProps) => {
return } />;
}
+ if (!config.environments?.length) {
+ return ;
+ }
+
switch (data?.insightsStatus) {
case InsightsStatus.STARTUP:
return (
@@ -321,23 +353,7 @@ export const Insights = (props: InsightsProps) => {
/>
);
case InsightsStatus.NO_SPANS_DATA:
- return (
-
-
- Trigger actions that call this application to learn more about
- its runtime behavior
-
-
- Not seeing your application data?
-
- >
- }
- />
- );
+ return ;
case InsightsStatus.NO_OBSERVABILITY:
return (
void;
isDisabled?: boolean;
diff --git a/src/components/Navigation/ScopeNavigation/index.tsx b/src/components/Navigation/ScopeNavigation/index.tsx
index 689fd719f..4f9c9d2e9 100644
--- a/src/components/Navigation/ScopeNavigation/index.tsx
+++ b/src/components/Navigation/ScopeNavigation/index.tsx
@@ -2,34 +2,46 @@ import { useContext, useEffect, useState } from "react";
import { actions } from "../../../actions";
import { dispatcher } from "../../../dispatcher";
import { usePrevious } from "../../../hooks/usePrevious";
-import { HistoryManager, HistoryStep } from "../../../utils/HistoryManager";
+import { HistoryManager } from "../../../utils/HistoryManager";
import { ConfigContext } from "../../common/App/ConfigContext";
import { Scope } from "../../common/App/types";
-import { ChangeEnvironmentPayload, ChangeViewPayload } from "../types";
+import {
+ ChangeEnvironmentPayload,
+ ChangeScopePayload,
+ ChangeViewPayload
+} from "../types";
import { actions as globalActions } from "./../actions";
import { HistoryNavigationPanel } from "./HistoryNavigationPanel";
import { ScopeNavigationProps } from "./types";
-const sendMessage = (historyStep: HistoryStep) => {
- if (historyStep.scope) {
- window.sendMessageToDigma({
- action: globalActions.CHANGE_SCOPE,
- payload: {
- ...historyStep.scope
- }
- });
- }
+const changeScope = (scope: Scope | null) => {
+ window.sendMessageToDigma({
+ action: globalActions.CHANGE_SCOPE,
+ payload: {
+ span: scope?.span || null
+ }
+ });
};
export const ScopeNavigation = (props: ScopeNavigationProps) => {
const [historyManager, setHistoryManager] = useState(
new HistoryManager()
);
- const { environment } = useContext(ConfigContext);
+ const { environment, environments } = useContext(ConfigContext);
const previousTabId = usePrevious(props.currentTabId);
const previousEnvironment = usePrevious(environment);
const previousSate = usePrevious(historyManager.getCurrent());
+ useEffect(() => {
+ if (
+ !environment ||
+ !environments?.find((x) => x.originalName == environment?.originalName)
+ ) {
+ сhangeScope(null);
+ setHistoryManager(new HistoryManager());
+ }
+ }, [environment, environments]);
+
useEffect(() => {
const currentStep = historyManager.getCurrent();
if (
@@ -100,15 +112,15 @@ export const ScopeNavigation = (props: ScopeNavigationProps) => {
const handleBackClick = () => {
const currentStep = historyManager.back();
- if (currentStep) {
- sendMessage(currentStep);
+ if (currentStep && currentStep.scope) {
+ changeScope(currentStep.scope);
}
};
const handleNexClick = () => {
const currentStep = historyManager.forward();
- if (currentStep) {
- sendMessage(currentStep);
+ if (currentStep && currentStep.scope) {
+ changeScope(currentStep.scope);
}
};
diff --git a/src/components/Navigation/index.tsx b/src/components/Navigation/index.tsx
index 216835548..9fe91a79a 100644
--- a/src/components/Navigation/index.tsx
+++ b/src/components/Navigation/index.tsx
@@ -169,9 +169,12 @@ export const Navigation = () => {
if (
config.environments &&
config.environments.length > 0 &&
- !config.environment
+ (!config.environment ||
+ !config.environments.find(
+ (x) => x.originalName == config.environment?.originalName
+ ))
) {
- setSelectedEnvironment(config.environments[0]);
+ handleEnvironmentChange(config.environments[0]);
}
if (config.environments && config.environments.length === 0) {
@@ -179,10 +182,6 @@ export const Navigation = () => {
}
}, [config.environments, config.environment]);
- useEffect(() => {
- setSelectedEnvironment(config.environment);
- }, [config.environment]);
-
useEffect(() => {
setIsAutoFixing(false);
setIsAnnotationAdding(false);
diff --git a/src/components/Navigation/types.ts b/src/components/Navigation/types.ts
index 85f909bcf..48e981eea 100644
--- a/src/components/Navigation/types.ts
+++ b/src/components/Navigation/types.ts
@@ -16,7 +16,7 @@ export interface OpenDocumentationPayload {
}
export interface OpenDashboardPayload {
- environment?: Environment;
+ environment?: Environment | null;
}
export interface ChangeScopePayload {
diff --git a/src/components/common/App/index.tsx b/src/components/common/App/index.tsx
index c3adc0d2a..982236640 100644
--- a/src/components/common/App/index.tsx
+++ b/src/components/common/App/index.tsx
@@ -195,6 +195,13 @@ export const App = (props: AppProps) => {
...config,
environments: data.environments as Environment[]
}));
+
+ if (!data.environments.length) {
+ setConfig((config) => ({
+ ...config,
+ environment: null
+ }));
+ }
}
};
diff --git a/src/components/common/App/types.ts b/src/components/common/App/types.ts
index 8f2e3f9c4..39264dbcd 100644
--- a/src/components/common/App/types.ts
+++ b/src/components/common/App/types.ts
@@ -82,7 +82,7 @@ export interface ConfigContextData {
isDockerComposeInstalled: boolean;
userEmail: string;
userRegistrationEmail: string;
- environment: Environment | undefined;
+ environment?: Environment | null;
backendInfo: BackendInfo | undefined;
environments: Environment[] | undefined;
scope: Scope | undefined;