30
30
* </ul>
31
31
* </ul>
32
32
* @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
33
36
* @param {string= } layout Various alternative layouts the aggregate status card may have:<br/>
34
37
* <ul style='list-style-type: none'>
35
38
* <li>'mini' displays a mini aggregate status card. Note: when using 'mini' layout, only one notification can be specified in the status object
44
47
<example module="patternfly.card">
45
48
46
49
<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>
66
85
</div>
67
86
</div>
68
87
</file>
69
88
70
89
<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 ) {
72
91
var imagePath = $window.IMAGE_PATH || "img";
92
+
93
+ $scope.dataLoading = true;
94
+
73
95
$scope.status = {
74
96
"title":"Nodes",
75
- "count":793,
76
97
"href":"#",
77
98
"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":[]
89
100
};
90
101
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
+ };
91
119
$scope.aggStatusAlt = {
92
120
"title":"Providers",
93
121
"count":3,
103
131
"href":"#"
104
132
}
105
133
]
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 );
107
179
108
- $scope.miniAggStatus = {
180
+ $scope.miniAggStatus = {
109
181
"iconClass":"pficon pficon-container-node",
110
182
"title":"Nodes",
111
183
"count":52,
112
184
"href":"#",
113
185
"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
+ };
118
190
119
- $scope.miniAggStatus2 = {
191
+ $scope.miniAggStatus2 = {
120
192
"iconClass":"pficon pficon-cluster",
121
193
"title":"Adipiscing",
122
194
"count":9,
123
195
"href":"#",
124
196
"notification":{
125
- "iconClass":"pficon pficon-ok"
126
- }
127
- };
197
+ "iconClass":"pficon pficon-ok"
198
+ }
199
+ };
128
200
});
129
201
</file>
130
202
@@ -135,6 +207,9 @@ angular.module( 'patternfly.card' ).component('pfAggregateStatusCard', {
135
207
bindings : {
136
208
status : '=' ,
137
209
showTopBorder : '@?' ,
210
+ showSpinner : '<?' ,
211
+ spinnerText : '@?' ,
212
+ spinnerCardHeight : '@?' ,
138
213
altLayout : '@?' ,
139
214
layout : '@?'
140
215
} ,
@@ -146,6 +221,11 @@ angular.module( 'patternfly.card' ).component('pfAggregateStatusCard', {
146
221
ctrl . shouldShowTopBorder = ( ctrl . showTopBorder === 'true' ) ;
147
222
ctrl . isAltLayout = ( ctrl . altLayout === 'true' || ctrl . layout === 'tall' ) ;
148
223
ctrl . isMiniLayout = ( ctrl . layout === 'mini' ) ;
224
+ ctrl . showSpinner = ctrl . showSpinner === true ;
225
+
226
+ if ( ctrl . spinnerCardHeight ) {
227
+ ctrl . spinnerHeight = { 'height' : ctrl . spinnerCardHeight } ;
228
+ }
149
229
} ;
150
230
}
151
231
} ) ;
0 commit comments