Skip to content

Commit

Permalink
revert alert treemap and chart
Browse files Browse the repository at this point in the history
  • Loading branch information
angorayc committed Jan 26, 2023
1 parent b65787c commit 609bf6c
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 1,233 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ import { InspectButtonContainer } from '../inspect';
import { DEFAULT_STACK_BY_FIELD0_SIZE, getAlertsRiskQuery } from '../alerts_treemap/query';
import type { AlertsTreeMapAggregation } from '../alerts_treemap/types';
import { useIsExperimentalFeatureEnabled } from '../../hooks/use_experimental_features';
import { getAlertsTreemapLensAttributes as getLensAttributes } from '../visualization_actions/lens_attributes/common/alerts/alerts_treemap';
import { SourcererScopeName } from '../../store/sourcerer/model';
import { VisualizationEmbeddable } from '../visualization_actions/visualization_embeddable';

const DEFAULT_HEIGHT = DEFAULT_MIN_CHART_HEIGHT + 134; // px

Expand Down Expand Up @@ -92,15 +89,6 @@ const AlertsTreemapPanelComponent: React.FC<Props> = ({
// create a unique, but stable (across re-renders) query id
const uniqueQueryId = useMemo(() => `${ALERTS_TREEMAP_ID}-${uuidv4()}`, []);
const isChartEmbeddablesEnabled = useIsExperimentalFeatureEnabled('chartEmbeddablesEnabled');
const timerange = useMemo(() => ({ from, to }), [from, to]);

const extraVisualizationOptions = useMemo(
() => ({
breakdownField: stackByField1,
filters,
}),
[stackByField1, filters]
);

const additionalFilters = useMemo(() => {
try {
Expand Down Expand Up @@ -133,7 +121,7 @@ const AlertsTreemapPanelComponent: React.FC<Props> = ({
stackByField1,
to,
}),
skip: !isPanelExpanded || isChartEmbeddablesEnabled,
skip: !isPanelExpanded,
indexName: signalIndexName,
queryName: ALERTS_QUERY_NAMES.TREE_MAP,
});
Expand Down Expand Up @@ -213,19 +201,7 @@ const AlertsTreemapPanelComponent: React.FC<Props> = ({
</HeaderSection>

{isPanelExpanded ? (
isChartEmbeddablesEnabled && getLensAttributes && timerange ? (
<VisualizationEmbeddable
extraActions={extraActions}
extraOptions={extraVisualizationOptions}
getLensAttributes={getLensAttributes}
height={`${DEFAULT_MIN_CHART_HEIGHT}px`}
id={`charts-embeddable-${uniqueQueryId}`}
inspectTitle={inspectTitle}
scopeId={SourcererScopeName.detections}
stackByField={stackByField0}
timerange={timerange}
/>
) : isLoadingAlerts ? (
isLoadingAlerts ? (
<EuiProgress color="accent" data-test-subj="progress" position="absolute" size="xs" />
) : (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ export interface DonutChartWrapperProps {
/* Make this position absolute in order to overlap the text onto the donut */
export const DonutTextWrapper = styled(EuiFlexGroup)<
EuiFlexGroupProps & {
$isChartEmbeddablesEnabled?: boolean;
$dataExists?: boolean;
$donutTextWrapperStyles?: FlattenSimpleInterpolation;
$isChartEmbeddablesEnabled?: boolean;
className?: string;
donutTextWrapperStyles?: FlattenSimpleInterpolation;
}
>`
top: ${({ $isChartEmbeddablesEnabled, $dataExists }) =>
Expand All @@ -79,8 +79,8 @@ export const DonutTextWrapper = styled(EuiFlexGroup)<
position: absolute;
z-index: 1;
${({ className, donutTextWrapperStyles }) =>
className && donutTextWrapperStyles ? `&.${className} {${donutTextWrapperStyles}}` : ''}
${({ className, $donutTextWrapperStyles }) =>
className && $donutTextWrapperStyles ? `&.${className} {${$donutTextWrapperStyles}}` : ''}
`;

export const StyledEuiFlexItem = styled(EuiFlexItem)`
Expand Down Expand Up @@ -116,11 +116,11 @@ const DonutChartWrapperComponent: React.FC<DonutChartWrapperProps> = ({
<StyledEuiFlexItem grow={isChartEmbeddablesEnabled}>
<DonutTextWrapper
$dataExists={dataExists}
$donutTextWrapperStyles={donutTextWrapperStyles}
$isChartEmbeddablesEnabled={isChartEmbeddablesEnabled}
alignItems="center"
className={donutTextWrapperClassName}
direction="column"
donutTextWrapperStyles={donutTextWrapperStyles}
gutterSize="none"
justifyContent="center"
>
Expand Down

This file was deleted.

Loading

0 comments on commit 609bf6c

Please sign in to comment.