Skip to content

DT-35: Refactor Deployment Page#63

Merged
kigiri merged 4 commits intomasterfrom
35-create-preact-logsviewer-component
Oct 3, 2025
Merged

DT-35: Refactor Deployment Page#63
kigiri merged 4 commits intomasterfrom
35-create-preact-logsviewer-component

Conversation

@abdotop
Copy link
Member

@abdotop abdotop commented Sep 17, 2025

No description provided.

…in ProjectPage

feat: Implement DeploymentPage with sidebar navigation and query editor
@abdotop abdotop linked an issue Sep 17, 2025 that may be closed by this pull request
@abdotop abdotop self-assigned this Sep 17, 2025
@abdotop abdotop added the tournament Pull requests that are related to the Tournament team label Sep 17, 2025
// f{prefix}c1=..., f{prefix}o1=..., f{prefix}v1=...
type FilterRow = { idx: number; key: string; op: string; value: string }

const filterOperators = ['=', '!=', '>', '>=', '<', '<=', 'contains'] as const
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=  -> eq
!= -> neq
>  -> gt
>= -> gte
<  -> lt
<= -> lte

@@ -0,0 +1,290 @@
// URL filter schema (prefix = 't' | 'l'):
// f{prefix}c0=key, f{prefix}o0=op, f{prefix}v0=value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// ft=name,eq,patrick
// ft=id,gte,10
// ft=name,neq,martin
// fl=name,like,pat%rick
const tableFilters = urlSearchParams.getAll('ft')
const logFilters = urlSearchParams.getAll('fl')

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const str = 'name,neq,martin'
const first = str.indexOf(',')
const second = str.indexOf(',', first + 1)
const key = str.slice(0, first)
const op = str.slice(first + 1, second)
const query = str.slice(second + 1)

<div class='m-0 p-2 text-xs font-mono text-base-content/50 leading-6 text-right'>
{Array.from({
length: Math.max(1, (query.match(/\n/g)?.length ?? 0) + 1),
}).map((_, i) => <div key={i}>{i + 1}</div>)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Array(Math.max(1, (query.match(/\n/g)?.length ?? 0) + 1))
  .keys().map(i => <div key={i}>{i + 1}</div>).toArray()

activeTab = 'tables',
}: { activeTab?: 'tables' | 'queries' | 'logs' }) {
const tabClass = (t: 'tables' | 'queries' | 'logs') =>
`tab ${activeTab === t ? 'tab-active' : ''}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(
  <A params={{ tab }} role='tab' class={`tab ${activeTab === tab ? 'tab-active' : ''} capitalize`}>
    {tab}
  </A>
)

Verify the css tailwind class for capitalized

export const DeploymentPage = () => {
const tab = url.params.tab || 'tables'
if (!['tables', 'queries', 'logs'].includes(tab)) {
navigate({ params: { tab: 'tables' } })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace: true in this navigate no ?

</>
)
if (!project.pending && !project.data) {
navigate({ href: '/projects', params: undefined })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want a replace here too ?

@abdotop abdotop force-pushed the 35-create-preact-logsviewer-component branch from 59265aa to 855ff40 Compare September 23, 2025 09:51
…and enhance URL parameter handling in router
@abdotop abdotop force-pushed the 35-create-preact-logsviewer-component branch from 855ff40 to df009d1 Compare September 29, 2025 09:35

export function QueryEditor() {
const query = url.params.q || ''
const results = [] as AnyRecord[]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const results: AnyRecord[] = []

>
<span class='text-sm'>Entries</span>
<ChevronsDown class='h-4 w-4' />
</button>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either add action to button or just remove it

role='tab'
class={`tab ${activeTab === t ? 'tab-active' : ''}`}
>
{t.charAt(0).toUpperCase() + t.slice(1)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do this with css instead

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and should be mouved outside this comp to be it's own component

>
{tab('tables')}
{tab('queries')}
{tab('logs')}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<TabButton tabName='tables' />
<TabButton tabName='queries' />
<TabButton tabName='logs' />


const safeFormatTimestamp = (timestamp: string) => {
const d = new Date(timestamp)
if (isNaN(d.getTime())) return timestamp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure we don't want Number.isNaN() here ? usually the one we want

minute: '2-digit',
second: '2-digit',
fractionalSecondDigits: 3,
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how can this fail ?

@abdotop abdotop marked this pull request as ready for review September 30, 2025 08:48
@abdotop abdotop force-pushed the 35-create-preact-logsviewer-component branch from d4f6bd8 to 24e96b2 Compare September 30, 2025 13:02
@abdotop abdotop changed the title DT-35: Refactor Deployment Pas DT-35: Refactor Deployment Pages Oct 1, 2025
@abdotop abdotop changed the title DT-35: Refactor Deployment Pages DT-35: Refactor Deployment Page Oct 1, 2025
@kigiri kigiri merged commit d0a7231 into master Oct 3, 2025
4 checks passed
@kigiri kigiri deleted the 35-create-preact-logsviewer-component branch October 3, 2025 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tournament Pull requests that are related to the Tournament team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Preact LogsViewer component

2 participants