Skip to content

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

fix type errors for LogType usage

TzeYiingb012a92bfe2c
diff --git a/studio/components/interfaces/Settings/Logs/Logs.constants.ts b/studio/components/interfaces/Settings/Logs/Logs.constants.ts
index db9360e4e80..78c41406bae 100644
--- a/studio/components/interfaces/Settings/Logs/Logs.constants.ts
+++ b/studio/components/interfaces/Settings/Logs/Logs.constants.ts
@@ -1,4 +1,4 @@
-import { LogTemplate, LogType } from '.'
+import { LogTemplate } from '.'
export const TEMPLATES: LogTemplate[] = [
{
@@ -57,7 +57,7 @@ ORDER BY
},
]
-export const LOG_TYPE_LABEL_MAPPING: { [k: LogType]: string } = {
+export const LOG_TYPE_LABEL_MAPPING: { [k: string]: string } = {
api: 'API',
database: 'Database',
}
diff --git a/studio/components/interfaces/Settings/Logs/Logs.types.ts b/studio/components/interfaces/Settings/Logs/Logs.types.ts
index 01a1dff24f6..877bcd3d77a 100644
--- a/studio/components/interfaces/Settings/Logs/Logs.types.ts
+++ b/studio/components/interfaces/Settings/Logs/Logs.types.ts
@@ -16,7 +16,7 @@ export interface LogData {
export interface LogTemplate {
label?: string
mode: 'custom' | 'simple'
- for?: LogType[]
+ for?: string[]
searchString: string
}
diff --git a/studio/components/layouts/SettingsLayout/SettingsMenu.utils.ts b/studio/components/layouts/SettingsLayout/SettingsMenu.utils.ts
index 8e8d24baeea..1c6f13d71b2 100644
--- a/studio/components/layouts/SettingsLayout/SettingsMenu.utils.ts
+++ b/studio/components/layouts/SettingsLayout/SettingsMenu.utils.ts
@@ -1,8 +1,8 @@
-import { LogType, LOG_TYPE_LABEL_MAPPING } from 'components/interfaces/Settings/Logs'
+import { LOG_TYPE_LABEL_MAPPING } from 'components/interfaces/Settings/Logs'
import { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types'
export const generateSettingsMenu = (ref: string): ProductMenuGroup[] => {
- const logTypes: LogType[] = ['database', 'api']
+ const logTypes: string[] = ['database', 'api']
return [
{
diff --git a/studio/pages/project/[ref]/settings/logs/[type].tsx b/studio/pages/project/[ref]/settings/logs/[type].tsx
index 9d457237e5f..b70ae7dc39e 100644
--- a/studio/pages/project/[ref]/settings/logs/[type].tsx
+++ b/studio/pages/project/[ref]/settings/logs/[type].tsx
@@ -28,7 +28,6 @@ import {
TEMPLATES,
LogData,
LogSearchCallback,
- LogType,
LOG_TYPE_LABEL_MAPPING,
} from 'components/interfaces/Settings/Logs'
import { uuidv4 } from 'lib/helpers'
@@ -66,7 +65,7 @@ export const LogPage: NextPage = () => {
timestamp_start: '',
timestamp_end: '',
})
- const title = `Logs - ${LOG_TYPE_LABEL_MAPPING[type as LogType]}`
+ const title = `Logs - ${LOG_TYPE_LABEL_MAPPING[type as keyof typeof LOG_TYPE_LABEL_MAPPING]}`
const checkIfSelectQuery = (value: string) =>
value.toLowerCase().includes('select') ? true : false
const isSelectQuery = checkIfSelectQuery(editorValue)
@@ -248,7 +247,7 @@ export const LogPage: NextPage = () => {
isCustomQuery={mode === 'custom'}
isLoading={isValidating}
newCount={newCount}
- templates={TEMPLATES.filter((template) => template.for?.includes(type as LogType))}
+ templates={TEMPLATES.filter((template) => template.for?.includes(type as string))}
onRefresh={handleRefresh}
onSearch={handleSearch}
defaultSearchValue={params.search_query}