Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add paths to logics #6945

Merged
merged 7 commits into from Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .kearc
@@ -1,6 +1,7 @@
{
"tsConfigPath": "./tsconfig.json",
"rootPath": "./frontend/src",
"typesPath": "./frontend/src"
"typesPath": "./frontend/src",
"writePaths": true
}

1 change: 1 addition & 0 deletions frontend/src/layout/lemonade/lemonadeLogic.ts
Expand Up @@ -4,6 +4,7 @@ import { featureFlagLogic } from '../../lib/logic/featureFlagLogic'
import { lemonadeLogicType } from './lemonadeLogicType'

export const lemonadeLogic = kea<lemonadeLogicType>({
path: ['layout', 'lemonade', 'lemonadeLogic'],
connect: {
values: [featureFlagLogic, ['featureFlags']],
},
Expand Down
1 change: 1 addition & 0 deletions frontend/src/layout/navigation/navigationLogic.ts
Expand Up @@ -19,6 +19,7 @@ type WarningType =
| null

export const navigationLogic = kea<navigationLogicType<WarningType>>({
path: ['layout', 'navigation', 'navigationLogic'],
actions: {
setMenuCollapsed: (collapsed: boolean) => ({ collapsed }),
collapseMenu: () => {},
Expand Down
Expand Up @@ -13,6 +13,7 @@ interface AnnotationsLogicProps {
}

export const annotationsLogic = kea<annotationsLogicType<AnnotationsLogicProps>>({
path: (key) => ['lib', 'components', 'Annotations', 'annotationsLogic', key],
props: {} as AnnotationsLogicProps,
key: (props) => (props.pageKey ? `${props.pageKey}_annotations` : 'annotations_default'),
connect: {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/components/AppEditorLink/appUrlsLogic.ts
Expand Up @@ -10,6 +10,7 @@ import { teamLogic } from 'scenes/teamLogic'
const defaultValue = 'https://'

export const appUrlsLogic = kea<appUrlsLogicType>({
path: ['lib', 'components', 'AppEditorLink', 'appUrlsLogic'],
connect: {
values: [teamLogic, ['currentTeam', 'currentTeamId']],
},
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/components/BackTo.tsx
Expand Up @@ -11,6 +11,7 @@ interface IBackTo {
}

const backToLogic = kea<backToLogicType<IBackTo>>({
path: ['lib', 'components', 'BackTo'],
actions: {
setBackTo: (payload) => ({ payload }),
},
Expand Down
Expand Up @@ -9,6 +9,7 @@ function isFunnelVizType(filter: FunnelVizType | ChartDisplayType): filter is Fu
}

export const chartFilterLogic = kea<chartFilterLogicType>({
path: ['lib', 'components', 'ChartFilter', 'chartFilterLogic'],
actions: () => ({
setChartFilter: (filter: ChartDisplayType | FunnelVizType) => ({ filter }),
}),
Expand Down
Expand Up @@ -121,6 +121,7 @@ export const commandPaletteLogic = kea<
RegExpCommandPairs
>
>({
path: ['lib', 'components', 'CommandPalette', 'commandPaletteLogic'],
connect: {
actions: [personalAPIKeysLogic, ['createKey']],
values: [teamLogic, ['currentTeam'], userLogic, ['user']],
Expand Down
Expand Up @@ -5,6 +5,7 @@ import { InsightType, ViewType } from '~/types'
import { compareFilterLogicType } from './compareFilterLogicType'

export const compareFilterLogic = kea<compareFilterLogicType>({
path: ['lib', 'components', 'CompareFilter', 'compareFilterLogic'],
actions: () => ({
setCompare: (compare: boolean) => ({ compare }),
setDisabled: (disabled: boolean) => ({ disabled }),
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/components/HelpButton/HelpButton.tsx
Expand Up @@ -13,6 +13,7 @@ import { IconArticle, IconGithub, IconMail, IconQuestionAnswer } from '../icons'
const HELP_UTM_TAGS = '?utm_medium=in-product&utm_campaign=help-button-top'

export const helpButtonLogic = kea<helpButtonLogicType>({
path: ['lib', 'components', 'HelpButton', 'HelpButton'],
connect: {
actions: [eventUsageLogic, ['reportHelpButtonViewed']],
},
Expand Down
Expand Up @@ -5,6 +5,7 @@ import { intervalFilterLogicType } from './intervalFilterLogicType'
import { IntervalKeyType } from 'lib/components/IntervalFilter/intervals'

export const intervalFilterLogic = kea<intervalFilterLogicType>({
path: ['lib', 'components', 'IntervalFilter', 'intervalFilterLogic'],
actions: () => ({
setIntervalFilter: (filter: IntervalKeyType) => ({ filter }),
setDateFrom: (dateFrom: string) => ({ dateFrom }),
Expand Down
Expand Up @@ -6,6 +6,7 @@ import { personalAPIKeysLogicType } from './personalAPIKeysLogicType'
import { copyToClipboard } from 'lib/utils'

export const personalAPIKeysLogic = kea<personalAPIKeysLogicType>({
path: ['lib', 'components', 'PersonalAPIKeys', 'personalAPIKeysLogic'],
loaders: ({ values }) => ({
keys: [
[] as PersonalAPIKeyType[],
Expand Down
Expand Up @@ -6,6 +6,7 @@ import { taxonomicPropertyFilterLogicType } from './taxonomicPropertyFilterLogic
import { cohortsModel } from '~/models/cohortsModel'

export const taxonomicPropertyFilterLogic = kea<taxonomicPropertyFilterLogicType>({
path: (key) => ['lib', 'components', 'PropertyFilters', 'components', 'taxonomicPropertyFilterLogic', key],
props: {} as TaxonomicPropertyFilterLogicProps,
key: (props) => `${props.pageKey}-${props.filterIndex}`,

Expand Down
Expand Up @@ -8,6 +8,7 @@ import { isValidPropertyFilter, parseProperties } from 'lib/components/PropertyF
import { PropertyFilterLogicProps } from 'lib/components/PropertyFilters/types'

export const propertyFilterLogic = kea<propertyFilterLogicType>({
path: (key) => ['lib', 'components', 'PropertyFilters', 'propertyFilterLogic', key],
props: {} as PropertyFilterLogicProps,
key: (props) => props.pageKey,

Expand Down
Expand Up @@ -2,6 +2,7 @@ import { kea } from 'kea'

import { propertySelectLogicType } from './propertyNamesSelectLogicType'
export const propertySelectLogic = kea<propertySelectLogicType>({
path: (key) => ['lib', 'components', 'PropertyNamesSelect', 'propertyNamesSelectLogic', key],
props: {
propertySelectLogicKey: '' as string,

Expand Down
Expand Up @@ -19,6 +19,7 @@ const filterColumns = (columnFilter: string, columns: string[]): string[] =>
: columns

export const columnConfiguratorLogic = kea<columnConfiguratorLogicType<ColumnConfiguratorLogicProps>>({
path: ['lib', 'components', 'ResizableTable', 'columnConfiguratorLogic'],
props: { availableColumns: [], selectedColumns: [] } as ColumnConfiguratorLogicProps,
actions: {
selectColumn: (column: string) => ({ column }),
Expand Down
Expand Up @@ -4,6 +4,7 @@ import { router } from 'kea-router'
import { ColumnChoice } from '~/types'

export const tableConfigLogic = kea<tableConfigLogicType>({
path: ['lib', 'components', 'ResizableTable', 'tableConfigLogic'],
actions: {
showModal: true,
hideModal: false,
Expand Down
Expand Up @@ -6,6 +6,7 @@ import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { saveToDashboardModalLogicType } from './saveToDashboardModalLogicType'

export const saveToDashboardModalLogic = kea<saveToDashboardModalLogicType>({
path: (key) => ['lib', 'components', 'SaveToDashboard', 'saveToDashboardModalLogic', key],
props: {} as {
id?: number
fromDashboard?: number
Expand Down
Expand Up @@ -33,6 +33,7 @@ const apiCache: Record<string, EventDefinitionStorage> = {}
const apiCacheTimers: Record<string, number> = {}

export const infiniteListLogic = kea<infiniteListLogicType>({
path: (key) => ['lib', 'components', 'TaxonomicFilter', 'infiniteListLogic', key],
props: {} as InfiniteListLogicProps,

key: (props) => `${props.taxonomicFilterLogicKey}-${props.listGroupType}`,
Expand Down
Expand Up @@ -18,6 +18,7 @@ import { groupsModel } from '~/models/groupsModel'
import { groupPropertiesModel } from '~/models/groupPropertiesModel'

export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>({
path: (key) => ['lib', 'components', 'TaxonomicFilter', 'taxonomicFilterLogic', key],
props: {} as TaxonomicFilterLogicProps,
key: (props) => `${props.taxonomicFilterLogicKey}`,
connect: { values: [teamLogic, ['currentTeamId'], groupsModel, ['groupTypes']] },
Expand Down
Expand Up @@ -2,6 +2,7 @@ import { kea } from 'kea'

import { visibilitySensorLogicType } from './visibilitySensorLogicType'
export const visibilitySensorLogic = kea<visibilitySensorLogicType>({
path: (key) => ['lib', 'components', 'VisibilitySensor', 'visibilitySensorLogic', key],
props: {} as {
id: string
offset?: number
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/experimental/NPSPrompt.tsx
Expand Up @@ -24,6 +24,7 @@ interface NPSPayload {
}

const npsLogic = kea<npsLogicType<NPSPayload, Step>>({
path: ['lib', 'experimental', 'NPSPrompt'],
selectors: {
featureFlagEnabled: [
() => [featureFlagLogic.selectors.featureFlags],
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/logic/prompt.jsx
Expand Up @@ -12,6 +12,7 @@ import { Modal, Input, Form } from 'antd'
// actions:
// - prompt({ title, placeholder, value, error, success, failure })
export const prompt = kea({
path: (key) => ['lib', 'logic', 'prompt', key],
key: (props) => props.key,

actions: () => ({
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/logic/selectBoxLogic.ts
Expand Up @@ -37,6 +37,7 @@ export const searchItems = (sources: SelectedItem[], search: string): SelectedIt
}

export const selectBoxLogic = kea<selectBoxLogicType>({
path: ['lib', 'logic', 'selectBoxLogic'],
props: {} as {
items: SelectBoxItem[]
updateFilter: (type: any, id: string | number, name: string) => void
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/utils/eventUsageLogic.ts
Expand Up @@ -146,6 +146,7 @@ function sanitizeFilterParams(filters: Partial<FilterType>): Record<string, any>
export const eventUsageLogic = kea<
eventUsageLogicType<DashboardEventSource, GraphSeriesAddedSource, RecordingWatchedSource>
>({
path: ['lib', 'utils', 'eventUsageLogic'],
connect: () => [preflightLogic],
actions: {
reportAnnotationViewed: (annotations: AnnotationType[] | null) => ({ annotations }),
Expand Down
1 change: 1 addition & 0 deletions frontend/src/models/actionsModel.ts
Expand Up @@ -8,6 +8,7 @@ interface ActionsModelProps {
}

export const actionsModel = kea<actionsModelType<ActionsModelProps>>({
path: ['models', 'actionsModel'],
props: {} as ActionsModelProps,
loaders: ({ props }) => ({
actions: {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/models/annotationsModel.ts
Expand Up @@ -8,6 +8,7 @@ import { AnnotationScope, AnnotationType } from '~/types'
import { teamLogic } from '../scenes/teamLogic'

export const annotationsModel = kea<annotationsModelType>({
path: ['models', 'annotationsModel'],
actions: {
createGlobalAnnotation: (content: string, date_marker: string, dashboard_item?: number) => ({
content,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/models/cohortsModel.ts
Expand Up @@ -6,6 +6,7 @@ import { CohortType } from '~/types'
const POLL_TIMEOUT = 5000

export const cohortsModel = kea<cohortsModelType>({
path: ['models', 'cohortsModel'],
actions: () => ({
setPollTimeout: (pollTimeout: number | null) => ({ pollTimeout }),
updateCohort: (cohort: CohortType) => ({ cohort }),
Expand Down
1 change: 1 addition & 0 deletions frontend/src/models/dashboardItemsModel.tsx
Expand Up @@ -11,6 +11,7 @@ import { urls } from 'scenes/urls'
import { teamLogic } from '../scenes/teamLogic'

export const dashboardItemsModel = kea<dashboardItemsModelType>({
path: ['models', 'dashboardItemsModel'],
actions: () => ({
renameDashboardItem: (item: DashboardItemType) => ({ item }),
renameDashboardItemSuccess: (item: DashboardItemType) => ({ item }),
Expand Down
1 change: 1 addition & 0 deletions frontend/src/models/eventDefinitionsModel.ts
Expand Up @@ -17,6 +17,7 @@ interface EventsGroupedInterface {
}

export const eventDefinitionsModel = kea<eventDefinitionsModelType<EventDefinitionStorage, EventsGroupedInterface>>({
path: ['models', 'eventDefinitionsModel'],
actions: () => ({
updateDescription: (id: string, description: string | null, type: string) => ({ id, description, type }),
updateEventDefinition: (eventDefinition: EventDefinition) => ({ eventDefinition }),
Expand Down
1 change: 1 addition & 0 deletions frontend/src/models/funnelsModel.ts
Expand Up @@ -19,6 +19,7 @@ const parseSavedFunnel = (result: Record<string, any>): SavedFunnel => {
}

export const funnelsModel = kea<funnelsModelType>({
path: ['models', 'funnelsModel'],
loaders: ({ values, actions }) => ({
funnels: {
__default: [] as SavedFunnel[],
Expand Down
1 change: 1 addition & 0 deletions frontend/src/models/groupPropertiesModel.ts
Expand Up @@ -6,6 +6,7 @@ import { teamLogic } from 'scenes/teamLogic'
import { groupsModel } from './groupsModel'

export const groupPropertiesModel = kea<groupPropertiesModelType>({
path: ['models', 'groupPropertiesModel'],
connect: {
values: [teamLogic, ['currentTeamId'], groupsModel, ['groupsEnabled']],
},
Expand Down
1 change: 1 addition & 0 deletions frontend/src/models/groupsModel.ts
Expand Up @@ -9,6 +9,7 @@ import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { preflightLogic } from 'scenes/PreflightCheck/logic'

export const groupsModel = kea<groupsModelType>({
path: ['models', 'groupsModel'],
connect: {
values: [
teamLogic,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/models/index.ts
Expand Up @@ -11,6 +11,7 @@ import { modelsType } from './indexType'

/** "Models" are logics that are persistently mounted (start with app) */
export const models = kea<modelsType>({
path: ['models', 'index'],
connect: [
actionsModel,
annotationsModel,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/models/personPropertiesModel.ts
Expand Up @@ -4,6 +4,7 @@ import api from 'lib/api'
import { PersonProperty } from '~/types'

export const personPropertiesModel = kea<personPropertiesModelType>({
path: ['models', 'personPropertiesModel'],
loaders: {
personProperties: [
[] as Array<PersonProperty>,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/models/propertyDefinitionsModel.ts
Expand Up @@ -16,6 +16,7 @@ interface PropertyDefinitionStorage {
export const propertyDefinitionsModel = kea<
propertyDefinitionsModelType<PropertyDefinitionStorage, PropertySelectOption>
>({
path: ['models', 'propertyDefinitionsModel'],
actions: () => ({
updatePropertyDefinition: (property: PropertyDefinition) => ({ property }),
}),
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/App.tsx
Expand Up @@ -22,6 +22,7 @@ import { SideBar } from '../layout/lemonade/SideBar/SideBar'
import { appScenes } from 'scenes/appScenes'

export const appLogic = kea<appLogicType>({
path: ['scenes', 'App'],
actions: {
enableDelayedSpinner: true,
ignoreFeatureFlags: true,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/PreflightCheck/logic.ts
Expand Up @@ -8,6 +8,7 @@ import { getAppContext } from 'lib/utils/getAppContext'
type PreflightMode = 'experimentation' | 'live'

export const preflightLogic = kea<preflightLogicType<PreflightMode>>({
path: ['scenes', 'PreflightCheck', 'preflightLogic'],
loaders: {
preflight: [
null as PreflightStatus | null,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/actions/Action.tsx
Expand Up @@ -18,6 +18,7 @@ interface ActionLogicProps {
}

const actionLogic = kea<actionLogicType<ActionLogicProps>>({
path: (key) => ['scenes', 'actions', 'actionLogic', key],
props: {} as ActionLogicProps,
key: (props) => props.id || 'new',
actions: () => ({
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/actions/actionEditLogic.ts
Expand Up @@ -17,6 +17,7 @@ export interface ActionEditLogicProps {
}

export const actionEditLogic = kea<actionEditLogicType<ActionEditLogicProps, ActionEditType>>({
path: (key) => ['scenes', 'actions', 'actionEditLogic', key],
props: {} as ActionEditLogicProps,
key: (props) => props.id || 'new',
actions: () => ({
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/annotations/logic.ts
Expand Up @@ -7,6 +7,7 @@ import { AnnotationType } from '~/types'
import { teamLogic } from '../teamLogic'

export const annotationsTableLogic = kea<annotationsTableLogicType>({
path: ['scenes', 'annotations', 'logic'],
loaders: ({ actions }) => ({
annotations: {
__default: [],
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/authentication/inviteSignupLogic.ts
Expand Up @@ -22,6 +22,7 @@ interface AcceptInvitePayloadInterface {
}

export const inviteSignupLogic = kea<inviteSignupLogicType<AcceptInvitePayloadInterface, ErrorInterface>>({
path: ['scenes', 'authentication', 'inviteSignupLogic'],
actions: {
setError: (payload: ErrorInterface) => ({ payload }),
},
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/authentication/loginLogic.ts
Expand Up @@ -14,6 +14,7 @@ export function afterLoginRedirect(): string {
}

export const loginLogic = kea<loginLogicType<AuthenticateResponseType>>({
path: ['scenes', 'authentication', 'loginLogic'],
loaders: {
authenticateResponse: [
null as AuthenticateResponseType | null,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/authentication/passwordResetLogic.ts
Expand Up @@ -20,6 +20,7 @@ interface ValidatedTokenResponseType extends ResponseType {
export const passwordResetLogic = kea<
passwordResetLogicType<ResetResponseType, ResponseType, ValidatedTokenResponseType>
>({
path: ['scenes', 'authentication', 'passwordResetLogic'],
loaders: ({ values }) => ({
resetResponse: [
null as ResetResponseType | null,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/authentication/signupLogic.ts
Expand Up @@ -11,6 +11,7 @@ interface AccountResponse {
}

export const signupLogic = kea<signupLogicType<AccountResponse>>({
path: ['scenes', 'authentication', 'signupLogic'],
actions: {
setInitialEmail: (email: string) => ({ email }),
setFormSubmitted: (submitted: boolean) => ({ submitted }),
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/billing/billingLogic.ts
Expand Up @@ -16,6 +16,7 @@ export enum BillingAlertType {
}

export const billingLogic = kea<billingLogicType<BillingAlertType>>({
path: ['scenes', 'billing', 'billingLogic'],
actions: {
registerInstrumentationProps: true,
},
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/cohorts/Cohorts.tsx
Expand Up @@ -35,6 +35,7 @@ const NEW_COHORT: CohortType = {
}

const cohortsUrlLogic = kea<cohortsUrlLogicType>({
path: ['scenes', 'cohorts', 'cohortsUrlLogic'],
actions: {
setOpenCohort: (cohort: CohortType | null) => ({ cohort }),
},
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/cohorts/cohortLogic.tsx
Expand Up @@ -41,6 +41,7 @@ export const cohortLogic = kea<cohortLogicType>({
cohort: CohortType
},
key: (props) => props.cohort.id || 'new',
path: (key) => ['scenes', 'cohorts', 'cohortLogic', key],
connect: [cohortsModel],

actions: () => ({
Expand Down