Skip to content

Commit ae667ca

Browse files
author
Dave Conway-Jones
committed
more fixes for template size and catch gauge init error
1 parent 0380085 commit ae667ca

File tree

9 files changed

+44
-38
lines changed

9 files changed

+44
-38
lines changed

CHANGELOG.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33

44
**Fixes**
55

6-
- stop reset icon repeating on tab changes
7-
- let helper library load from editor side
8-
- better detect height (or lack of) for template nodes
6+
- Stop light and dark colour reset icon repeating on tab changes
7+
- Let colour helper library load from editor side
8+
- Better height detection (or lack of) for template nodes
9+
- Catch ui_gauge initialisation errors
910

1011
### 2.3.1: Maintenance Release
1112

@@ -18,12 +19,12 @@
1819
**Enhancements**
1920

2021
- Add Themes to Dashboard Tab - includes colour and sizes and other options - Issue137
21-
- Colourpicker - add configurable lightness slider - PR123
22+
- Colour-picker - add configurable lightness slider - PR123
2223
- Configurable colour for Notification toasts - Issue145
2324
- Remove whitespace from above gauge with no label - Issue159
2425
- Let gauge widgets scall larger when basic unit size increased - Issue162
2526
- Let most labels show icons if required (via html <i syntax)
26-
- Add date picker widget - Issue14
27+
- Add date-picker widget - Issue14
2728
- Give audio node option to play when not in focus - Issue167
2829

2930
**Fixes**

dist/dashboard.appcache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ fonts/fontawesome-webfont.woff2
1919
NETWORK:
2020
*
2121

22-
# hash: 92d596f4edd13c65e8e54e1bf1bf4cf50302e362343107c6b05ce1514883479e
22+
# hash: eda23d9d5ca8a0d35ac41c89a68bae209ead97ce320b9b17833ec4c1fa8d1175

dist/js/app.min.js

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

nodes/ui_gauge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ module.exports = function (RED) {
1919
if (config.gtype && config.gtype === "donut") { node.autoheight = parseInt(group.config.width -1); }
2020
if (config.gtype && config.gtype === "compass") { node.autoheight = parseInt(group.config.width -1); }
2121

22-
var theme = ui.getTheme();
2322
var sizes = ui.getSizes();
23+
var theme = ui.getTheme();
2424
if (theme === undefined) {
2525
theme = {"group-textColor":{value:"#000"}};
2626
theme["widget-textColor"] = {value:"#000"};

nodes/ui_switch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = function(RED) {
3232
if (onvalueType === 'flow' || onvalueType === 'global') {
3333
try {
3434
parts = RED.util.normalisePropertyExpression(onvalue);
35-
console.log(parts);
35+
//console.log(parts);
3636
if (parts.length === 0) {
3737
throw new Error();
3838
}

nodes/ui_template.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ module.exports = function(RED) {
99
if (!group) { return; }
1010
var tab = RED.nodes.getNode(group.config.tab);
1111
if (!tab) { return; }
12-
13-
var he = Number(config.height|| 0 );
14-
if (he === 0) {
15-
if ((config.format.indexOf('<style') === -1) && (config.format.indexOf('<link') === -1)) { he = 1; } // and if no style or link tag
16-
else { // or if any common tags for content
17-
if (config.format.indexOf('<div') !== -1) { he = 1; }
18-
if (config.format.indexOf('<p') !== -1) { he = 1; }
19-
if (config.format.indexOf('<span') !== -1) { he = 1; }
12+
13+
var hei = Number(config.height|| 0);
14+
if (hei === 0) { // and if no style or link tag
15+
if ((config.format.indexOf('<style') === -1) && (config.format.indexOf('<link') === -1)) { hei = 1; }
16+
else { // or if any common tags for content
17+
if (config.format.indexOf('<div') !== -1) { hei = 1; }
18+
if (config.format.indexOf('<p') !== -1) { hei = 1; }
19+
if (config.format.indexOf('<span') !== -1) { hei = 1; }
2020
}
2121
}
2222

@@ -31,7 +31,7 @@ module.exports = function(RED) {
3131
type: 'template',
3232
order: config.order,
3333
width: config.width || group.config.width || 6,
34-
height: he,
34+
height: hei,
3535
format: config.format
3636
},
3737
beforeEmit: function(msg, value) {

src/components/ui-card-panel/ui-card-panel-ctrl.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ angular.module('ui').controller('uiCardPanelController', ['uiSizes', '$timeout',
55
var ctrl = this;
66
ctrl.width = (sizes.columns($scope.group) * sizes.sx) + (sizes.px * 2) + ((sizes.columns($scope.group) - 1) * sizes.cx);
77
var defaultWidth = sizes.columns($scope.group);
8-
var defaultHeight = 1;
8+
var defaultHeight = 0;
99

1010
var root;
1111
ctrl.init = function (rootElement) {
@@ -36,21 +36,21 @@ angular.module('ui').controller('uiCardPanelController', ['uiSizes', '$timeout',
3636
var result = size.split('x');
3737
var width = Math.max(1, Math.min(sizes.columns($scope.group), result ? parseInt(result[0]) || defaultWidth : defaultWidth));
3838
var height = Math.max(1, result ? parseInt(result[1]) || defaultHeight : defaultHeight);
39-
// if ((parseInt(result[1]) === 0) && (child.attr('ui-template') !== undefined)) { /*is template node*/
40-
// // template node will size the height based upon it's content
41-
// // - child.height() defaults to calculating based on width of group
42-
// var ch = child.height() * parseInt($scope.group.header.config.width)/width;
43-
// if (!ch || (ch <= 0)) { // if height is 0 or undefined
44-
// var t = (child[0].innerHTML).toLowerCase();
45-
// if ((t.indexOf('<style') === -1) && (t.indexOf('<link') === -1)) { ch = 1; } // and if no style or link tag
46-
// else { // or if any common tags for content
47-
// if (t.indexOf('<div') !== -1) { ch = 1; }
48-
// if (t.indexOf('<p') !== -1) { ch = 1; }
49-
// if (t.indexOf('<span') !== -1) { ch = 1; }
50-
// }
51-
// }
52-
// height = Math.ceil(ch / (sizes.cy + sizes.sy));
53-
// }
39+
if ((parseInt(result[1]) <= 0) && (child.attr('ui-template') !== undefined)) { /*is template node*/
40+
// template node will size the height based upon it's content
41+
// - child.height() defaults to calculating based on width of group
42+
var ch = child.height() * parseInt($scope.group.header.config.width)/width;
43+
if (!ch || (ch <= 0)) { // if height is 0 or undefined
44+
var t = (child[0].innerHTML).toLowerCase();
45+
if ((t.indexOf('<style') === -1) && (t.indexOf('<link') === -1)) { ch = 1; } // and if no style or link tag
46+
else { // or if any common tags for content
47+
if (t.indexOf('<div') !== -1) { ch = 1; }
48+
if (t.indexOf('<p') !== -1) { ch = 1; }
49+
if (t.indexOf('<span') !== -1) { ch = 1; }
50+
}
51+
}
52+
height = Math.ceil(ch / (sizes.cy + sizes.sy));
53+
}
5454

5555
var position = getNextPosition(width, height);
5656
child.css({

src/components/ui-gauge/ui-gauge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ angular.module('ui').directive('uiGauge', [ '$timeout', '$interpolate',
1616

1717
//Backwards compatability for background and foreground
1818
if (!bgnd || !fgnd) {
19-
if (theme === 'theme-light') {
19+
if (theme === 'theme-dark') {
2020
bgnd = "#097479";
2121
fgnd = "#111111";
2222
} else {

ui.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,12 @@ function addBaseConfig(config) {
392392
}
393393

394394
function getTheme() {
395-
return baseConfiguration.theme.themeState;
395+
if (baseConfiguration && baseConfiguration.hasOwnProperty("theme") && (typeof baseConfiguration.theme !== "undefined") ) {
396+
return baseConfiguration.theme.themeState;
397+
}
398+
else {
399+
return undefined;
400+
}
396401
}
397402

398403
function getSizes() {

0 commit comments

Comments
 (0)