How to use kea - 10 common examples

To help you get started, we’ve selected a few kea examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mariusandra / insights / packages / insights-core / client / scenes / dashboard / graph / index.js View on Github external
// utils
import urlToState from 'lib/explorer/url-to-state'
import promptPopup from 'lib/popups/prompt'

// components
import ExplorerGraph from '~/scenes/explorer/graph'
import Spinner from 'lib/tags/spinner'

// logic
import dashboardLogic from '~/scenes/dashboard/logic'
import headerLogic from '~/scenes/header/logic'

import client from '~/client'
const resultsService = client.service('api/results')

@connect({
  actions: [
    headerLogic, [
      'openLocation'
    ],
    dashboardLogic, [
      'deleteItem',
      'renameItem'
    ]
  ],
  props: [
    dashboardLogic, [
      'items'
    ]
  ]
})
@Dimensions({ elementResize: true })
github mariusandra / insights / packages / insights-core / client / scenes / header / index.js View on Github external
// utils

// components
import User from './user'
import Views from './views'
import Share from './share'
import CopyQuery from './copy-query'

// logic
import authLogic from '~/scenes/auth'
import headerLogic from '~/scenes/header/logic'
import sceneSaga from '~/scenes/header/saga'
import viewsSaga from '~/scenes/header/views/saga'

@connect({
  actions: [
    headerLogic, [
      'openLocation'
    ]
  ],
  props: [
    state => state.routing.locationBeforeTransitions, [
      'pathname',
      'search'
    ],
    authLogic, [
      'user',
      'runningInElectron'
    ]
  ],
  sagas: [
github mariusandra / insights / packages / insights-core / client / scenes / explorer / filter / index.js View on Github external
// libraries
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'kea'

// utils
import Dimensions from 'react-dimensions'

// components
import OneFilter from './one-filter'

// logic
import explorerLogic from '~/scenes/explorer/logic'

@connect({
  props: [
    explorerLogic, [
      'filter'
    ]
  ]
})
@Dimensions({ elementResize: true })
export default class Filter extends Component {
  static propTypes = {
    setFilterHeight: PropTypes.func
  }

  componentDidUpdate () {
    const { setFilterHeight } = this.props

    const element = this.refs.filter
github mariusandra / insights / packages / insights-core / client / scenes / header / views / index.js View on Github external
import './styles.scss'

// libraries
import React, { Component } from 'react'
import { connect } from 'kea'

// utils
import { AnchorButton, Dialog, Classes, Intent, Button, Popover, Position, Menu, MenuItem, MenuDivider } from "@blueprintjs/core"
// components

// logic
import viewsLogic from '~/scenes/header/views/logic'

@connect({
  actions: [
    viewsLogic, [
      'setNewName',
      'openNew',
      'saveView',
      'cancelNew',
      'openView'
    ]
  ],
  props: [
    viewsLogic, [
      'newName',
      'newOpen',
      'sortedViews'
    ],
    state => state.routing.locationBeforeTransitions, [
github mariusandra / insights / app / scenes / index.js View on Github external
}

  if (isClientSide) {
    const sagaMiddleware = createSagaMiddleware()
    const finalCreateStore = compose(
      applyMiddleware(sagaMiddleware),
      applyMiddleware(routerMiddleware(browserHistory)),
      window.devToolsExtension ? window.devToolsExtension() : f => f
    )(createStore)

    const store = createKeaStore(finalCreateStore, appReducers)
    sagaMiddleware.run(createRootSaga(appSaga))
    const history = syncHistoryWithStore(browserHistory, store)

    // TODO: check why do we need to do this?
    match({routes: getRoutes(Layout, store, routes), location: railsContext.location}, () => {})

    store.dispatch(initFromProps(props))

    // custom scenes
    store.addKeaScene(headerScene, true)

    return (
      
        
      
    )
  } else {
    // we aren't using this at the moment
  }
}
github mariusandra / insights / app / scenes / index.js View on Github external
const store = createKeaStore(finalCreateStore, appReducers)
    sagaMiddleware.run(createRootSaga(appSaga))
    const history = syncHistoryWithStore(browserHistory, store)

    // TODO: check why do we need to do this?
    match({routes: getRoutes(Layout, store, routes), location: railsContext.location}, () => {})

    store.dispatch(initFromProps(props))

    // custom scenes
    store.addKeaScene(headerScene, true)

    return (
      
        
      
    )
  } else {
    // we aren't using this at the moment
  }
}
github keajs / kea / assets / scaffolds / code / index.js View on Github external
// libraries
import React, { Component } from 'react'
import { connect } from 'kea/logic'

// utils

// components

// logic
import $$camelScene$$ from '~/scenes/$$dash-scene$$/logic'
import $$camelComponent$$Logic from '~/scenes/$$dash-scene$$/$$path-component$$/logic'
import $$camelComponent$$Saga from '~/scenes/$$dash-scene$$/$$path-component$$/saga'

// const { SHOW_ALL, SHOW_ACTIVE, SHOW_COMPLETED } = $$camelScene$$.constants

@connect({
  actions: [
    $$camelScene$$, [
      // 'showAll',
      // 'setVisibilityFilter'
    ],
    $$camelComponent$$Logic, [
      //
    ]
  ],
  props: [
    $$camelScene$$, [
      // 'visibilityFilter'
    ],
    $$camelComponent$$Logic, [
      //
    ]
github mariusandra / insights / app / scenes / index.js View on Github external
}

  const appReducers = {
    routing: routerReducer,
    rails: () => railsContext
  }

  if (isClientSide) {
    const sagaMiddleware = createSagaMiddleware()
    const finalCreateStore = compose(
      applyMiddleware(sagaMiddleware),
      applyMiddleware(routerMiddleware(browserHistory)),
      window.devToolsExtension ? window.devToolsExtension() : f => f
    )(createStore)

    const store = createKeaStore(finalCreateStore, appReducers)
    sagaMiddleware.run(createRootSaga(appSaga))
    const history = syncHistoryWithStore(browserHistory, store)

    // TODO: check why do we need to do this?
    match({routes: getRoutes(Layout, store, routes), location: railsContext.location}, () => {})

    store.dispatch(initFromProps(props))

    // custom scenes
    store.addKeaScene(headerScene, true)

    return (
      
        
      
    )
github mariusandra / insights / app / scenes / index.js View on Github external
const appReducers = {
    routing: routerReducer,
    rails: () => railsContext
  }

  if (isClientSide) {
    const sagaMiddleware = createSagaMiddleware()
    const finalCreateStore = compose(
      applyMiddleware(sagaMiddleware),
      applyMiddleware(routerMiddleware(browserHistory)),
      window.devToolsExtension ? window.devToolsExtension() : f => f
    )(createStore)

    const store = createKeaStore(finalCreateStore, appReducers)
    sagaMiddleware.run(createRootSaga(appSaga))
    const history = syncHistoryWithStore(browserHistory, store)

    // TODO: check why do we need to do this?
    match({routes: getRoutes(Layout, store, routes), location: railsContext.location}, () => {})

    store.dispatch(initFromProps(props))

    // custom scenes
    store.addKeaScene(headerScene, true)

    return (
      
        
      
    )
  } else {
github mariusandra / insights / packages / insights-core / client / scenes / explorer / tree / node / index.js View on Github external
<div>
            {childNodes.filter(child =&gt; !localSearch || stringIn(localSearch.split(' ')[0], `${path}.${child.connection}`)).map(child =&gt; (
              
            ))}
          </div>
        ) : null}
      
    )
  }
}
const ConnectedNode = connect(connection)(Node)
export default ConnectedNode

kea

Smart front-end architecture

MIT
Latest version published 1 year ago

Package Health Score

62 / 100
Full package analysis