Skip to content

Commit

Permalink
feat: Filter connect page by connector config display name
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyxiao committed Dec 20, 2023
1 parent 88c627c commit feb2fdd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
10 changes: 6 additions & 4 deletions apps/web/app/connect/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {clerkClient} from '@clerk/nextjs'
import Image from 'next/image'

import {defConnectors} from '@usevenice/app-config/connectors/connectors.def'
import {kAccessToken} from '@usevenice/app-config/constants'
import {env} from '@usevenice/app-config/env'
Expand All @@ -14,11 +13,9 @@ import {
} from '@usevenice/cdk'
import {zConnectPageParams} from '@usevenice/engine-backend/router/endUserRouter'
import {makeUlid, z} from '@usevenice/util'

import {ClientRoot} from '@/components/ClientRoot'
import {SuperHydrate} from '@/components/SuperHydrate'
import {createServerComponentHelpers} from '@/lib-server/server-component-helpers'

import ConnectPage from './ConnectPage'
import {SetCookieAndRedirect} from './SetCookieAndRedirect'

Expand Down Expand Up @@ -65,9 +62,14 @@ export default async function ConnectPageContainer({
// Implement shorthand for specifying only connectorConfigId by connectorName
let connectorConfigId = params.connectorConfigId
if (!connectorConfigId && params.connectorName) {
const ints = await ssg.listConnectorConfigInfos.fetch({
let ints = await ssg.listConnectorConfigInfos.fetch({
connectorName: params.connectorName,
})
if (params.connectorConfigDisplayName) {
ints = ints.filter(
(int) => int.displayName === params.connectorConfigDisplayName,
)
}
if (ints.length === 1 && ints[0]?.id) {
connectorConfigId = ints[0]?.id
} else if (ints.length < 1) {
Expand Down
9 changes: 8 additions & 1 deletion packages/engine-backend/router/endUserRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ export const zConnectPageParams = z.object({
'Where to send user to after connect / if they press back button',
),
// TODO: How to make sure we actually have a typed api here and can use zProviderName
connectorName: z.string().nullish().describe('Which provider to use'),
connectorName: z
.string()
.nullish()
.describe('Filter connector config by connector name'),
connectorConfigDisplayName: z
.string()
.nullish()
.describe('Filter connector config by displayName '),
/** Launch the conector with config right away */
connectorConfigId: zId('ccfg').optional(),
/** Whether to show existing resources */
Expand Down

1 comment on commit feb2fdd

@vercel
Copy link

@vercel vercel bot commented on feb2fdd Dec 20, 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:

venice – ./

venice-git-production-venice.vercel.app
venice-venice.vercel.app
usevenice.vercel.app
app.venice.is

Please sign in to comment.