Files
zeekay 1b367e2b62 chore: rebase the tree onto upstream master
The tree was a debranded snapshot of upstream taken around 2026-02-20, and
upstream has moved about five months since. This replaces it with upstream
master, mechanically re-derived: bin/debrand does the rename, and the
pipeline and squashed migrations are restored from the shipped tree.

Not a merge. The previous import replaced the tree wholesale in a single
commit, so there is no shared content history to merge against. Reproducing
the rename on the new tree is what actually converges.

What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints,
compose files, LLM.md, and insights/migrations. The squashed initial
migration is load-bearing — the live database records it by name, so
upstream's ~918 individual migrations cannot come back.

Nine products are dropped as unreferenced. Twenty-one more that we do not run
are kept anyway because the core app still imports them; unpicking those is a
refactor and does not belong in a rebase.

This base does not build yet, and the reasons are not in the rename:
upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against
our 4.2, and the dependency manifests still name upstream packages that we
republish under our own names. Those are decisions, not renames.
2026-08-01 15:44:40 -07:00

177 lines
6.5 KiB
TypeScript

import { useActions, useValues } from 'kea'
import { combineUrl } from 'kea-router'
import { Button, Table, Tag } from '@hanzo/elements'
import type { TableColumns } from '@hanzo/elements'
import { More } from 'lib/elements/Button/More'
import { atColumn } from 'lib/elements/Table/columnUtils'
import { TableLink } from 'lib/elements/Table/TableLink'
import { ProfilePicture } from 'lib/elements/ProfilePicture'
import { urls } from 'scenes/urls'
import { SceneSection } from '~/layout/scenes/components/SceneSection'
import type { EndpointVersionType } from '~/types'
import { endpointLogic } from '../endpointLogic'
import { EndpointTab, endpointSceneLogic } from '../endpointSceneLogic'
function getStatusTagType(status: string | undefined): 'success' | 'danger' | 'warning' | 'default' {
if (!status) {
return 'warning'
}
switch (status.toLowerCase()) {
case 'failed':
return 'danger'
case 'running':
return 'warning'
case 'completed':
return 'success'
default:
return 'default'
}
}
export function EndpointVersions(): JSX.Element {
const { endpoint, versions, versionsLoading } = useValues(endpointLogic)
const { updateEndpoint } = useActions(endpointLogic)
const { viewingVersion } = useValues(endpointSceneLogic)
if (!endpoint) {
return <></>
}
const columns: TableColumns<EndpointVersionType> = [
{
title: 'Version',
dataIndex: 'version',
key: 'version',
width: '25%',
render: function Render(_, record) {
const isViewing = viewingVersion?.version === record.version
const isCurrent = record.version === endpoint.current_version
const versionUrl = combineUrl(urls.endpoint(endpoint.name), {
tab: EndpointTab.VERSIONS,
...(isCurrent ? {} : { version: record.version }),
}).url
return (
<TableLink
to={versionUrl}
title={
<>
v{record.version}
{isCurrent && (
<Tag type="completion" className="ml-2">
Latest
</Tag>
)}
{isViewing && !isCurrent && (
<Tag type="highlight" className="ml-2">
Viewing
</Tag>
)}
</>
}
description={record.description}
/>
)
},
},
{
title: 'Status',
dataIndex: 'is_active',
key: 'status',
align: 'center',
render: function RenderStatus(_, record) {
return record.is_active ? (
<Tag type="success">Active</Tag>
) : (
<Tag type="danger">Inactive</Tag>
)
},
},
{
title: 'Materialized',
dataIndex: 'is_materialized',
key: 'materialization',
render: function RenderMaterialization(_, record) {
if (!record.is_materialized) {
return <span className="text-muted">-</span>
}
return (
<div className="flex items-center gap-2">
<Tag type={getStatusTagType(record.materialization?.status)}>
{record.materialization?.status || 'Unknown'}
</Tag>
</div>
)
},
},
atColumn<EndpointVersionType>('version_created_at', 'Created') as any,
{
title: 'Created by',
dataIndex: 'version_created_by',
render: function RenderCreatedBy(_, record) {
return (
<div className="flex flex-row items-center flex-nowrap">
{record.version_created_by && (
<ProfilePicture user={record.version_created_by} size="md" showName />
)}
</div>
)
},
},
{
key: 'actions',
width: 0,
render: function RenderActions(_, record) {
const isCurrent = record.version === endpoint.current_version
const versionUrl = combineUrl(urls.endpoint(endpoint.name), {
tab: EndpointTab.VERSIONS,
...(isCurrent ? {} : { version: record.version }),
}).url
return (
<More
overlay={
<>
<Button fullWidth to={versionUrl}>
View version
</Button>
<Button
fullWidth
onClick={() =>
updateEndpoint(
endpoint.name,
{ is_active: !record.is_active },
{ version: record.version }
)
}
>
{record.is_active ? 'Deactivate version' : 'Activate version'}
</Button>
</>
}
/>
)
},
},
]
return (
<SceneSection
title="Endpoint versions"
description="Updating an endpoint's query creates a new version. However, you can manage each endpoint version's configuration separately. You can also either deactivate a single version, or the entire endpoint."
>
<Table
data-attr="endpoint-versions-table"
dataSource={versions || []}
columns={columns}
loading={versionsLoading}
rowKey="id"
emptyState="No versions found"
nouns={['version', 'versions']}
/>
</SceneSection>
)
}