-
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: Add tabs for pipeline UI (#18235)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
4a97546
commit bca73ba
Showing
9 changed files
with
124 additions
and
11 deletions.
There are no files selected for viewing
Binary file added
BIN
+55 KB
frontend/__snapshots__/scenes-app-pipeline--pipeline-filtering-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.88 KB
(110%)
frontend/__snapshots__/scenes-app-pipeline--pipeline-landing-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+56.3 KB
frontend/__snapshots__/scenes-app-pipeline--pipeline-transformations-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,6 +1,67 @@ | ||
import { kea } from 'kea' | ||
import { actions, kea, path, reducers, selectors } from 'kea' | ||
import type { pipelineLogicType } from './pipelineLogicType' | ||
import { actionToUrl, urlToAction } from 'kea-router' | ||
import { urls } from 'scenes/urls' | ||
import { Breadcrumb, PipelineTabs } from '~/types' | ||
|
||
export const pipelineLogic = kea<pipelineLogicType>({ | ||
path: ['scenes', 'pipeline', 'pipelineLogic'], | ||
}) | ||
export const singularName = (tab: PipelineTabs): string => { | ||
switch (tab) { | ||
case PipelineTabs.Filters: | ||
return 'filter' | ||
case PipelineTabs.Transformations: | ||
return 'transformation' | ||
case PipelineTabs.Destinations: | ||
return 'destination' | ||
} | ||
} | ||
|
||
export const humanFriendlyTabName = (tab: PipelineTabs): string => { | ||
switch (tab) { | ||
case PipelineTabs.Filters: | ||
return 'Filters' | ||
case PipelineTabs.Transformations: | ||
return 'Transformations' | ||
case PipelineTabs.Destinations: | ||
return 'Destinations' | ||
} | ||
} | ||
|
||
export const pipelineLogic = kea<pipelineLogicType>([ | ||
path(['scenes', 'pipeline', 'pipelineLogic']), | ||
actions({ | ||
setCurrentTab: (tab: PipelineTabs = PipelineTabs.Destinations) => ({ tab }), | ||
}), | ||
reducers({ | ||
currentTab: [ | ||
PipelineTabs.Destinations as PipelineTabs, | ||
{ | ||
setCurrentTab: (_, { tab }) => tab, | ||
}, | ||
], | ||
}), | ||
selectors(() => ({ | ||
breadcrumbs: [ | ||
(s) => [s.currentTab], | ||
(tab): Breadcrumb[] => { | ||
const breadcrumbs: Breadcrumb[] = [{ name: 'Pipeline' }] | ||
breadcrumbs.push({ | ||
name: humanFriendlyTabName(tab), | ||
}) | ||
|
||
return breadcrumbs | ||
}, | ||
], | ||
})), | ||
actionToUrl(({ values }) => { | ||
return { | ||
setCurrentTab: () => [urls.pipeline(values.currentTab)], | ||
} | ||
}), | ||
urlToAction(({ actions, values }) => ({ | ||
'/pipeline/:tab': ({ tab }) => { | ||
if (tab !== values.currentTab) { | ||
actions.setCurrentTab(tab as PipelineTabs) | ||
} | ||
}, | ||
})), | ||
]) |
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