Skip to content

Commit

Permalink
chore(ui): adjust SSO credential form styling (#3742)
Browse files Browse the repository at this point in the history
  • Loading branch information
liangfung authored and zwpaper committed Jan 23, 2025
1 parent c51cbe3 commit e82dd0c
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@ export function LDAPCredentialForm({
</FormItem>
)}
/>
<div className="mt-4">
<Separator className="my-2" />
<div className="flex flex-col gap-4 sm:flex-row sm:justify-between">
<Button
onClick={onTestLdapCredential}
type="button"
Expand All @@ -465,66 +466,63 @@ export function LDAPCredentialForm({
<IconSpinner className="mr-2 h-4 w-4 animate-spin" />
)}
</Button>
</div>

<Separator />

<div className="flex justify-end gap-4">
<Button
type="button"
variant="ghost"
onClick={navigateToSSOSettings}
>
Back
</Button>
{!isNew && (
<AlertDialog
open={deleteAlertVisible}
onOpenChange={setDeleteAlertVisible}
<div className="flex items-center justify-end gap-4 sm:justify-start">
<Button
type="button"
variant="ghost"
onClick={navigateToSSOSettings}
>
<AlertDialogTrigger asChild>
<Button variant="hover-destructive">Delete</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>
Are you absolutely sure?
</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. It will permanently delete
the current credential.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction
className={buttonVariants({ variant: 'destructive' })}
onClick={onDelete}
>
{isDeleting && (
<IconSpinner className="mr-2 h-4 w-4 animate-spin" />
)}
Yes, delete it
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
)}
<LicenseGuard licenses={[LicenseType.Enterprise]}>
{({ hasValidLicense }) => (
<Button
type="submit"
disabled={
!hasValidLicense || isSubmitting || (!isNew && !isDirty)
}
Back
</Button>
{!isNew && (
<AlertDialog
open={deleteAlertVisible}
onOpenChange={setDeleteAlertVisible}
>
{isSubmitting && (
<IconSpinner className="mr-2 h-4 w-4 animate-spin" />
)}
{isNew ? 'Create' : 'Update'}
</Button>
<AlertDialogTrigger asChild>
<Button variant="hover-destructive">Delete</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>
Are you absolutely sure?
</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. It will permanently delete
the current credential.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction
className={buttonVariants({ variant: 'destructive' })}
onClick={onDelete}
>
{isDeleting && (
<IconSpinner className="mr-2 h-4 w-4 animate-spin" />
)}
Yes, delete it
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
)}
</LicenseGuard>
<LicenseGuard licenses={[LicenseType.Enterprise]}>
{({ hasValidLicense }) => (
<Button
type="submit"
disabled={
!hasValidLicense || isSubmitting || (!isNew && !isDirty)
}
>
{isSubmitting && (
<IconSpinner className="mr-2 h-4 w-4 animate-spin" />
)}
{isNew ? 'Create' : 'Update'}
</Button>
)}
</LicenseGuard>
</div>
</div>
</form>
<FormMessage className="text-center" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
import { Separator } from '@/components/ui/separator'
import { CopyButton } from '@/components/copy-button'
import { LicenseGuard } from '@/components/license-guard'

Expand Down Expand Up @@ -276,17 +277,20 @@ export default function OAuthCredentialForm({

{oauthRedirectUrlData && (
<FormItem className="mt-4">
<div className="flex flex-col gap-2 rounded-lg border px-3 py-2">
<div className="flex flex-col gap-2 overflow-hidden rounded-lg border px-3 py-2">
<div className="text-sm text-muted-foreground">
Create your OAuth2 application with the following information
</div>
<div className="flex items-center justify-between">
<div className="flex flex-col justify-between sm:flex-row sm:items-center">
<div className="text-sm font-medium">
Authorization callback URL
</div>
<span className="flex items-center text-sm">
{oauthRedirectUrlData.oauthCallbackUrl}
<span className="truncate">
{oauthRedirectUrlData.oauthCallbackUrl}
</span>
<CopyButton
className="shrink-0"
type="button"
value={oauthRedirectUrlData.oauthCallbackUrl!}
/>
Expand Down Expand Up @@ -345,6 +349,7 @@ export default function OAuthCredentialForm({
</FormItem>
)}
/>
<Separator className="my-2" />
<div className="flex justify-end gap-4">
<Button
type="button"
Expand Down

0 comments on commit e82dd0c

Please sign in to comment.