WIP: display config hierarchy

This commit is contained in:
ziirish 2018-01-22 20:16:37 +01:00
parent 4cc8b1dc38
commit beeedf7448
No known key found for this signature in database
GPG key ID: 72DB229A64B54E46
8 changed files with 66 additions and 4 deletions

View file

@ -168,6 +168,30 @@ class ServerSettings(Resource):
]
},
{ "...": "..." }
],
"hierarchy": [
{
"children": [
{
"children": [],
"dir": "/tmp/burp/conf.d",
"full": "/tmp/burp/conf.d/empty.conf",
"name": "empty.conf",
"parent": "/tmp/burp/burp-server.conf"
},
{
"children": [],
"dir": "/tmp/burp/conf.d",
"full": "/tmp/burp/conf.d/ipv4.conf",
"name": "ipv4.conf",
"parent": "/tmp/burp/burp-server.conf"
}
],
"dir": "/tmp/burp",
"full": "/tmp/burp/burp-server.conf",
"name": "burp-server.conf",
"parent": null
}
]
},
"server_doc": {

View file

@ -314,6 +314,7 @@ class Parser(Doc):
u'includes': [],
u'includes_ext': [],
u'clients': self._list_clients(),
u'hierarchy': [],
}
if not client and not conf:
return res
@ -341,6 +342,7 @@ class Parser(Doc):
for x in parsed.flatten('include', False).keys()
]
res2[u'includes_ext'] = parsed.include
res2[u'hierarchy'] = config.tree
res.update(res2)
self.filescache[mconf] = {
@ -362,6 +364,7 @@ class Parser(Doc):
u'includes': [],
u'includes_ext': [],
u'clients': self._list_clients(),
u'hierarchy': [],
}
if not conf:
mconf = self.conf
@ -390,6 +393,7 @@ class Parser(Doc):
for x in parsed.flatten('include', False).keys()
]
res2[u'includes_ext'] = parsed.include
res2[u'hierarchy'] = self.server_conf.tree
res.update(res2)
self.filescache[mconf] = {

View file

@ -103,6 +103,30 @@ class BUIparser(with_metaclass(ABCMeta, object)):
]
},
],
"hierarchy": [
{
"children": [
{
"children": [],
"dir": "/tmp/burp/conf.d",
"full": "/tmp/burp/conf.d/empty.conf",
"name": "empty.conf",
"parent": "/tmp/burp/burp-server.conf"
},
{
"children": [],
"dir": "/tmp/burp/conf.d",
"full": "/tmp/burp/conf.d/ipv4.conf",
"name": "ipv4.conf",
"parent": "/tmp/burp/burp-server.conf"
}
],
"dir": "/tmp/burp",
"full": "/tmp/burp/burp-server.conf",
"name": "burp-server.conf",
"parent": null
}
]
}
"""
raise NotImplementedError(

View file

@ -1072,6 +1072,7 @@ class Config(File):
basename = os.path.basename(name)
return {
'name': basename,
'title': basename,
'full': name,
'dir': dirname,
'parent': parent,

View file

@ -108,6 +108,7 @@ app.controller('ConfigCtrl', ['$scope', '$http', '$scrollspy', function($scope,
$scope.bools = [];
$scope.strings = [];
$scope.clients = [];
$scope.hierarchy = [];
$scope.client = {};
$scope.defaults = {};
$scope.placeholders = {};
@ -161,6 +162,7 @@ app.controller('ConfigCtrl', ['$scope', '$http', '$scrollspy', function($scope,
$scope.includes = data.results.includes;
$scope.includes_ori = angular.copy($scope.includes);
$scope.includes_ext = data.results.includes_ext;
$scope.hierarchy = data.results.hierarchy;
$scope.refreshScrollspy();
$('#waiting-container').hide();
$('#settings-panel').show();

View file

@ -26,7 +26,7 @@
<link href="{{ url_for('bower.static', filename='datatables.net-buttons-bs/css/buttons.bootstrap.min.css') }}" rel="stylesheet">
{% endif -%}
{% endif -%}
{% if tree -%}
{% if tree or settings -%}
<link href="{{ url_for('bower.static', filename='jquery.fancytree/dist/skin-bootstrap/ui.fancytree.min.css') }}" rel="stylesheet">
{% endif -%}
{% if settings or me -%}
@ -104,7 +104,7 @@
<script src="{{ url_for('bower.static', filename='angular-resource/angular-resource.min.js') }}"></script>
<script src="{{ url_for('bower.static', filename='angular-animate/angular-animate.min.js') }}"></script>
{% endif -%}
{% if tree -%}
{% if tree or settings -%}
<!-- Fancytree Javascript
================================================== -->
{# <script src="{{ url_for('bower.static', filename='js-cookie/src/js.cookie.js') }}"></script> -#}

View file

@ -268,6 +268,11 @@
</div>
</div>
<div class="tab-pane fade" id="hierarchy">
<div id="tree-hierarchy" data-type="json">
{% raw -%}
{{ hierarchy }}
{% endraw -%}
</div>
</div>
<div class="tab-pane fade" id="clients">
</div>

View file

@ -140,7 +140,8 @@ class BurpuiAPITestCase(TestCase):
u'multi': [],
u'includes': [],
u'includes_ext': [],
u'clients': []
u'clients': [],
u'hierarchy': [{'children': [], 'dir': '/dev', 'full': '/dev/null', 'name': 'null', 'parent': None}],
}
),
(u'boolean', self.bui.client.get_parser_attr('boolean_srv')),
@ -166,7 +167,8 @@ class BurpuiAPITestCase(TestCase):
u'multi': [],
u'includes': [],
u'includes_ext': [],
u'clients': []
u'clients': [],
u'hierarchy': [],
}
),
(u'boolean', self.bui.client.get_parser_attr('boolean_cli')),