Skip to content
Permalink
Browse files

Remove settings capabilities from UI

  • Loading branch information...
knewell committed Sep 16, 2019
1 parent 9423b25 commit 394d2a0b37861bb32600f9c2614ade899d7cf672
Showing with 7 additions and 118 deletions.
  1. +2 −8 .gitignore
  2. +1 −1 Dockerfile
  3. +3 −21 main.py
  4. +0 −12 ui/config.yml
  5. +1 −40 ui/index.html
  6. +0 −36 ui/ui.js
@@ -103,11 +103,5 @@ pip-selfcheck.json
*.retry
*.swp

.retry
group_vars/vmware
*.ova
*.iso
*.vmdk
*.mf
*.ovf
.vscode
.vscode
ui/config.yml
@@ -1,4 +1,4 @@
FROM python:3
FROM python:3-slim

WORKDIR /srv

24 main.py
@@ -18,10 +18,11 @@
#


import os
import cherrypy
import hashlib
import datetime
import hashlib
import logging
import os
import yaml
import re

@@ -496,18 +497,6 @@ def parseFlow(self, flow=None):

return data

def save_settings(self, dev_user=None, dev_pw=None, routers=None, age_out_interval=None):

self.dev_user = dev_user
self.dev_pw = dev_pw
self.age_out_interval = age_out_interval
# self.routers = routers

# with open('ui/config.yml', 'w') as fp:
# config = {'dev_user': self.dev_user, 'dev_pw': self.dev_pw, 'routers': self.routers,
# 'age_out_interval': self.age_out_interval}
# yaml.safe_dump(config, fp, default_flow_style=False)

def load_settings(self):

with open('ui/config.yml', 'r') as fp:
@@ -562,13 +551,6 @@ def POST(self, action=None):
resp = self.my_dev.delFlowRoute(flowRouteData=input_json)
return resp

elif action == 'save':

input_json = cherrypy.request.json
self.my_dev.save_settings(dev_user=input_json['user'], dev_pw=input_json['password'],
age_out_interval=input_json['age_out_interval'])
return True, 'Successfully saved configuration settings'

else:
return False, 'Action not defined'

This file was deleted.

Oops, something went wrong.
@@ -46,9 +46,7 @@ <h2 style="text-align:right;float:right;" class="mainheader">Monitoring BGP Flow
</li>
<li><a href="#filterActive" data-toggle="tab">Active Flow Filters</a>
</li>
<li><a href="#settings" data-toggle="tab">Settings</a>
</li>
</ul>
</ul>
<div class="tab-content clearfix">
<div class="tab-pane active" id="overview">
<br/>
@@ -150,43 +148,6 @@ <h2 style="text-align:right;float:right;" class="mainheader">Monitoring BGP Flow
</div>
</div>
</div>
<div class="tab-pane" id="settings">
<br/>
<div class="panel panel-default">
<div class="panel-heading"><h3>Settings</h3></div>
<div class="panel-body">
<div class="form-group row">
<label for="inputDevUser" class="col-sm-2 col-form-label">Device User</label>
<div class="col-sm-3">
<input type="text" class="form-control" id="inputDevUser" placeholder="root">
</div>
</div>
<div class="form-group row">
<label for="inputDevPassword" class="col-sm-2 col-form-label">Device Password</label>
<div class="col-sm-3">
<input type="password" class="form-control" id="inputDevPassword">
</div>
</div>
<div class="form-group row">
<label for="inputPollInterval" class="col-sm-2 col-form-label">Poll Interval (sec)</label>
<div class="col-sm-3">
<input type="text" class="form-control" id="inputPollInterval" value="5000">
</div>
</div>
<div class="form-group row">
<label for="inputAgeOutInterval" class="col-sm-2 col-form-label">Age out timer</label>
<div class="col-sm-3">
<input type="text" class="form-control" id="inputAgeOutInterval" value="0:03:00">
</div>
</div>
<p>
<button id="saveDevSettingsBtn" type="button" class="btn btn-primary btn-sm">
Save Settings
</button>
</p>
</div>
</div>
</div>
</div>
</div>

@@ -32,7 +32,6 @@ $(document).ready(function () {
flowRouteModModalBtnEventHandler();
flowRouteModBtnEventHandler();
flowRouteDelBtnEventHandler();
saveSettingsBtnEventHandler();

var t_flow_config = $('#t_flow_config').DataTable({
'ajax' : {
@@ -620,38 +619,3 @@ function getActiveFlowFilter(pollInterval){
}
setTimeout(poll, pollInterval);
}

function saveSettingsBtnEventHandler(){

$("#saveDevSettingsBtn").on( "click", function() {

var data = new Object();

data.user = $('#inputDevUser').val();
data.password = $('#inputDevPassword').val();
data.ip = $('#inputDevIP').val();
data.age_out_interval = $('#inputAgeOutInterval').val();
ageOutInterval = $('#inputAgeOutInterval').val();
pollInterval = $('#inputPollInterval').val();

saveSettings(data);
});
}

function saveSettings(settings){

$.ajax({
url: '/api?action=save',
type: 'POST',
data: JSON.stringify(settings),
cache: false,
processData: true,
dataType: 'json',
contentType: 'application/json',
success: function (response) {
},
error : function (data, errorText) {
$("#errormsg").html(errorText).show();
}
});
}

0 comments on commit 394d2a0

Please sign in to comment.
You can’t perform that action at this time.