add tags view, make flat work

This commit is contained in:
George Hotz 2019-03-23 23:59:04 -07:00
parent fac560bc00
commit a1e6ec14fb
5 changed files with 23 additions and 6 deletions

View File

@ -57,6 +57,15 @@ def gettagsa():
ret.append(rret)
return json.dumps(ret)
@app.route('/gettagss', methods=["POST"])
def gettagss():
arr = json.loads(request.data)
ret = []
for i in arr:
i = fhex(i)
ret.append(program.static[i].todict());
return json.dumps(ret)
@socketio.on('gotoname', namespace='/qira')
@socket_method
def gotoname(name):

View File

@ -503,6 +503,13 @@ class Tags:
self.static = static
self.address = address
def todict(self):
ret = {}
for k in self.backing:
# TODO: add proper type conversions as needed
ret[k] = str(self.backing[k])
return ret
def __contains__(self, tag):
return tag in self.backing

View File

@ -128,16 +128,16 @@ function zoom_out_max(dontforce) {
push_history("zoom out cview");
}
function sync_tags_request(addrs) {
function sync_tags_request(addrs, call='gettagsa') {
var req = new XMLHttpRequest();
req.open('POST', '/gettagsa', false);
req.open('POST', '/'+call, false);
req.send(JSON.stringify(addrs));
return JSON.parse(req.response);
}
function async_tags_request(addrs, cb) {
function async_tags_request(addrs, cb, call='gettagsa') {
var req = new XMLHttpRequest();
req.open('POST', '/gettagsa', true);
req.open('POST', '/'+call, true);
req.onreadystatechange = function() {
if (req.readyState == 4 && req.status == 200) {
cb(JSON.parse(req.response));

View File

@ -37,14 +37,14 @@ Deps.autorun(function() { DA("update itags view");
var addr = Session.get('iaddr');
async_tags_request([addr], function(x) {
$("#itags-static").html(draw_tags(addr, x[0]));
})
}, 'gettagss')
});
Deps.autorun(function() { DA("update dtags view");
var addr = Session.get('daddr');
async_tags_request([addr], function(x) {
$("#dtags-static").html(draw_tags(addr, x[0]));
})
}, 'gettagss')
});
// TODO: this code is replicated in idump.js

View File

@ -139,6 +139,7 @@ td {
min-height: 18px;
position: absolute;
top: 0;
background-color: #BBBBBB;
}
#itags-static {