Skip to content

Commit

Permalink
Merge pull request gooddata#5123 from gooddata/jsc/f1
Browse files Browse the repository at this point in the history
fix: scheduling filters title style
  • Loading branch information
hackerstanislav authored Jul 15, 2024
2 parents 186efe6 + 98585be commit 995316a
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export const AttachmentFiltersList: React.FC<IAttachmentFiltersListProps> = ({ f
const FilterListItem: React.FC<{ title: string; subtitle: string }> = ({ title, subtitle }) => {
return (
<div className="gd-attachment-filters-list-item">
<div className="gd-attachment-filters-list-item-title">{title}</div>
<div className="gd-attachment-filters-list-item-title" title={subtitle}>
{title}
</div>
<div className="gd-attachment-filters-list-item-subtitle" title={subtitle}>
{subtitle}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
};

This file was deleted.

3 changes: 3 additions & 0 deletions libs/sdk-ui-dashboard/styles/scss/scheduled_mail.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 995316a

Please sign in to comment.