Skip to content

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

Show database and rest logs, and show new count in refresh button

Joshen Lim28f176d90df9
diff --git a/studio/components/interfaces/Settings/Logs/LogPanel.tsx b/studio/components/interfaces/Settings/Logs/LogPanel.tsx
index d5a4721d3ba..fb206ee38e6 100644
--- a/studio/components/interfaces/Settings/Logs/LogPanel.tsx
+++ b/studio/components/interfaces/Settings/Logs/LogPanel.tsx
@@ -17,7 +17,7 @@ interface Props {
templates?: any
isLoading: boolean
isCustomQuery: boolean
- hasNewData: boolean
+ newCount: number
showReset: boolean
onReset: () => void
onRefresh?: () => void
@@ -34,7 +34,7 @@ const LogPanel: FC<Props> = ({
templates = [],
isLoading,
isCustomQuery,
- hasNewData,
+ newCount,
showReset,
onReset,
onRefresh,
@@ -50,8 +50,16 @@ const LogPanel: FC<Props> = ({
type="text"
icon={
<div className="relative">
- {hasNewData && (
- <div className={['absolute -top-0.5 -right-0.5', 'h-2 w-2 z-50'].join(' ')}>
+ {newCount > 0 && (
+ <div
+ className={[
+ 'absolute flex items-center justify-center -top-0.5 -right-0.5',
+ 'h-3 w-3 z-50',
+ ].join(' ')}
+ >
+ <div className="absolute ">
+ <Typography.Text style={{ fontSize: '0.5rem' }}>{newCount}</Typography.Text>
+ </div>
<div className="bg-green-500 rounded-full w-full h-full"></div>
<div className="absolute top-0 right-0 bg-green-500 rounded-full w-full h-full animate-ping"></div>
</div>
diff --git a/studio/components/layouts/SettingsLayout/SettingsMenu.utils.ts b/studio/components/layouts/SettingsLayout/SettingsMenu.utils.ts
index e45f48d6969..a1547dfa076 100644
--- a/studio/components/layouts/SettingsLayout/SettingsMenu.utils.ts
+++ b/studio/components/layouts/SettingsLayout/SettingsMenu.utils.ts
@@ -18,16 +18,17 @@ export const generateSettingsMenu = (ref: string): ProductMenuGroup[] => {
},
],
},
- // {
- // title: 'Logs',
- // items: ['database', 'auth', 'realtime', 'rest', 'storage'].map((type: string) => {
- // return {
- // name: LOG_TYPE_LABEL_MAPPING[type],
- // key: `logs-${type}`,
- // url: `/project/${ref}/settings/logs/${type}`,
- // items: [],
- // }
- // }),
- // },
+ {
+ title: 'Logs',
+ // items: ['database', 'auth', 'realtime', 'rest', 'storage'].map((type: string) => {
+ items: ['database', 'rest'].map((type: string) => {
+ return {
+ name: LOG_TYPE_LABEL_MAPPING[type],
+ key: `logs-${type}`,
+ url: `/project/${ref}/settings/logs/${type}`,
+ items: [],
+ }
+ }),
+ },
]
}
diff --git a/studio/lib/constants/index.ts b/studio/lib/constants/index.ts
index d14763cbb05..6908b4af550 100644
--- a/studio/lib/constants/index.ts
+++ b/studio/lib/constants/index.ts
@@ -89,7 +89,7 @@ export const POLICY_MODAL_VIEWS = {
}
export const LOG_TYPE_LABEL_MAPPING: { [k: string]: string } = {
- rest: 'PostgREST',
+ rest: 'API',
realtime: 'Realtime',
auth: 'Auth',
storage: 'Storage',
diff --git a/studio/pages/project/[ref]/settings/logs/[type].tsx b/studio/pages/project/[ref]/settings/logs/[type].tsx
index d9b2913e305..ea65f2bcb66 100644
--- a/studio/pages/project/[ref]/settings/logs/[type].tsx
+++ b/studio/pages/project/[ref]/settings/logs/[type].tsx
@@ -96,7 +96,7 @@ export const LogPage: NextPage = () => {
<LogPanel
isCustomQuery={mode === 'custom'}
isLoading={isValidating}
- hasNewData={newCount > 0}
+ newCount={newCount}
showReset={search.length > 0}
searchValue={search}
templates={TEMPLATES}