Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .storybook/preview-body.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
window.isDigmathonModeEnabled = true;

window.assetsRefreshInterval;
window.assetsSearch = true;
window.assetsSelectedServices = [];

window.dashboardEnvironment = "SAMPLE_ENV";
window.dashboardRefreshInterval;
Expand All @@ -35,7 +33,6 @@
window.recentActivityExpirationLimit;
window.recentActivityDocumentationURL =
"https://github.com/digma-ai/digma-vscode-plugin#%EF%B8%8F-extension-settings";
window.recentActivityIsEnvironmentManagementEnabled = true;

window.testsRefreshInterval;

Expand Down
16 changes: 0 additions & 16 deletions src/components/Assets/AssetList/AssetEntry/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,22 +182,6 @@ export const AssetEntry = (props: AssetEntryProps) => {
</s.ValueContainer>
</Tooltip>
</s.Stats>
{!props.isOverallImpactHidden && (
<s.Stats>
<span>Overall impact</span>
<Tooltip title={props.entry.impactScores.ScoreExp1000}>
<s.ValueContainer>
<ImpactScore
score={props.entry.impactScores.ScoreExp1000}
showIndicator={
props.sortingCriterion ===
SORTING_CRITERION.OVERALL_IMPACT
}
/>
</s.ValueContainer>
</Tooltip>
</s.Stats>
)}
</s.StatsColumn>
)}
</s.StatsContainer>
Expand Down
1 change: 0 additions & 1 deletion src/components/Assets/AssetList/AssetEntry/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export interface AssetEntryProps {
onAssetLinkClick: (entry: AssetEntry) => void;
sortingCriterion: SORTING_CRITERION;
isImpactHidden: boolean;
isOverallImpactHidden: boolean;
}

export interface ImpactScoreIndicatorProps {
Expand Down
1 change: 0 additions & 1 deletion src/components/Assets/AssetList/AssetList.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const Default: Story = {
args: {
searchQuery: "",
assetTypeId: "Endpoint",
services: [],
data: {
data: [
{
Expand Down
71 changes: 9 additions & 62 deletions src/components/Assets/AssetList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import {
} from "react";
import { DefaultTheme, useTheme } from "styled-components";
import { dispatcher } from "../../../dispatcher";
import { getFeatureFlagValue } from "../../../featureFlags";
import { usePrevious } from "../../../hooks/usePrevious";
import { isEnvironment } from "../../../typeGuards/isEnvironment";
import { isNumber } from "../../../typeGuards/isNumber";
import { isString } from "../../../typeGuards/isString";
import { FeatureFlag } from "../../../types";
import { ConfigContext } from "../../common/App/ConfigContext";
import { DeploymentType } from "../../common/App/types";
import { EmptyState } from "../../common/EmptyState";
Expand Down Expand Up @@ -124,30 +122,15 @@ const getSortingCriterionInfo = (
[SORTING_CRITERION.PERFORMANCE_IMPACT]: {
label: "Performance impact",
defaultOrder: SORTING_ORDER.DESC
},
[SORTING_CRITERION.OVERALL_IMPACT]: {
label: "Overall impact",
defaultOrder: SORTING_ORDER.DESC
}
};

return sortingCriterionInfoMap[sortingCriterion];
};

const getSortingCriteria = (
isImpactHidden: boolean,
isOverallImpactHidden: boolean
) =>
const getSortingCriteria = (isImpactHidden: boolean) =>
Object.values(SORTING_CRITERION).filter(
(x) =>
!(
(isImpactHidden &&
[
SORTING_CRITERION.PERFORMANCE_IMPACT,
SORTING_CRITERION.OVERALL_IMPACT
].includes(x)) ||
(isOverallImpactHidden && x === SORTING_CRITERION.OVERALL_IMPACT)
)
(x) => !(isImpactHidden && x === SORTING_CRITERION.PERFORMANCE_IMPACT)
);

const getData = (
Expand All @@ -156,8 +139,6 @@ const getData = (
sorting: Sorting,
searchQuery: string,
filters: AssetFilterQuery | undefined,
services: string[] | undefined,
isComplexFilterEnabled: boolean,
isDirect?: boolean,
scopedSpanCodeObjectId?: string
) => {
Expand All @@ -175,13 +156,11 @@ const getData = (
...(searchQuery && searchQuery.length > 0
? { displayName: searchQuery }
: {}),
...(isComplexFilterEnabled
? filters || {
services: [],
operations: [],
insights: []
}
: { services: services || [] })
...(filters || {
services: [],
operations: [],
insights: []
})
}
}
});
Expand Down Expand Up @@ -217,19 +196,8 @@ export const AssetList = (props: AssetListProps) => {
const refreshTimerId = useRef<number>();
const previousEnvironment = usePrevious(config.environment);
const previousAssetTypeId = usePrevious(props.assetTypeId);
const previousServices = usePrevious(props.services);
const previousFilters = usePrevious(props.filters);
const previousViewScope = usePrevious(props.scopeViewOptions);
const isComplexFilterEnabled = useMemo(
() =>
Boolean(
getFeatureFlagValue(
config,
FeatureFlag.IS_ASSETS_COMPLEX_FILTER_ENABLED
)
),
[config]
);

const refreshData = useCallback(() => {
getData(
Expand All @@ -238,20 +206,16 @@ export const AssetList = (props: AssetListProps) => {
sorting,
props.searchQuery,
props.filters,
props.services,
isComplexFilterEnabled,
props.scopeViewOptions?.isDirect,
props.scopeViewOptions?.scopedSpanCodeObjectId
);
}, [
isComplexFilterEnabled,
page,
props.assetTypeId,
props.filters,
props.scopeViewOptions?.isDirect,
props.scopeViewOptions?.scopedSpanCodeObjectId,
props.searchQuery,
props.services,
sorting
]);

Expand All @@ -268,19 +232,10 @@ export const AssetList = (props: AssetListProps) => {
[config.backendInfo?.deploymentType, config.environment?.type]
);

const isOverallImpactHidden = Boolean(
getFeatureFlagValue(config, FeatureFlag.IS_ASSETS_OVERALL_IMPACT_HIDDEN)
);

const sortingCriteria = getSortingCriteria(
isImpactHidden,
isOverallImpactHidden
);
const sortingCriteria = getSortingCriteria(isImpactHidden);

const areAnyFiltersApplied = checkIfAnyFiltersApplied(
isComplexFilterEnabled,
props.filters,
props.services,
props.searchQuery
);

Expand Down Expand Up @@ -321,8 +276,6 @@ export const AssetList = (props: AssetListProps) => {
previousSearchQuery !== props.searchQuery) ||
(isString(previousAssetTypeId) &&
previousAssetTypeId !== props.assetTypeId) ||
(Array.isArray(previousServices) &&
previousServices !== props.services) ||
(previousFilters && previousFilters !== props.filters) ||
previousViewScope !== props.scopeViewOptions
) {
Expand All @@ -336,14 +289,12 @@ export const AssetList = (props: AssetListProps) => {
previousFilters,
previousPage,
previousSearchQuery,
previousServices,
previousSorting,
previousViewScope,
props.assetTypeId,
props.filters,
props.scopeViewOptions,
props.searchQuery,
props.services,
refreshData,
sorting
]);
Expand Down Expand Up @@ -372,10 +323,7 @@ export const AssetList = (props: AssetListProps) => {
useEffect(() => {
if (
isImpactHidden &&
[
SORTING_CRITERION.PERFORMANCE_IMPACT,
SORTING_CRITERION.OVERALL_IMPACT
].includes(sorting.criterion)
sorting.criterion === SORTING_CRITERION.PERFORMANCE_IMPACT
) {
setSorting({
criterion: SORTING_CRITERION.CRITICAL_INSIGHTS,
Expand Down Expand Up @@ -463,7 +411,6 @@ export const AssetList = (props: AssetListProps) => {
onAssetLinkClick={handleAssetLinkClick}
sortingCriterion={sorting.criterion}
isImpactHidden={isImpactHidden}
isOverallImpactHidden={isOverallImpactHidden}
/>
);
})}
Expand Down
4 changes: 1 addition & 3 deletions src/components/Assets/AssetList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export interface AssetListProps {
data?: AssetsData;
onBackButtonClick: () => void;
assetTypeId: string;
services?: string[];
filters?: AssetFilterQuery;
searchQuery: string;
scopeViewOptions: AssetScopeOption | null;
Expand All @@ -20,8 +19,7 @@ export enum SORTING_CRITERION {
SLOWEST_FIVE_PERCENT = "p95",
LATEST = "latest",
NAME = "displayname",
PERFORMANCE_IMPACT = "performanceimpact",
OVERALL_IMPACT = "overallimpact"
PERFORMANCE_IMPACT = "performanceimpact"
}

export enum SORTING_ORDER {
Expand Down
2 changes: 0 additions & 2 deletions src/components/Assets/AssetTypeList/AssetTypeList.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
searchQuery: "",
services: [],
data: {
assetCategories: [
{
Expand Down Expand Up @@ -55,7 +54,6 @@ export const Default: Story = {
export const Empty: Story = {
args: {
searchQuery: "",
services: [],
data: {
assetCategories: []
}
Expand Down
40 changes: 3 additions & 37 deletions src/components/Assets/AssetTypeList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
import {
useCallback,
useContext,
useEffect,
useMemo,
useRef,
useState
} from "react";
import { useCallback, useContext, useEffect, useRef, useState } from "react";
import { dispatcher } from "../../../dispatcher";
import { getFeatureFlagValue } from "../../../featureFlags";
import { usePrevious } from "../../../hooks/usePrevious";
import { isEnvironment } from "../../../typeGuards/isEnvironment";
import { isNull } from "../../../typeGuards/isNull";
import { isNumber } from "../../../typeGuards/isNumber";
import { isString } from "../../../typeGuards/isString";
import { FeatureFlag } from "../../../types";
import { ConfigContext } from "../../common/App/ConfigContext";
import { AssetFilterQuery } from "../AssetsFilter/types";
import { NoDataMessage } from "../NoDataMessage";
Expand Down Expand Up @@ -42,9 +33,7 @@ const ASSET_TYPE_IDS = [

const getData = (
filters: AssetFilterQuery | undefined,
services: string[] | undefined,
searchQuery: string,
isComplexFilterEnabled: boolean,
isDirect?: boolean,
scopedSpanCodeObjectId?: string
) => {
Expand All @@ -54,9 +43,7 @@ const getData = (
query: {
directOnly: isDirect,
scopedSpanCodeObjectId,
...(isComplexFilterEnabled
? filters || { services: [], operations: [], insights: [] }
: { services: services || [] }),
...(filters || { services: [], operations: [], insights: [] }),
...(searchQuery.length > 0 ? { displayName: searchQuery } : {})
}
}
Expand All @@ -75,38 +62,23 @@ export const AssetTypeList = (props: AssetTypeListProps) => {
const config = useContext(ConfigContext);
const previousEnvironment = usePrevious(config.environment);
const refreshTimerId = useRef<number>();
const previousServices = usePrevious(props.services);
const previousFilters = usePrevious(props.filters);
const previousSearchQuery = usePrevious(props.searchQuery);
const previousViewScope = usePrevious(props.scopeViewOptions);
const isComplexFilterEnabled = useMemo(
() =>
Boolean(
getFeatureFlagValue(
config,
FeatureFlag.IS_ASSETS_COMPLEX_FILTER_ENABLED
)
),
[config]
);

const refreshData = useCallback(
() =>
getData(
props.filters,
props.services,
props.searchQuery,
isComplexFilterEnabled,
props.scopeViewOptions?.isDirect,
props.scopeViewOptions?.scopedSpanCodeObjectId
),
[
isComplexFilterEnabled,
props.filters,
props.scopeViewOptions?.isDirect,
props.scopeViewOptions?.scopedSpanCodeObjectId,
props.searchQuery,
props.services
props.searchQuery
]
);

Expand All @@ -115,9 +87,7 @@ export const AssetTypeList = (props: AssetTypeListProps) => {
}, [refreshData, props.setRefresher]);

const areAnyFiltersApplied = checkIfAnyFiltersApplied(
isComplexFilterEnabled,
props.filters,
props.services,
props.searchQuery
);

Expand Down Expand Up @@ -154,8 +124,6 @@ export const AssetTypeList = (props: AssetTypeListProps) => {
if (
(isEnvironment(previousEnvironment) &&
previousEnvironment.id !== config.environment?.id) ||
(Array.isArray(previousServices) &&
previousServices !== props.services) ||
(previousFilters && previousFilters !== props.filters) ||
(isString(previousSearchQuery) &&
previousSearchQuery !== props.searchQuery) ||
Expand All @@ -168,12 +136,10 @@ export const AssetTypeList = (props: AssetTypeListProps) => {
previousEnvironment,
previousFilters,
previousSearchQuery,
previousServices,
previousViewScope,
props.filters,
props.scopeViewOptions,
props.searchQuery,
props.services,
refreshData
]);

Expand Down
1 change: 0 additions & 1 deletion src/components/Assets/AssetTypeList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { AssetScopeOption } from "../AssetsViewScopeConfiguration/types";
export interface AssetTypeListProps {
data?: AssetCategoriesData;
onAssetTypeSelect: (assetTypeId: string) => void;
services?: string[];
filters?: AssetFilterQuery;
searchQuery: string;
scopeViewOptions: AssetScopeOption | null;
Expand Down
Loading