Skip to content

Commit

Permalink
fix(ui): TE-2643 remove previous period compare btn
Browse files Browse the repository at this point in the history
  • Loading branch information
nalin-patidar committed Feb 10, 2025
1 parent 8b7d79c commit 5c2dc3b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 45 deletions.
7 changes: 1 addition & 6 deletions thirdeye-ui/e2e/pages/anomaly-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,7 @@ export class AnomalyViewPage extends BasePage {
async checkConfirmAnomalyActions() {
await expect(
this.page.getByTestId("feedback-collector-text")
).toHaveText(
"Confirm anomalyCompare with previous time period to confirm this is an anomaly"
);
).toHaveText("Confirm anomaly");
await expect(this.page.getByTestId("not-an-anomaly")).toHaveText(
"No, this is not an anomaly"
);
Expand All @@ -207,8 +205,5 @@ export class AnomalyViewPage extends BasePage {
await expect(this.page.getByTestId("investigate-anomaly")).toHaveText(
"Investigate Anomaly"
);
await expect(this.page.getByTestId("add-previous-period")).toHaveText(
"Add previous period to compare"
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ export const FeedbackCollector: FunctionComponent<FeedbackCollectorProps> = ({
<Typography variant="h4">
{t("label.confirm-anomaly")}
</Typography>
<Typography variant="body1">
{t(
"message.compare-with-previous-time-period-to-confirm-this"
)}
</Typography>
</Grid>
<Grid
item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
* See the License for the specific language governing permissions and limitations under
* the License.
*/
import { Box, Button, Grid } from "@material-ui/core";
import { Grid } from "@material-ui/core";
import React, { FunctionComponent, useMemo } from "react";
import { useTranslation } from "react-i18next";
import { useOutletContext, useSearchParams } from "react-router-dom";
import { Chart } from "../../components/anomalies-view/chart/chart.component";
import { TimeRangeQueryStringKey } from "../../components/time-range/time-range-provider/time-range-provider.interfaces";
Expand All @@ -30,7 +29,6 @@ export const AnomaliesViewValidatePage: FunctionComponent = () => {
const { anomaly, alertInsight } =
useOutletContext<AnomalyViewContainerPageOutletContext>();
const [searchParams, setSearchParams] = useSearchParams();
const { t } = useTranslation();

// Array of strings in ISO-8601 format
const additionalCharts: string[] = useMemo(() => {
Expand All @@ -56,24 +54,6 @@ export const AnomaliesViewValidatePage: FunctionComponent = () => {
return [Number(start), Number(end)];
}, [searchParams]);

const handleAddChartClick = (): void => {
const newState = [...additionalCharts];

// Use the last previous period as the new previous period
if (newState.length > 0) {
newState.push(newState[newState.length - 1]);
} else {
// Default to no offset from the start and end
newState.push("P1W");
}

searchParams.set(
ADDITIONAL_CHARTS_QUERY_PARAM_KEY,
JSON.stringify(newState)
);
setSearchParams(searchParams);
};

const handleDeleteChartClick = (idx: number): void => {
const removedElement = [...additionalCharts];

Expand Down Expand Up @@ -158,19 +138,6 @@ export const AnomaliesViewValidatePage: FunctionComponent = () => {
</Grid>
);
})}
<Grid item xs={12}>
<Box textAlign="right">
<Button
color="primary"
data-testid="add-previous-period"
style={{ backgroundColor: "#FFF" }}
variant="outlined"
onClick={handleAddChartClick}
>
{t("label.add-previous-period-to-compare")}
</Button>
</Box>
</Grid>
</Grid>
</Grid>
);
Expand Down

0 comments on commit 5c2dc3b

Please sign in to comment.