-
Notifications
You must be signed in to change notification settings - Fork 53
feat: get creating, updating, deleting Integrations working #240
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
action={ | ||
<Switch | ||
checked={enabled} | ||
checked={integration?.isEnabled} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-drive
subheader={ | ||
<Stack direction="column"> | ||
<Typography>{name}</Typography> | ||
<Typography fontSize={12}>{status === 'auth-only' ? status : category.toUpperCase()}</Typography> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add in integration category
const updatedIntegrations = [...existingIntegrations, newIntegration]; | ||
|
||
mutate(updatedIntegrations, false); | ||
mutateIntegration(createRemoteIntegration(newIntegration), false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the pattern from the linked SWR reading for now
label: 'Active', | ||
value: 'active', | ||
label: 'Installed', | ||
value: 'installed', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renaming to Installed since you can have existing but disabled integrations
<Typography variant="body2" noWrap> | ||
<Card variant="outlined" className="h-32"> | ||
<Stack> | ||
<CardHeader avatar={icon} subheader={title} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make use of mui's CardHeader
, CardContent
so you get responsive for free
</FormControl> | ||
</Box> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used on sync log page
</Grid> | ||
</CardContent> | ||
</Card> | ||
</Box> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved from the dashboard page
oauth_client_secret: 941b846a-5a8c-48b8-b0e1-41b6d4bc4f1a | ||
- sync: | ||
- period_ms: 60000 | ||
- remote_provider_app_id: my_app_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
92d5053
to
9e4779c
Compare
export const APPLICATION_ID = 'a4398523-03a2-42dd-9681-c91e3e2efaf4'; | ||
|
||
// TODO: use Supaglue TS client | ||
export async function updateRemoteIntegration(data: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data can be typed
// TODO: get this on the server-side from the session | ||
export const APPLICATION_ID = 'a4398523-03a2-42dd-9681-c91e3e2efaf4'; | ||
|
||
// TODO: use Supaglue TS client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of this file can be DRYed
}} | ||
> | ||
Cancel | ||
</Button>{' '} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove {' '}
const newIntegration = { | ||
...integration, | ||
config: { | ||
providerAppId: '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this line necessary? Does it get overridden by the next line?
oauthScopes: oauthScopes.split(','), | ||
}, | ||
sync: { | ||
periodMs: 60 * 60 * 1000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 1x/hour what we want?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now
{providerToIcon(integrationCardInfo.providerName)} | ||
<Typography variant="subtitle1">{integrationCardInfo.name}</Typography> | ||
<Stack direction="row" className="items-center justify-center gap-2"> | ||
{providerToIcon(integrationCardInfo.providerName, 35)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ICON_SIZE?
|
||
const { trigger } = useSWRMutation('/mgmt/v1/integrations', sendRequest); | ||
const { mutate: mutateIntegration } = useIntegration(integration?.id); | ||
const { integrations: existingIntegrations = [], mutate } = useIntegrations(); | ||
|
||
useEffect(() => { | ||
setClientId(integration?.config?.oauth?.credentials?.oauthClientId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like integration is already passed in as a prop -- why do we need to do this?
dfb81b1
to
841ac81
Compare
841ac81
to
54d5c3c
Compare
Integration
: addsis_enabled
and makesconfig
optionaluseSWR
'smutate
to fetch and make updatesSWR related reading for using mutating local and remote state:
Other:
Card
forMetricCard
rather thanGrid
Active
tab toInstalled
Application 1
toYour application