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"></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="status"></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="150" 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
97
"count":793,
103
125
"href":"#"
104
126
}
105
127
]
106
- };
128
+ };
129
+
130
+ $scope.aggStatusAlt2 = {
131
+ "title":"Providers",
132
+ "notifications":[]
133
+ };
134
+
135
+ $timeout(function () {
136
+ $scope.dataLoading = false;
107
137
108
- $scope.miniAggStatus = {
138
+ $scope.aggStatusAlt2 = {
139
+ "title":"Providers",
140
+ "count":3,
141
+ "notifications":[
142
+ {
143
+ "iconImage": imagePath + "/kubernetes.svg",
144
+ "count":1,
145
+ "href":"#"
146
+ },
147
+ {
148
+ "iconImage": imagePath + "/OpenShift-logo.svg",
149
+ "count":2,
150
+ "href":"#"
151
+ }
152
+ ]
153
+ };
154
+ }, 6000 );
155
+
156
+ $scope.miniAggStatus = {
109
157
"iconClass":"pficon pficon-container-node",
110
158
"title":"Nodes",
111
159
"count":52,
112
160
"href":"#",
113
161
"notification": {
114
- "iconClass":"pficon pficon-error-circle-o",
115
- "count":3
116
- }
117
- };
162
+ "iconClass":"pficon pficon-error-circle-o",
163
+ "count":3
164
+ }
165
+ };
118
166
119
- $scope.miniAggStatus2 = {
167
+ $scope.miniAggStatus2 = {
120
168
"iconClass":"pficon pficon-cluster",
121
169
"title":"Adipiscing",
122
170
"count":9,
123
171
"href":"#",
124
172
"notification":{
125
- "iconClass":"pficon pficon-ok"
126
- }
127
- };
173
+ "iconClass":"pficon pficon-ok"
174
+ }
175
+ };
128
176
});
129
177
</file>
130
178
@@ -135,6 +183,9 @@ angular.module( 'patternfly.card' ).component('pfAggregateStatusCard', {
135
183
bindings : {
136
184
status : '=' ,
137
185
showTopBorder : '@?' ,
186
+ showSpinner : '<?' ,
187
+ spinnerText : '@?' ,
188
+ spinnerCardHeight : '@?' ,
138
189
altLayout : '@?' ,
139
190
layout : '@?'
140
191
} ,
@@ -146,6 +197,11 @@ angular.module( 'patternfly.card' ).component('pfAggregateStatusCard', {
146
197
ctrl . shouldShowTopBorder = ( ctrl . showTopBorder === 'true' ) ;
147
198
ctrl . isAltLayout = ( ctrl . altLayout === 'true' || ctrl . layout === 'tall' ) ;
148
199
ctrl . isMiniLayout = ( ctrl . layout === 'mini' ) ;
200
+ ctrl . showSpinner = ctrl . showSpinner === true ;
201
+
202
+ if ( ctrl . spinnerCardHeight ) {
203
+ ctrl . spinnerHeight = { 'height' : ctrl . spinnerCardHeight } ;
204
+ }
149
205
} ;
150
206
}
151
207
} ) ;
0 commit comments