How to use the @kui-shell/core.REPL.encodeComponent 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-openwhisk / src / lib / cmds / openwhisk-core.ts View on Github external
export const fillInActionDetails = (pkage: Package, type = 'actions') => actionSummary => {
  const kindAnnotation = actionSummary.annotations && actionSummary.annotations.find(_ => _.key === 'exec')
  const kind = kindAnnotation && kindAnnotation.value

  return Object.assign({}, actionSummary, {
    // given the actionSummary from the 'actions' field of a package entity
    type,
    packageName: pkage.name,
    namespace: `${pkage.namespace}/${pkage.name}`,
    kind,
    onclick: `wsk action get ${REPL.encodeComponent(`/${pkage.namespace}/${pkage.name}/${actionSummary.name}`)}`
  })
}
github IBM / kui / plugins / plugin-tekton / src / lib / tekton2graph.ts View on Github external
if (task && task.spec.steps && task.spec.steps.length > 0) {
        //
        // in this case, we do have a full Task definition, which
        // includes Steps; we will make a subgraph for the steps
        //
        const resources = (task.spec.inputs && task.spec.inputs.resources) || []
        const resourceList = `${resources.map(_ =&gt; `<span class="color-base0A">${_.type}</span>:${_.name}`).join(', ')}`

        const params = (task.spec.inputs &amp;&amp; task.spec.inputs.params) || []
        const paramList = `(${params.map(_ =&gt; _.name).join(', ')})`

        const subgraph = makeSubGraph(taskRef.name, {
          type: 'Tekton Task',
          tooltip: `<table><tbody><tr><td><strong>Resources</strong></td><td>${resourceList}</td></tr><tr><td><strong>Params</strong></td><td>${paramList}</td></tr></tbody></table>`,
          tooltipColor: '0C',
          onclick: `tekton get task ${REPL.encodeComponent(pipeline.metadata.name)} ${REPL.encodeComponent(
            task.metadata.name
          )} ${filearg}`,
          visited: task.visitedIdx !== undefined ? [task.visitedIdx] : undefined,
          children: task.spec.steps.map(step =&gt; {
            const stepNode: TektonNode = {
              id: stepId(taskRef, step),
              label: step.name,
              width: step.name.length * defaultCharWidth,
              height: defaultHeight,
              nChildren: 0,
              nParents: 0,
              deployed: false,
              visited: step.visitedIdx !== undefined ? [step.visitedIdx] : undefined,
              type: 'Tekton Step',
              tooltip: `<strong>Image</strong>: ${step.image}`,
              tooltipColor: '0E',
github IBM / kui / plugins / plugin-tekton / src / lib / tekton2graph.ts View on Github external
(symtab: SymbolTable, taskRef: TaskRef) =&gt; {
      const task: Task = taskName2Task[taskRef.taskRef.name]
      debug('TaskRef', taskRef.name, task)

      // -f file argument for drilldowns, if we have one
      const filearg = filepath ? `-f ${REPL.encodeComponent(filepath)}` : ''

      let node: TektonNode
      if (task &amp;&amp; task.spec.steps &amp;&amp; task.spec.steps.length &gt; 0) {
        //
        // in this case, we do have a full Task definition, which
        // includes Steps; we will make a subgraph for the steps
        //
        const resources = (task.spec.inputs &amp;&amp; task.spec.inputs.resources) || []
        const resourceList = `${resources.map(_ =&gt; `<span class="color-base0A">${_.type}</span>:${_.name}`).join(', ')}`

        const params = (task.spec.inputs &amp;&amp; task.spec.inputs.params) || []
        const paramList = `(${params.map(_ =&gt; _.name).join(', ')})`

        const subgraph = makeSubGraph(taskRef.name, {
          type: 'Tekton Task',
          tooltip: `<table><tbody><tr><td><strong>Resources</strong></td><td>${resourceList}</td></tr><tr><td><strong>Params</strong></td><td>${paramList}</td></tr></tbody></table>`,
github IBM / kui / plugins / plugin-grid / src / lib / cmds / table.ts View on Github external
bar.style.left = percent(left)
        bar.style.width = percent(right - left)

        // fancy focus, to show the extent of the bar on the x axis!
        const resetFocus = xAxisResetFocus(barWrapper)
        const doFocus = () =&gt; xAxisToggleFocus({ barWrapper, this25, this75, left, right })
        const focus = (dom: HTMLElement) =&gt; {
          dom.onmouseenter = doFocus
          dom.onmouseleave = doFocus
        }

        // drill down to grid view; note how we pass through a name filter
        // query, to filter based on the clicked-upon row
        cell.onclick = drilldownWith(
          `grid ${REPL.encodeComponent(group.path)} ${optionsToString(options)} ${splitOptions}`,
          [resetFocus]
        )

        // install the fancy focus handlers
        focus(bar)

        // add 25th and 75th explainers to widest bar
        if (
          this75 - this25 === maxBarRange ||
          ((lastTimeWeRenderedARangeIndicator === undefined || idx - lastTimeWeRenderedARangeIndicator &gt; 20) &amp;&amp;
            (this75 - this25) / maxBarRange &gt; 0.9)
        ) {
          // render the &lt; 25th and 75th &gt; indicators inside the bar
          lastTimeWeRenderedARangeIndicator = idx

          // e.g. 25th versus min; and 75th percentile versus max
github IBM / kui / plugins / plugin-k8s / src / lib / controller / kiali.ts View on Github external
list.applications.map(app => ({
      type: 'application',
      name: app.name,
      onclick: `kubectl get svc ${REPL.encodeComponent(app.name)} -o yaml`,
      attributes: [
        {
          value: app.istioSidecar,
          outerCSS: 'text-center hide-with-sidecar',
          css: app.istioSidecar ? 'green-text' : 'red-text',
          fontawesome: app.istioSidecar ? 'fas fa-check-circle' : 'fas fa-exclamation-triangle'
        },
        {
          key: 'inboundErrorRatio',
          value: '\u2014', // emdash
          // outerCSS: 'hide-with-sidecar',
          css: TrafficLight.Gray
        },
        {
          key: 'outboundErrorRatio',
          value: '\u2014', // emdash
github IBM / kui / plugins / plugin-wrk / src / lib / init.ts View on Github external
    clicky.onclick = () => REPL.pexec(`ls ${REPL.encodeComponent(wrkExec())}`)
    msg.appendChild(clicky)
github IBM / kui / plugins / plugin-openwhisk / src / lib / cmds / openwhisk-core.ts View on Github external
onclick: () => {
                      return REPL.pexec(`wsk api get ${REPL.encodeComponent(name)} ${verb}`)
                    },
                    attributes: [
github IBM / kui / plugins / plugin-openwhisk / src / lib / cmds / openwhisk-core.ts View on Github external
                        onclick: () => REPL.pexec(`wsk action get ${REPL.encodeComponent(actionFqn)}`)
                      },
github IBM / kui / plugins / plugin-tekton / src / lib / tekton2graph.ts View on Github external
children: task.spec.steps.map(step =&gt; {
            const stepNode: TektonNode = {
              id: stepId(taskRef, step),
              label: step.name,
              width: step.name.length * defaultCharWidth,
              height: defaultHeight,
              nChildren: 0,
              nParents: 0,
              deployed: false,
              visited: step.visitedIdx !== undefined ? [step.visitedIdx] : undefined,
              type: 'Tekton Step',
              tooltip: `<strong>Image</strong>: ${step.image}`,
              tooltipColor: '0E',
              onclick: `tekton get step ${REPL.encodeComponent(pipeline.metadata.name)} ${REPL.encodeComponent(
                task.metadata.name
              )} ${REPL.encodeComponent(step.name)} ${filearg}`
            }

            symtab[stepNode.id] = stepNode
            return stepNode
          })
        })
github IBM / kui / plugins / plugin-openwhisk / src / lib / views / cli / activations / list.ts View on Github external
return Object.keys(map).reduce((opts, key) => {
    if (key === '_' || typeof map[key] === 'object') {
      return opts
    } else {
      return `${opts} --${key} ${REPL.encodeComponent(map[key])}`
    }
  }, '')
}