-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed feeder logging and added upd/del/add functionality for feed config
- Loading branch information
Showing
14 changed files
with
340 additions
and
45 deletions.
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 |
---|---|---|
|
@@ -17,6 +17,7 @@ db_repository/ | |
.DS_Store | ||
redis-stable/ | ||
*.log | ||
feeder/feed.json | ||
|
||
|
||
celerybeat-schedule |
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
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,9 +1,101 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
|
||
{% include "modals/form_config_edit.html" %} | ||
|
||
<div class="row"> | ||
<div class="col-md-12"> | ||
<h1 class="lead">Current Feed Config</h1> | ||
<pre>{{ data }}</pre> | ||
</div> | ||
<div class="col-md-12"> | ||
<h1 class="lead">{{ title }}</h1> | ||
<button type="button" class="btn btn-primary" id="addButton" data-toggle="modal" data-target="#ConfigEditModal">Add New</button> | ||
<table id="config_table" class="table table-bordered"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Frequency</th> | ||
<th>Event</th> | ||
<th>Config</th> | ||
<th>Actions</th> | ||
</tr> | ||
</thead> | ||
{% for dt in data %} | ||
<tr> | ||
<th scope="row" data-id="{{ loop.index0 }}">{{ dt['name'] }}</th> | ||
<td>{{ dt['frequency'] }}</td> | ||
<td data-id="{{ dt['event_id'] }}">{{ dt['event_name'] }}</td> | ||
<td><pre>{{ dt['modules'] }}</pre></td> | ||
<td data-tablename="data_type"> | ||
<button type="button" id="editRow" class="btn btn-primary" data-toggle="modal" data-target="#ConfigEditModal">Edit</button> | ||
<button type="button" id="delRow" class="btn btn-primary" data-toggle="modal" data-target="#ConfigEditModal">Delete</button> | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
</div> | ||
</div> | ||
{% endblock %} | ||
|
||
{% block extra_javascripts %} | ||
<script type="text/javascript"> | ||
|
||
$(document).delegate('#addButton', 'click', function(){ | ||
$('.modal-title').text('Edit Config') | ||
$('#modal_form').attr('action', '/feeds/config/add') | ||
|
||
$('#name').prop("readonly", false); | ||
$('#event').prop("readonly", false); | ||
$('#module').prop("readonly", false); | ||
$('#frequency').prop("readonly", false); | ||
$('#name').val(''); | ||
$('#frequency').val('*'); | ||
$('#module').val(''); | ||
}); | ||
|
||
|
||
$(document).delegate('#editRow', 'click', function(){ | ||
var row_id = $(this).closest('tr').find('th').eq(0).data('id'); | ||
var row_name = $(this).closest('tr').find('th').eq(0).text(); | ||
var row_freq = $(this).closest('tr').find('td').eq(0).text(); | ||
var row_evt_id = $(this).closest('tr').find('td').eq(1).data('id'); | ||
var row_evt_name = $(this).closest('tr').find('td').eq(1).text(); | ||
var row_module = $(this).closest('tr').find('td').eq(2).text(); | ||
|
||
$('.modal-title').text('Edit Config') | ||
$('#modal_form').attr('action', '/feeds/config/edit') | ||
|
||
$('#name').prop("readonly", false); | ||
$('#event').prop("readonly", false); | ||
$('#module').prop("readonly", false); | ||
$('#frequency').prop("readonly", false); | ||
|
||
$('#index_id').val(row_id); | ||
$('#name').val(row_name); | ||
$('#frequency').val(row_freq); | ||
$('#module').val(row_module); | ||
$('#event').val(row_evt_id); | ||
}); | ||
|
||
$(document).delegate('#delRow', 'click', function(){ | ||
var row_id = $(this).closest('tr').find('th').eq(0).data('id'); | ||
var row_name = $(this).closest('tr').find('th').eq(0).text(); | ||
var row_freq = $(this).closest('tr').find('td').eq(0).text(); | ||
var row_evt_id = $(this).closest('tr').find('td').eq(1).data('id'); | ||
var row_evt_name = $(this).closest('tr').find('td').eq(1).text(); | ||
var row_module = $(this).closest('tr').find('td').eq(2).text(); | ||
|
||
$('.modal-title').text('Delete Config') | ||
$('#modal_form').attr('action', '/feeds/config/del') | ||
|
||
$('#name').prop("readonly", true); | ||
$('#event').prop("readonly", true); | ||
$('#module').prop("readonly", true); | ||
$('#frequency').prop("readonly", true); | ||
|
||
$('#index_id').val(row_id); | ||
$('#name').val(row_name); | ||
$('#frequency').val(row_freq); | ||
$('#module').val(row_module); | ||
$('#event').val(row_evt_id); | ||
|
||
}); | ||
</script> | ||
{% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{% import "macros/form.html" as forms %} | ||
<div class="modal fade" id="myEvModal" tabindex="-1" role="dialog"> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
<h4 class="modal-title">Edit Event</h4> | ||
</div> | ||
<div class="modal-body"> | ||
<form method="post" action="/event/view/{{ event.id }}" name="event"> | ||
<div class="form-group row"> | ||
<div class="col-md-10"> | ||
{{ forms.render_field(ev_form.name) }} | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<div class="col-md-12"> | ||
{{ forms.render_field(ev_form.details) }} | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<div class="col-md-6"> | ||
{{ forms.render_field(ev_form.status) }} | ||
</div> | ||
<div class="col-md-6"> | ||
{{ forms.render_field(ev_form.source) }} | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<div class="col-md-6"> | ||
{{ forms.render_field(ev_form.impact) }} | ||
</div> | ||
<div class="col-md-6"> | ||
{{ forms.render_field(ev_form.likelihood) }} | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<div class="col-md-6"> | ||
{{ forms.render_field(ev_form.confidence) }} | ||
</div> | ||
<div class="col-md-6"> | ||
{{ forms.render_field(ev_form.tlp) }} | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<div class="col-md-6"> | ||
<button type="submit" class="btn btn-primary">Save changes</button> | ||
</div> | ||
</div> | ||
{{ ev_form.hidden_tag() }} | ||
</form> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> | ||
</div> | ||
</div><!-- /.modal-content --> | ||
</div><!-- /.modal-dialog --> | ||
</div><!-- /.modal --> |
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,47 @@ | ||
{% import "macros/form.html" as forms %} | ||
<div class="modal fade" id="ConfigEditModal" tabindex="-1" role="dialog"> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
<h4 class="modal-title">Edit Config</h4> | ||
</div> | ||
<div class="modal-body"> | ||
<form method="post" action="/feeds/config/" name="modal_form" id="modal_form"> | ||
<div class="form-group row"> | ||
<div class="col-md-10"> | ||
{{ forms.render_field(form_edit.name) }} | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<div class="col-md-10"> | ||
{{ forms.render_field(form_edit.event) }} | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<div class="col-md-10"> | ||
{{ forms.render_field(form_edit.frequency) }} | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<div class="col-md-10"> | ||
{{ forms.render_field(form_edit.module) }} | ||
</div> | ||
</div> | ||
<div class="form-group row"> | ||
<div class="col-md-6"> | ||
<button type="submit" class="btn btn-primary">Save changes</button> | ||
</div> | ||
</div> | ||
{{ form_edit.index_id }} | ||
{{ form_edit.hidden_tag() }} | ||
</form> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> | ||
</div> | ||
</div><!-- /.modal-content --> | ||
</div><!-- /.modal-dialog --> | ||
</div><!-- /.modal --> |
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
Oops, something went wrong.