Files
Jordi EnricandJoshen Lim 003cfd6425 feat: warehouse explorer (#27611)
* add basic feature

* rename to datasource

* rename elements in left sidebar

* update copy in titles in left sidebar

* Add optional 'enabled' parameter in useLogsQuery hook

* Update warehouse query state and components

* add template selector for warehouse query builder

* update deprecated input compo

* fix create token and console warnings

* fix type errors

* fix dupped import

* update endpoints and add missing permissions

* update queries with new api path

* fix type errors

* undo last commit

* undo missing file

* fix imports in logs page

* import fixes

* add settings link like in storage menu

* sort imports, fix form submit

* rename access tokens settings section

* align dropdwn

* add overflow to templates dropdown

* add name as defaultvalue to udpate form

* update rm collection dialog

* capitalize

* Update apps/studio/pages/project/[ref]/logs/explorer/index.tsx

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>

* fix typo

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-07-11 12:05:44 +02:00

19 lines
570 B
TypeScript

export type WarehouseQueryTemplate = {
query: string
name: string
description: string
}
export function createWarehouseQueryTemplates(
collections: { name: string }[]
): WarehouseQueryTemplate[] {
return collections.map((collection) => ({
query:
'select id, timestamp, event_message from `' +
collection.name +
'`\nwhere timestamp > timestamp_sub(current_timestamp(), interval 7 day)\norder by timestamp desc limit 10',
name: `${collection.name}`,
description: `Select last 10 events from ${collection.name} collection`,
}))
}