Skip to content

Commit ae8038b

Browse files
Merge branch 'master-local' into master-dist
2 parents 5a58a6a + 9c65a89 commit ae8038b

File tree

60 files changed

+624
-125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+624
-125
lines changed

dist/angular-patternfly.js

Lines changed: 135 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3726,12 +3726,14 @@ angular.module('patternfly.card').component('pfCard', {
37263726
onThresholdChange: '&'
37273727
},
37283728
templateUrl: 'charts/donut/donut-pct-chart.html',
3729-
controller: ["pfUtils", "$element", "$timeout", function (pfUtils, $element, $timeout) {
3729+
controller: ["pfUtils", "$scope", function (pfUtils, $scope) {
37303730
'use strict';
37313731
var ctrl = this, prevData;
3732+
ctrl.$id = $scope.$id;
37323733

37333734
ctrl.$onInit = function () {
3734-
ctrl.donutChartId = 'donutPctChart';
3735+
ctrl.donutChartId = 'donutPctChart' + ctrl.$id;
3736+
37353737
if (ctrl.config.chartId) {
37363738
ctrl.donutChartId = ctrl.config.chartId + ctrl.donutChartId;
37373739
}
@@ -3743,6 +3745,10 @@ angular.module('patternfly.card').component('pfCard', {
37433745
ctrl.data.available = ctrl.data.total - ctrl.data.used;
37443746
};
37453747

3748+
ctrl.updatePercentage = function () {
3749+
ctrl.data.percent = Math.round(ctrl.data.used / ctrl.data.total * 100.0);
3750+
};
3751+
37463752
ctrl.getStatusColor = function (used, thresholds) {
37473753
var threshold = "none";
37483754
var color = pfUtils.colorPalette.blue;
@@ -3846,6 +3852,7 @@ angular.module('patternfly.card').component('pfCard', {
38463852

38473853
ctrl.config = pfUtils.merge(patternfly.c3ChartDefaults().getDefaultDonutConfig(), ctrl.config);
38483854
ctrl.updateAvailable();
3855+
ctrl.updatePercentage();
38493856
ctrl.config.data = pfUtils.merge(ctrl.config.data, ctrl.getDonutData());
38503857
ctrl.config.color = ctrl.statusDonutColor(ctrl);
38513858
ctrl.config.tooltip = ctrl.donutTooltip();
@@ -4022,11 +4029,21 @@ angular.module('patternfly.card').component('pfCard', {
40224029
* <li>.tooltipFn(d) - user defined function to customize the tool tip (optional)
40234030
* <li>.centerLabelFn - user defined function to customize the text of the center label (optional)
40244031
* <li>.onClickFn(d,i) - user defined function to handle when donut arc is clicked upon.
4032+
* <li>.labelConfig - object containing properties for external label (optional) - default: undefined
4033+
* <ul>
4034+
* <li>.orientation - string with possible values: 'left', 'right' (optional) - default: 'center'
4035+
* <li>.title - string representing a prefix or title (optional) - default: empty string
4036+
* <li>.label - the wording format to display, possible values: 'used', 'available', 'percent', 'none' (optional) - default: 'used'
4037+
* <li>.units - unit label for values, ex: 'MHz','GB', etc.. (optional) - default: empty string
4038+
* <li>.labelFn - function to customize the text of the external label. This callback returns no data. Updated display data can be accessed through the passed and updated parameter 'data'. (optional) - default: undefined
4039+
* </ul>
4040+
* </li>
40254041
* </ul>
40264042
*
40274043
* @param {object} data the Total and Used values for the donut chart. Available is calculated as Total - Used.<br/>
40284044
* <ul style='list-style-type: none'>
40294045
* <li>.used - number representing the amount used
4046+
* <li>.percent - number representing the percentage used
40304047
* <li>.total - number representing the total amount
40314048
* <li>.dataAvailable - Flag if there is data available - default: true
40324049
* </ul>
@@ -4058,19 +4075,23 @@ angular.module('patternfly.card').component('pfCard', {
40584075
<div class="row">
40594076
<div class="col-md-3 text-center">
40604077
<label>Error Threshold</label>
4061-
<pf-donut-pct-chart config="configErr" data="dataErr" chart="chartErr"></pf-donut-pct-chart>
4078+
<p class="text-right">
4079+
<pf-donut-pct-chart config="configErr" data="dataErr" chart="chartErr"></pf-donut-pct-chart>
4080+
</p>
40624081
</div>
4063-
<div class="col-md-3 text-center"">
4082+
<div class="col-md-3 text-center">
40644083
<label>Warning Threshold</label>
40654084
<pf-donut-pct-chart config="configWarn" data="dataWarn"></pf-donut-pct-chart>
40664085
</div>
4067-
<div class="col-md-3 text-center"">
4086+
<div class="col-md-3 text-center">
40684087
<label class="camelcase">{{threshLabel}} Threshold</label>
4069-
<pf-donut-pct-chart config="configDynamic" data="dataDynamic" center-label="labelDynamic"
4070-
on-threshold-change="thresholdChanged(threshold)">
4071-
</pf-donut-pct-chart>
4088+
<p class="text-left">
4089+
<pf-donut-pct-chart config="configDynamic" data="dataDynamic" center-label="labelDynamic"
4090+
on-threshold-change="thresholdChanged(threshold)">
4091+
</pf-donut-pct-chart>
4092+
</p>
40724093
</div>
4073-
<div class="col-md-3 text-center"">
4094+
<div class="col-md-3 text-center">
40744095
<label>No Threshold</label>
40754096
<pf-donut-pct-chart config="configNoThresh" data="dataNoThresh"></pf-donut-pct-chart>
40764097
</div>
@@ -4084,20 +4105,45 @@ angular.module('patternfly.card').component('pfCard', {
40844105

40854106
<div class="row">
40864107
<div class="col-md-3 text-center">
4087-
<pf-donut-pct-chart config="usedConfig" data="usedData" center-label="usedLabel"></pf-donut-pct-chart>
40884108
<label>center-label = 'used'</label>
4109+
<pf-donut-pct-chart config="usedConfig" data="usedData" center-label="usedLabel"></pf-donut-pct-chart>
40894110
</div>
40904111
<div class="col-md-3 text-center">
4091-
<pf-donut-pct-chart config="availConfig" data="availData" center-label="availLabel"></pf-donut-pct-chart>
40924112
<label>center-label = 'available'</label>
4113+
<pf-donut-pct-chart config="availConfig" data="availData" center-label="availLabel"></pf-donut-pct-chart>
40934114
</div>
40944115
<div class="col-md-3 text-center">
4095-
<pf-donut-pct-chart config="pctConfig" data="pctData" center-label="pctLabel"></pf-donut-pct-chart>
40964116
<label>center-label = 'percent'</label>
4117+
<pf-donut-pct-chart config="pctConfig" data="pctData" center-label="pctLabel"></pf-donut-pct-chart>
40974118
</div>
40984119
<div class="col-md-3 text-center">
4120+
<label>center-label = 'none'</label>
40994121
<pf-donut-pct-chart config="noneConfig" data="noneData" center-label="noLabel"></pf-donut-pct-chart>
4100-
<label>center-label = ' none'</label>
4122+
</div>
4123+
</div>
4124+
4125+
<div class="row">
4126+
<div class="col-md-12">
4127+
<hr>
4128+
</div>
4129+
</div>
4130+
4131+
<div class="row">
4132+
<div class="col-md-4 text-center">
4133+
<label>Sized with orientation left 'configLabel'</label>
4134+
<p class="text-right">
4135+
<pf-donut-pct-chart config="configOrientationLeft" data="dataOrientationLeft"></pf-donut-pct-chart>
4136+
</p>
4137+
</div>
4138+
<div class="col-md-4 text-center">
4139+
<label>Sized with 'configLabel'</label>
4140+
<pf-donut-pct-chart config="configOrientationCenter" data="dataOrientationCenter"></pf-donut-pct-chart>
4141+
</div>
4142+
<div class="col-md-4 text-center">
4143+
<label>Sized with orientation right 'configLabel'</label>
4144+
<p class="text-left">
4145+
<pf-donut-pct-chart config="configOrientationRight" data="dataOrientationRight"></pf-donut-pct-chart>
4146+
</p>
41014147
</div>
41024148
</div>
41034149

@@ -4116,7 +4162,7 @@ angular.module('patternfly.card').component('pfCard', {
41164162
</div>
41174163
<div class="row">
41184164
<div class="col-md-3">
4119-
<form role="form"">
4165+
<form role="form">
41204166
<div class="form-group">
41214167
<label class="checkbox-inline">
41224168
<input type="checkbox" ng-model="custData.dataAvailable">Data Available</input>
@@ -4140,6 +4186,7 @@ angular.module('patternfly.card').component('pfCard', {
41404186

41414187
<file name="script.js">
41424188
angular.module( 'patternfly.charts' ).controller( 'ChartCtrl', function( $scope, $interval ) {
4189+
// start demo 1st row
41434190
$scope.configErr = {
41444191
'chartId': 'chartErr',
41454192
'units': 'GB',
@@ -4196,14 +4243,15 @@ angular.module('patternfly.card').component('pfCard', {
41964243

41974244
$scope.configNoThresh = {
41984245
'chartId': 'chartNoThresh',
4199-
'units': 'GB',
4246+
'units': 'GB'
42004247
};
42014248

42024249
$scope.dataNoThresh = {
42034250
'used': '750',
42044251
'total': '1000'
42054252
};
42064253

4254+
//start demo 2nd row
42074255
$scope.usedConfig = {
42084256
'chartId': 'usedChart',
42094257
'units': 'GB',
@@ -4256,6 +4304,76 @@ angular.module('patternfly.card').component('pfCard', {
42564304

42574305
$scope.noLabel = "none";
42584306

4307+
//start demo 3rd row
4308+
$scope.configOrientationLeft = {
4309+
'units': 'GB',
4310+
'thresholds':{'warning':'60','error':'90'},
4311+
'labelConfig': {
4312+
'orientation': 'left',
4313+
'labelFn': function () {
4314+
return "<strong>Lorem ipsum</strong><br/>" + $scope.dataOrientationLeft.used + " GB used";
4315+
}
4316+
},
4317+
'size': {
4318+
'height': 85,
4319+
'width': 85
4320+
},
4321+
'centerLabelFn': function () {
4322+
return $scope.dataOrientationLeft.used + "GB";
4323+
}
4324+
};
4325+
4326+
$scope.dataOrientationLeft = {
4327+
'used': '350',
4328+
'total': '1000'
4329+
};
4330+
4331+
$scope.configOrientationCenter = {
4332+
'units': 'GB',
4333+
'thresholds':{'warning':'60','error':'90'},
4334+
'labelConfig': {
4335+
'label': 'available',
4336+
'units': 'GB',
4337+
'title': 'Lorem ipsum,'
4338+
},
4339+
'size': {
4340+
'height': 115,
4341+
'width': 115
4342+
},
4343+
'centerLabelFn': function () {
4344+
return $scope.dataOrientationCenter.used + "GB";
4345+
}
4346+
};
4347+
4348+
$scope.dataOrientationCenter = {
4349+
'used': '350',
4350+
'total': '1000'
4351+
};
4352+
4353+
$scope.configOrientationRight = {
4354+
'units': 'GB',
4355+
'thresholds':{'warning':'60','error':'90'},
4356+
'labelConfig': {
4357+
'orientation': 'right',
4358+
'labelFn': function () {
4359+
return "<strong>Lorem ipsum</strong><br/>" + $scope.dataOrientationRight.percent + "% used";
4360+
}
4361+
},
4362+
'size': {
4363+
'height': 85,
4364+
'width': 85
4365+
},
4366+
'centerLabelFn': function () {
4367+
return $scope.dataOrientationRight.percent + "%";
4368+
}
4369+
};
4370+
4371+
$scope.dataOrientationRight = {
4372+
'used': '350',
4373+
'total': '1000'
4374+
};
4375+
4376+
//start demo 4th row
42594377
$scope.custConfig = {
42604378
'chartId': 'custChart',
42614379
'units': 'MHz',
@@ -4285,6 +4403,7 @@ angular.module('patternfly.card').component('pfCard', {
42854403
</file>
42864404
</example>
42874405
*/
4406+
42884407
;/**
42894408
*
42904409
* @description
@@ -17875,7 +17994,7 @@ angular.module('patternfly.wizard').component('pfWizard', {
1787517994

1787617995

1787717996
$templateCache.put('charts/donut/donut-pct-chart.html',
17878-
"<span><pf-c3-chart ng-if=\"$ctrl.data.dataAvailable !== false\" id={{$ctrl.donutChartId}} config=$ctrl.config get-chart-callback=$ctrl.setChart></pf-c3-chart><pf-empty-chart ng-if=\"$ctrl.data.dataAvailable === false\" chart-height=$ctrl.chartHeight></pf-empty-chart></span>"
17997+
"<span class=pct-donut-chart-pf><span ng-class=\"{'pct-donut-chart-pf-left': $ctrl.config.labelConfig.orientation === 'left', 'pct-donut-chart-pf-right': $ctrl.config.labelConfig.orientation === 'right'}\"><span class=pct-donut-chart-pf-chart><pf-c3-chart ng-if=\"$ctrl.data.dataAvailable !== false\" id={{$ctrl.donutChartId}} config=$ctrl.config get-chart-callback=$ctrl.setChart></pf-c3-chart><pf-empty-chart ng-if=\"$ctrl.data.dataAvailable === false\" chart-height=$ctrl.chartHeight></pf-empty-chart></span> <span ng-if=\"$ctrl.data.dataAvailable !== false && $ctrl.config.labelConfig && !$ctrl.config.labelConfig.labelFn()\" class=pct-donut-chart-pf-label>{{$ctrl.config.labelConfig.title}} <span ng-if=$ctrl.data ng-switch=$ctrl.config.labelConfig.label><span ng-switch-when=none></span> <span ng-switch-when=available>{{$ctrl.data.available}} {{$ctrl.config.labelConfig.units}} available</span> <span ng-switch-when=percent>{{$ctrl.data.percent}}&#37; used</span> <span ng-switch-default=\"\">{{$ctrl.data.used}} {{$ctrl.config.labelConfig.units}} of {{$ctrl.data.total}} {{$ctrl.config.labelConfig.units}} used</span></span></span> <span ng-if=\"$ctrl.data.dataAvailable !== false && $ctrl.config.labelConfig && $ctrl.config.labelConfig.labelFn()\" class=pct-donut-chart-pf-label ng-bind-html=$ctrl.config.labelConfig.labelFn()></span></span></span>"
1787917998
);
1788017999

1788118000

dist/angular-patternfly.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)