Skip to content

Commit 3585cbb

Browse files
committed
Updated dist files and final merge
1 parent 868787d commit 3585cbb

File tree

6 files changed

+66
-57
lines changed

6 files changed

+66
-57
lines changed

dist/angular-patternfly.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,10 +1173,10 @@ angular.module('patternfly.charts').directive('pfSparklineChart', ["c3ChartDefau
11731173
* <ul style='list-style-type: none'>
11741174
* <li>.chartId - the unique id of this trends chart
11751175
* <li>.title - (optional) title of the Trends chart
1176-
* <li>.layout - the layout and sizes of titles and chart. Values are 'large' (default), and 'small'
1176+
* <li>.layout - (optional) the layout and sizes of titles and chart. Values are 'large' (default), and 'small'
11771177
* <li>.timeFrame - (optional) the time frame for the data in the pfSparklineChart, ex: 'Last 30 Days'
11781178
* <li>.units - unit label for values, ex: 'MHz','GB', etc..
1179-
* <li>.valueType - the format of the latest data point which is shown in the title. Values are 'actual'(default) or 'percentage'
1179+
* <li>.valueType - (optional) the format of the latest data point which is shown in the title. Values are 'actual'(default) or 'percentage'
11801180
* </ul>
11811181
*
11821182
* @param {object} chartData the data to be shown in the sparkline charts<br/>
@@ -1217,7 +1217,7 @@ angular.module('patternfly.charts').directive('pfSparklineChart', ["c3ChartDefau
12171217
<form role="form" >
12181218
<div class="form-group">
12191219
<label>Title Value Type</label></br>
1220-
<select pf-select style="height:25px; width:120px;" ng-model="valueType" id="valueType">
1220+
<select pf-select class="pf-select-sm" ng-model="valueType" id="valueType">
12211221
<option value="actual" ng-selected="true" selected>Actual</option>
12221222
<option value="percentage">Percentage</option>
12231223
</select>
@@ -1228,7 +1228,7 @@ angular.module('patternfly.charts').directive('pfSparklineChart', ["c3ChartDefau
12281228
<form role="form" >
12291229
<div class="form-group">
12301230
<label>Layout</label></br>
1231-
<select pf-select style="height:25px; width:120px;" ng-model="layout" id="layout">
1231+
<select pf-select class="pf-select-sm" ng-model="layout" id="layout">
12321232
<option value="large" ng-selected="true" selected>Large</option>
12331233
<option value="small">Small</option>
12341234
</select>
@@ -1300,25 +1300,25 @@ angular.module('patternfly.charts').directive('pfTrendsChart',
13001300
},
13011301
replace: true,
13021302
templateUrl: 'charts/trends/trends-chart.html',
1303-
controller: ['$scope',
1304-
function ($scope) {
1305-
$scope.getPercentageValue = function () {
1306-
return Math.round($scope.getLatestValue() / $scope.chartData.total * 100.0);
1307-
};
1308-
$scope.getLatestValue = function () {
1309-
return $scope.chartData.yData[$scope.chartData.yData.length - 1];
1310-
};
1311-
$scope.getChartHeight = function () {
1312-
var retValue = 60;
1313-
if ($scope.chartHeight) {
1314-
retValue = $scope.chartHeight;
1315-
} else if ($scope.config.layout === 'small') {
1316-
retValue = 30;
1317-
}
1318-
return retValue;
1319-
};
1320-
}
1321-
],
1303+
controller: ["$scope", function ($scope) {
1304+
var SMALL = 30, LARGE = 60;
1305+
1306+
$scope.getPercentageValue = function () {
1307+
return Math.round($scope.getLatestValue() / $scope.chartData.total * 100.0);
1308+
};
1309+
$scope.getLatestValue = function () {
1310+
return $scope.chartData.yData[$scope.chartData.yData.length - 1];
1311+
};
1312+
$scope.getChartHeight = function () {
1313+
var retValue = LARGE;
1314+
if ($scope.chartHeight) {
1315+
retValue = $scope.chartHeight;
1316+
} else if ($scope.config.layout === 'small') {
1317+
retValue = SMALL;
1318+
}
1319+
return retValue;
1320+
};
1321+
}],
13221322
link: function (scope) {
13231323
scope.$watch('config', function () {
13241324
scope.showLargeCardLayout = (!scope.config.layout || scope.config.layout === 'large');

dist/angular-patternfly.min.js

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

dist/styles/angular-patternfly.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

misc/demo.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,8 @@ hr {
7070
.dropdown-menu > li > a:hover {
7171
background-image: none;
7272
}
73+
74+
.pf-select-sm {
75+
height :25px;
76+
width :120px;
77+
}

src/charts/trends/trends-chart.directive.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<form role="form" >
5858
<div class="form-group">
5959
<label>Title Value Type</label></br>
60-
<select pf-select style="height:25px; width:120px;" ng-model="valueType" id="valueType">
60+
<select pf-select class="pf-select-sm" ng-model="valueType" id="valueType">
6161
<option value="actual" ng-selected="true" selected>Actual</option>
6262
<option value="percentage">Percentage</option>
6363
</select>
@@ -68,7 +68,7 @@
6868
<form role="form" >
6969
<div class="form-group">
7070
<label>Layout</label></br>
71-
<select pf-select style="height:25px; width:120px;" ng-model="layout" id="layout">
71+
<select pf-select class="pf-select-sm" ng-model="layout" id="layout">
7272
<option value="large" ng-selected="true" selected>Large</option>
7373
<option value="small">Small</option>
7474
</select>
@@ -140,25 +140,25 @@ angular.module('patternfly.charts').directive('pfTrendsChart',
140140
},
141141
replace: true,
142142
templateUrl: 'charts/trends/trends-chart.html',
143-
controller: ['$scope',
144-
function ($scope) {
145-
$scope.getPercentageValue = function () {
146-
return Math.round($scope.getLatestValue() / $scope.chartData.total * 100.0);
147-
};
148-
$scope.getLatestValue = function () {
149-
return $scope.chartData.yData[$scope.chartData.yData.length - 1];
150-
};
151-
$scope.getChartHeight = function () {
152-
var retValue = 60;
153-
if ($scope.chartHeight) {
154-
retValue = $scope.chartHeight;
155-
} else if ($scope.config.layout === 'small') {
156-
retValue = 30;
157-
}
158-
return retValue;
159-
};
160-
}
161-
],
143+
controller: function ($scope) {
144+
var SMALL = 30, LARGE = 60;
145+
146+
$scope.getPercentageValue = function () {
147+
return Math.round($scope.getLatestValue() / $scope.chartData.total * 100.0);
148+
};
149+
$scope.getLatestValue = function () {
150+
return $scope.chartData.yData[$scope.chartData.yData.length - 1];
151+
};
152+
$scope.getChartHeight = function () {
153+
var retValue = LARGE;
154+
if ($scope.chartHeight) {
155+
retValue = $scope.chartHeight;
156+
} else if ($scope.config.layout === 'small') {
157+
retValue = SMALL;
158+
}
159+
return retValue;
160+
};
161+
},
162162
link: function (scope) {
163163
scope.$watch('config', function () {
164164
scope.showLargeCardLayout = (!scope.config.layout || scope.config.layout === 'large');

test/charts/trends/trends-chart.spec.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,41 +40,45 @@ describe('Directive: pfTrendsChart', function() {
4040
var compileChart = function (markup, scope) {
4141
var el = $compile(markup)(scope);
4242
scope.$digest();
43-
return el;
43+
return angular.element(el);
4444
};
4545

4646
it("should show the last data point of sparkline chart as the trend heading", function() {
47-
expect(angular.element(element).find('.trend-title-big-pf').html()).toBe("76");
48-
expect(angular.element(element).find('.trend-title-small-pf').html()).toBe("MHz");
47+
expect(element.find('.trend-title-big-pf').html()).toBe("76");
48+
expect(element.find('.trend-title-small-pf').html()).toBe("MHz");
4949
});
5050

5151
it("should show the correct card heading and time frame", function() {
52-
expect(angular.element(element).find('.trend-header-pf').html()).toBe("Network Utilization Trends");
53-
expect(angular.element(element).find('.trend-footer-pf').html()).toBe("Last 15 Minutes");
52+
expect(element.find('.trend-header-pf').html()).toBe("Network Utilization Trends");
53+
expect(element.find('.trend-footer-pf').html()).toBe("Last 15 Minutes");
5454
});
5555

5656
it("should show the percentage in the trend heading", function() {
5757

5858
$scope.config.valueType = 'percentage';
5959
$scope.$digest();
6060

61-
expect(angular.element(element).find('.trend-title-big-pf').html()).toBe("76%");
62-
expect(angular.element(element).find('.trend-title-small-pf').html()).toBe("of 100 MHz");
61+
expect(element.find('.trend-title-big-pf').html()).toBe("76%");
62+
expect(element.find('.trend-title-small-pf').html()).toBe("of 100 MHz");
6363
});
6464

6565
it("should show large or small trend card layouts", function() {
6666
// by default, should show a large card
67-
var trendCard = angular.element(element.find('.trend-card-large-pf'));
67+
var trendCard = element.find('.trend-card-large-pf');
6868
expect(trendCard.size()).toBe(1);
69+
// check small card isn't being shown by default
70+
expect(trendCard.hasClass('.trend-card-small-pf')).toBeFalsy();
6971

7072
$scope.config.layout = 'small';
7173
$scope.$digest();
72-
trendCard = angular.element(element.find('.trend-card-small-pf'));
74+
trendCard = element.find('.trend-card-small-pf');
7375
expect(trendCard.size()).toBe(1);
76+
expect(trendCard.hasClass('.trend-card-large-pf')).toBeFalsy();
7477

7578
$scope.config.layout = 'large';
7679
$scope.$digest();
77-
trendCard = angular.element(element.find('.trend-card-large-pf'));
80+
trendCard = element.find('.trend-card-large-pf');
7881
expect(trendCard.size()).toBe(1);
82+
expect(trendCard.hasClass('.trend-card-small-pf')).toBeFalsy();
7983
});
8084
});

0 commit comments

Comments
 (0)