Skip to content

Commit

Permalink
chore(root): Release 2024-10-10 08:05 (#6671)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Oct 10, 2024
2 parents 6ed674f + d5b284d commit 72f99e3
Show file tree
Hide file tree
Showing 58 changed files with 1,808 additions and 759 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@
"unarchived",
"Unarchived",
"Unfetch",
"unplugin",
"Unpromoted",
"unpublish",
"unsub",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BadRequestException, Logger, Injectable } from '@nestjs/common';
import axios from 'axios';
import { HealthCheck } from '@novu/framework';
import { HealthCheck, GetActionEnum, HttpQueryKeysEnum } from '@novu/framework';
import { GetBridgeStatusCommand } from './get-bridge-status.command';

const axiosInstance = axios.create();
Expand All @@ -11,7 +11,10 @@ export const LOG_CONTEXT = 'GetBridgeStatusUsecase';
export class GetBridgeStatus {
async execute(command: GetBridgeStatusCommand): Promise<HealthCheck> {
try {
const response = await axiosInstance.get<HealthCheck>(`${command.bridgeUrl}?action=health-check`, {
const bridgeActionUrl = new URL(command.bridgeUrl);
bridgeActionUrl.searchParams.set(HttpQueryKeysEnum.ACTION, GetActionEnum.HEALTH_CHECK);

const response = await axiosInstance.get<HealthCheck>(bridgeActionUrl.toString(), {
headers: {
'Bypass-Tunnel-Reminder': 'true',
'content-type': 'application/json',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createHmac } from 'crypto';
import axios from 'axios';
import { BadRequestException, Injectable } from '@nestjs/common';
import { PostActionEnum, HttpQueryKeysEnum } from '@novu/framework';

import { EnvironmentRepository } from '@novu/dal';
import { decryptApiKey } from '@novu/application-generic';
Expand All @@ -23,9 +24,12 @@ export class PreviewStep {
try {
const payload = this.mapPayload(command);
const novuSignatureHeader = this.buildNovuSignature(environment, payload);
const url = `${bridgeUrl}?action=preview&workflowId=${command.workflowId}&stepId=${command.stepId}`;
const bridgeActionUrl = new URL(bridgeUrl);
bridgeActionUrl.searchParams.set(HttpQueryKeysEnum.ACTION, PostActionEnum.PREVIEW);
bridgeActionUrl.searchParams.set(HttpQueryKeysEnum.WORKFLOW_ID, command.workflowId);
bridgeActionUrl.searchParams.set(HttpQueryKeysEnum.STEP_ID, command.stepId);

const response = await axiosInstance.post(url, payload, {
const response = await axiosInstance.post(bridgeActionUrl.toString(), payload, {
headers: {
'content-type': 'application/json',
'x-novu-signature': novuSignatureHeader,
Expand Down
4 changes: 4 additions & 0 deletions apps/dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<title>Vite + React + TS</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Ubuntu+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap"
rel="stylesheet"
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
"@hookform/resolvers": "^2.9.1",
"@novu/react": "^2.3.0",
"@novu/shared": "workspace:*",
"@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-popover": "^1.1.1",
"@radix-ui/react-progress": "^1.1.0",
"@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-scroll-area": "^1.2.0",
"@radix-ui/react-select": "^2.1.2",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.3",
"@segment/analytics-next": "^1.73.0",
"@tanstack/react-query": "^4.20.4",
"@tanstack/react-query": "^5.59.6",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"date-fns": "^4.1.0",
Expand Down
6 changes: 3 additions & 3 deletions apps/dashboard/src/components/dashboard-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { SideNavigation } from './side-navigation';

export const DashboardLayout = ({ children }: { children: ReactNode }) => {
return (
<div className="relative flex h-screen w-full">
<div className="relative flex w-full">
<SideNavigation />
<div className="flex min-h-screen flex-1 flex-col overflow-y-auto overflow-x-hidden">
<div className="flex flex-1 flex-col overflow-y-auto overflow-x-hidden">
<div className="bg-background flex h-16 w-full items-center justify-between border-b p-4">
<a
href="/legacy/integrations"
Expand All @@ -22,7 +22,7 @@ export const DashboardLayout = ({ children }: { children: ReactNode }) => {
</div>
</div>

<div className="overflow-y-auto overflow-x-hidden">{children}</div>
<div className="flex min-h-[calc(100dvh-4rem)] flex-col overflow-y-auto overflow-x-hidden">{children}</div>
</div>
</div>
);
Expand Down
101 changes: 101 additions & 0 deletions apps/dashboard/src/components/default-pagination.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import {
Pagination,
PaginationContent,
PaginationItem,
PaginationStart,
PaginationPrevious,
PaginationLink,
PaginationEllipsis,
PaginationNext,
PaginationEnd,
} from '@/components/primitives/pagination';

type DefaultPaginationProps = {
offset: number;
limit: number;
totalCount: number;
hrefFromOffset: (offset: number) => string;
};

export const DefaultPagination = (props: DefaultPaginationProps) => {
const { hrefFromOffset, offset, limit, totalCount } = props;
const currentPage = Math.floor(offset / limit) + 1;
const totalPages = Math.ceil(totalCount / limit);
const startPage = Math.max(1, currentPage - 2);
const endPage = Math.min(totalPages, currentPage + 2);

return (
<Pagination>
<PaginationContent>
<PaginationItem>
<PaginationStart to={hrefFromOffset(0)} />
</PaginationItem>
<PaginationItem>
<PaginationPrevious to={hrefFromOffset(Math.max(0, offset - limit))} isDisabled={currentPage === 1} />
</PaginationItem>
{(() => {
const pageItems = [];

if (startPage > 1) {
pageItems.push(
<PaginationItem key={1}>
<PaginationLink to={hrefFromOffset(0)}>1</PaginationLink>
</PaginationItem>
);

if (startPage > 2) {
pageItems.push(
<PaginationItem key="ellipsis">
<PaginationEllipsis />
</PaginationItem>
);
}
}

for (let i = startPage; i <= endPage; i++) {
pageItems.push(
<PaginationItem key={i}>
<PaginationLink to={hrefFromOffset((i - 1) * limit)} isActive={i === currentPage}>
{i}
</PaginationLink>
</PaginationItem>
);
}

if (endPage < totalPages) {
if (endPage < totalPages - 1) {
pageItems.push(
<PaginationItem key="ellipsis-end">
<PaginationEllipsis />
</PaginationItem>
);
}

pageItems.push(
<PaginationItem key={totalPages}>
<PaginationLink to={hrefFromOffset((totalPages - 1) * limit)}>{totalPages}</PaginationLink>
</PaginationItem>
);
}

pageItems.push(
<PaginationItem key="next">
<PaginationNext
to={hrefFromOffset(Math.min(offset + limit, (totalPages - 1) * limit))}
isDisabled={currentPage === totalPages}
/>
</PaginationItem>
);

pageItems.push(
<PaginationItem key="end">
<PaginationEnd to={hrefFromOffset((totalPages - 1) * limit)} isDisabled={currentPage === totalPages} />
</PaginationItem>
);

return pageItems;
})()}
</PaginationContent>
</Pagination>
);
};
2 changes: 1 addition & 1 deletion apps/dashboard/src/components/primitives/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const buttonVariants = cva(
'bg-gradient-to-b from-destructive/90 to-destructive text-destructive-foreground shadow-[inset_0_-4px_2px_-2px_hsl(var(--destructive)),inset_0_0_0_1px_rgba(255,255,255,0.16),0_0_0_1px_hsl(var(--destructive)),0px_1px_2px_0px_#0E121B3D] after:content-[""] after:absolute after:w-full after:h-full after:bg-gradient-to-b after:from-background/10 after:opacity-0 hover:after:opacity-100 after:rounded-lg after:transition-opacity after:duration-300',
outline: 'border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground',
ghost: 'hover:bg-accent',
link: 'text-primary underline-offset-4 hover:underline',
link: 'underline-offset-4 hover:underline',
light:
'bg-destructive/10 hover:bg-background hover:border hover:border-destructive text-destructive focus-visible:ring-destructive/10 focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:bg-background focus-visible:border focus-visible:border-destructive',
},
Expand Down
10 changes: 7 additions & 3 deletions apps/dashboard/src/components/primitives/pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {

import { cn } from '@/utils/ui';
import { ButtonProps, buttonVariants } from '@/components/primitives/button';
import { Link, LinkProps } from 'react-router-dom';

const Pagination = ({ className, ...props }: React.ComponentProps<'nav'>) => (
<nav
Expand All @@ -34,17 +35,20 @@ PaginationItem.displayName = 'PaginationItem';

type PaginationLinkProps = {
isActive?: boolean;
isDisabled?: boolean;
} & Pick<ButtonProps, 'size'> &
React.ComponentProps<'a'>;
LinkProps;

const PaginationLink = ({ className, isActive, size = 'icon', ...props }: PaginationLinkProps) => (
<a
const PaginationLink = ({ className, isActive, isDisabled, size = 'icon', ...props }: PaginationLinkProps) => (
<Link
aria-current={isActive ? 'page' : undefined}
className={cn(
buttonVariants({
variant: 'ghost',
size,
}),
{ 'bg-neutral-50': isActive },
{ 'pointer-events-none cursor-default opacity-50': isDisabled },
'rounded-none',
className
)}
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/components/primitives/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const SelectTrigger = React.forwardRef<
<SelectPrimitive.Trigger
ref={ref}
className={cn(
'border-input ring-offset-background placeholder:text-muted-foreground focus:ring-ring shadow-xs flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm focus:outline-none focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
'border-input ring-offset-background text-foreground-600 placeholder:text-foreground-400 focus:ring-ring shadow-xs flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm focus:outline-none focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
className
)}
{...props}
Expand Down
7 changes: 7 additions & 0 deletions apps/dashboard/src/components/primitives/skeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { cn } from '@/utils/ui';

function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
return <div className={cn('bg-neutral-alpha-100 animate-pulse rounded-md', className)} {...props} />;
}

export { Skeleton };
2 changes: 1 addition & 1 deletion apps/dashboard/src/components/primitives/step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const stepVariants = cva(
destructive: 'border-destructive/30 bg-neutral-50 text-destructive/30',
},
size: {
default: 'p-2 [&>svg]:size-3.5',
default: 'p-1 [&>svg]:size-3.5',
},
},
defaultVariants: {
Expand Down
11 changes: 2 additions & 9 deletions apps/dashboard/src/components/primitives/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,8 @@ const TableHead = React.forwardRef<HTMLTableCellElement, React.ThHTMLAttributes<
TableHead.displayName = 'TableHead';

const TableCell = React.forwardRef<HTMLTableCellElement, React.TdHTMLAttributes<HTMLTableCellElement>>(
({ className, ...props }, ref) => <td ref={ref} className={cn('p-2 align-middle', className)} {...props} />
({ className, ...props }, ref) => <td ref={ref} className={cn('px-6 py-2 align-middle', className)} {...props} />
);
TableCell.displayName = 'TableCell';

const TableCaption = React.forwardRef<HTMLTableCaptionElement, React.HTMLAttributes<HTMLTableCaptionElement>>(
({ className, ...props }, ref) => (
<caption ref={ref} className={cn('text-foreground/50 mt-4 text-sm', className)} {...props} />
)
);
TableCaption.displayName = 'TableCaption';

export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell };
5 changes: 3 additions & 2 deletions apps/dashboard/src/components/primitives/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const tooltipContentVariants = cva(
{
variants: {
variant: {
default: 'bg-primary text-primary-foreground',
light: 'border border-stroke/20 bg-background shadow-xs',
default: 'bg-neutral-950 text-foreground-0',
light: 'border border-neutral-alpha-400 bg-background shadow-xs',
},
size: {
default: 'rounded-md',
Expand All @@ -26,6 +26,7 @@ const tooltipContentVariants = cva(
},
},
defaultVariants: {
size: 'default',
variant: 'default',
},
}
Expand Down
43 changes: 43 additions & 0 deletions apps/dashboard/src/components/truncated-text.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/primitives/tooltip';
import { cn } from '@/utils/ui';
import { useCallback, useEffect, useRef, useState } from 'react';

interface TruncatedTextProps {
text: string;
className?: string;
}

export default function TruncatedText({ text, className = '' }: TruncatedTextProps) {
const [isTruncated, setIsTruncated] = useState(false);
const textRef = useRef<HTMLDivElement>(null);

const checkTruncation = useCallback(() => {
if (textRef.current) {
const { scrollWidth, clientWidth } = textRef.current;
setIsTruncated(scrollWidth > clientWidth);
}
}, []);

useEffect(() => {
checkTruncation();
window.addEventListener('resize', checkTruncation);
return () => window.removeEventListener('resize', checkTruncation);
}, [checkTruncation]);

return (
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<span ref={textRef} className={cn('block truncate', className)}>
{text}
</span>
</TooltipTrigger>
{isTruncated && (
<TooltipContent>
<p>{text}</p>
</TooltipContent>
)}
</Tooltip>
</TooltipProvider>
);
}
Loading

0 comments on commit 72f99e3

Please sign in to comment.