How to use the @kui-shell/core.eventBus.emit function in @kui-shell/core

To help you get started, we’ve selected a few @kui-shell/core 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 IBM / kui / plugins / plugin-wrk / src / lib / history.ts View on Github external
if (!penultimate) {
      localStorage.removeItem(lsKeys.last)
    } else {
      localStorage.setItem(lsKeys.last, JSON.stringify(penultimate))
    }
  }

  // update the list of all runs
  which.forEach(idx => {
    list[idx] = null
  })
  list = list.filter(_ => _) // remove the nulls

  localStorage.setItem(lsKeys.history, JSON.stringify(list))

  eventBus.emit('/wrk/history/delete', which)

  return true
}
github IBM / kui / plugins / plugin-openwhisk / src / lib / cmds / openwhisk-core.ts View on Github external
role: 'replacement',
                badge: isZip ? 'zip' : 'jar'
              }
            ]
          })

          options.action.annotations.push({ key: 'binary', value: true })
        }

        if (options.native) {
          // native code blackbox action
          options.action.exec.kind = 'blackbox'
          options.action.exec.image = 'openwhisk/dockerskeleton'
        }

        eventBus.emit('/action/update', {
          file: filepath,
          action: { name: options.name, namespace: options.namespace }
        })

        // set the default kind
        if (!options.action.exec.kind) {
          if (options.kind) {
            options.action.exec.kind = options.kind
          } else {
            const extension = filepath.substring(filepath.lastIndexOf('.') + 1)
            if (extension) {
              options.action.exec.kind = extensionToKind[extension] || extension
            }
          }
        }
      }
github IBM / kui / plugins / plugin-core-support / src / lib / new-tab.ts View on Github external
const makeThisTabActive = (tab.nextElementSibling as Tab) || (tab.previousElementSibling as Tab)
    debug('makeThisTabActive', makeThisTabActive, tab.nextSibling)
    switchTab(getTabId(makeThisTabActive), true)
  }

  // remove the tab state for the current tab
  const tabState = tab.state
  tabState.abortAllJobs()
  tabState.closed = true

  // remove the UI for the current tab
  const tabButton = getTabButton(tab)
  tab.parentNode.removeChild(tab)
  tabButton.parentNode.removeChild(tabButton)

  eventBus.emit('/tab/close', tab)

  return true
}
github IBM / kui / plugins / plugin-wrk / src / lib / lt.ts View on Github external
const push = () => {
            // notify the client of an incremental data point
            if (eventBus) {
              debug('row', row)
              eventBus.emit('/wrk/iter', row)
            }

            // and also push on the overall list of results
            results.push(row)

            return true
          }
github IBM / kui / plugins / plugin-core-support / src / lib / new-tab.ts View on Github external
setTimeout(async () => {
    getReplImpl(tab)
    eventBus.emit('/tab/new', tab)
  })
github IBM / kui / plugins / plugin-openwhisk / src / lib / cmds / auth.ts View on Github external
async () =>
      eventBus.emit('/auth/change', {
        namespace: await namespace.current(),
        subject: subject
      }),
    0
github IBM / kui / plugins / plugin-openwhisk / src / lib / cmds / openwhisk-core.ts View on Github external
invoke: options => {
    eventBus.emit('/action/invoke', {
      name: options.name,
      namespace: options.namespace
    })

    if (options && options.action && options.action.parameters) {
      options.params =
        options.action &&
        options.action.parameters &&
        options.action.parameters.reduce((M, kv) => {
          M[kv.key] = kv.value
          return M
        }, {})
    }
  }
}
github IBM / kui / plugins / plugin-wrk / src / lib / wrk.ts View on Github external
export const end = (): boolean => {
  eventBus.emit('/wrk/terminate')
  return true
}
github IBM / kui / plugins / plugin-openwhisk / src / lib / cmds / auth.ts View on Github external
const notifyOfHostChange = host => async () => {
  eventBus.emit('/host/change', {
    namespace: await namespace.current({ noNamespaceOk: true }),
    host: host
  })
}