diff --git a/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/Attachments/AttachmentFiltersList.tsx b/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/Attachments/AttachmentFiltersList.tsx index ad6f7614cac..782adaa3cb5 100644 --- a/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/Attachments/AttachmentFiltersList.tsx +++ b/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/Attachments/AttachmentFiltersList.tsx @@ -24,7 +24,9 @@ export const AttachmentFiltersList: React.FC = ({ f const FilterListItem: React.FC<{ title: string; subtitle: string }> = ({ title, subtitle }) => { return (
-
{title}
+
+ {title} +
{subtitle}
diff --git a/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/Attachments/Attachments.tsx b/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/Attachments/Attachments.tsx index 34b42e8544c..909b2a4a6d6 100644 --- a/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/Attachments/Attachments.tsx +++ b/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/Attachments/Attachments.tsx @@ -5,7 +5,7 @@ import { FilterContextItem, IAutomationMetadataObject } from "@gooddata/sdk-mode import { Message } from "@gooddata/sdk-ui-kit"; import { AttachmentFilters, AttachmentFilterType } from "./AttachmentFilters.js"; import { useAttachmentDashboardFilters } from "../../hooks/useAttachmentDashboardFilters.js"; -import { getAutomationDashboardFilters } from "../../utils/getAutomationFilters.js"; +import { getAutomationDashboardFilters } from "../../utils/automationFilters.js"; export interface IAttachmentsProps { dashboardTitle: string; diff --git a/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.ts b/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.ts index 4fc288fadc4..6fe0c760b6d 100644 --- a/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.ts +++ b/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.ts @@ -15,7 +15,7 @@ import { Alignment, normalizeTime } from "@gooddata/sdk-ui-kit"; import { IScheduledEmailDialogProps } from "../../types.js"; import { toModifiedISOString } from "../../DefaultScheduledEmailManagementDialog/utils.js"; import { useAttachmentDashboardFilters } from "./useAttachmentDashboardFilters.js"; -import { getAutomationDashboardFilters } from "../utils/getAutomationFilters.js"; +import { getAutomationDashboardFilters, isDashboardAutomation } from "../utils/automationFilters.js"; export function useEditScheduledEmail(props: IScheduledEmailDialogProps) { const { editSchedule, webhooks } = props; @@ -89,9 +89,7 @@ export function useEditScheduledEmail(props: IScheduledEmailDialogProps) { dashboardTitle, filters, }); - const dashboardExportDefinitionExists = state.exportDefinitions?.some((exportDefinition) => - isExportDefinitionDashboardContent(exportDefinition.requestPayload.content), - ); + const dashboardExportDefinitionExists = isDashboardAutomation(state); const updatedExportDefinitions = dashboardExportDefinitionExists ? state.exportDefinitions?.map((exportDefinition) => isExportDefinitionDashboardContent(exportDefinition.requestPayload.content) diff --git a/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useSaveScheduledEmailToBackend.ts b/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useSaveScheduledEmailToBackend.ts index 767d82aa9df..b3af4dc4348 100644 --- a/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useSaveScheduledEmailToBackend.ts +++ b/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useSaveScheduledEmailToBackend.ts @@ -11,7 +11,7 @@ import { useUpdateScheduledEmail } from "./useUpdateScheduledEmail.js"; import { IScheduledEmailDialogProps } from "../../types.js"; import { IntlShape, useIntl } from "react-intl"; import omit from "lodash/omit.js"; -import { getAutomationDashboardFilters } from "../utils/getAutomationFilters.js"; +import { getAutomationDashboardFilters } from "../utils/automationFilters.js"; export function useSaveScheduledEmailToBackend( automation: IAutomationMetadataObject | IAutomationMetadataObjectDefinition, diff --git a/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/utils/automationFilters.ts b/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/utils/automationFilters.ts new file mode 100644 index 00000000000..3edee075f8c --- /dev/null +++ b/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/utils/automationFilters.ts @@ -0,0 +1,52 @@ +// (C) 2024 GoodData Corporation + +import { + FilterContextItem, + IAutomationMetadataObject, + IAutomationMetadataObjectDefinition, + IFilter, + isExportDefinitionDashboardContent, + isExportDefinitionVisualizationObjectContent, + isFilter, + isFilterContextItem, +} from "@gooddata/sdk-model"; + +export const isDashboardAutomation = ( + automation: IAutomationMetadataObject | IAutomationMetadataObjectDefinition | undefined, +) => { + if (!automation) { + return false; + } + + return automation?.exportDefinitions?.some((exportDefinition) => { + return isExportDefinitionDashboardContent(exportDefinition.requestPayload.content); + }); +}; + +export const getAutomationDashboardFilters = ( + automation: IAutomationMetadataObject | IAutomationMetadataObjectDefinition | undefined, +): FilterContextItem[] | undefined => { + if (!automation) { + return undefined; + } + + return automation.exportDefinitions + ?.find((exportDefinition) => { + return isExportDefinitionDashboardContent(exportDefinition.requestPayload.content); + }) + ?.requestPayload?.content.filters?.filter(isFilterContextItem); +}; + +export const getAutomationVisualizationFilters = ( + automation: IAutomationMetadataObject | IAutomationMetadataObjectDefinition | undefined, +): IFilter[] | undefined => { + if (!automation) { + return undefined; + } + + return automation.exportDefinitions + ?.find((exportDefinition) => { + return isExportDefinitionVisualizationObjectContent(exportDefinition.requestPayload.content); + }) + ?.requestPayload?.content.filters?.filter(isFilter); +}; diff --git a/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/utils/getAutomationFilters.ts b/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/utils/getAutomationFilters.ts deleted file mode 100644 index a338455e0cd..00000000000 --- a/libs/sdk-ui-dashboard/src/presentation/scheduledEmail/DefaultScheduledEmailDialog/utils/getAutomationFilters.ts +++ /dev/null @@ -1,22 +0,0 @@ -// (C) 2024 GoodData Corporation - -import { - IAutomationMetadataObject, - IAutomationMetadataObjectDefinition, - isExportDefinitionDashboardContent, - isFilterContextItem, -} from "@gooddata/sdk-model"; - -export const getAutomationDashboardFilters = ( - automation: IAutomationMetadataObject | IAutomationMetadataObjectDefinition | undefined, -) => { - if (!automation) { - return undefined; - } - - return automation.exportDefinitions - ?.find((exportDefinition) => { - return isExportDefinitionDashboardContent(exportDefinition.requestPayload.content); - }) - ?.requestPayload?.content.filters?.filter(isFilterContextItem); -}; diff --git a/libs/sdk-ui-dashboard/styles/scss/scheduled_mail.scss b/libs/sdk-ui-dashboard/styles/scss/scheduled_mail.scss index 49a6f071312..3e4edf38120 100644 --- a/libs/sdk-ui-dashboard/styles/scss/scheduled_mail.scss +++ b/libs/sdk-ui-dashboard/styles/scss/scheduled_mail.scss @@ -281,6 +281,9 @@ $min-content-height: 110px; } .gd-attachment-filters-list-item-title { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; color: kit-variables.$gd-color-link; font-size: 12px; font-style: normal;