Skip to content

Commit

Permalink
Merge pull request #451 from andig/states
Browse files Browse the repository at this point in the history
Set default style when creating channel
  • Loading branch information
andig committed Jul 30, 2016
2 parents f669124 + 6833e28 commit c05e1a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
16 changes: 11 additions & 5 deletions htdocs/frontend/javascripts/wui.js
Expand Up @@ -254,8 +254,14 @@ vz.wui.dialogs.init = function() {
$('#entity-create form table .optional').remove();

var container = $('#entity-create form table');
vz.wui.dialogs.addProperties(container, vz.capabilities.definitions.entities[$(this)[0].selectedIndex].required, "required");
vz.wui.dialogs.addProperties(container, vz.capabilities.definitions.entities[$(this)[0].selectedIndex].optional, "optional");
var entityDefinition = vz.capabilities.definitions.entities[$(this)[0].selectedIndex];
vz.wui.dialogs.addProperties(container, entityDefinition.required, "required");
vz.wui.dialogs.addProperties(container, entityDefinition.optional, "optional");

// set default style
if (entityDefinition.style) {
$(container).find('select[name=style] option[value=' + entityDefinition.style + ']').attr('selected', 'selected');
}
});
$('#entity-create select').change();

Expand Down Expand Up @@ -505,9 +511,9 @@ vz.wui.updateLegend = function() {
} else if (series.lines.states) {
y = null;
if (j < series.data.length) {
var p2 = series.data[j];
if (p2)
y = p2[1];
var p3 = series.data[j];
if (p3)
y = p3[1];
}
} else { // no steps -> interpolate
var p1 = series.data[j - 1], p2 = series.data[j];
Expand Down
1 change: 1 addition & 0 deletions lib/Definition/EntityDefinition.json
Expand Up @@ -283,6 +283,7 @@
"icon" : "pipe.png",
"unit" : "%",
"interpreter" : "Volkszaehler\\Interpreter\\SensorInterpreter",
"style" : "states",
"model" : "Volkszaehler\\Model\\Channel",
"translation" : {
"de" : "Ventil",
Expand Down

0 comments on commit c05e1a6

Please sign in to comment.