Skip to content

Commit

Permalink
console: don't allow to setup syncs with API destination
Browse files Browse the repository at this point in the history
  • Loading branch information
absorbb committed Jan 4, 2024
1 parent 72e106b commit 90dcadb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 4 additions & 0 deletions webapps/console/lib/schema/destinations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ export function getCoreDestinationType(typeId: string): DestinationType {
return destinationType;
}

export function getCoreDestinationTypeNonStrict(typeId: string): DestinationType | undefined {
return coreDestinationsMap[typeId];
}

export const ClickhouseCredentials = z.object({
protocol: z
.enum(["http", "https", "clickhouse", "clickhouse-secure"])
Expand Down
6 changes: 4 additions & 2 deletions webapps/console/pages/[workspaceId]/syncs/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ErrorCard, GlobalError } from "../../../components/GlobalError/GlobalEr
import { useLinksQuery } from "../../../lib/queries";
import SyncEditorPage from "../../../components/SyncEditorPage/SyncEditorPage";
import { Redirect } from "../../../components/Redirect/Redirect";
import { getCoreDestinationTypeNonStrict } from "../../../lib/schema/destinations";

const Loader = () => {
const workspace = useWorkspace();
Expand All @@ -32,13 +33,14 @@ const Loader = () => {
return <GlobalError title={"Failed to load data from server"} error={result.error} />;
}
const [services, destinations, links] = result.data;
const bulkerDsts = destinations.filter(d => getCoreDestinationTypeNonStrict(d.destinationType)?.usesBulker);
//protection from faulty redirects to this page
if (services.length === 0) {
return <Redirect href={`/${workspace.slugOrId}/services`} />;
} else if (destinations.length === 0) {
} else if (bulkerDsts.length === 0) {
return <Redirect href={`/${workspace.slugOrId}/destinations`} />;
}
return <SyncEditorPage services={services} destinations={destinations} links={links} />;
return <SyncEditorPage services={services} destinations={bulkerDsts} links={links} />;
};

const RootComponent: React.FC = () => {
Expand Down
12 changes: 8 additions & 4 deletions webapps/console/pages/[workspaceId]/syncs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { CodeBlock } from "../../../components/CodeBlock/CodeBlock";
import { processTaskStatus, TaskStatus } from "./tasks";
import omit from "lodash/omit";
import { toURL } from "../../../lib/shared/url";
import { getCoreDestinationTypeNonStrict } from "../../../lib/schema/destinations";

dayjs.extend(relativeTime);
dayjs.extend(utc);
Expand Down Expand Up @@ -392,18 +393,21 @@ function Syncs(props: RemoteEntitiesProps) {
const destinationFilter = router.query.destination as string | undefined;
const srcFilter = router.query.source as string | undefined;
const workspace = useWorkspace();
if (props.services.length == 0 || props.destinations.length == 0) {
const bulkerDsts = destinations.filter(d => getCoreDestinationTypeNonStrict(d.destinationType)?.usesBulker);

if (services.length == 0 || bulkerDsts.length == 0) {
return (
<div className="flex flex-col justify-center items-center ">
<Inbox className="w-16 h-16 text-textDisabled" />
<div className="text-center mt-12 text text-textLight max-w-4xl">
In order to create a sync please create at least one destination and one connector. Currently, you have{" "}
In order to create a sync please create at least one connector and destination of <b>data warehouse</b> or{" "}
<b>cloud storage</b> type. Currently, you have{" "}
<Link href={`/${workspace.slug || workspace.id}/destinations`} className="underline">
{props.destinations.length} destination{props.destinations.length === 1 ? "" : "s"}
{bulkerDsts.length} destination{bulkerDsts.length === 1 ? "" : "s"}
</Link>{" "}
and{" "}
<Link href={`/${workspace.slug || workspace.id}/services`} className="underline">
{props.services.length} connector{props.services.length === 1 ? "" : "s"}
{services.length} connector{services.length === 1 ? "" : "s"}
</Link>{" "}
configured
</div>
Expand Down

1 comment on commit 90dcadb

@vercel
Copy link

@vercel vercel bot commented on 90dcadb Jan 4, 2024

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
d.askloan.tw
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
dog.jitsu.com
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
data.embeddables.com
dataqa.investing.com
dev.blazingboost.com
j.israeladvocate.org
mercury.stagehub.com
store.sidetrekai.com
teslahenry.github.io
data.hogarlylabs.tech
data.your-company.com
event.clickncruise.hu
event.clickncruise.ro
test-domain.jitsu.com
test.bigfootproof.com
teste.fazcomex.com.br
analytics.dev.knekt.io
loraboutiquedental.com
notion.twelftree.co.uk
dev-portal.zoopsign.com
event.tradejobsnz.co.nz
investing-poc.jitsu.dev
savvy-replay.jitsu.tech
data.analytics-smart.com
data.handelsregister.app
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
ingest-load-testing.jitsu.dev
jitsu.precisaosistemas.com.br
analytics.inspiresolutions.app
betteruptime-monitoring.jitsu.dev
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.