bug fixes around new data structures and transport data

master
Steve L. Nyemba 8 years ago
parent ce0c802776
commit e1d9b657d0

@ -155,7 +155,7 @@ def dashboard():
if 'title' in PARAMS : if 'title' in PARAMS :
title = PARAMS['title'] title = PARAMS['title']
else: else:
title = 'Zulu Watch Tower' title = 'Zulu OverWatch'
return render_template('dashboard.html',context=context,title=title) return render_template('dashboard.html',context=context,title=title)
""" """
@ -253,20 +253,23 @@ def get_folders():
d = gReader.read() d = gReader.read()
if 'folders' in d: if 'folders' in d:
d = d['folders'] d = d['folders']
r = [] index = len(d) - 1
m = {} d = d[index]
for row in d :
key = row.keys()[0]
row = row[key] # m = {}
if key not in m: # for row in d :
r.append(row)
m[key] = len(r) -1 # key = row.keys()[0]
else:
index = m[key] # row = row[key]
r[index] = row # if key not in m:
d = r # r.append(row)
# m[key] = len(r) -1
# else:
# index = m[key]
# r[index] = row
# d = r
else: else:
d = [] d = []

@ -36,7 +36,16 @@ monitor.processes.init = function (x) {
// Auto start the first item in the menu // Auto start the first item in the menu
// This is designed not to let the user wander or wonder what is going on // This is designed not to let the user wander or wonder what is going on
// //
jx.dom.get.children('menu')[0].click() var nodes = jx.dom.get.children('menu')
if (nodes.length > 0) {
nodes[0].click()
} else {
//
// We should hide the panes for this
//
jx.dom.hide('apps')
}
setTimeout(monitor.sandbox.init,3000) setTimeout(monitor.sandbox.init,3000)
} }
@ -363,7 +372,7 @@ monitor.folders.init = function () {
var data = [] var data = []
for (var id in r) { for (var id in r) {
var item = r[id] var item = r[id]
item.id = id // item.id = id
data = data.concat(item) data = data.concat(item)
} }
@ -506,26 +515,26 @@ monitor.folders.render.summary = function (data) {
return 'small' return 'small'
} }
options.rowClick = function(args){ options.rowClick = function(args){
var item = args.item // var item = args.item
age = jx.utils.patterns.visitor(item.details.age, function (row) { // age = jx.utils.patterns.visitor(item.details.age, function (row) {
return {y:row[0],x:row[1]} // return {y:row[0],x:row[1]}
}) // })
size = jx.utils.patterns.visitor(item.details.size, function (row) { // size = jx.utils.patterns.visitor(item.details.size, function (row) {
return {y:row[0],x:row[1]} // return {y:row[0],x:row[1]}
}) // })
monitor.folders.render.details(item.name,{age:age,size:size}) // monitor.folders.render.details(item.name,{age:age,size:size})
} }
// //
// @TODO Add the units in days just in case // @TODO Add the units in days just in case
options.autoload = true options.autoload = true
options.fields = [ options.fields = [
{ name: 'id', type: 'text', title: "Host", headercss: "small bold", css: "small"},
{ name: 'label', type: 'text', title: "Folder Name", headercss: "small bold", css: "small"},
{ name: 'name', type: 'text', title: "Folder Name", headercss: "small bold", css: "small"}, { name: "size", type: "number", title: "Folder Size", type: "number", headercss: "small bold" },
{ name: "count", type: "number", title: "File Count", type: "number", headercss: "small bold" }
{ name: "summary.size", type: "number", title: "Folder Size", type: "number", headercss: "small bold" },
{ name: "summary.count", type: "number", title: "File Count", type: "number", headercss: "small bold" }
] ]
var grid = $('#gridfolders').jsGrid(options) ; var grid = $('#gridfolders').jsGrid(options) ;

@ -562,22 +562,25 @@ class CouchdbWriter(Couchdb,Writer):
document[label] = [] document[label] = []
document[label].append(row) document[label].append(row)
self.dbase.save_doc(document) self.dbase.save_doc(document)
def flush(self,params) : def flush(self,**params) :
size = params['size'] size = params['size']
has_changed = False
document = self.dbase.get(self.uid) document = self.dbase.get(self.uid)
for key in documment: for key in document:
if key not in ['_id','_rev','_attachments'] : if key not in ['_id','_rev','_attachments'] :
content = document[key] content = document[key]
else: else:
content = [] continue
if isinstance(content,list): if isinstance(content,list):
index = len(content) - size index = len(content) - size
content = content[index:] content = content[index:]
document[key] = content document[key] = content
else: else:
document[key] = {} document[key] = {}
has_changed = True
if has_changed:
self.dbase.save_doc(document) self.dbase.save_doc(document)
def archive(self,params=None): def archive(self,params=None):

Loading…
Cancel
Save