API Docs for:
Show:

CharmCollectionView Class

Module: views.charm-panel
Parent Module: views

Charm collection view. Show a list of charms, each clickable through for a description, or deployed directly with a "Deploy" button.

Methods

_setScroll

() Undefined protected

When the view's "height" attribute is set, adjust the internal scrollable div to have the appropriate height.

Returns:

Undefined: Mutates only.

_showErrors

()

Show errors on both console and notifications.

CharmCollectionView.events.mouseenter

()

Show the charm deploy button on mouse pointer enter.

CharmCollectionView.events.mouseleave

()

Hide the charm deploy button on mouse pointer leave.

CharmCollectionView.initializer

()

Set searchText to cause the results to be found and rendered.

Set defaultSeries to cause all the results for the default series to be found and rendered.

CharmCollectionView.render

()

filterEntries

(
  • entries
  • filter
  • services
)
Array private static

Given a set of entries as returned by the charm store "find" method (charms grouped by series), return the list filtered by 'filter'.

Parameters:

  • entries Array

    An ordered collection of groups of charms, as returned by the charm store "find" method.

  • filter String

    Either 'all', 'subordinates', or 'deployed'.

  • services Object

    The db.services model list.

Returns:

Array: A filtered, grouped set of entries.

findCharms

()

Find charms that match a query.

getInterfaces

(
  • data
)
Array private static

Given an array of interface data as stored in a charm's "required" and "provided" attributes, return an array of interface names.

Parameters:

  • data Array

    A collection of interfaces as stored in a charm's "required" and "provided" attributes.

Returns:

Array: A collection of interface names extracted from the input.

hideCharmFilterPicker

(
  • evt
)
Undefined

Event handler to hide the charm filter picker

Parameters:

  • evt Object

    The event.

Returns:

Undefined: nothing.

isDeployedFilter

(
  • charm
)
Boolean

Filter to determine if a charm is the same as any deployed services.

Parameters:

  • charm Object

    The charm to test.

Returns:

Boolean: True if the charm matches a deployed service.

isSubFilter

(
  • charm
)
Boolean

Filter to determine if a charm is a subordinate.

Parameters:

  • charm Object

    The charm to test.

Returns:

Boolean: True if the charm is a subordinate.

makeRenderableResults

(
  • entries
)
Array private static

Given a set of grouped entries as returned by the charm store "find" method, return the same data but with the charms converted into data objects that are more amenable to rendering with handlebars.

Parameters:

  • entries Array

    An ordered collection of groups of charms, as returned by the charm store "find" method.

Returns:

Array: An ordered collection of groups of charm data.

normalizeCharms.

()

Create a data structure friendly to the view.

setScroll

() Undefined private static

Given a container node and a total height available, set the height of a '.charm-panel' node to fill the remaining height available to it within the container. This expects '.charm-panel' node to possibly have siblings before it, but not any siblings after it.

Returns:

Undefined: Mutates only.

showCharmFilterPicker

(
  • evt
)
Undefined

Event handler to show the charm filter picker.

Parameters:

  • evt Object

    The event.

Returns:

Undefined: nothing.

showConfiguration

(
  • ev
)
Undefined

Fire an event indicating that the charm panel should switch to the "configuration" for a given charm.

Parameters:

  • ev Object

    An event object (with a halt method).

Returns:

Undefined: Sends a signal only.

showDetails

(
  • ev
)
Undefined

Fire an event indicating that the charm panel should switch to the "description" for a given charm.

Parameters:

  • ev Object

    An event object (with a halt method).

Returns:

Undefined: Sends a signal only.

toggleSectionVisibility

() Undefined private static

A shared listener for click events on headers that open and close associated divs.

It expects the event target to contain an i tag used as a bootstrap icon, and to have a parent with the 'charm-section' class. The parent must contain an element with the 'collapsible' class. The i switches back and forth between up and down icons, and the collapsible element opens and closes.

Returns:

Undefined: Mutates only.