55 *
66 * @param {string } headTitle Title for the card
77 * @param {string= } subTitle Sub-Title for the card
8+ * @param {string= } spinnerText Text for the card spinner
89 * @param {boolean= } showTopBorder Show/Hide the blue top border. True shows top border, false (default) hides top border
910 * @param {boolean= } showTitlesSeparator Show/Hide the grey line between the title and sub-title.
1011 * True (default) shows the line, false hides the line
12+ * @param {boolean= } showSpinner Show/Hide the spinner for loading state. True shows the spinner, false (default) hides the spinner
1113 * @param {object= } footer footer configuration properties:<br/>
1214 * <ul style='list-style-type: none'>
1315 * <li>.iconClass - (optional) the icon to show on the bottom left of the footer panel
3537 <file name="index.html">
3638 <div ng-controller="ChartCtrl">
3739 <label class="label-title">Card With Multiple Utilization Bars</label>
38- <pf-card head-title="System Resources" show-top-border="true" style="width: 65% ">
40+ <pf-card head-title="System Resources" show-spinner="dataLoading" spinner-text="Loading" show-top-border="true ">
3941 <pf-utilization-bar-chart chart-data=data2 chart-title=title2 layout=layoutInline units=units2 threshold-error="85" threshold-warning="60"></pf-utilization-bar-chart>
4042 <pf-utilization-bar-chart chart-data=data3 chart-title=title3 layout=layoutInline units=units3 threshold-error="85" threshold-warning="60"></pf-utilization-bar-chart>
4143 <pf-utilization-bar-chart chart-data=data4 chart-title=title4 layout=layoutInline units=units4 threshold-error="85" threshold-warning="60"></pf-utilization-bar-chart>
4446 </div>
4547 </file>
4648 <file name="script.js">
47- angular.module( 'demo', ['patternfly.charts', 'patternfly.card'] ).controller( 'ChartCtrl', function( $scope ) {
49+ angular.module( 'demo', ['patternfly.charts', 'patternfly.card'] ).controller( 'ChartCtrl', function( $scope, $timeout ) {
50+
51+ $scope.dataLoading = true;
4852
4953 $scope.title2 = 'Memory';
5054 $scope.units2 = 'GB';
5155
52- $scope.data2 = {
53- 'used': '25',
54- 'total': '100'
55- };
56-
5756 $scope.title3 = 'CPU Usage';
5857 $scope.units3 = 'MHz';
5958
60- $scope.data3 = {
61- 'used': '420',
62- 'total': '500'
63- };
64-
6559 $scope.title4 = 'Disk Usage';
6660 $scope.units4 = 'TB';
67- $scope.data4 = {
68- 'used': '350',
69- 'total': '500'
70- };
7161
7262 $scope.title5 = 'Disk I/O';
73- $scope.units5 = 'I/Ops';
74- $scope.data5 = {
75- 'used': '450',
76- 'total': '500'
77- };
63+ $scope.units5 = 'I/Ops';
64+
65+ $timeout(function () {
66+ $scope.dataLoading = false;
67+
68+ $scope.data2 = {
69+ 'used': '25',
70+ 'total': '100'
71+ };
72+
73+ $scope.data3 = {
74+ 'used': '420',
75+ 'total': '500'
76+ };
77+
78+ $scope.data4 = {
79+ 'used': '350',
80+ 'total': '500'
81+ };
82+ $scope.data5 = {
83+ 'used': '450',
84+ 'total': '500'
85+ };
86+ }, 3000 );
7887
7988 $scope.layoutInline = {
8089 'type': 'inline'
@@ -91,6 +100,8 @@ angular.module('patternfly.card').component('pfCard', {
91100 subTitle : '@?' ,
92101 showTopBorder : '@?' ,
93102 showTitlesSeparator : '@?' ,
103+ showSpinner : '<?' ,
104+ spinnerText : '@?' ,
94105 footer : '=?' ,
95106 filter : '=?'
96107 } ,
@@ -104,11 +115,9 @@ angular.module('patternfly.card').component('pfCard', {
104115 ctrl . currentFilter = ctrl . filter . filters [ 0 ] ;
105116 }
106117 }
107-
108118 ctrl . footerCallBackFn = function ( ) {
109119 ctrl . footerCallBackResult = ctrl . footer . callBackFn ( ) ;
110120 } ;
111-
112121 ctrl . filterCallBackFn = function ( f ) {
113122 ctrl . currentFilter = f ;
114123 if ( ctrl . filter . callBackFn ) {
@@ -130,6 +139,7 @@ angular.module('patternfly.card').component('pfCard', {
130139
131140 ctrl . $onInit = function ( ) {
132141 ctrl . shouldShowTitlesSeparator = ( ! ctrl . showTitlesSeparator || ctrl . showTitlesSeparator === 'true' ) ;
142+ ctrl . showSpinner = ctrl . showSpinner === true ;
133143 } ;
134144 }
135145} ) ;
0 commit comments