Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/newjitsu' into newjitsu
Browse files Browse the repository at this point in the history
  • Loading branch information
absorbb committed Dec 2, 2023
2 parents 9fe6189 + 90f741c commit edf6475
Show file tree
Hide file tree
Showing 12 changed files with 218 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type EditorTitleProps<T extends { id: string } = { id: string }> = {
export const EditorTitle: React.FC<EditorTitleProps> = ({ title, subtitle, onBack }) => {
return (
<>
<div className="flex justify-between pt-6 pb-6 mb-0 items-center ">
<div className="flex justify-between pt-6 pb-4 mb-0 items-center ">
<h1 className="text-3xl">{title}</h1>
<div>
<JitsuButton icon={<ChevronLeft className="w-6 h-6" />} type="link" size="small" onClick={onBack}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ export const ConnectionsDiagram: React.FC<ConnectionDiagramProps> = ({
key={s.id}
ref={connectorsRef.current[idx] as any}
className="cursor-pointer mb-4"
onClick={() => console.log("Clicked", s.id)}
onMouseOver={() => {
setMouseOverSrc(s.id);
}}
Expand Down Expand Up @@ -281,7 +280,6 @@ export const ConnectionsDiagram: React.FC<ConnectionDiagramProps> = ({
key={s.id}
ref={srcRefs.current[idx] as any}
className="cursor-pointer mb-4"
onClick={() => console.log("Clicked", s.id)}
onMouseOver={() => {
setMouseOverSrc(s.id);
}}
Expand Down
31 changes: 31 additions & 0 deletions webapps/console/components/EditorToolbar/EditorToolbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React, { ReactNode } from "react";
import classNames from "classnames";
import Link from "next/link";

export type EditorToolbarProps = {
items: {
title: ReactNode;
icon: ReactNode;
href: string;
onClick?: () => void;
}[];
className?: string;
};

export const EditorToolbar: React.FC<EditorToolbarProps> = ({ items, className }) => {
return (
<div className={classNames(className, `flex flex-nowrap items-center gap-2`)}>
{items.map(({ href, icon, title, onClick }, index) => (
<Link
key={index}
href={href}
className="flex items-center space-x-2 border border-textLight px-2 py-1 rounded text-textLight text-xs"
onClick={onClick}
>
<div className="h-4 w-4">{icon}</div>
<span>{title}</span>
</Link>
))}
</div>
);
};
10 changes: 9 additions & 1 deletion webapps/console/components/ObjectTitle/ObjectTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import React from "react";
import Link from "next/link";
import { FaExternalLinkAlt } from "react-icons/fa";

export const ObjectTitle: React.FC<{
size?: "small" | "default" | "large";
icon?: React.ReactNode;
title: string | React.ReactNode;
}> = ({ icon, title, size = "default" }) => {
href?: string;
}> = ({ icon, title, size = "default", href }) => {
const iconClassName = (() => {
switch (size) {
case "small":
Expand All @@ -19,6 +22,11 @@ export const ObjectTitle: React.FC<{
<div className={`flex overflow-auto items-center ${size !== "small" ? "gap-3" : "gap-2"}`}>
{icon && <div className={iconClassName}>{icon}</div>}
<div className={`text-text truncate overflow-hidden ${size !== "small" ? "font-semibold" : ""}`}>{title}</div>
{href && (
<Link className={size === "small" ? `-ml-1` : `-ml-2`} href={href}>
<FaExternalLinkAlt className="w-2.5 h-2.5" />
</Link>
)}
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ function PageHeader() {
title: "Connectors",
icon: <PlugZap className="w-full h-full" />,
items: [
{ title: "Connected Services", path: "/services", icon: <ServerCog className="w-full h-full" /> },
{ title: "Service Connections", path: "/services", icon: <ServerCog className="w-full h-full" /> },
{ title: "Syncs", path: "/syncs", icon: <Share2 className="w-full h-full" /> },
{ title: "All Logs", path: "/syncs/tasks", icon: <ScrollText className="w-full h-full" /> },
],
Expand Down
21 changes: 3 additions & 18 deletions webapps/console/pages/[workspaceId]/connections/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { TableProps } from "antd/es/table/InternalTable";
import { ColumnType, SortOrder } from "antd/es/table/interface";
import { Activity, Edit3, Inbox, XCircle } from "lucide-react";
import { PlusOutlined } from "@ant-design/icons";
import { JitsuButton, WJitsuButton } from "../../../components/JitsuButton/JitsuButton";
import { WJitsuButton } from "../../../components/JitsuButton/JitsuButton";
import { DestinationTitle } from "../destinations";
import { ButtonGroup, ButtonProps } from "../../../components/ButtonGroup/ButtonGroup";
import { StreamTitle } from "../streams";
Expand Down Expand Up @@ -152,14 +152,7 @@ function ConnectionsTable({ links, streams, destinations, functions, reloadCallb
}
return (
<div className="flex items-center">
<StreamTitle stream={stream} />
<WJitsuButton
href={`/streams?id=${link.fromId}`}
type="link"
className="link"
size="small"
icon={<FaExternalLinkAlt className="w-2.5 h-2.5" />}
/>
<StreamTitle stream={stream} link />
</div>
);
},
Expand All @@ -179,17 +172,9 @@ function ConnectionsTable({ links, streams, destinations, functions, reloadCallb
if (!destination) {
return <div>Destination not found</div>;
}
const coreDestinationType = getCoreDestinationType(destination.destinationType);
return (
<div className="flex items-center">
<DestinationTitle destination={destination} />
<JitsuButton
type="link"
icon={<FaExternalLinkAlt className="w-2.5 h-2.5" />}
className="link"
size="small"
href={`/${workspace.id}/destinations?id=${link.toId}`}
/>
<DestinationTitle destination={destination} link />
</div>
);
},
Expand Down
40 changes: 38 additions & 2 deletions webapps/console/pages/[workspaceId]/destinations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { useQueryStringState } from "../../lib/useQueryStringState";
import { CustomWidgetProps } from "../../components/ConfigObjectEditor/Editors";
import { Htmlizer } from "../../components/Htmlizer/Htmlizer";
import omit from "lodash/omit";
import { EditorToolbar } from "../../components/EditorToolbar/EditorToolbar";

const log = getLog("destinations");
const Loader: React.FC<{}> = () => {
Expand Down Expand Up @@ -198,13 +199,16 @@ function getEditorComponent(editor: string, editorProps?: any) {
export const DestinationTitle: React.FC<{
destination?: DestinationConfig;
size?: "small" | "default" | "large";
title?: (d: DestinationConfig, t: DestinationType) => string | React.ReactNode;
}> = ({ destination, title = (d, t) => d.name, size = "default" }) => {
title?: (d: DestinationConfig, t: DestinationType) => React.ReactNode;
link?: boolean;
}> = ({ destination, title = (d, t) => d.name, size = "default", link }) => {
const w = useWorkspace();
const destinationType = coreDestinationsMap[destination?.destinationType ?? ""];
return (
<ObjectTitle
icon={getDestinationIcon(destinationType)}
size={size}
href={link && destination ? `/${w.slugOrId}/destinations?id=${destination.id}` : undefined}
title={destination ? title(destination, destinationType) : "Unknown destination"}
/>
);
Expand Down Expand Up @@ -668,6 +672,38 @@ const DestinationsList: React.FC<{ type?: string }> = ({ type }) => {
</div>
);
},
subtitle: (obj: DestinationConfig, isNew: boolean) => {
if (isNew) {
return undefined;
}

return (
<EditorToolbar
items={
[
obj.provisioned || obj.destinationType === "clickhouse"
? {
title: "SQL Query Editor",
icon: <TerminalSquare className="w-full h-full" />,
href: `/${workspace.slugOrId}/sql?destinationId=${obj.id}`,
}
: undefined,
{
title: "Connected Sources",
icon: <Zap className="w-full h-full" />,
href: `/${workspace.slugOrId}/connections?destination=${obj.id}`,
},
{
title: "Syncs",
icon: <Share2 className="w-full h-full" />,
href: `/${workspace.slugOrId}/syncs?destination=${obj.id}`,
},
].filter(Boolean) as any
}
className="mb-4"
/>
);
},
};
return (
<>
Expand Down
84 changes: 64 additions & 20 deletions webapps/console/pages/[workspaceId]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function HoverBorder({ children, forceHover }: { children: ReactNode; forceHover
return (
<div
className={classNames(
"border border-transparent transition duration-150 rounded-lg",
"border border-transparent transition duration-150 rounded-lg w-full",
hover ? "border-primary" : "border-primaryLighter"
)}
onMouseEnter={() => setHover(true)}
Expand All @@ -42,42 +42,60 @@ function HoverBorder({ children, forceHover }: { children: ReactNode; forceHover
);
}

function ConditionalBadge({ icon, tooltip, children }: { icon?: ReactNode; tooltip?: ReactNode; children: ReactNode }) {
if (!icon) {
return <>{children}</>;
}
return (
<Badge className="w-full block min-w-full" count={tooltip ? <Tooltip title={tooltip}>{icon}</Tooltip> : icon}>
{children}
</Badge>
);
}

function Card({
title,
configLink,
icon,
selected,
badge,
actions,
}: {
title: string;
configLink?: string;
icon: ReactNode;
actions?: { label: ReactNode; icon?: ReactNode; href: string }[];
selected?: boolean;
badge?: {
icon: ReactNode;
tooltip?: ReactNode;
};
}) {
const card = (
<HoverBorder forceHover={selected}>
<div className={classNames(`w-full px-4 py-5 rounded-lg text-primary`)}>
<div className="flex flex-nowrap justify-between items-start">
<div className="flex flex-start items-center space-x-4">
<div className="w-6 h-6">{icon}</div>
<div className="text-lg py-0 text-neutral-600 text-ellipsis">
<LabelEllipsis maxLen={29}>{title}</LabelEllipsis>
<ConditionalBadge icon={badge?.icon} tooltip={badge?.tooltip}>
<HoverBorder forceHover={selected}>
<div className={classNames(`w-full px-4 py-5 rounded-lg text-primary`)}>
<div className="flex flex-nowrap justify-between items-start">
<div className="flex flex-start items-center space-x-4">
<div className="w-6 h-6">{icon}</div>
<div className="text-lg py-0 text-neutral-600 text-ellipsis">
<LabelEllipsis maxLen={29}>{title}</LabelEllipsis>
</div>
</div>
{actions && actions.length > 0 && (
<ButtonGroup
dotsButtonProps={{
size: "small",
type: "ghost",
icon: <MoreVertical strokeWidth={2} className="text-textLight w-5 h-5" />,
}}
items={actions.map(a => ({ ...a, collapsed: true }))}
/>
)}
</div>
{actions && actions.length > 0 && (
<ButtonGroup
dotsButtonProps={{
size: "small",
type: "ghost",
icon: <MoreVertical strokeWidth={2} className="text-textLight w-5 h-5" />,
}}
items={actions.map(a => ({ ...a, collapsed: true }))}
/>
)}
</div>
</div>
</HoverBorder>
</HoverBorder>
</ConditionalBadge>
);
return configLink ? <a href={configLink}>{card}</a> : card;
}
Expand Down Expand Up @@ -203,6 +221,19 @@ function WorkspaceOverview(props: {
src={`/api/sources/logo?package=${encodeURIComponent(cfg.package)}&protocol=${cfg.protocol}`}
/>
}
badge={
links?.find(l => l.fromId === id)
? undefined
: {
icon: (
<div className="bg-warning w-5 h-5 rounded-full flex items-center justify-center font-bold text-text">
!
</div>
),
tooltip:
"The source is not connected to any destination. Connect it to any destination to start seeing the data",
}
}
title={name || id}
configLink={`/${workspace.slug || workspace.id}/services?id=${id}`}
actions={[
Expand Down Expand Up @@ -233,6 +264,19 @@ function WorkspaceOverview(props: {
selected={forceSelect}
icon={<FaviconLoader potentialUrl={name} />}
title={name || id}
badge={
links.find(l => l.fromId === id)
? undefined
: {
icon: (
<div className="bg-warning w-5 h-5 rounded-full flex items-center justify-center font-bold text-text">
!
</div>
),
tooltip:
"The source is not connected to any destination. Connect it to any destination to start seeing the data",
}
}
configLink={`/${workspace.slug || workspace.id}/streams?id=${id}`}
actions={[
{ label: "Edit", href: `/streams?id=${id}`, icon: <Edit3 className={"w-4 h-4"} /> },
Expand Down
5 changes: 4 additions & 1 deletion webapps/console/pages/[workspaceId]/services.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export const ServiceTitle: React.FC<{
service?: ServiceConfig;
size?: "small" | "default" | "large";
title?: (d: ServiceConfig) => string | React.ReactNode;
}> = ({ service, title = d => d.name, size = "default" }) => {
link?: boolean;
}> = ({ service, title = d => d.name, size = "default", link }) => {
const workspace = useWorkspace();
return (
<ObjectTitle
icon={
Expand All @@ -45,6 +47,7 @@ export const ServiceTitle: React.FC<{
/>
}
size={size}
href={link && service ? `/${workspace.slugOrId}/services?id=${service?.id}` : undefined}
title={service ? title(service) : "Unknown service"}
/>
);
Expand Down
Loading

1 comment on commit edf6475

@vercel
Copy link

@vercel vercel bot commented on edf6475 Dec 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

new-jitsu – ./webapps/console

ag.ru
logu.au
ozon.ru
sse.ere
erxes.io
baidu.dom
sambla.se
bobsec.com
sambla.com
agro4u.life
bluetick.ai
protontv.eu
t.quenti.io
alicesec.com
dev.aclis.io
docs.dh19.de
docs.dh19.eu
joseviso.com
mydomain.dom
t.democo.dev
t.shoppub.io
t2.jitsu.com
timeplus.com
zoopsign.com
*.d.jitsu.com
beta.mitzu.io
d.versatus.io
data.light.so
data.loudy.co
data.schej.it
imusician.app
imusician.pro
jitsu.logu.au
jitsu.www1.ru
t.thequack.ai
thinkr.com.br
use.jitsu.com
usepolygon.io
www.sambla.se
ajewellers.com
data.uselog.io
gpt.whatfa.com
sidetrekai.com
t.papermark.io
t.saasmonk.app
use2.jitsu.com
www.kellen.top
*.dataspecc.com
app.bluetick.ai
caddy.jitsu.com
data.askloan.tw
enterticket.com
events.mitzu.io
jitsu.efeer.com
jitsu.ivve.tech
krestomatio.com
sevenbillion.co
xrt.webxr.tools
www.sevenbillion.co
analytics.mtrsvc.com
data.embeddables.com
mercury.stagehub.com
store.sidetrekai.com
teslahenry.github.io
data.hogarlylabs.tech
event.clickncruise.hu
event.clickncruise.ro
test-domain.jitsu.com
teste.fazcomex.com.br
analytics.dev.knekt.io
loraboutiquedental.com
notion.twelftree.co.uk
dev-portal.zoopsign.com
event.tradejobsnz.co.nz
savvy-replay.jitsu.tech
data.analytics-smart.com
event.clickncruise.co.uk
jt.fairhopeweb.github.io
savvy-replay2.jitsu.tech
savvy-replay3.jitsu.tech
savvy-replay4.jitsu.tech
track.alquimiaweb.com.br
track.pressance-group.jp
track.uniquecafes.com.br
colectha.agenciavoolu.com
kolectha.agenciavoolu.com
lp.loraboutiquedental.com
stage-portal.zoopsign.com
new-jitsu-jitsu.vercel.app
lodercom-colectha.voolu.shop
warehouse1.trendstyle.com.au
d0.livingdesignsfurniture.com
jitsu.precisaosistemas.com.br
analytics.inspiresolutions.app
canvas.livingdesignsfurniture.com
analytics.dev.inspiresolutions.app
clm2jikrm00002v6r5l6niws3.d.jitsu.com
new-jitsu-git-newjitsu-jitsu.vercel.app
3000-rajaraodv-customerdemo-nmpsqwflswt.ws-us102.gitpod.io
new.jitsu.dev

Please sign in to comment.