Commit cfb38857 authored by Jérome Perrin's avatar Jérome Perrin

make GUI use floats for number properties

parent 18914b3f
......@@ -61,7 +61,7 @@
function (idx, property) {
if (property._class === "Dream.Property") {
previous_value = previous_data[property.id] || "";
if (previous_value.length > 0) {
if (previous_value.length > 0 || typeof previous_value == "number") {
previous_value = ' value="' + previous_value + '"';
}
fieldset.append("<label>" + property.id + "</label>" +
......@@ -162,6 +162,9 @@
prefixed_property_id = prefix + property.id;
property_element = $("#" + prefixed_property_id);
data[property.id] = property_element.val();
if (property.type === "number") {
data[property.id] = parseFloat(data[property.id])
}
} else if (property._class === "Dream.PropertyList") {
var next_prefix = prefix + property.id + "-";
data[property.id] = {};
......@@ -248,6 +251,9 @@
if (property._class === "Dream.Property") {
prefixed_property_id = prefix + property.id;
properties[property.id] = $("#" + prefixed_property_id).val();
if (property.type === "number") {
properties[property.id] = parseFloat(properties[property.id])
}
}
});
that.setGeneralProperties(properties);
......
......@@ -47,14 +47,14 @@ class Simulation(ShiftsSimulation):
# some more global properties
conf["Dream-Configuration"]["property_list"].append( {
"id": "throughputTarget",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "10" })
"_default": 10 })
conf["Dream-Configuration"]["property_list"].append( {
"id": "desiredPercentageOfSuccess",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "0.85" })
"_default": 0.85 })
# remove tools that does not make sense here
conf.pop('Dream-Machine')
......
......@@ -11,9 +11,9 @@ schema = {
},
"mean": {
"id": "mean",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "0.9"
"_default": 0.9
},
"distributionType": {
"id": "distributionType",
......@@ -23,21 +23,21 @@ schema = {
},
"stdev": {
"id": "stdev",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "0.1"
"_default": 0.1
},
"min": {
"id": "min",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "0.1"
"_default": 0.1
},
"max": {
"id": "max",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "1"
"_default": 1
},
"failureDistribution": {
"id": "failureDistribution",
......@@ -47,15 +47,15 @@ schema = {
},
"MTTF": {
"id": "MTTF",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "40"
"_default": 40
},
"MTTR": {
"id": "MTTR",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "10"
"_default": 10
},
"repairman": {
"id": "repairman",
......@@ -77,45 +77,45 @@ schema = {
},
"capacity": {
"id": "capacity",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "1"
"_default": 1
},
"numberOfReplications": {
"id": "numberOfReplications",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "10"
"_default": 10
},
"maxSimTime": {
"id": "maxSimTime",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "100"
"_default": 100
},
"confidenceLevel": {
"id": "confidenceLevel",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "0.5"
"_default": 0.5
},
"processTimeout": {
"id": "processTimeout",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "10"
"_default": 10
},
"batchNumberOfUnits": {
"id": "batchNumberOfUnits",
"type": "integer",
"type": "number",
"_class": "Dream.Property",
"_default": "10"
"_default": 10
},
"numberOfSubBatches": {
"id": "numberOfSubBatches",
"type": "integer",
"type": "number",
"_class": "Dream.Property",
"_default": "10"
"_default": 10
},
"method": {
"id": "method",
......@@ -125,27 +125,27 @@ schema = {
},
"start": {
"id": "start",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "1"
"_default": 1
},
"stop": {
"id": "stop",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "-1"
"_default": -1
},
"interval": {
"id": "interval",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "10"
"_default": 10
},
"duration": {
"id": "duration",
"type": "string",
"type": "number",
"_class": "Dream.Property",
"_default": "10"
"_default": 10
},
"argumentDict": {
"id": "argumentDict",
......@@ -155,7 +155,7 @@ schema = {
},
"currentDate": {
"id": "currentDate",
"type": "string", # XXX format ?
"type": "string", # date in YYYY/MM/DD format
"_class": "Dream.Property",
"_default": ""
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment