From 5ad20dd56ec72f244475d8e0d9c95961510fd931 Mon Sep 17 00:00:00 2001 From: opoliarush Date: Fri, 6 Sep 2024 12:14:30 +0300 Subject: [PATCH 1/9] Added child empty parent link --- .../AssetTypeList/AssetTypeList.stories.tsx | 34 +++++++++++++ src/components/Assets/AssetTypeList/index.tsx | 50 +++++++++++++++++++ src/components/Assets/AssetTypeList/styles.ts | 22 ++++++++ src/components/Assets/AssetTypeList/types.ts | 2 + src/components/Assets/tracking.ts | 3 +- src/components/Main/types.ts | 3 +- .../common/icons/30px/ChildIcon.tsx | 28 +++++++++++ 7 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 src/components/common/icons/30px/ChildIcon.tsx diff --git a/src/components/Assets/AssetTypeList/AssetTypeList.stories.tsx b/src/components/Assets/AssetTypeList/AssetTypeList.stories.tsx index 57266a477..595df1d53 100644 --- a/src/components/Assets/AssetTypeList/AssetTypeList.stories.tsx +++ b/src/components/Assets/AssetTypeList/AssetTypeList.stories.tsx @@ -82,3 +82,37 @@ export const Empty: Story = { }, 0); } }; + +export const EmptyWithParents: Story = { + args: { + searchQuery: "", + setRefresher: () => { + return undefined; + } + }, + play: () => { + window.setTimeout(() => { + window.postMessage({ + type: "digma", + action: actions.SET_CATEGORIES_DATA, + payload: { + assetCategories: [], + parents: [ + { + name: "http test", + displayName: "http get one", + instrumentationLibrary: "common", + spanCodeObjectId: "some span" + }, + { + name: "http test 2", + displayName: "http get two", + instrumentationLibrary: "common", + spanCodeObjectId: "some span 2" + } + ] + } + }); + }, 0); + } +}; diff --git a/src/components/Assets/AssetTypeList/index.tsx b/src/components/Assets/AssetTypeList/index.tsx index 902153e21..2c9ae22e5 100644 --- a/src/components/Assets/AssetTypeList/index.tsx +++ b/src/components/Assets/AssetTypeList/index.tsx @@ -6,9 +6,16 @@ import { useConfigSelector } from "../../../store/config/useConfigSelector"; import { isEnvironment } from "../../../typeGuards/isEnvironment"; import { isNull } from "../../../typeGuards/isNull"; import { isString } from "../../../typeGuards/isString"; +import { changeScope } from "../../../utils/actions/changeScope"; +import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; +import { SCOPE_CHANGE_EVENTS } from "../../Main/types"; +import { ChildIcon } from "../../common/icons/30px/ChildIcon"; +import { Link } from "../../common/v3/Link"; +import { NewEmptyState } from "../../common/v3/NewEmptyState"; import { AssetFilterQuery } from "../AssetsFilter/types"; import { NoDataMessage } from "../NoDataMessage"; import { actions } from "../actions"; +import { trackingEvents } from "../tracking"; import { checkIfAnyFiltersApplied, getAssetTypeInfo } from "../utils"; import { AssetTypeListItem } from "./AssetTypeListItem"; import * as s from "./styles"; @@ -172,6 +179,18 @@ export const AssetTypeList = ({ onAssetTypeSelect(assetTypeId); }; + const handleAssetLinkClick = (spanCodeObjectId: string) => { + sendUserActionTrackingEvent( + trackingEvents.EMPTY_CATEGORY_PARENT_LINK_CLICKED + ); + changeScope({ + span: { spanCodeObjectId }, + context: { + event: SCOPE_CHANGE_EVENTS.ASSETS_EMPTY_CATEGORY_PARENT_LINK_CLICKED + } + }); + }; + if (isInitialLoading) { return ; } @@ -185,6 +204,37 @@ export const AssetTypeList = ({ return ; } + if (data.parents.length > 0) { + return ( + + + + + There are no child assets under this asset. You can try + + + browsing its parent spans to continue to explore the trace. + + + {data.parents.map((x) => ( + handleAssetLinkClick(x.spanCodeObjectId)} + > + {x.displayName} + + ))} + + } + /> + + ); + } + return ; } diff --git a/src/components/Assets/AssetTypeList/styles.ts b/src/components/Assets/AssetTypeList/styles.ts index 2f2e0ef59..68ed3a666 100644 --- a/src/components/Assets/AssetTypeList/styles.ts +++ b/src/components/Assets/AssetTypeList/styles.ts @@ -1,4 +1,5 @@ import styled from "styled-components"; +import { footnoteRegularTypography } from "../../common/App/typographies"; export const List = styled.ul` display: flex; @@ -7,3 +8,24 @@ export const List = styled.ul` padding: 0 8px 8px; margin: 0; `; + +export const EmptyStateContainer = styled.div` + display: flex; + flex-direction: column; + align-items: center; + gap: 8px; + justify-content: center; + flex-grow: 1; + align-self: center; +`; +export const EmptyStateTextContainer = styled.div` + ${footnoteRegularTypography} + + display: flex; + flex-direction: column; + text-align: center; + gap: 4px; + padding-top: 4px; + padding-bottom: 4px; + color: ${({ theme }) => theme.colors.v3.text.tertiary}; +`; diff --git a/src/components/Assets/AssetTypeList/types.ts b/src/components/Assets/AssetTypeList/types.ts index cee38169c..d18125a11 100644 --- a/src/components/Assets/AssetTypeList/types.ts +++ b/src/components/Assets/AssetTypeList/types.ts @@ -1,4 +1,5 @@ import { MemoExoticComponent } from "react"; +import { SpanInfo } from "../../../types"; import { IconProps } from "../../common/icons/types"; import { AssetFilterQuery } from "../AssetsFilter/types"; import { AssetScopeOption } from "../AssetsViewScopeConfiguration/types"; @@ -17,6 +18,7 @@ export interface AssetCategoriesData { name: string; count: number; }[]; + parents: SpanInfo[]; } export interface AssetCategoryData { diff --git a/src/components/Assets/tracking.ts b/src/components/Assets/tracking.ts index 8892903e6..2b6477929 100644 --- a/src/components/Assets/tracking.ts +++ b/src/components/Assets/tracking.ts @@ -7,7 +7,8 @@ export const trackingEvents = addPrefix( { FILTER_APPLIED: "filter applied", REFRESH_BUTTON_CLICKED: "refresh button clicked", - FILTERS_POPUP_CLOSE_BUTTON_CLICKED: "filter popup close button clicked" + FILTERS_POPUP_CLOSE_BUTTON_CLICKED: "filter popup close button clicked", + EMPTY_CATEGORY_PARENT_LINK_CLICKED: "parent link in empty category clicked" }, " " ); diff --git a/src/components/Main/types.ts b/src/components/Main/types.ts index d62946312..41017adaf 100644 --- a/src/components/Main/types.ts +++ b/src/components/Main/types.ts @@ -55,7 +55,8 @@ export enum SCOPE_CHANGE_EVENTS { NOTIFICATIONS_NOTIFICATION_CARD_ASSET_LINK_CLICKED = "NOTIFICATIONS/NOTIFICATION_CARD_ASSET_LINK_CLICKED", RECENT_ACTIVITY_SPAN_LINK_CLICKED = "RECENT_ACTIVITY_SPAN_LINK_CLICKED", IDE_CODE_LENS_CLICKED = "IDE/CODE_LENS_CLICKED", - IDE_NOTIFICATION_LINK_CLICKED = "IDE/NOTIFICATION_LINK_CLICKED" + IDE_NOTIFICATION_LINK_CLICKED = "IDE/NOTIFICATION_LINK_CLICKED", + ASSETS_EMPTY_CATEGORY_PARENT_LINK_CLICKED = "ASSETS/EMPTY_CATEGORY_PARENT_LINK_CLICKED" } export interface ReactRouterLocationState { diff --git a/src/components/common/icons/30px/ChildIcon.tsx b/src/components/common/icons/30px/ChildIcon.tsx new file mode 100644 index 000000000..0f4c0348e --- /dev/null +++ b/src/components/common/icons/30px/ChildIcon.tsx @@ -0,0 +1,28 @@ +import React from "react"; +import { useIconProps } from "../hooks"; +import { IconProps } from "../types"; + +const ChildIconComponent = (props: IconProps) => { + const { size } = useIconProps(props); + + return ( + + + + + + + + + ); +}; + +export const ChildIcon = React.memo(ChildIconComponent); From 737d2cba39cc27edbd31a71b152717e3e26e1e27 Mon Sep 17 00:00:00 2001 From: opoliarush Date: Fri, 6 Sep 2024 13:02:46 +0300 Subject: [PATCH 2/9] fix styles --- src/components/Assets/AssetTypeList/index.tsx | 3 +-- src/components/Assets/AssetTypeList/styles.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/Assets/AssetTypeList/index.tsx b/src/components/Assets/AssetTypeList/index.tsx index 2c9ae22e5..0f9029f9e 100644 --- a/src/components/Assets/AssetTypeList/index.tsx +++ b/src/components/Assets/AssetTypeList/index.tsx @@ -11,7 +11,6 @@ import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActi import { SCOPE_CHANGE_EVENTS } from "../../Main/types"; import { ChildIcon } from "../../common/icons/30px/ChildIcon"; import { Link } from "../../common/v3/Link"; -import { NewEmptyState } from "../../common/v3/NewEmptyState"; import { AssetFilterQuery } from "../AssetsFilter/types"; import { NoDataMessage } from "../NoDataMessage"; import { actions } from "../actions"; @@ -207,7 +206,7 @@ export const AssetTypeList = ({ if (data.parents.length > 0) { return ( - theme.colors.v3.text.tertiary}; `; + +export const StyledEmptyState = styled(NewEmptyState)` + flex-grow: 1; + align-self: center; +`; From 6338d2e3ae64b2e629f69ef64edc55bb70aeaa8e Mon Sep 17 00:00:00 2001 From: opoliarush Date: Fri, 6 Sep 2024 17:23:32 +0300 Subject: [PATCH 3/9] Handle header visability --- src/components/Assets/AssetList/index.tsx | 3 + src/components/Assets/AssetTypeList/index.tsx | 19 +++-- src/components/Assets/index.tsx | 74 ++++++++++--------- src/store/assetsSlice/assetsSlice.ts | 23 ++++++ src/store/assetsSlice/useAssetsSelector.ts | 3 + src/store/useStore.ts | 3 +- 6 files changed, 84 insertions(+), 41 deletions(-) create mode 100644 src/store/assetsSlice/assetsSlice.ts create mode 100644 src/store/assetsSlice/useAssetsSelector.ts diff --git a/src/components/Assets/AssetList/index.tsx b/src/components/Assets/AssetList/index.tsx index 3e15c86e0..19cce04b7 100644 --- a/src/components/Assets/AssetList/index.tsx +++ b/src/components/Assets/AssetList/index.tsx @@ -4,6 +4,7 @@ import { DigmaMessageError } from "../../../api/types"; import { dispatcher } from "../../../dispatcher"; import { usePrevious } from "../../../hooks/usePrevious"; import { useConfigSelector } from "../../../store/config/useConfigSelector"; +import { useStore } from "../../../store/useStore"; import { isEnvironment } from "../../../typeGuards/isEnvironment"; import { changeScope } from "../../../utils/actions/changeScope"; import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; @@ -147,6 +148,7 @@ export const AssetList = ({ const previousEnvironment = usePrevious(environment); const previousViewScope = usePrevious(scopeViewOptions); const isServicesFilterEnabled = !scope?.span?.spanCodeObjectId; + const { setShowAssetsHeader } = useStore.getState(); const refreshData = useCallback(() => { getData( @@ -204,6 +206,7 @@ export const AssetList = ({ }; dispatcher.addActionListener(actions.SET_DATA, handleAssetsData); + setShowAssetsHeader(true); return () => { dispatcher.removeActionListener(actions.SET_DATA, handleAssetsData); diff --git a/src/components/Assets/AssetTypeList/index.tsx b/src/components/Assets/AssetTypeList/index.tsx index bd35650d3..59093de25 100644 --- a/src/components/Assets/AssetTypeList/index.tsx +++ b/src/components/Assets/AssetTypeList/index.tsx @@ -3,6 +3,7 @@ import { DigmaMessageError } from "../../../api/types"; import { dispatcher } from "../../../dispatcher"; import { usePrevious } from "../../../hooks/usePrevious"; import { useConfigSelector } from "../../../store/config/useConfigSelector"; +import { useStore } from "../../../store/useStore"; import { isEnvironment } from "../../../typeGuards/isEnvironment"; import { isNull } from "../../../typeGuards/isNull"; import { isString } from "../../../typeGuards/isString"; @@ -81,6 +82,8 @@ export const AssetTypeList = ({ const previousSearchQuery = usePrevious(searchQuery); const previousViewScope = usePrevious(scopeViewOptions); const isServicesFilterEnabled = !scope?.span?.spanCodeObjectId; + const { setShowAssetsHeader } = useStore.getState(); + const [showNoDataWithParents, setShowNoDataWithParents] = useState(false); const isInitialLoading = !data; @@ -143,8 +146,14 @@ export const AssetTypeList = ({ useEffect(() => { if (data && previousData !== data) { onAssetCountChange(getAssetCount(data)); + const showNoDataWithParents = + data && + data.parents.length > 0 && + data?.assetCategories.every((x) => x.count === 0); + setShowAssetsHeader(!showNoDataWithParents); + setShowNoDataWithParents(showNoDataWithParents); } - }, [previousData, data, onAssetCountChange]); + }, [previousData, data, onAssetCountChange, setShowAssetsHeader]); useEffect(() => { if ( @@ -197,11 +206,11 @@ export const AssetTypeList = ({ return ; } - if (scope !== null) { - return ; + if (!scope) { + return ; } - if (data.parents.length > 0) { + if (showNoDataWithParents) { return ( ; + return ; } const assetTypeListItems = ASSET_TYPE_IDS.map((assetTypeId) => { diff --git a/src/components/Assets/index.tsx b/src/components/Assets/index.tsx index 21f715ac3..100fc782c 100644 --- a/src/components/Assets/index.tsx +++ b/src/components/Assets/index.tsx @@ -3,6 +3,7 @@ import { useParams } from "react-router-dom"; import { getFeatureFlagValue } from "../../featureFlags"; import { useDebounce } from "../../hooks/useDebounce"; import { usePrevious } from "../../hooks/usePrevious"; +import { useAssetsSelector } from "../../store/assetsSlice/useAssetsSelector"; import { useConfigSelector } from "../../store/config/useConfigSelector"; import { FeatureFlag } from "../../types"; import { sendUserActionTrackingEvent } from "../../utils/actions/sendUserActionTrackingEvent"; @@ -45,6 +46,7 @@ export const Assets = () => { backendInfo, FeatureFlag.ARE_EXTENDED_ASSETS_FILTERS_ENABLED ); + const { showAssetsHeader } = useAssetsSelector(); useEffect(() => { if (!scope?.span) { @@ -131,7 +133,7 @@ export const Assets = () => { return ; } - if (!selectedFilters) { + if (!selectedFilters && showAssetsHeader) { return ; } @@ -163,43 +165,45 @@ export const Assets = () => { return ( - - {scope?.span && ( + {showAssetsHeader && ( + + {scope?.span && ( + + + + )} - - - )} - - - - - - - - {scope?.span && ( - Assets filtered to current scope - )} - + + + + + {scope?.span && ( + Assets filtered to current scope + )} + + )} {renderContent()} ); diff --git a/src/store/assetsSlice/assetsSlice.ts b/src/store/assetsSlice/assetsSlice.ts new file mode 100644 index 000000000..a7f2bb331 --- /dev/null +++ b/src/store/assetsSlice/assetsSlice.ts @@ -0,0 +1,23 @@ +import { createSlice } from "zustand-slices"; + +interface AssetsState { + showAssetsHeader: boolean; +} + +const initialState: AssetsState = { + showAssetsHeader: true +}; + +const set = (update: Partial) => (state: AssetsState) => ({ + ...state, + ...update +}); + +export const assetsSlice = createSlice({ + name: "assets", + value: initialState, + actions: { + setShowAssetsHeader: (showAssetsHeader: boolean) => + set({ showAssetsHeader }) + } +}); diff --git a/src/store/assetsSlice/useAssetsSelector.ts b/src/store/assetsSlice/useAssetsSelector.ts new file mode 100644 index 000000000..759e16d26 --- /dev/null +++ b/src/store/assetsSlice/useAssetsSelector.ts @@ -0,0 +1,3 @@ +import { useStore } from "../useStore"; + +export const useAssetsSelector = () => useStore((state) => state.assets); diff --git a/src/store/useStore.ts b/src/store/useStore.ts index 827bee2ba..01c6a2acb 100644 --- a/src/store/useStore.ts +++ b/src/store/useStore.ts @@ -1,12 +1,13 @@ import { create } from "zustand"; import { withSlices } from "zustand-slices"; import { Scope } from "../components/common/App/types"; +import { assetsSlice } from "./assetsSlice/assetsSlice"; import { configSlice } from "./config/configSlice"; import { insightsSlice } from "./insights/insightsSlice"; import { withMutableActions } from "./withMutableActions"; export const useStore = create( - withMutableActions(withSlices(configSlice, insightsSlice), { + withMutableActions(withSlices(configSlice, insightsSlice, assetsSlice), { setScope: (scope: Scope) => (_, set) => { set((state) => state.config.scope?.span?.spanCodeObjectId !== From 278087b5c099df67ec154948d0815e0adc3281de Mon Sep 17 00:00:00 2001 From: opoliarush Date: Fri, 6 Sep 2024 17:29:46 +0300 Subject: [PATCH 4/9] Update styles --- src/components/Assets/AssetTypeList/index.tsx | 5 ++--- src/components/Assets/AssetTypeList/styles.ts | 11 ++++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/Assets/AssetTypeList/index.tsx b/src/components/Assets/AssetTypeList/index.tsx index 59093de25..c10fa09c2 100644 --- a/src/components/Assets/AssetTypeList/index.tsx +++ b/src/components/Assets/AssetTypeList/index.tsx @@ -11,7 +11,6 @@ import { changeScope } from "../../../utils/actions/changeScope"; import { sendUserActionTrackingEvent } from "../../../utils/actions/sendUserActionTrackingEvent"; import { SCOPE_CHANGE_EVENTS } from "../../Main/types"; import { ChildIcon } from "../../common/icons/30px/ChildIcon"; -import { Link } from "../../common/v3/Link"; import { AssetFilterQuery } from "../AssetsFilter/types"; import { NoDataMessage } from "../NoDataMessage"; import { actions } from "../actions"; @@ -227,12 +226,12 @@ export const AssetTypeList = ({ {data.parents.map((x) => ( - handleAssetLinkClick(x.spanCodeObjectId)} > {x.displayName} - + ))} } diff --git a/src/components/Assets/AssetTypeList/styles.ts b/src/components/Assets/AssetTypeList/styles.ts index 2f1298568..5d6cca4a1 100644 --- a/src/components/Assets/AssetTypeList/styles.ts +++ b/src/components/Assets/AssetTypeList/styles.ts @@ -1,5 +1,9 @@ import styled from "styled-components"; -import { footnoteRegularTypography } from "../../common/App/typographies"; +import { + footnoteRegularTypography, + subscriptRegularTypography +} from "../../common/App/typographies"; +import { Link } from "../../common/v3/Link"; import { NewEmptyState } from "../../common/v3/NewEmptyState"; export const List = styled.ul` @@ -35,3 +39,8 @@ export const StyledEmptyState = styled(NewEmptyState)` flex-grow: 1; align-self: center; `; + +export const ParentLink = styled(Link)` + text-decoration: underline; + ${subscriptRegularTypography} +`; From 99bc53421f5ecee30d6c1764de9fcd9cef1aef7c Mon Sep 17 00:00:00 2001 From: opoliarush Date: Fri, 6 Sep 2024 18:53:58 +0300 Subject: [PATCH 5/9] change view box view --- src/components/Assets/AssetList/index.tsx | 4 +- src/components/Assets/AssetTypeList/index.tsx | 6 +- src/components/Assets/index.tsx | 81 ++++++++++--------- src/store/assetsSlice/assetsSlice.ts | 8 +- 4 files changed, 52 insertions(+), 47 deletions(-) diff --git a/src/components/Assets/AssetList/index.tsx b/src/components/Assets/AssetList/index.tsx index 19cce04b7..ee7b03871 100644 --- a/src/components/Assets/AssetList/index.tsx +++ b/src/components/Assets/AssetList/index.tsx @@ -148,7 +148,7 @@ export const AssetList = ({ const previousEnvironment = usePrevious(environment); const previousViewScope = usePrevious(scopeViewOptions); const isServicesFilterEnabled = !scope?.span?.spanCodeObjectId; - const { setShowAssetsHeader } = useStore.getState(); + const { setShowAssetsHeaderToolBox } = useStore.getState(); const refreshData = useCallback(() => { getData( @@ -206,7 +206,7 @@ export const AssetList = ({ }; dispatcher.addActionListener(actions.SET_DATA, handleAssetsData); - setShowAssetsHeader(true); + setShowAssetsHeaderToolBox(true); return () => { dispatcher.removeActionListener(actions.SET_DATA, handleAssetsData); diff --git a/src/components/Assets/AssetTypeList/index.tsx b/src/components/Assets/AssetTypeList/index.tsx index c10fa09c2..8f8169264 100644 --- a/src/components/Assets/AssetTypeList/index.tsx +++ b/src/components/Assets/AssetTypeList/index.tsx @@ -81,7 +81,7 @@ export const AssetTypeList = ({ const previousSearchQuery = usePrevious(searchQuery); const previousViewScope = usePrevious(scopeViewOptions); const isServicesFilterEnabled = !scope?.span?.spanCodeObjectId; - const { setShowAssetsHeader } = useStore.getState(); + const { setShowAssetsHeaderToolBox } = useStore.getState(); const [showNoDataWithParents, setShowNoDataWithParents] = useState(false); const isInitialLoading = !data; @@ -149,10 +149,10 @@ export const AssetTypeList = ({ data && data.parents.length > 0 && data?.assetCategories.every((x) => x.count === 0); - setShowAssetsHeader(!showNoDataWithParents); + setShowAssetsHeaderToolBox(!showNoDataWithParents); setShowNoDataWithParents(showNoDataWithParents); } - }, [previousData, data, onAssetCountChange, setShowAssetsHeader]); + }, [previousData, data, onAssetCountChange, setShowAssetsHeaderToolBox]); useEffect(() => { if ( diff --git a/src/components/Assets/index.tsx b/src/components/Assets/index.tsx index 100fc782c..311299aba 100644 --- a/src/components/Assets/index.tsx +++ b/src/components/Assets/index.tsx @@ -46,7 +46,7 @@ export const Assets = () => { backendInfo, FeatureFlag.ARE_EXTENDED_ASSETS_FILTERS_ENABLED ); - const { showAssetsHeader } = useAssetsSelector(); + const { showAssetsHeaderToolBox } = useAssetsSelector(); useEffect(() => { if (!scope?.span) { @@ -133,7 +133,7 @@ export const Assets = () => { return ; } - if (!selectedFilters && showAssetsHeader) { + if (!selectedFilters && showAssetsHeaderToolBox) { return ; } @@ -165,45 +165,50 @@ export const Assets = () => { return ( - {showAssetsHeader && ( - - {scope?.span && ( - - - - )} + + {scope?.span && ( - - - - - - {scope?.span && ( - Assets filtered to current scope - )} - - )} + )} + {showAssetsHeaderToolBox && ( + <> + + + + + + + + {scope?.span && ( + Assets filtered to current scope + )} + + )} + + {renderContent()} ); diff --git a/src/store/assetsSlice/assetsSlice.ts b/src/store/assetsSlice/assetsSlice.ts index a7f2bb331..6ad581221 100644 --- a/src/store/assetsSlice/assetsSlice.ts +++ b/src/store/assetsSlice/assetsSlice.ts @@ -1,11 +1,11 @@ import { createSlice } from "zustand-slices"; interface AssetsState { - showAssetsHeader: boolean; + showAssetsHeaderToolBox: boolean; } const initialState: AssetsState = { - showAssetsHeader: true + showAssetsHeaderToolBox: true }; const set = (update: Partial) => (state: AssetsState) => ({ @@ -17,7 +17,7 @@ export const assetsSlice = createSlice({ name: "assets", value: initialState, actions: { - setShowAssetsHeader: (showAssetsHeader: boolean) => - set({ showAssetsHeader }) + setShowAssetsHeaderToolBox: (showAssetsHeaderToolBox: boolean) => + set({ showAssetsHeaderToolBox }) } }); From e3ecc9da43d23ea2a0d7f7b7041ff99f5c09451f Mon Sep 17 00:00:00 2001 From: opoliarush Date: Sat, 7 Sep 2024 11:12:35 +0300 Subject: [PATCH 6/9] Stay on assets during navigation --- src/components/Main/index.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/Main/index.tsx b/src/components/Main/index.tsx index 4e581aeec..6b432811e 100644 --- a/src/components/Main/index.tsx +++ b/src/components/Main/index.tsx @@ -205,6 +205,10 @@ export const Main = () => { } goTo(`/${TAB_IDS.ISSUES}`, { state }); break; + case SCOPE_CHANGE_EVENTS.ASSETS_EMPTY_CATEGORY_PARENT_LINK_CLICKED as string: { + goTo(`/${TAB_IDS.ASSETS}`, { state }); + break; + } case SCOPE_CHANGE_EVENTS.IDE_CODE_LENS_CLICKED as string: { const url = getURLToNavigateOnCodeLensClick(scope); if (url) { @@ -212,6 +216,7 @@ export const Main = () => { break; } } + // falls through case SCOPE_CHANGE_EVENTS.DASHBOARD_SLOW_QUERIES_WIDGET_ITEM_LINK_CLICKED as string: case SCOPE_CHANGE_EVENTS.DASHBOARD_CLIENT_SPANS_PERFORMANCE_IMPACT_WIDGET_ITEM_LINK_CLICKED as string: From 373769d00b2893939a3ce37da4299f59467eebbb Mon Sep 17 00:00:00 2001 From: opoliarush Date: Sat, 7 Sep 2024 11:16:51 +0300 Subject: [PATCH 7/9] Fix scope check --- src/components/Insights/InsightsCatalog/InsightsPage/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Insights/InsightsCatalog/InsightsPage/index.tsx b/src/components/Insights/InsightsCatalog/InsightsPage/index.tsx index 53861352c..e375a1409 100644 --- a/src/components/Insights/InsightsCatalog/InsightsPage/index.tsx +++ b/src/components/Insights/InsightsCatalog/InsightsPage/index.tsx @@ -562,7 +562,7 @@ const renderEmptyState = ( ); } - if (!scope && insightsViewType == "Analytics") { + if (!scope?.span?.spanCodeObjectId && insightsViewType == "Analytics") { return ( Date: Sat, 7 Sep 2024 16:05:06 +0200 Subject: [PATCH 8/9] Update src/components/Main/index.tsx --- src/components/Main/index.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/Main/index.tsx b/src/components/Main/index.tsx index 6b432811e..a0a7858ed 100644 --- a/src/components/Main/index.tsx +++ b/src/components/Main/index.tsx @@ -205,10 +205,9 @@ export const Main = () => { } goTo(`/${TAB_IDS.ISSUES}`, { state }); break; - case SCOPE_CHANGE_EVENTS.ASSETS_EMPTY_CATEGORY_PARENT_LINK_CLICKED as string: { + case SCOPE_CHANGE_EVENTS.ASSETS_EMPTY_CATEGORY_PARENT_LINK_CLICKED as string: goTo(`/${TAB_IDS.ASSETS}`, { state }); break; - } case SCOPE_CHANGE_EVENTS.IDE_CODE_LENS_CLICKED as string: { const url = getURLToNavigateOnCodeLensClick(scope); if (url) { From 7b119a89d06635b756cf3e2f45f523d130704a25 Mon Sep 17 00:00:00 2001 From: opoliarush Date: Sat, 7 Sep 2024 21:23:23 +0300 Subject: [PATCH 9/9] Fixed issue with missing parents --- src/components/Assets/AssetTypeList/index.tsx | 11 ++++++----- src/components/Assets/AssetTypeList/types.ts | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/Assets/AssetTypeList/index.tsx b/src/components/Assets/AssetTypeList/index.tsx index 8f8169264..20e1d8b00 100644 --- a/src/components/Assets/AssetTypeList/index.tsx +++ b/src/components/Assets/AssetTypeList/index.tsx @@ -145,10 +145,11 @@ export const AssetTypeList = ({ useEffect(() => { if (data && previousData !== data) { onAssetCountChange(getAssetCount(data)); - const showNoDataWithParents = - data && - data.parents.length > 0 && - data?.assetCategories.every((x) => x.count === 0); + const showNoDataWithParents = Boolean( + data?.parents && + data.parents.length > 0 && + data?.assetCategories.every((x) => x.count === 0) + ); setShowAssetsHeaderToolBox(!showNoDataWithParents); setShowNoDataWithParents(showNoDataWithParents); } @@ -209,7 +210,7 @@ export const AssetTypeList = ({ return ; } - if (showNoDataWithParents) { + if (showNoDataWithParents && data.parents) { return (