-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Pipeline UI App tabs with logs view
- Loading branch information
Showing
10 changed files
with
198 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { SceneExport } from 'scenes/sceneTypes' | ||
import { useValues } from 'kea' | ||
import { pipelineAppLogic } from './pipelineAppLogic' | ||
import { PageHeader } from 'lib/components/PageHeader' | ||
import { LemonTabs } from 'lib/lemon-ui/LemonTabs/LemonTabs' | ||
import { router } from 'kea-router' | ||
import { PipelineAppTabs } from '~/types' | ||
import { urls } from 'scenes/urls' | ||
import { PluginLogs } from 'scenes/plugins/plugin/PluginLogs' | ||
import { Spinner } from '@posthog/lemon-ui' | ||
|
||
export const scene: SceneExport = { | ||
component: PipelineApp, | ||
logic: pipelineAppLogic, | ||
paramsToProps: ({ params: { id } }: { params: { id?: string } }) => ({ id: id ? parseInt(id) : 'new' }), | ||
} | ||
|
||
export function PipelineApp({ id }: { id?: string } = {}): JSX.Element { | ||
const { currentTab } = useValues(pipelineAppLogic) | ||
|
||
const confId = id ? parseInt(id) : undefined | ||
|
||
if (!confId) { | ||
return <Spinner /> | ||
} | ||
|
||
const tab_to_content: Record<PipelineAppTabs, JSX.Element> = { | ||
[PipelineAppTabs.Configuration]: <div>Configuration editing</div>, | ||
[PipelineAppTabs.Metrics]: <div>Metrics page</div>, | ||
[PipelineAppTabs.Logs]: <PluginLogs pluginConfigId={confId} />, | ||
} | ||
|
||
return ( | ||
<div className="pipeline-app-scene"> | ||
<PageHeader title={`Pipeline App`} /> | ||
<LemonTabs | ||
activeKey={currentTab} | ||
onChange={(tab) => router.actions.push(urls.pipelineApp(confId, tab as PipelineAppTabs))} | ||
tabs={Object.values(PipelineAppTabs).map((tab) => ({ | ||
label: tab, | ||
key: tab, | ||
content: tab_to_content[tab], | ||
}))} | ||
/> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"count": 2, | ||
"next": null, | ||
"previous": null, | ||
"results": [ | ||
{ | ||
"id": "018bb51f-0f9f-0000-34ae-d3aa1d9a5770", | ||
"team_id": 1, | ||
"plugin_id": 1, | ||
"plugin_config_id": 11, | ||
"timestamp": "2023-11-09T17:26:33.626000Z", | ||
"source": "PLUGIN", | ||
"type": "ERROR", | ||
"message": "Error: Received an unexpected error from the endpoint API. Response 400: {\"meta\":{\"errors\":[\"value for attribute '$current_url' cannot be longer than 1000 bytes\"]}}\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)", | ||
"instance_id": "12345678-1234-1234-1234-123456789012" | ||
}, | ||
{ | ||
"id": "018bb51e-262a-0000-eb34-39afd4691d56", | ||
"team_id": 1, | ||
"plugin_id": 1, | ||
"plugin_config_id": 11, | ||
"timestamp": "2023-11-09T17:25:33.790000Z", | ||
"source": "PLUGIN", | ||
"type": "INFO", | ||
"message": "Successfully sent event to endpoint", | ||
"instance_id": "12345678-1234-1234-1234-123456789012" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { kea, reducers, path, props, key, actions, selectors } from 'kea' | ||
|
||
import type { pipelineAppLogicType } from './pipelineAppLogicType' | ||
import { Breadcrumb, PipelineAppTabs } from '~/types' | ||
import { urls } from 'scenes/urls' | ||
import { actionToUrl, urlToAction } from 'kea-router' | ||
|
||
export interface PipelineAppLogicProps { | ||
id: number | ||
} | ||
|
||
export const pipelineAppLogic = kea<pipelineAppLogicType>([ | ||
props({} as PipelineAppLogicProps), | ||
key(({ id }) => id), | ||
path((id) => ['scenes', 'pipeline', 'PipelineAppLogic', id]), | ||
actions({ | ||
setCurrentTab: (tab: PipelineAppTabs = PipelineAppTabs.Configuration) => ({ tab }), | ||
}), | ||
reducers({ | ||
currentTab: [ | ||
PipelineAppTabs.Configuration as PipelineAppTabs, | ||
{ | ||
setCurrentTab: (_, { tab }) => tab, | ||
}, | ||
], | ||
}), | ||
selectors({ | ||
breadcrumbs: [ | ||
() => [], | ||
(): Breadcrumb[] => [ | ||
{ | ||
name: 'Pipeline', | ||
path: urls.pipeline(), | ||
}, | ||
{ | ||
name: 'App name', | ||
}, | ||
], | ||
], | ||
}), | ||
actionToUrl(({ values, props }) => { | ||
return { | ||
setCurrentTab: () => [urls.pipelineApp(props.id, values.currentTab)], | ||
} | ||
}), | ||
urlToAction(({ actions, values }) => ({ | ||
'/pipeline/:id/:tab': ({ tab }) => { | ||
if (tab !== values.currentTab) { | ||
actions.setCurrentTab(tab as PipelineAppTabs) | ||
} | ||
}, | ||
})), | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters