The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
hide timestamp from dropdown on custom query mode
TzeYiing93d3129bc9a0
diff --git a/studio/components/interfaces/Settings/Logs/LogPanel.tsx b/studio/components/interfaces/Settings/Logs/LogPanel.tsxindex 781e6e2c98f..4e19460ad4d 100644--- a/studio/components/interfaces/Settings/Logs/LogPanel.tsx+++ b/studio/components/interfaces/Settings/Logs/LogPanel.tsx@@ -124,78 +124,80 @@ const LogPanel: FC<Props> = ({</div></div><div className="flex items-center gap-x-4">- <div>- <Dropdown- side="bottom"- align="end"- overlay={- <Dropdown.Misc>- <Input- label="From"- labelOptional="UTC"- value={from.value === '' ? defaultTimestamp : from.value}- onChange={handleFromChange}- actions={[- from.value && (- <IconX- key="reset-from"- size="tiny"- className="cursor-pointer mx-1"- title="Reset"- onClick={handleFromReset}- />- ),- <Button- key="set"- size="tiny"- title="Set"- type="secondary"- onClick={handleSearch}- >- Set- </Button>,- ]}- />- </Dropdown.Misc>- }- >- <Button type="outline" icon={<IconClock size="tiny" />}>- {from.value ? 'Custom' : 'Now'}- </Button>- </Dropdown>- <Button icon={<IconX />} title="Clear timestamp filter" />- </div>- {/* wrap with form so that if user presses enter, the search value will submit automatically */}{!isCustomQuery && (- <form- id="log-panel-search"- onSubmit={(e) => {- // prevent redirection- e.preventDefault()- handleSearch()- }}- >- <Input- placeholder="Search events"- onChange={(e) => setSearch(e.target.value)}- value={search}- actions={[- search && (- <IconX- key="clear-search"- size="tiny"- className="cursor-pointer mx-1"- title="Clear search"- onClick={() => setSearch('')}- />- ),+ <>+ <div className="flex flex-row gap-x-1">+ <Dropdown+ side="bottom"+ align="end"+ overlay={+ <Dropdown.Misc>+ <Input+ label="From"+ labelOptional="UTC"+ value={from.value === '' ? defaultTimestamp : from.value}+ onChange={handleFromChange}+ actions={[+ from.value && (+ <IconX+ key="reset-from"+ size="tiny"+ className="cursor-pointer mx-1"+ title="Reset"+ onClick={handleFromReset}+ />+ ),+ <Button+ key="set"+ size="tiny"+ title="Set"+ type="secondary"+ onClick={handleSearch}+ >+ Set+ </Button>,+ ]}+ />+ </Dropdown.Misc>+ }+ >+ <Button type="outline" icon={<IconClock size="tiny" />}>+ {from.value ? 'Custom' : 'Now'}+ </Button>+ </Dropdown>+ <Button icon={<IconX />} title="Clear timestamp filter" />+ </div>+ {/* wrap with form so that if user presses enter, the search value will submit automatically */}+ <form+ id="log-panel-search"+ onSubmit={(e) => {+ // prevent redirection+ e.preventDefault()+ handleSearch()+ }}+ >+ <Input+ placeholder="Search events"+ onChange={(e) => setSearch(e.target.value)}+ value={search}+ actions={[+ search && (+ <IconX+ key="clear-search"+ size="tiny"+ className="cursor-pointer mx-1"+ title="Clear search"+ onClick={() => setSearch('')}+ />+ ),- <Button key="go" size="tiny" title="Go" type="secondary" onClick={handleSearch}>- <IconSearch size={16} />- </Button>,- ]}- />- </form>+ <Button key="go" size="tiny" title="Go" type="secondary" onClick={handleSearch}>+ <IconSearch size={16} />+ </Button>,+ ]}+ />+ </form>+ </>)}</div></div>diff --git a/studio/tests/pages/projects/LogPanel.test.js b/studio/tests/pages/projects/LogPanel.test.jsindex 89fc9b71c52..75c349417f3 100644--- a/studio/tests/pages/projects/LogPanel.test.js+++ b/studio/tests/pages/projects/LogPanel.test.js@@ -61,8 +61,8 @@ test('reset search filter', async () => {expect(() => screen.getByDisplayValue(/something123/)).toThrow()})-test('timestamp from filter default value', async ()=>{- render(<LogPanel defaultFromValue='2022-01-18T10:43:39+0000' />)+test('timestamp from filter default value', async () => {+ render(<LogPanel defaultFromValue="2022-01-18T10:43:39+0000" />)clickDropdown(await screen.findByText('Custom'))await screen.findByDisplayValue('2022-01-18T10:43:39+0000')})@@ -88,11 +88,21 @@ test('timestamp from filter', async () => {userEvent.type(input, newDate.toISOString())// input actions- await screen.findByTitle("Reset")+ await screen.findByTitle('Reset')const set = await screen.findByRole('button', { name: 'Set' })userEvent.click(set)expect(mockFn).toBeCalled()- await screen.findByText("Custom")+ await screen.findByText('Custom')await screen.findByTitle('Clear timestamp filter')})++test('custom query mode hides elements', async () => {+ const { rerender } = render(<LogPanel isCustomQuery={false} />)+ await screen.findByPlaceholderText(/Search/)+ await screen.findByText('Now')+ rerender(<LogPanel isCustomQuery={true} />)+ await expect(screen.findByPlaceholderText(/Search/)).rejects.toThrow()+ await expect(screen.findByText('Now')).rejects.toThrow()+ await expect(screen.findByText('Custom')).rejects.toThrow()+})