-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alarm dashboard页面添加搜索功能 #63
Open
hctech
wants to merge
2
commits into
open-falcon:master
Choose a base branch
from
hctech:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea/ | ||
env/ | ||
var/ | ||
log/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
{% extends "portal/layout.html" %} | ||
{% block content %} | ||
<form class="form-inline", method="get"> | ||
<div class="form-group"> | ||
<label for="endpoint">EndPoint</label> | ||
<input type="text" class="form-control" id="endpoint" name="endpoint_q"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="metric">Metric</label> | ||
<input type="text" class="form-control" id="metric" name="metric_q"> | ||
</div> | ||
<div class="form-group"> | ||
<label>From</label> | ||
<div class='input-group date' id='from_data'> | ||
<input type='text' class="form-control" name="from_data" placeholder="YYYY-MM-DD HH:mm:ss"/> | ||
<span class="input-group-addon"> | ||
<span class="glyphicon glyphicon-calendar"></span> | ||
</span> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label>To</label> | ||
<div class='input-group date' id='to_data'> | ||
<input type='text' class="form-control" name="to_data" placeholder="YYYY-MM-DD HH:mm:ss"/> | ||
<span class="input-group-addon"> | ||
<span class="glyphicon glyphicon-calendar"></span> | ||
</span> | ||
</div> | ||
</div> | ||
<input type="text" name="status" value="PROBLEM" hidden> | ||
<button type="submit" class="btn btn-default">Search</button> | ||
<script> | ||
$( function() { | ||
$('#from_data').datetimepicker({ | ||
format: 'YYYY-MM-DD', | ||
locale: moment.locale('zh-cn') | ||
}); | ||
$('#to_data').datetimepicker({ | ||
format: 'YYYY-MM-DD', | ||
locale: moment.locale('zh-cn') | ||
}); | ||
} ); | ||
</script> | ||
</form> | ||
<br/> | ||
<div class="panel panel-danger"> | ||
<div class="panel-heading"> | ||
<h4 class="panel-title">{{_('alerting cases')}} | ||
<a class="pull-right small" href="/portal/alarm-dash/case?status=PROBLEM">{{_('not recovered cases')}}</a> | ||
</h4> | ||
</div> | ||
<div class="panel-body"> | ||
<div class="alarms"> | ||
{%for case in cases%} | ||
<div class="alarm"> | ||
<input type="checkbox" alarm="{{case.id}}"> | ||
{{case.status}} P{{case.priority}} | ||
[第<span class="orange">#{{case.current_step}}</span>次/最大{{case.max_step}}次] | ||
<span class="orange">{{case.timestamp}}</span> | ||
<span class="orange">{{case.timestamp|time_duration}}</span> | ||
<span class="gray">[</span> | ||
<a href="/portal/template/view/{{case.template_id}}" target="_blank">template</a> | ||
|
||
{%if case.strategy_id>0%} | ||
<span class="cut-line">¦</span> | ||
<a href="/portal/strategy/{{case.strategy_id}}" target="_blank">strategy</a> | ||
{%endif%} | ||
|
||
{%if case.expression_id>0%} | ||
<span class="cut-line">¦</span> | ||
<a href="/portal/expression/view/{{case.expression_id}}" target="_blank">expression</a> | ||
{%endif%} | ||
|
||
<span class="cut-line">¦</span> | ||
<a href="javascript:alarm_case_rm('{{case.id}}');">delete</a> | ||
<span class="cut-line">¦</span> | ||
<a href="/portal/alarm-dash/case/event?case_id={{case.id}}">{{_('event list')}}</a> | ||
<span class="gray">]</span> | ||
</br> | ||
|
||
<span style="padding-left:17px;"> {{case.endpoint}} | ||
<span class="cut-line">¦</span> | ||
{{case.metric}} | ||
<span class="cut-line">¦</span> | ||
{{case.func}} | ||
<span class="cut-line">¦</span> | ||
{{case.cond}}</span> | ||
<span class="cut-line">¦</span> | ||
<span class="gray">note: {{case.note}}</span> | ||
</div> | ||
<hr> | ||
{%endfor%} | ||
<a href="javascript:alarm_case_all_select();">{{_('select all')}}</a>/ | ||
<a href="javascript:alarm_case_reverse_select();">{{_('reverse select')}}</a> | ||
<button class="btn btn-warning btn-sm" onclick="alarm_case_batch_rm();">{{_('batch delete')}}</button> | ||
</div> | ||
</div> | ||
|
||
{% import "portal/blocks.html" as blocks %} | ||
<div class="pull-left"> | ||
{{ blocks.pager('/portal/alarm-dash/case?status='+status+'&endpoint_q='+endpoint_q+'&metric_q='+metric_q+'&from_data='+from_data+'&to_data='+to_data, total, limit, page) }} | ||
</div> | ||
|
||
</div> | ||
{%endblock%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,14 @@ def alarm_dash_case_get(): | |
endpoint_q = request.args.get("endpoint_q") or "" | ||
metric_q = request.args.get("metric_q") or "" | ||
status = request.args.get("status") or "" | ||
from_data = request.args.get("from_data") or "" | ||
to_data = request.args.get("to_data") or "" | ||
|
||
cases, total = EventCase.query(page, limit, endpoint_q, metric_q, status) | ||
return render_template("portal/alarm/case.html", **locals()) | ||
cases, total = EventCase.query(page, limit, endpoint_q, metric_q, status, from_data, to_data) | ||
if status == 'PROBLEM': | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. case_problem.html 这个文件是多余的哈,可以删除的:) |
||
return render_template("portal/alarm/case_problem.html", **locals()) | ||
else: | ||
return render_template("portal/alarm/case.html", **locals()) | ||
|
||
@app.route("/portal/alarm-dash/case/event") | ||
def alarm_dash_event_get(): | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个模板文件是多余的:)