This is an archive of the ONOS 1.2 wiki. For the current ONOS wiki, look here.

IconService

The IconService is an Angular Factory in the SVG module with the name icon.js. It provides an API to inject pre-installed icons (based on glyphs) to be used in the client-side application. To use this API, see the documentation on injecting Angular services.

What is an icon?

An icon is a higher level of abstraction for the GlyphService. It is used as a lookup for predefined glyphs to quickly create an SVG element. Icons are used in an HTML attribute in a directive to quickly insert dynamic icons into the GUI. There is also an API to quickly insert icons via the IconService instead of going through the GlyphService.

Icons are in the Device View. Below is a checkmark icon and a device switch icon as examples.

Notice how these are still SVG glyphs. The only difference is that they were inserted using the IconService via an icon directive.

API Functions

NameSummary
loadIconCreates an icon with the given glyph ID.
loadIconByClassCreate an icon with the given icon lookup. This function provides more options than loadEmbeddedIcon.
loadEmbeddedIconCreate an icon with the given icon lookup.
addDeviceIconAdds a device icon to the given element.
addHostIconAdds a host icon to the given element.
iconConfigReturns the configuration for device and host icons in the Topology View.
sortIconsReturns an API (used in Tabular views) for adding ascending and descending icons, and removing them.

Function Descriptions

loadIcon

loadIconByClass

loadEmbeddedIcon

addDeviceIcon

addHostIcon

iconConfig

Returns the configuration for device and host icons in the Topology View .

Example UsageArgumentsReturn Value
is.iconConfig();nonean object with icon configuration information for device and host icons – access these through the tags 'device' and 'host'

sortIcons

 

 

 

 

 

  • No labels