Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladislav Rykov
THSO.server
Commits
ad155bf6
Commit
ad155bf6
authored
May 14, 2020
by
Vladislav Rykov
Browse files
new alert form polished
parent
cb9fe380
Changes
5
Hide whitespace changes
Inline
Side-by-side
app/app/__pycache__/views.cpython-37.pyc
View file @
ad155bf6
No preview for this file type
app/app/static/css/custom.css
View file @
ad155bf6
...
@@ -51,3 +51,7 @@
...
@@ -51,3 +51,7 @@
.glyphicon-graphnav
{
.glyphicon-graphnav
{
font-size
:
40px
;
font-size
:
40px
;
}
}
.notifelem
{
margin-top
:
10px
;
}
app/app/templates/public/alerts.html
View file @
ad155bf6
...
@@ -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>
...
...
app/app/templates/public/new-alert.html
View file @
ad155bf6
...
@@ -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>
<br>
{% if feedback %}
<p
class=
"text-danger float-right"
>
{{ feedback }}
</p>
{% endif %}
</form>
</form>
{% if feedback %}
<p
class=
"text-danger float-right"
>
{{ feedback }}
</p>
{% endif %}
<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,15 +82,13 @@
...
@@ -76,15 +82,13 @@
}
}
}
}
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
(
"
<input type='numeric' class='form-control notifelem' name='avalue' id='avalue' placeholder='Value' required>
"
);
$
(
"
#alertform
"
).
append
(
"
<br><input type='numeric' class='form-control' name='avalue' id='avalue' placeholder='Value' required>
"
);
}
else
{
}
else
{
if
(
document
.
getElementById
(
"
avalue
"
))
{
if
(
document
.
getElementById
(
"
avalue
"
))
{
$
(
"
#avalue
"
).
remove
();
$
(
"
#avalue
"
).
remove
();
}
}
}
}
}
}
}
...
...
app/app/views.py
View file @
ad155bf6
...
@@ -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>'
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment