Skip to content

Commit 8f5caae

Browse files
committed
Merge pull request #164 from jeff-phillips-18/master
Update to use the c3ChartsDefaults from Patternfly
2 parents 2140745 + 9bf68aa commit 8f5caae

File tree

45 files changed

+857
-839
lines changed

Some content is hidden

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

45 files changed

+857
-839
lines changed

Gruntfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ module.exports = function (grunt) {
125125
'lib/patternfly/components/bootstrap-treeview/src/js/bootstrap-treeview.js',
126126
'lib/patternfly/components/c3/c3.js',
127127
'lib/patternfly/components/d3/d3.js',
128+
'lib/patternfly/dist/js/patternfly.js',
128129
'lib/angular/angular.js',
129130
'lib/angular-sanitize/angular-sanitize.js',
130131
'lib/angular-animate/angular-animate.js',

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@
4242
"angular-route": "1.3.0 - 1.4.*",
4343
"angular-bootstrap": "0.13.x",
4444
"lodash": "3.x",
45-
"patternfly": "~2.7.0"
45+
"patternfly": "git://github.com/patternfly/patternfly.git#master"
4646
}
4747
}

dist/angular-patternfly.js

Lines changed: 32 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -536,104 +536,23 @@ angular.module('patternfly.card').directive('pfCard', function () {
536536
;(function () {
537537
'use strict';
538538

539+
var patternflyDefaults = $().c3ChartDefaults();
540+
539541
angular.module('patternfly.charts').constant('c3ChartDefaults', {
540-
getDefaultDonut: function (title) {
541-
return {
542-
title: title,
543-
label: {
544-
show: false
545-
},
546-
width: 11
547-
};
548-
},
549-
getDefaultDonutSize: function () {
550-
return {
551-
height: 171 // produces a diameter of 150 and a centered chart
552-
};
553-
},
554-
getDefaultDonutColor: function () {
555-
return {
556-
pattern: ['#0088CE', '#D1D1D1']
557-
};
558-
},
559-
getDefaultDonutTooltip: function () {
560-
return {
561-
show: false
562-
};
563-
},
564-
getDefaultDonutLegend: function () {
565-
return {
566-
show: false
567-
};
568-
},
569-
getDefaultDonutConfig: function (title) {
570-
return {
571-
donut: this.getDefaultDonut(title),
572-
size: this.getDefaultDonutSize(),
573-
legend: this.getDefaultDonutLegend(),
574-
color: this.getDefaultDonutColor(),
575-
tooltip: this.getDefaultDonutTooltip()
576-
};
577-
},
578-
getDefaultSparklineArea: function () {
579-
return {
580-
zerobased: true
581-
};
582-
},
583-
getDefaultSparklineSize: function () {
584-
return {
585-
height: 60
586-
};
587-
},
588-
getDefaultSparklineAxis: function () {
589-
return {
590-
x: {
591-
show: false
592-
},
593-
y: {
594-
show: false
595-
}
596-
};
597-
},
598-
getDefaultSparklineColor: function () {
599-
return {
600-
pattern: ['#0088ce', '#00659c', '#3f9c35', '#ec7a08', '#cc0000']
601-
};
602-
},
603-
getDefaultSparklineLegend: function () {
604-
return {
605-
show: false
606-
};
607-
},
608-
getDefaultSparklinePoint: function () {
609-
return {
610-
r: 1,
611-
focus: {
612-
expand: {
613-
r: 4
614-
}
615-
}
616-
};
617-
},
618-
getDefaultSparklineTooltip: function () {
619-
return {
620-
// because a sparkline should only contain a single data column, the tooltip will only work for a single data column
621-
contents: function (d) {
622-
return '<span class="c3-tooltip-sparkline">' + d[0].value + ' ' + d[0].name + '</span>';
623-
}
624-
};
625-
},
626-
getDefaultSparklineConfig: function () {
627-
return {
628-
area: this.getDefaultSparklineArea(),
629-
size: this.getDefaultSparklineSize(),
630-
axis: this.getDefaultSparklineAxis(),
631-
color: this.getDefaultSparklineColor(),
632-
legend: this.getDefaultSparklineLegend(),
633-
point: this.getDefaultSparklinePoint(),
634-
tooltip: this.getDefaultSparklineTooltip()
635-
};
636-
}
542+
getDefaultColors: patternflyDefaults.getDefaultColors,
543+
getDefaultDonut: patternflyDefaults.getDefaultDonut,
544+
getDefaultDonutSize: patternflyDefaults.getDefaultDonutSize,
545+
getDefaultDonutColor: patternflyDefaults.getDefaultDonutColors,
546+
getDefaultDonutLegend: patternflyDefaults.getDefaultDonutLegend,
547+
getDefaultDonutConfig: patternflyDefaults.getDefaultDonutConfig,
548+
getDefaultSparklineArea: patternflyDefaults.getDefaultSparklineArea,
549+
getDefaultSparklineSize: patternflyDefaults.getDefaultSparklineSize,
550+
getDefaultSparklineAxis: patternflyDefaults.getDefaultSparklineAxis,
551+
getDefaultSparklineColor: patternflyDefaults.getDefaultColors,
552+
getDefaultSparklineLegend: patternflyDefaults.getDefaultSparklineLegend,
553+
getDefaultSparklinePoint: patternflyDefaults.getDefaultSparklinePoint,
554+
getDefaultSparklineTooltip: patternflyDefaults.getDefaultSparklineTooltip,
555+
getDefaultSparklineConfig: patternflyDefaults.getDefaultSparklineConfig
637556
});
638557
})();
639558
;/**
@@ -674,34 +593,17 @@ angular.module('patternfly.card').directive('pfCard', function () {
674593
$scope.total = 1000;
675594
$scope.available = $scope.total - $scope.used;
676595
677-
$scope.chartConfig = {
596+
$scope.chartConfig = $().c3ChartDefaults().getDefaultDonutConfig('MHz Used');
597+
$scope.chartConfig.data = {
678598
type: "donut",
679-
donut: {
680-
title: "MHz Used",
681-
label: {show: false},
682-
width: 10
683-
},
684-
size: {
685-
height: 130
686-
},
687-
legend: {
688-
show: false
689-
},
690-
color: {
691-
pattern: ["#0088CE","#D1D1D1"]
692-
},
693-
tooltip: {},
694-
data: {
695-
type: "donut",
696-
columns: [
697-
["Used", $scope.used],
698-
["Available", $scope.total - $scope.used]
699-
],
700-
groups: [
701-
["used", "available"]
702-
],
703-
order: null
704-
}
599+
columns: [
600+
["Used", $scope.used],
601+
["Available", $scope.total - $scope.used]
602+
],
603+
groups: [
604+
["used", "available"]
605+
],
606+
order: null
705607
};
706608
707609
$scope.updateAvailable = function (val) {
@@ -973,7 +875,7 @@ angular.module('patternfly.card').directive('pfCard', function () {
973875
</file>
974876
</example>
975877
*/
976-
angular.module('patternfly.charts').directive('pfDonutPctChart', ["c3ChartDefaults", "pfUtils", "$timeout", function (c3ChartDefaults, pfUtils, $timeout) {
878+
angular.module('patternfly.charts').directive('pfDonutPctChart', ["pfUtils", "$timeout", function (pfUtils, $timeout) {
977879
'use strict';
978880

979881
return {
@@ -1098,7 +1000,7 @@ angular.module('patternfly.charts').directive('pfDonutPctChart', ["c3ChartDefaul
10981000
$scope.config.data.onclick = $scope.config.onClickFn;
10991001
};
11001002

1101-
$scope.config = pfUtils.merge(c3ChartDefaults.getDefaultDonutConfig(), $scope.config);
1003+
$scope.config = pfUtils.merge($().c3ChartDefaults().getDefaultDonutConfig(), $scope.config);
11021004
$scope.updateAll($scope);
11031005
}
11041006
],
@@ -1549,7 +1451,7 @@ angular.module('patternfly.charts').directive('pfHeatmap', ["$compile", function
15491451
</file>
15501452
</example>
15511453
*/
1552-
angular.module('patternfly.charts').directive('pfSparklineChart', ["c3ChartDefaults", "pfUtils", function (c3ChartDefaults, pfUtils) {
1454+
angular.module('patternfly.charts').directive('pfSparklineChart', ["pfUtils", function (pfUtils) {
15531455
'use strict';
15541456
return {
15551457
restrict: 'A',
@@ -1631,7 +1533,7 @@ angular.module('patternfly.charts').directive('pfSparklineChart', ["c3ChartDefau
16311533
'</tr>';
16321534
break;
16331535
default:
1634-
tipRows = c3ChartDefaults.getDefaultSparklineTooltip().contents(d);
1536+
tipRows = $().c3ChartDefaults().getDefaultSparklineTooltip().contents(d);
16351537
}
16361538
}
16371539
return $scope.getTooltipTableHTML(tipRows);
@@ -1677,7 +1579,7 @@ angular.module('patternfly.charts').directive('pfSparklineChart', ["c3ChartDefau
16771579
$scope.showYAxis = ($scope.config.showAxis !== undefined) && $scope.config.showAxis;
16781580
}
16791581

1680-
$scope.defaultConfig = c3ChartDefaults.getDefaultSparklineConfig();
1582+
$scope.defaultConfig = $().c3ChartDefaults().getDefaultSparklineConfig();
16811583
$scope.defaultConfig.axis = {
16821584
x: {
16831585
show: $scope.showXAxis === true,
@@ -5287,7 +5189,7 @@ angular.module('patternfly.views').directive('pfDataToolbar', function () {
52875189
'use strict';
52885190

52895191
$templateCache.put('filters/simple-filter-fields.html',
5290-
"<div class=\"simple-filter filter-fields\"><form><div class=\"form-group toolbar-pf-filter\"><div class=input-group><div dropdown class=input-group-btn><button dropdown-toggle type=button class=\"btn btn-default dropdown-toggle filter-fields\" aria-haspopup=true aria-expanded=false tooltip=\"Filter by\" tooltip-placement=bottom>{{currentField.title}} <span class=caret></span></button><ul class=dropdown-menu><li ng-repeat=\"item in config.fields\"><a class=filter-field role=menuitem tabindex=-1 ng-click=selectField(item)>{{item.title}}</a></li></ul></div><div ng-if=\"currentField.filterType !== 'select'\"><input class=form-control type={{currentField.filterType}} ng-model=config.currentValue placeholder={{currentField.placeholder}} ng-keypress=\"onValueKeyPress($event)\"></div><div ng-if=\"currentField.filterType === 'select'\"><select pf-select class=\"form-control filter-select\" id=currentValue ng-model=config.currentValue ng-options=\"filterValue for filterValue in currentField.filterValues\" ng-change=selectValue(config.currentValue)><option value=\"\">{{currentField.placeholder}}</option></select></div></div></div></form></div>"
5192+
"<div class=\"simple-filter filter-fields\"><form><div class=\"form-group toolbar-pf-filter\"><div class=input-group><div dropdown class=input-group-btn><button dropdown-toggle type=button class=\"btn btn-default dropdown-toggle filter-fields\" aria-haspopup=true aria-expanded=false tooltip=\"Filter by\" tooltip-placement=top>{{currentField.title}} <span class=caret></span></button><ul class=dropdown-menu><li ng-repeat=\"item in config.fields\"><a class=filter-field role=menuitem tabindex=-1 ng-click=selectField(item)>{{item.title}}</a></li></ul></div><div ng-if=\"currentField.filterType !== 'select'\"><input class=form-control type={{currentField.filterType}} ng-model=config.currentValue placeholder={{currentField.placeholder}} ng-keypress=\"onValueKeyPress($event)\"></div><div ng-if=\"currentField.filterType === 'select'\"><select pf-select class=\"form-control filter-select\" id=currentValue ng-model=config.currentValue ng-options=\"filterValue for filterValue in currentField.filterValues\" ng-change=selectValue(config.currentValue)><option value=\"\">{{currentField.placeholder}}</option></select></div></div></div></form></div>"
52915193
);
52925194

52935195

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/docs/css/patternfly-additions.css

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

dist/docs/css/patternfly.css

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

0 commit comments

Comments
 (0)