Skip to content

Commit

Permalink
Merge pull request #5460 from gooddata/mkn-f1-739
Browse files Browse the repository at this point in the history
fix: show % in alerts description
  • Loading branch information
hackerstanislav authored Oct 9, 2024
2 parents ed11138 + de6c746 commit 57f6002
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Alerts } from "./components/AlertsList.js";
import { DeleteAlertConfirmDialog } from "./components/DeleteAlertConfirmDialog.js";
import { PauseAlertRunner } from "./components/PauseAlertRunner.js";
import { GoodDataSdkError } from "@gooddata/sdk-ui";
import { useDashboardSelector, selectIsWhiteLabeled } from "../../../model/index.js";

/**
* @alpha
Expand All @@ -34,6 +35,7 @@ export const AlertingManagementDialog: React.FC<IAlertingManagementDialogProps>
const [alertToDelete, setAlertToDelete] = useState<IAutomationMetadataObject | null>(null);
const [alertToPause, setAlertToPause] = useState<[IAutomationMetadataObject, boolean] | null>(null);
const intl = useIntl();
const isWhiteLabeled = useDashboardSelector(selectIsWhiteLabeled);

const handleAlertDelete = useCallback((alert: IAutomationMetadataObject) => {
setAlertToDelete(alert);
Expand Down Expand Up @@ -109,11 +111,13 @@ export const AlertingManagementDialog: React.FC<IAlertingManagementDialogProps>
</div>
<div className="gd-content-divider"></div>
<div className="gd-buttons">
<Hyperlink
text={intl.formatMessage({ id: helpTextId })}
href="https://www.gooddata.com/docs/cloud/create-dashboards/automation/alerts/"
iconClass="gd-icon-circle-question"
/>
{!isWhiteLabeled ? (
<Hyperlink
text={intl.formatMessage({ id: helpTextId })}
href="https://www.gooddata.com/docs/cloud/create-dashboards/automation/alerts/"
iconClass="gd-icon-circle-question"
/>
) : null}
<Button
onClick={onClose}
className="gd-button-secondary s-close-button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { useAlertValidation } from "../../../widget/insight/configuration/Insigh
import {
getAlertThreshold,
getOperatorTitle,
getValueSuffix,
} from "../../../widget/insight/configuration/InsightAlertConfig/utils.js";

interface IAlertProps {
Expand Down Expand Up @@ -62,7 +63,8 @@ export const Alert: React.FC<IAlertProps> = (props) => {
const insightWidget = isInsightWidget(widget) ? widget : undefined;
const widgetName = insightWidget?.title ?? "";

const subtitle = [`${getOperatorTitle(intl, alert.alert)} ${threshold}`, widgetName]
const valueSuffix = getValueSuffix(alert.alert) ?? "";
const subtitle = [`${getOperatorTitle(intl, alert.alert)} ${threshold}${valueSuffix}`, widgetName]
.filter(Boolean)
.join(" • ");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
selectEntitlementMaxAutomationRecipients,
selectEntitlementMinimumRecurrenceMinutes,
selectIsCrossFiltering,
selectIsWhiteLabeled,
} from "../../../model/index.js";
import { IScheduledEmailDialogProps } from "../types.js";
import { getDefaultCronExpression, useEditScheduledEmail } from "./hooks/useEditScheduledEmail.js";
Expand Down Expand Up @@ -72,6 +73,8 @@ export function ScheduledMailDialogRenderer({
IAutomationMetadataObject | IAutomationMetadataObjectDefinition | null
>(null);

const isWhiteLabeled = useDashboardSelector(selectIsWhiteLabeled);

const handleScheduleDeleteSuccess = () => {
onDeleteSuccess?.();
setScheduledEmailToDelete(null);
Expand Down Expand Up @@ -155,11 +158,13 @@ export function ScheduledMailDialogRenderer({
showProgressIndicator={isSavingScheduledEmail}
footerLeftRenderer={() => (
<div className="gd-notifications-channels-dialog-footer-link">
<Hyperlink
text={intl.formatMessage({ id: helpTextId })}
href="https://www.gooddata.com/docs/cloud/create-dashboards/automation/scheduled-exports/#ScheduleExportsinDashboards-ScheduleExport"
iconClass="gd-icon-circle-question"
/>
{!isWhiteLabeled ? (
<Hyperlink
text={intl.formatMessage({ id: helpTextId })}
href="https://www.gooddata.com/docs/cloud/create-dashboards/automation/scheduled-exports/#ScheduleExportsinDashboards-ScheduleExport"
iconClass="gd-icon-circle-question"
/>
) : null}
{scheduledExportToEdit ? (
<Button
className="gd-button-link-dimmed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
useDashboardSelector,
DEFAULT_MAX_AUTOMATIONS,
selectCanCreateAutomation,
selectIsWhiteLabeled,
} from "../../../model/index.js";
import { messages } from "../../../locales.js";
import { isMobileView } from "../DefaultScheduledEmailDialog/utils/responsive.js";
Expand All @@ -41,6 +42,7 @@ export const ScheduledEmailManagementDialog: React.FC<IScheduledEmailManagementD
const currentUser = useDashboardSelector(selectCurrentUser);
const maxAutomationsEntitlement = useDashboardSelector(selectEntitlementMaxAutomations);
const unlimitedAutomationsEntitlement = useDashboardSelector(selectEntitlementUnlimitedAutomations);
const isWhiteLabeled = useDashboardSelector(selectIsWhiteLabeled);
const maxAutomations = parseInt(maxAutomationsEntitlement?.value ?? DEFAULT_MAX_AUTOMATIONS, 10);
const intl = useIntl();

Expand Down Expand Up @@ -108,11 +110,13 @@ export const ScheduledEmailManagementDialog: React.FC<IScheduledEmailManagementD
</div>
<div className="gd-content-divider"></div>
<div className="gd-buttons">
<Hyperlink
text={intl.formatMessage({ id: helpTextId })}
href="https://www.gooddata.com/docs/cloud/create-dashboards/automation/scheduled-exports/#ScheduleExportsinDashboards-ScheduleExport"
iconClass="gd-icon-circle-question"
/>
{!isWhiteLabeled ? (
<Hyperlink
text={intl.formatMessage({ id: helpTextId })}
href="https://www.gooddata.com/docs/cloud/create-dashboards/automation/scheduled-exports/#ScheduleExportsinDashboards-ScheduleExport"
iconClass="gd-icon-circle-question"
/>
) : null}
<Button
onClick={onClose}
className="gd-button-secondary s-close-button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useTheme } from "@gooddata/sdk-ui-theme-provider";
import { Icon } from "@gooddata/sdk-ui-kit";
import cx from "classnames";
import { AlertActionsDropdown } from "./AlertActionsDropdown.js";
import { getAlertThreshold, getOperatorTitle } from "./utils.js";
import { getAlertThreshold, getOperatorTitle, getValueSuffix } from "./utils.js";
import { gdColorNegative } from "../../../../constants/colors.js";
import { useAlertValidation } from "./hooks/useAlertValidation.js";
import {
Expand All @@ -33,7 +33,10 @@ export const AlertsListItem: React.FC<IAlertsListItemProps> = ({
const theme = useTheme();
const intl = useIntl();
const isPaused = alert.alert?.trigger?.state === "PAUSED";
const description = `${getOperatorTitle(intl, alert.alert)} ${getAlertThreshold(alert.alert)}`;
const valueSuffix = getValueSuffix(alert.alert) ?? "";
const description = `${getOperatorTitle(intl, alert.alert)} ${getAlertThreshold(
alert.alert,
)}${valueSuffix}`;
const { isValid } = useAlertValidation(alert);
const currentUser = useDashboardSelector(selectCurrentUser);
const canManageWorkspace = useDashboardSelector(selectCanManageWorkspace);
Expand Down

0 comments on commit 57f6002

Please sign in to comment.