3030 * </ul>
3131 * </ul>
3232 * @param {boolean= } show-top-border Show/hide the top border, true shows top border, false (default) hides top border
33+ * @param {boolean= } showSpinner Show/Hide the spinner for loading state. True shows the spinner, false (default) hides the spinner
34+ * @param {string= } spinnerText Text for the card spinner
35+ * @param {string= } spinnerCardHeight Height to set for the card when data is loading and spinner is shown
3336 * @param {string= } layout Various alternative layouts the aggregate status card may have:<br/>
3437 * <ul style='list-style-type: none'>
3538 * <li>'mini' displays a mini aggregate status card. Note: when using 'mini' layout, only one notification can be specified in the status object
4447 <example module="patternfly.card">
4548
4649 <file name="index.html">
47- <div ng-controller="CardDemoCtrl" style="display:inline-block;">
48- <div class="col-md-10">
49- <label>With Top Border</label>
50- <pf-aggregate-status-card status="status" show-top-border="true"></pf-aggregate-status-card>
51- <br/>
52- <label>No Top Border</label>
53- <pf-aggregate-status-card status="status"></pf-aggregate-status-card>
54- <br/>
55- <label>layout = "mini"</label>
56- <pf-aggregate-status-card status="miniAggStatus" show-top-border="true" layout="mini"></pf-aggregate-status-card>
57- <pf-aggregate-status-card status="miniAggStatus2" show-top-border="true" layout="mini"></pf-aggregate-status-card>
58- <br/>
59- <label>layout = "tall"</label>
60- <pf-aggregate-status-card status="aggStatusAlt" show-top-border="true" layout="tall"></pf-aggregate-status-card>
61- <br/>
62- <label>Alternate Layout</label>
63- <i>(depreciated, use layout = 'tall' instead)</i>
64- </br></br>
65- <pf-aggregate-status-card status="aggStatusAlt" show-top-border="true" alt-layout="true"></pf-aggregate-status-card>
50+ <div ng-controller="CardDemoCtrl" class="container-fluid">
51+ <div class="row">
52+ <div class="col-xs-12 col-sm-6 col-md-5 col-lg-4">
53+ <label>With Top Border</label>
54+ <pf-aggregate-status-card status="status" show-top-border="true" show-spinner="dataLoading" spinner-text="Loading" spinner-card-height="90"></pf-aggregate-status-card>
55+ </div>
56+ <div class="col-xs-12 col-sm-6 col-md-5 col-lg-4">
57+ <label>No Top Border</label>
58+ <pf-aggregate-status-card status="status2"></pf-aggregate-status-card>
59+ </div>
60+ </div>
61+ <div class="row">
62+ <div class="col-xs-12 col-sm-6 col-md-5 col-lg-4">
63+ <label>layout = "mini"</label>
64+ <pf-aggregate-status-card status="miniAggStatus" show-top-border="true" layout="mini"></pf-aggregate-status-card>
65+ <pf-aggregate-status-card status="miniAggStatus2" show-top-border="true" layout="mini"></pf-aggregate-status-card>
66+ </div>
67+ <div class="col-xs-12 col-sm-6 col-md-5 col-lg-4">
68+ <label>layout = "tall"</label>
69+ <pf-aggregate-status-card status="aggStatusAlt" show-top-border="true" layout="tall"></pf-aggregate-status-card>
70+ </div>
71+ </div>
72+ <div class="row">
73+ <div class="col-xs-12 col-sm-6 col-md-5 col-lg-4">
74+ <label>Alternate Layout</label>
75+ <br>
76+ <i>(depreciated, use layout = 'tall' instead)</i>
77+ <pf-aggregate-status-card status="aggStatusAlt" show-top-border="true" alt-layout="true"></pf-aggregate-status-card>
78+ </div>
79+ <div class="col-xs-12 col-sm-6 col-md-5 col-lg-4">
80+ <label>Loading State</label>
81+ <br>
82+ <br>
83+ <pf-aggregate-status-card status="aggStatusAlt2" spinner-card-height="140" show-top-border="true" show-spinner="dataLoading" spinner-text="Loading" layout="tall"></pf-aggregate-status-card>
84+ </div>
6685 </div>
6786 </div>
6887 </file>
6988
7089 <file name="script.js">
71- angular.module( 'patternfly.card' ).controller( 'CardDemoCtrl', function( $scope, $window ) {
90+ angular.module( 'patternfly.card' ).controller( 'CardDemoCtrl', function( $scope, $window, $timeout ) {
7291 var imagePath = $window.IMAGE_PATH || "img";
92+
93+ $scope.dataLoading = true;
94+
7395 $scope.status = {
7496 "title":"Nodes",
75- "count":793,
7697 "href":"#",
7798 "iconClass": "fa fa-shield",
78- "notifications":[
79- {
80- "iconClass":"pficon pficon-error-circle-o",
81- "count":4,
82- "href":"#"
83- },
84- {
85- "iconClass":"pficon pficon-warning-triangle-o",
86- "count":1
87- }
88- ]
99+ "notifications":[]
89100 };
90101
102+ $scope.status2 = {
103+ "title":"Nodes",
104+ "count":793,
105+ "href":"#",
106+ "iconClass": "fa fa-shield",
107+ "notifications":[
108+ {
109+ "iconClass":"pficon pficon-error-circle-o",
110+ "count":4,
111+ "href":"#"
112+ },
113+ {
114+ "iconClass":"pficon pficon-warning-triangle-o",
115+ "count":1
116+ }
117+ ]
118+ };
91119 $scope.aggStatusAlt = {
92120 "title":"Providers",
93121 "count":3,
103131 "href":"#"
104132 }
105133 ]
106- };
134+ };
135+
136+ $scope.aggStatusAlt2 = {
137+ "title":"Providers",
138+ "notifications":[]
139+ };
140+
141+ $timeout(function () {
142+ $scope.dataLoading = false;
143+
144+ $scope.status = {
145+ "title":"Nodes",
146+ "count":793,
147+ "href":"#",
148+ "iconClass": "fa fa-shield",
149+ "notifications":[
150+ {
151+ "iconClass":"pficon pficon-error-circle-o",
152+ "count":4,
153+ "href":"#"
154+ },
155+ {
156+ "iconClass":"pficon pficon-warning-triangle-o",
157+ "count":1
158+ }
159+ ]
160+ };
161+
162+ $scope.aggStatusAlt2 = {
163+ "title":"Providers",
164+ "count":3,
165+ "notifications":[
166+ {
167+ "iconImage": imagePath + "/kubernetes.svg",
168+ "count":1,
169+ "href":"#"
170+ },
171+ {
172+ "iconImage": imagePath + "/OpenShift-logo.svg",
173+ "count":2,
174+ "href":"#"
175+ }
176+ ]
177+ };
178+ }, 6000 );
107179
108- $scope.miniAggStatus = {
180+ $scope.miniAggStatus = {
109181 "iconClass":"pficon pficon-container-node",
110182 "title":"Nodes",
111183 "count":52,
112184 "href":"#",
113185 "notification": {
114- "iconClass":"pficon pficon-error-circle-o",
115- "count":3
116- }
117- };
186+ "iconClass":"pficon pficon-error-circle-o",
187+ "count":3
188+ }
189+ };
118190
119- $scope.miniAggStatus2 = {
191+ $scope.miniAggStatus2 = {
120192 "iconClass":"pficon pficon-cluster",
121193 "title":"Adipiscing",
122194 "count":9,
123195 "href":"#",
124196 "notification":{
125- "iconClass":"pficon pficon-ok"
126- }
127- };
197+ "iconClass":"pficon pficon-ok"
198+ }
199+ };
128200 });
129201 </file>
130202
@@ -135,6 +207,9 @@ angular.module( 'patternfly.card' ).component('pfAggregateStatusCard', {
135207 bindings : {
136208 status : '=' ,
137209 showTopBorder : '@?' ,
210+ showSpinner : '<?' ,
211+ spinnerText : '@?' ,
212+ spinnerCardHeight : '@?' ,
138213 altLayout : '@?' ,
139214 layout : '@?'
140215 } ,
@@ -146,6 +221,11 @@ angular.module( 'patternfly.card' ).component('pfAggregateStatusCard', {
146221 ctrl . shouldShowTopBorder = ( ctrl . showTopBorder === 'true' ) ;
147222 ctrl . isAltLayout = ( ctrl . altLayout === 'true' || ctrl . layout === 'tall' ) ;
148223 ctrl . isMiniLayout = ( ctrl . layout === 'mini' ) ;
224+ ctrl . showSpinner = ctrl . showSpinner === true ;
225+
226+ if ( ctrl . spinnerCardHeight ) {
227+ ctrl . spinnerHeight = { 'height' : ctrl . spinnerCardHeight } ;
228+ }
149229 } ;
150230 }
151231} ) ;
0 commit comments