Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Refactor MultiSelect component and implement UI logic for auth policy editor roles

Joshen Lim6b17743a848d
diff --git a/studio/components/interfaces/Authentication/Policies/PolicyEditor/PolicyRoles.tsx b/studio/components/interfaces/Authentication/Policies/PolicyEditor/PolicyRoles.tsx
new file mode 100644
index 00000000000..61bd3423fff
--- /dev/null
+++ b/studio/components/interfaces/Authentication/Policies/PolicyEditor/PolicyRoles.tsx
@@ -0,0 +1,46 @@
+import { FC } from 'react'
+import { PostgresRole } from '@supabase/postgres-meta'
+
+import MultiSelectUI from 'components/ui/MultiSelect'
+
+interface Props {
+ roles: PostgresRole[]
+ selectedRoles: PostgresRole[]
+ onUpdateSelectedRoles: (roles: PostgresRole[]) => void
+}
+
+const PolicyRoles: FC<Props> = ({ roles, selectedRoles, onUpdateSelectedRoles }) => {
+ // @ts-ignore
+ const formattedRoles = roles.map((role) => {
+ return {
+ id: role.id.toString(),
+ name: role.name,
+ value: role.name,
+ disabled: false,
+ }
+ })
+
+ return (
+ <div className="flex space-x-12">
+ <div className="flex w-1/3 flex-col space-y-2">
+ <label className="text-scale-1100 text-base" htmlFor="policy-name">
+ Roles
+ </label>
+ <p className="text-scale-900 text-sm">Apply policy to the specified roles</p>
+ </div>
+ <div className="relative w-2/3">
+ <MultiSelectUI
+ options={formattedRoles}
+ value={selectedRoles.map((role) => role.name)}
+ searchPlaceholder="Search for a role"
+ onChange={(updatedRoles) => {
+ const selectedRoles = roles.filter((role) => updatedRoles.includes(role.name))
+ onUpdateSelectedRoles(selectedRoles)
+ }}
+ />
+ </div>
+ </div>
+ )
+}
+
+export default PolicyRoles
diff --git a/studio/components/interfaces/Authentication/Policies/PolicyEditor/index.tsx b/studio/components/interfaces/Authentication/Policies/PolicyEditor/index.tsx
index 369f421741f..39e4fe249ed 100644
--- a/studio/components/interfaces/Authentication/Policies/PolicyEditor/index.tsx
+++ b/studio/components/interfaces/Authentication/Policies/PolicyEditor/index.tsx
@@ -1,14 +1,16 @@
-import { FC } from 'react'
+import { FC, useEffect } from 'react'
import { Modal } from '@supabase/ui'
-import { get } from 'lodash'
import PolicyName from './PolicyName'
import PolicyDefinition from './PolicyDefinition'
import PolicyAllowedOperation from './PolicyAllowedOperation'
+import PolicyRoles from './PolicyRoles'
import PolicyEditorFooter from './PolicyEditorFooter'
+import { PostgresRole } from '@supabase/postgres-meta'
interface Props {
isNewPolicy: boolean
+ roles: PostgresRole[]
policyFormFields: any
onUpdatePolicyFormFields: (value: any) => void
onViewTemplates: () => void
@@ -17,18 +19,20 @@ interface Props {
const PolicyEditor: FC<Props> = ({
isNewPolicy = true,
+ roles = [],
policyFormFields = {},
onUpdatePolicyFormFields = () => {},
onViewTemplates = () => {},
onReviewPolicy = () => {},
}) => {
- const operation = get(policyFormFields, ['command'], '')
- const definition = get(policyFormFields, ['definition'], '') || ''
- const check = get(policyFormFields, ['check'], '') || ''
+ const operation = policyFormFields?.operation ?? ''
+ const definition = policyFormFields?.definition ?? ''
+ const check = policyFormFields?.check ?? ''
+ const selectedRoles = policyFormFields?.roles ?? []
return (
<div className="">
- <div className="mb-8 space-y-8 py-8">
+ <div className="space-y-8 py-8">
<Modal.Content>
<PolicyName
name={policyFormFields.name}
@@ -47,6 +51,13 @@ const PolicyEditor: FC<Props> = ({
<Modal.Seperator />
</>
)}
+ <Modal.Content>
+ <PolicyRoles
+ roles={roles}
+ selectedRoles={selectedRoles}
+ onUpdateSelectedRoles={(roles) => onUpdatePolicyFormFields({ roles })}
+ />
+ </Modal.Content>
<Modal.Content>
<PolicyDefinition
operation={operation}
diff --git a/studio/components/interfaces/Authentication/Policies/PolicyEditorModal/index.tsx b/studio/components/interfaces/Authentication/Policies/PolicyEditorModal/index.tsx
index 7c362ed956a..d82ce6e2c83 100644
--- a/studio/components/interfaces/Authentication/Policies/PolicyEditorModal/index.tsx
+++ b/studio/components/interfaces/Authentication/Policies/PolicyEditorModal/index.tsx
@@ -1,6 +1,7 @@
import { Modal } from '@supabase/ui'
import { FC, useState, useEffect } from 'react'
import { isEmpty } from 'lodash'
+import { PostgresRole } from '@supabase/postgres-meta'
import { POLICY_MODAL_VIEWS } from 'lib/constants'
import { getGeneralPolicyTemplates } from './PolicyEditorModal.constants'
@@ -19,6 +20,7 @@ import { useStore } from 'hooks'
interface Props {
visible: boolean
+ roles?: PostgresRole[]
schema: string
table: string
selectedPolicyToEdit: any
@@ -30,6 +32,7 @@ interface Props {
const PolicyEditorModal: FC<Props> = ({
visible = false,
+ roles = [],
schema = '',
table = '',
selectedPolicyToEdit = {},
@@ -47,6 +50,7 @@ const PolicyEditorModal: FC<Props> = ({
definition: '',
check: '',
command: null,
+ roles: [],
}
const isNewPolicy = isEmpty(selectedPolicyToEdit)
@@ -174,6 +178,7 @@ const PolicyEditorModal: FC<Props> = ({
) : view === POLICY_MODAL_VIEWS.EDITOR ? (
<PolicyEditor
isNewPolicy={isNewPolicy}
+ roles={roles}
policyFormFields={policyFormFields}
onUpdatePolicyFormFields={onUpdatePolicyFormFields}
onViewTemplates={onViewTemplates}
diff --git a/studio/components/layouts/AuthLayout/AuthLayout.tsx b/studio/components/layouts/AuthLayout/AuthLayout.tsx
index da038f2bfa5..c59cd0f8257 100644
--- a/studio/components/layouts/AuthLayout/AuthLayout.tsx
+++ b/studio/components/layouts/AuthLayout/AuthLayout.tsx
@@ -26,6 +26,7 @@ const AuthLayout: FC<Props> = ({ title, children }) => {
useEffect(() => {
if (ui.selectedProject) {
meta.tables.load()
+ meta.roles.load()
}
}, [ui.selectedProject])
diff --git a/studio/components/to-be-cleaned/MultiSelect.tsx b/studio/components/to-be-cleaned/MultiSelect.tsx
deleted file mode 100644
index ac487c000c4..00000000000
--- a/studio/components/to-be-cleaned/MultiSelect.tsx
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Move this to @supabase/ui
- *
- * can be merged into ListBox
- *
- */
-
-import React, { useRef } from 'react'
-
-import { Popover, IconX, IconCheck, Typography, IconAlertCircle } from '@supabase/ui'
-import { useEffect, useState } from 'react'
-
-import { orderBy, filter, without } from 'lodash'
-
-interface Options {
- id: string
- value: string
- name: string
- disabled: boolean
-}
-interface Props {
- options: Options[]
- value: string[]
- onChange?(x: string[]): void
- label: string
- descriptionText: string | React.ReactNode
- emptyMessage: React.ReactNode
-}
-
-export default function MultiSelect({
- options,
- value,
- onChange = () => {},
- label,
- descriptionText,
- emptyMessage,
-}: Props) {
- const ref = useRef(null)
-
- const [selectedd, setSelected] = useState(value || [])
- const [inputWidth, setInputWidth] = useState(128)
-
- /*
- * Selected is `value` if defined, otherwise use local useState
- */
- const selected = value || selectedd
-
- /*
- * Calculate width of the Popover
- */
- useEffect(() => {
- setInputWidth(ref.current ? (ref.current as any).offsetWidth : inputWidth)
- }, [])
-
- const width = `${inputWidth}px`
-
- /*
- * order the options so disabled items are at the beginning
- */
- options = orderBy(options, ['disabled'], ['desc'])
-
- /*
- * options to show in Popover menu
- */
- const optionsFiltered = filter(options, { disabled: false })
-
- function handleChange(value: any, active: any) {
- let _selected = selected
- if (active) {
- const payload = [...without(_selected, value)]
- setSelected(payload)
- onChange(payload)
- } else {
- _selected.push(value)
- const payload = [..._selected]
- setSelected(payload)
- onChange(payload)
- }
- }
-
- return (
- <>
- <div className="form-group">
- <label>{label}</label>
-
- <div
- className="form-control form-control--multi-select relative border rounded border-input-border-light dark:border-input-border-dark dark:border-dark space-x-1 overflow-auto"
- ref={ref}
- >
- {/* {options.map(x => {
- const active =
- selected &&
- selected.find(selected => {
- return selected === x.value
- })
- if (x.disabled) {
- return <span>{x.name}</span>
- } else if (active) {
- return <span>{x.name}</span>
- }
- })} */}
- <Popover
- sideOffset={4}
- side="bottom"
- align="start"
- overlay={
- <div className="space-y-1 p-1 overflow-auto">
- {optionsFiltered.length >= 1 ? (
- optionsFiltered.map((x) => {
- const active =
- selected &&
- selected.find((selected) => {
- return selected === x.value
- })
- ? true
- : false
-
- return (
- <div
- key={`multiselect-option-${x.value}`}
- onClick={() => handleChange(x.value, active)}
- className={`
- transition
- bg-transparent hover:bg-gray-600
- rounded p-2 px-4
- text-sm text-typography-body-light dark:text-typography-body-dark
- flex items-center justify-between space-x-1
- cursor-pointer ${active ? ' dark:bg-green-600 dark:bg-opacity-25' : ''}
-
- `}
- >
- <span>{x.name}</span>
- {active && (
- <IconCheck
- size={16}
- strokeWidth={3}
- className={`transition cursor-pointer ${
- active ? ' dark:text-green-500' : ''
- }`}
- />
- )}
- </div>
- )
- })
- ) : (
- <div
- className="
- h-full w-full p-3
- border border-dashed dark:border-dark
- flex flex-col items-center justify-center
- "
- >
- {emptyMessage ? (
- emptyMessage
- ) : (
- <>
- <Typography.Text className="mb-2">
- <IconAlertCircle />
- </Typography.Text>
- <Typography.Text>No options available</Typography.Text>
- </>
- )}
- </div>
- )}
- </div>
- }
- style={{
- width: width,
- }}
- >
- <div className="flex items-center space-x-1 w-full p-1.5">
- {options.map((x) => {
- const active =
- selected &&
- selected.find((selected) => {
- return selected === x.value
- })
-
- if (x.disabled) {
- return <BadgeDisabled key={x.id} name={x.name} />
- } else if (active) {
- return (
- <BadgeSelected
- key={x.id}
- name={x.name}
- id={x.name}
- value={x.value}
- handleRemove={() => handleChange(x.value, true)}
- />
- )
- }
- })}
- </div>
- </Popover>
- </div>
-
- <span className="form-text text-muted">{descriptionText}</span>
- </div>
- </>
- )
-}
-
-const BadgeDisabled = (props: any) => (
- <div
- className="
- bg-gray-600 cursor-not-allowed rounded py-0.5 px-2 text-sm text-typography-body-light dark:text-typography-body-dark
- flex items-center
- space-x-2"
- >
- <span className="opacity-50">{props.name}</span>
- </div>
-)
-
-const BadgeSelected = (props: any) => (
- <div
- className="
- bg-gray-500 rounded py-0.5 px-2 text-sm text-typography-body-light dark:text-typography-body-dark
- flex items-center
- space-x-2"
- >
- <span>{props.name}</span>
- <IconX
- size={12}
- className="transition cursor-pointer opacity-50 hover:opacity-100"
- onClick={(e: any) => {
- e.preventDefault()
- props.handleRemove()
- }}
- />
- </div>
-)
diff --git a/studio/components/ui/MultiSelect/Badges.tsx b/studio/components/ui/MultiSelect/Badges.tsx
new file mode 100644
index 00000000000..6cc89d7f9d3
--- /dev/null
+++ b/studio/components/ui/MultiSelect/Badges.tsx
@@ -0,0 +1,33 @@
+import { IconX } from '@supabase/ui'
+
+export const BadgeDisabled = (props: any) => (
+ <div
+ className={[
+ 'text-typography-body-light dark:text-typography-body-dark',
+ 'flex cursor-not-allowed items-center space-x-2 rounded bg-gray-600',
+ 'py-0.5 px-2 text-sm',
+ ].join(' ')}
+ >
+ <span className="opacity-50">{props.name}</span>
+ </div>
+)
+
+export const BadgeSelected = (props: any) => (
+ <div
+ className={[
+ 'text-typography-body-light dark:text-typography-body-dark',
+ 'flex items-center space-x-2 rounded bg-gray-500',
+ 'py-0.5 px-2 text-sm',
+ ].join(' ')}
+ >
+ <span>{props.name}</span>
+ <IconX
+ size={12}
+ className="cursor-pointer opacity-50 transition hover:opacity-100"
+ onClick={(e: any) => {
+ e.preventDefault()
+ props.handleRemove()
+ }}
+ />
+ </div>
+)
diff --git a/studio/components/ui/MultiSelect/index.tsx b/studio/components/ui/MultiSelect/index.tsx
new file mode 100644
index 00000000000..b8beff0cba2
--- /dev/null
+++ b/studio/components/ui/MultiSelect/index.tsx
@@ -0,0 +1,223 @@
+import { useRef, useEffect, useState, FormEvent, KeyboardEvent } from 'react'
+import { orderBy, filter, without } from 'lodash'
+import { Popover, IconCheck, IconAlertCircle, IconSearch } from '@supabase/ui'
+
+import { BadgeDisabled, BadgeSelected } from './Badges'
+
+export interface MultiSelectOption {
+ id: string
+ value: string
+ name: string
+ disabled: boolean
+}
+
+interface Props {
+ options: MultiSelectOption[]
+ value: string[]
+ label?: string
+ searchPlaceholder?: string
+ descriptionText?: string | React.ReactNode
+ emptyMessage?: string | React.ReactNode
+ onChange?(x: string[]): void
+}
+
+export default function MultiSelect({
+ options,
+ value,
+ label,
+ descriptionText,
+ searchPlaceholder = 'Search for option',
+ emptyMessage,
+ onChange = () => {},
+}: Props) {
+ const ref = useRef(null)
+
+ const [selected, setSelected] = useState(value || [])
+ const [searchString, setSearchString] = useState('')
+ const [inputWidth, setInputWidth] = useState(128)
+
+ // Selected is `value` if defined, otherwise use local useState
+ const selectedOptions = value || selected
+
+ // Calculate width of the Popover
+ useEffect(() => {
+ setInputWidth(ref.current ? (ref.current as any).offsetWidth : inputWidth)
+ }, [])
+
+ const width = `${inputWidth}px`
+
+ // Order the options so disabled items are at the beginning
+ const formattedOptions = orderBy(options, ['disabled'], ['desc'])
+
+ // Options to show in Popover menu
+ const filteredOptions =
+ searchString.length > 0
+ ? filter(formattedOptions, (option) => !option.disabled && option.name.includes(searchString))
+ : filter(formattedOptions, { disabled: false })
+
+ const checkIfActive = (option: MultiSelectOption) => {
+ const isOptionSelected = (selectedOptions || []).find((x) => x === option.value)
+ return isOptionSelected !== undefined
+ }
+
+ const handleChange = (option: MultiSelectOption) => {
+ const _selected = selectedOptions
+ const isActive = checkIfActive(option)
+
+ const updatedPayload = isActive
+ ? [...without(_selected, option.value)]
+ : [..._selected.concat([option.value])]
+
+ setSelected(updatedPayload)
+ onChange(updatedPayload)
+ }
+
+ const onKeyPress = (e: KeyboardEvent<HTMLInputElement>) => {
+ if (e.key === 'Enter') {
+ if (searchString.length > 0 && filteredOptions.length === 1) {
+ handleChange(filteredOptions[0])
+ }
+ }
+ }
+
+ return (
+ <>
+ <div className="form-group">
+ {label && <label>{label}</label>}
+ <div
+ className={[
+ 'form-control form-control--multi-select',
+ 'border-scale-700 bg-scale-400 border',
+ // 'border-input-border-light dark:border-input-border-dark dark:border-dark border',
+ 'multi-select relative w-full space-x-1 overflow-auto rounded',
+ ].join(' ')}
+ ref={ref}
+ >
+ <Popover
+ sideOffset={4}
+ side="bottom"
+ align="start"
+ style={{ width }}
+ header={
+ <div className="flex items-center space-x-2 py-1">
+ <IconSearch size={14} />
+ <input
+ autoFocus
+ className="placeholder-scale-1000 w-72 bg-transparent text-sm outline-none"
+ value={searchString}
+ placeholder={searchPlaceholder}
+ onKeyPress={onKeyPress}
+ onChange={(e: FormEvent<HTMLInputElement>) =>
+ setSearchString(e.currentTarget.value)
+ }
+ />
+ </div>
+ }
+ overlay={
+ <div className="max-h-[225px] space-y-1 overflow-y-auto p-1">
+ {filteredOptions.length >= 1 ? (
+ filteredOptions.map((option) => {
+ const active =
+ selectedOptions &&
+ selectedOptions.find((selected) => {
+ return selected === option.value
+ })
+ ? true
+ : false
+
+ return (
+ <div
+ key={`multiselect-option-${option.value}`}
+ onClick={() => handleChange(option)}
+ className={[
+ 'text-typography-body-light dark:text-typography-body-dark',
+ 'flex cursor-pointer items-center justify-between transition',
+ 'space-x-1 rounded bg-transparent p-2 px-4 text-sm hover:bg-gray-600',
+ `${active ? ' dark:bg-green-600 dark:bg-opacity-25' : ''}`,
+ ].join(' ')}
+ >
+ <span>{option.name}</span>
+ {active && (
+ <IconCheck
+ size={16}
+ strokeWidth={3}
+ className={`cursor-pointer transition ${
+ active ? ' dark:text-green-500' : ''
+ }`}
+ />
+ )}
+ </div>
+ )
+ })
+ ) : options.length === 0 ? (
+ <div
+ className={[
+ 'dark:border-dark flex h-full w-full flex-col',
+ 'items-center justify-center border border-dashed p-3',
+ ].join(' ')}
+ >
+ {emptyMessage ? (
+ emptyMessage
+ ) : (
+ <div className="flex w-full items-center space-x-2">
+ <IconAlertCircle strokeWidth={1.5} size={18} className="text-scale-1000" />
+ <p className="text-scale-1000 text-sm">No options available</p>
+ </div>
+ )}
+ </div>
+ ) : (
+ <div
+ className={[
+ 'dark:border-dark flex h-full w-full flex-col',
+ 'items-center justify-center border border-dashed p-3',
+ ].join(' ')}
+ >
+ {emptyMessage ? (
+ emptyMessage
+ ) : (
+ <div className="flex w-full items-center space-x-2">
+ <p className="text-scale-1000 text-sm">No options found</p>
+ </div>
+ )}
+ </div>
+ )}
+ </div>
+ }
+ onOpenChange={() => setSearchString('')}
+ >
+ <div
+ className={[
+ 'flex w-full flex-wrap items-start items-center gap-1.5 p-1.5',
+ `${selectedOptions.length === 0 ? 'h-9' : ''}`,
+ ].join(' ')}
+ >
+ {formattedOptions.map((option) => {
+ const active =
+ selectedOptions &&
+ selectedOptions.find((selected) => {
+ return selected === option.value
+ })
+
+ if (option.disabled) {
+ return <BadgeDisabled key={option.id} name={option.name} />
+ } else if (active) {
+ return (
+ <BadgeSelected
+ key={option.id}
+ name={option.name}
+ id={option.name}
+ value={option.value}
+ handleRemove={() => handleChange(option)}
+ />
+ )
+ }
+ })}
+ </div>
+ </Popover>
+ </div>
+
+ {descriptionText && <span className="form-text text-muted">{descriptionText}</span>}
+ </div>
+ </>
+ )
+}
diff --git a/studio/pages/project/[ref]/auth/policies.tsx b/studio/pages/project/[ref]/auth/policies.tsx
index 331e99f8ef2..db78a286cd0 100644
--- a/studio/pages/project/[ref]/auth/policies.tsx
+++ b/studio/pages/project/[ref]/auth/policies.tsx
@@ -116,6 +116,8 @@ const AuthPoliciesTables = observer(() => {
const { ui, meta } = useStore()
const PageState: any = useContext(PageContext)
+ const roles = meta.roles.list()
+
const [selectedSchemaAndTable, setSelectedSchemaAndTable] = useState<any>({})
const [selectedTableToToggleRLS, setSelectedTableToToggleRLS] = useState<any>({})
const [selectedPolicyToEdit, setSelectedPolicyToEdit] = useState<any>({})
@@ -246,6 +248,7 @@ const AuthPoliciesTables = observer(() => {
<PolicyEditorModal
visible={!isEmpty(selectedSchemaAndTable)}
+ roles={roles}
schema={selectedSchemaAndTable.schema}
table={selectedSchemaAndTable.table}
selectedPolicyToEdit={selectedPolicyToEdit}
diff --git a/studio/pages/project/[ref]/settings/api.tsx b/studio/pages/project/[ref]/settings/api.tsx
index 9ddfa532ba8..d42025c3bda 100644
--- a/studio/pages/project/[ref]/settings/api.tsx
+++ b/studio/pages/project/[ref]/settings/api.tsx
@@ -38,13 +38,13 @@ import { uuidv4 } from 'lib/helpers'
import { patch, get } from 'lib/common/fetch'
import { useStore, useJwtSecretUpdateStatus, withAuth } from 'hooks'
+import Panel from 'components/to-be-cleaned/Panel'
+import SchemaFormPanel from 'components/to-be-cleaned/forms/SchemaFormPanel'
+
import { SettingsLayout } from 'components/layouts'
import Flag from 'components/ui/Flag/Flag'
import ConfirmModal from 'components/ui/Dialogs/ConfirmDialog'
-
-import Panel from 'components/to-be-cleaned/Panel'
-import MultiSelectUI from 'components/to-be-cleaned/MultiSelect'
-import SchemaFormPanel from 'components/to-be-cleaned/forms/SchemaFormPanel'
+import MultiSelect from 'components/ui/MultiSelect'
import { DisplayApiSettings } from 'components/ui/ProjectSettings'
const JWT_SECRET_UPDATE_ERROR_MESSAGES = {
@@ -101,7 +101,7 @@ const ApiSettings = () => {
return (
<SettingsLayout title="API Settings">
<PageContext.Provider value={PageState}>
- <div className="content w-full h-full overflow-y-auto">
+ <div className="content h-full w-full overflow-y-auto">
<ServiceList projectRef={ref} />
</div>
</PageContext.Provider>
@@ -176,14 +176,14 @@ const ServiceList: FC<any> = ({ projectRef }) => {
if (error || isJwtSecretUpdateStatusError) {
return (
- <div className="p-6 mx-auto sm:w-full md:w-3/4 text-center">
+ <div className="mx-auto p-6 text-center sm:w-full md:w-3/4">
<Typography.Title level={3}>Error loading API settings</Typography.Title>
</div>
)
}
if (!data || isJwtSecretUpdateStatusLoading) {
return (
- <div className="p-6 mx-auto sm:w-full md:w-3/4 text-center">
+ <div className="mx-auto p-6 text-center sm:w-full md:w-3/4">
<Typography.Title level={3}>Loading...</Typography.Title>
</div>
)
@@ -224,7 +224,7 @@ const ServiceList: FC<any> = ({ projectRef }) => {
return (
<>
- <article className="p-4 max-w-4xl">
+ <article className="max-w-4xl p-4">
<DisplayApiSettings key="DisplayAPISettings" />
<section>
<Panel
@@ -246,7 +246,7 @@ const ServiceList: FC<any> = ({ projectRef }) => {
layout="horizontal"
/>
</Panel.Content>
- <Panel.Content className="border-t border-panel-border-interior-light dark:border-panel-border-interior-dark space-y-6">
+ <Panel.Content className="border-panel-border-interior-light dark:border-panel-border-interior-dark space-y-6 border-t">
<Input
label="JWT Secret"
readOnly
@@ -257,8 +257,8 @@ const ServiceList: FC<any> = ({ projectRef }) => {
isJwtSecretUpdateFailed
? 'JWT secret update failed'
: isUpdatingJwtSecret
- ? 'Updating JWT secret...'
- : config?.jwt_secret || ''
+ ? 'Updating JWT secret...'
+ : config?.jwt_secret || ''
}
className="input-mono"
descriptionText={
@@ -268,7 +268,7 @@ const ServiceList: FC<any> = ({ projectRef }) => {
/>
<Flag name="jwtSecretUpdate">
<div className="space-y-3">
- <div className="p-3 px-6 dark:bg-bg-alt-dark bg-bg-alt-light rounded-md shadow-sm border dark:border-dark">
+ <div className="dark:bg-bg-alt-dark bg-bg-alt-light dark:border-dark rounded-md border p-3 px-6 shadow-sm">
{isUpdatingJwtSecret ? (
<div className="flex items-center space-x-2">
<IconLoader className="animate-spin" size={14} />
@@ -278,10 +278,10 @@ const ServiceList: FC<any> = ({ projectRef }) => {
</div>
) : (
<div className="w-full space-y-2">
- <div className="w-full flex items-center justify-between">
+ <div className="flex w-full items-center justify-between">
<div className="flex flex-col space-y-1">
<Typography.Text>Generate a new JWT secret</Typography.Text>
- <p className="opacity-50 text-sm">
+ <p className="text-sm opacity-50">
A random secret will be created, or you can create your own.
</p>
</div>
@@ -383,8 +383,8 @@ const ServiceList: FC<any> = ({ projectRef }) => {
}
>
<Modal.Content>
- <div className="py-4 space-y-2">
- <p className="text-sm text-scale-1100">
+ <div className="space-y-2 py-4">
+ <p className="text-scale-1100 text-sm">
Create a custom JWT secret. Make sure it is a strong combination of characters that
cannot be guessed easily.
</p>
@@ -494,7 +494,7 @@ const PostgrestConfig = observer(({ config, projectRef }: any) => {
>
<div className="space-y-6 py-4">
{schema.length >= 1 && (
- <MultiSelectUI
+ <MultiSelect
options={schema}
// value must be passed as array of strings
value={updates.db_schema.replace(/ /g, '').split(',')}
diff --git a/studio/styles/main.scss b/studio/styles/main.scss
index 1b92d6faee3..e716144439d 100644
--- a/studio/styles/main.scss
+++ b/studio/styles/main.scss
@@ -206,3 +206,10 @@ div.fixed.inset-0 {
grid-column: 1/-1;
justify-content: flex-start;
}
+
+.multi-select {
+ button {
+ display: block;
+ width: 100%;
+ }
+}
\ No newline at end of file