mirror of
https://github.com/supabase/supabase.git
synced 2026-10-13 05:09:12 +03:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Introduces UI for Scoped PAT's. ## Additional context WIP. Testing endpoints. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Scoped access tokens: create, view, delete, and manage granular resource/action permissions with custom expiry options and scoped creation flows. * New scoped token UI: modal/sheet creation flow, resource access selectors, permissions editor, and a scoped token list. * **UI Improvements** * Tabbed Classic vs Scoped tokens layout, refreshed tokens page, improved forms, search/filtering, and table tweaks. * **Bug Fixes / Maintenance** * New data hooks and utilities for scoped tokens and token handling. * **Removed** * Legacy account settings layout and legacy token banner. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
34 lines
818 B
TypeScript
34 lines
818 B
TypeScript
import { useState } from 'react'
|
|
|
|
import { Button } from 'ui'
|
|
import { type NewScopedAccessToken } from 'data/scoped-access-tokens/scoped-access-token-create-mutation'
|
|
import { NewScopedTokenSheet } from './NewScopedTokenSheet'
|
|
|
|
export interface NewScopedTokenButtonProps {
|
|
onCreateToken: (token: NewScopedAccessToken) => void
|
|
}
|
|
|
|
export const NewScopedTokenButton = ({ onCreateToken }: NewScopedTokenButtonProps) => {
|
|
const [visible, setVisible] = useState(false)
|
|
|
|
return (
|
|
<>
|
|
<Button
|
|
type="primary"
|
|
onClick={() => {
|
|
setVisible(true)
|
|
}}
|
|
>
|
|
Generate new token
|
|
</Button>
|
|
|
|
<NewScopedTokenSheet
|
|
visible={visible}
|
|
onOpenChange={setVisible}
|
|
tokenScope={undefined}
|
|
onCreateToken={onCreateToken}
|
|
/>
|
|
</>
|
|
)
|
|
}
|