Code coverage report for src/views/view-utils.js

Statements: 100% (7 / 7)      Branches: 100% (10 / 10)      Functions: 100% (6 / 6)      Lines: 100% (7 / 7)      Ignored: none     

All files » src/views/ » view-utils.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 611                                           1   30             33             33             30             30                
(function () {
  'use strict';
 
  /**
   * @ngdoc object
   * @name patternfly.views.pfViewUtils
   * @description
   * A utility constant to return view objects used for Dashboard, Card, Table, List, and Topology view switcher types.
   * @example
   * <pre>
   * $scope.viewsConfig = {
   *   views: [pfViewUtils.getListView(), pfViewUtils.getCardView(), pfViewUtils.getTableView()]
   * };
   * </pre>
   * Each getXxxxView() returns an object:
   * <ul style='list-style-type: none'>
   *    <li>.id - (String) Unique id for the view, used for comparisons
   *    <li>.title - (String) Optional title, uses as a tooltip for the view selector
   *    <li>.iconClass - (String) Icon class to use for the view selector
   * </ul>
   * Please see {@link patternfly.toolbars.component:pfToolbar pfToolbar} for use in Toolbar View Switcher
   */
  angular.module('patternfly.views').constant('pfViewUtils', {
    getDashboardView: function (title) {
      return {
        id: 'dashboardView',
        title: title || 'Dashboard View',
        iconClass: 'fa fa-dashboard'
      };
    },
    getCardView: function (title) {
      return {
        id: 'cardView',
        title: title || 'Card View',
        iconClass: 'fa fa-th'
      };
    },
    getListView: function (title) {
      return {
        id: 'listView',
        title: title || 'List View',
        iconClass: 'fa fa-th-list'
      };
    },
    getTableView: function (title) {
      return {
        id: 'tableView',
        title: title || 'Table View',
        iconClass: 'fa fa-table'
      };
    },
    getTopologyView: function (title) {
      return {
        id: 'topologyView',
        title: title || 'Topology View',
        iconClass: 'fa fa-sitemap'
      };
    }
  });
})();