Commit ad155bf6 authored by Vladislav Rykov's avatar Vladislav Rykov
Browse files

new alert form polished

parent cb9fe380
...@@ -51,3 +51,7 @@ ...@@ -51,3 +51,7 @@
.glyphicon-graphnav { .glyphicon-graphnav {
font-size: 40px; font-size: 40px;
} }
.notifelem {
margin-top: 10px;
}
...@@ -30,11 +30,12 @@ ...@@ -30,11 +30,12 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<center><a href="/new-alert"><button class="btn btn-primary" type="submit">Create New Alert</button></a></center>
</div> </div>
{% else %} {% else %}
<center> There are no alarms for given application. </center> <center> There are no alarms for given application. </center>
{% endif %} {% endif %}
<br>
<center><a href="/new-alert"><button class="btn btn-primary" type="submit">Create New Alert</button></a></center>
</div> </div>
</div> </div>
......
...@@ -31,13 +31,12 @@ ...@@ -31,13 +31,12 @@
<option value="{{ d[1] }}">{{ d[0] }}</option> <option value="{{ d[1] }}">{{ d[0] }}</option>
{% endfor %} {% endfor %}
</select> </select>
</form>
<br>
{% if feedback %} {% if feedback %}
<p class="text-danger float-right">{{ feedback }}</p> <p class="text-danger float-right">{{ feedback }}</p>
{% endif %} {% endif %}
</form>
<br> <br>
<h4> THEN </h4> <h4> THEN </h4>
<h5> Send email to </h5> <h5> Send email to </h5>
...@@ -61,12 +60,19 @@ ...@@ -61,12 +60,19 @@
} else { } else {
if (sel_op == "-") { if (sel_op == "-") {
$("#varname").remove(); $("#varname").remove();
if (document.getElementById("operation")) {
$("#operation").remove();
}
if (document.getElementById("avalue")) {
$("#avalue").remove();
}
} }
} }
} }
function onvar() { function onvar() {
if (!document.getElementById("operation")) { if (!document.getElementById("operation")) {
$("#alertform").append("<br><select class='form-control' name='operaton' id='operation' onchange='onop()' required><option default>CHANGES</option><option>></option><option>>=</option><option><</option><option><=</option><option>==</option></select>"); $("#alertform").append("<select class='form-control notifelem' name='operaton' id='operation' onchange='onop()' required><option default>CHANGES</option><option>></option><option>>=</option><option><</option><option><=</option><option>==</option></select>");
} else { } else {
var var_sel = document.getElementById("varname"); var var_sel = document.getElementById("varname");
var sel_var = var_sel.options[var_sel.selectedIndex].value; var sel_var = var_sel.options[var_sel.selectedIndex].value;
...@@ -76,18 +82,16 @@ ...@@ -76,18 +82,16 @@
} }
} }
function onop() { function onop() {
if (!document.getElementById("value")) {
var op_sel = document.getElementById("operation"); var op_sel = document.getElementById("operation");
var sel_op = op_sel.options[op_sel.selectedIndex].text; var sel_op = op_sel.options[op_sel.selectedIndex].text;
if (sel_op != "CHANGES" && !document.getElementById("avalue")) { if (sel_op != "CHANGES" && !document.getElementById("avalue")) {
$("#alertform").append("<br><input type='numeric' class='form-control' name='avalue' id='avalue' placeholder='Value' required>"); $("#alertform").append("<input type='numeric' class='form-control notifelem' name='avalue' id='avalue' placeholder='Value' required>");
} else { } else {
if (document.getElementById("avalue")) { if (document.getElementById("avalue")) {
$("#avalue").remove(); $("#avalue").remove();
} }
} }
} }
}
</script> </script>
{% endblock %} {% endblock %}
......
...@@ -327,7 +327,7 @@ def dev_vars(): ...@@ -327,7 +327,7 @@ def dev_vars():
if 'name' in session: if 'name' in session:
last = data.get_last_n(session['appkey'], request.args.get('id'), 1) last = data.get_last_n(session['appkey'], request.args.get('id'), 1)
if last[0]: if last[0]:
select = '<select class="form-control" id="varname" name="varname" onchange="onvar(event)" required>' select = '<select class="form-control notifelem" id="varname" name="varname" onchange="onvar(event)" required>'
select += '<option value="-">Select Variable</option>' select += '<option value="-">Select Variable</option>'
for k in last[1][0][2]: for k in last[1][0][2]:
select += '<option>'+k+'</option>' select += '<option>'+k+'</option>'
......
Supports Markdown
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