mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
716 files rewritten, 30 renamed, same family mapping as the frontend pass.
Held back, and each for a reason rather than by oversight:
db_table values insights_hogfunction, insights_hogflow,
insights_hogfunctiontemplate, hogflow_templates.
Renaming a table is ALTER TABLE, so it ships as a
migration with the raw SQL in nodejs that names it.
hog_invocation_results a Datastore table with Kafka engine tables on it
products/review_hog the module path is the Django app path; moving it
moves app_label and every migration is recorded under
(app_label, name). That is the same history break as
renaming a migration file, one level up.
*/migrations/* five files, untouched
whogho an integration vendor
Checked: 395 of 397 changed Python files compile. The two that do not —
insightsql/database/database.py and temporal/schedule.py — fail identically at
origin/main under the same interpreter, because they use `type X = ...` and
`except*`, which need the 3.13 this repo pins and not the 3.9 doing the check.
Running the check against the original is what told those apart from a real
break.
Co-authored-by: Hanzo Dev <[email protected]>
120 lines
5.4 KiB
TypeScript
120 lines
5.4 KiB
TypeScript
import { BindLogic, useValues } from 'kea'
|
|
import { router } from 'kea-router'
|
|
|
|
import { IconPlusSmall } from '@hanzo/icons'
|
|
import { Button } from '@hanzo/elements'
|
|
|
|
import { AccessControlAction } from 'lib/components/AccessControlAction'
|
|
import { BigLeaguesScript } from 'lib/components/mascots'
|
|
import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIntroduction'
|
|
import { Shortcut } from 'lib/components/Shortcuts/Shortcut'
|
|
import { keyBinds } from 'lib/components/Shortcuts/shortcuts'
|
|
import { Tab, Tabs } from 'lib/elements/Tabs'
|
|
import { sceneConfigurations } from 'scenes/scenes'
|
|
import { Scene, SceneExport } from 'scenes/sceneTypes'
|
|
import { urls } from 'scenes/urls'
|
|
|
|
import { SceneContent } from '~/layout/scenes/components/SceneContent'
|
|
import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
|
|
import { ProductKey } from '~/queries/schema/schema-general'
|
|
import { AccessControlLevel, AccessControlResourceType } from '~/types'
|
|
|
|
import { Endpoints } from './Endpoints'
|
|
import { endpointsLogic } from './endpointsLogic'
|
|
import { EndpointsUsage } from './EndpointsUsage'
|
|
import { endpointsUsageLogic } from './endpointsUsageLogic'
|
|
import { InsightPickerEndpointModal } from './InsightPickerEndpointModal'
|
|
import { OverlayForNewEndpointMenu } from './newEndpointMenu'
|
|
|
|
const ENDPOINTS_PRODUCT_DESCRIPTION =
|
|
'Create reusable SQL queries and expose them as API endpoints. Query your data programmatically from any application.'
|
|
const ENDPOINTS_USAGE_PRODUCT_DESCRIPTION =
|
|
'Monitor endpoint execution metrics including bytes read, CPU usage, and query duration. Compare materialized vs inline executions.'
|
|
|
|
export const scene: SceneExport = {
|
|
component: EndpointsScene,
|
|
logic: endpointsLogic,
|
|
productKey: ProductKey.ENDPOINTS,
|
|
}
|
|
|
|
export function EndpointsScene(): JSX.Element {
|
|
const { activeTab } = useValues(endpointsLogic)
|
|
|
|
const tabs: Tab<string>[] = [
|
|
{
|
|
key: 'endpoints',
|
|
label: 'Endpoints',
|
|
content: <Endpoints />,
|
|
link: urls.endpoints(),
|
|
},
|
|
{
|
|
key: 'usage',
|
|
label: 'Usage',
|
|
content: <EndpointsUsage />,
|
|
link: urls.endpointsUsage(),
|
|
},
|
|
]
|
|
return (
|
|
<BindLogic logic={endpointsLogic} props={{}}>
|
|
<BindLogic logic={endpointsUsageLogic} props={{}}>
|
|
<SceneContent>
|
|
<SceneTitleSection
|
|
name={sceneConfigurations[Scene.EndpointsScene].name}
|
|
description={sceneConfigurations[Scene.EndpointsScene].description}
|
|
resourceType={{
|
|
type: sceneConfigurations[Scene.EndpointsScene].iconType || 'default_icon_type',
|
|
}}
|
|
actions={
|
|
<Shortcut
|
|
name="EndpointsNew"
|
|
keybind={[keyBinds.new]}
|
|
intent="New endpoint"
|
|
interaction="click"
|
|
scope={Scene.EndpointsScene}
|
|
>
|
|
<AccessControlAction
|
|
resourceType={AccessControlResourceType.Endpoint}
|
|
minAccessLevel={AccessControlLevel.Editor}
|
|
>
|
|
<Button
|
|
type="primary"
|
|
to={urls.sqlEditor({ source: 'endpoint' })}
|
|
sideAction={{
|
|
dropdown: {
|
|
placement: 'bottom-end',
|
|
className: 'new-endpoint-overlay',
|
|
actionable: true,
|
|
overlay: <OverlayForNewEndpointMenu />,
|
|
},
|
|
'data-attr': 'new-endpoint-dropdown',
|
|
}}
|
|
data-attr="new-endpoint-button"
|
|
size="small"
|
|
icon={<IconPlusSmall />}
|
|
>
|
|
New
|
|
</Button>
|
|
</AccessControlAction>
|
|
</Shortcut>
|
|
}
|
|
/>
|
|
<ProductIntroduction
|
|
productName="endpoints"
|
|
productKey={ProductKey.ENDPOINTS}
|
|
thingName="endpoint"
|
|
description={
|
|
activeTab === 'usage' ? ENDPOINTS_USAGE_PRODUCT_DESCRIPTION : ENDPOINTS_PRODUCT_DESCRIPTION
|
|
}
|
|
docsURL="https://hanzo.ai/docs/endpoints"
|
|
customScript={BigLeaguesScript}
|
|
isEmpty={false}
|
|
action={() => router.actions.push(urls.sqlEditor({ source: 'endpoint' }))}
|
|
/>
|
|
<Tabs activeKey={activeTab} data-attr="endpoints-tabs" tabs={tabs} sceneInset />
|
|
<InsightPickerEndpointModal />
|
|
</SceneContent>
|
|
</BindLogic>
|
|
</BindLogic>
|
|
)
|
|
}
|