Bug fix around folder handling from various sources

master
Steve L. Nyemba 8 years ago
parent a8f415eb6e
commit 267e11e47b

@ -253,8 +253,17 @@ def get_folders():
d = gReader.read()
if 'folders' in d:
d = d['folders']
index = len(d) - 1
d = d[index]
hosts = set([row[0]['id'] for row in d])
m = {}
for id in hosts:
for row in d:
if id == row[0]['id'] :
m[id] = row
d = m.values()
for row in d:
print row[0]['id']
# index = len(d) - 1
# d = d[index]
# m = {}

@ -408,7 +408,7 @@ monitor.folders.search.init = function(){
term = term.replace(/\x32/g,'')
if (term.length == 0) {
monitor.folders.render.summary(data)
} else if (term.length > 3) {
} else if (term.length > 0) {
data = jx.utils.patterns.visitor(data, function (row) {
if (row.id.match(term)) {
@ -517,9 +517,9 @@ monitor.folders.render.summary = function (data) {
}
options.paging = true
options.pageSize = 4
options.pageIndex = 1
options.pageIndex = 2
options.pageButtonCount = 4
options.pagerContainer = '#latest_process_pager'
options.pagerContainer = '#folderspager'
options.pagerFormat= "{prev} Page {pageIndex} of {pageCount} {next}"
options.pagePrevText= '<i class="fa fa-chevron-left"></i>'
options.pageNextText= "<i class='fa fa-chevron-right small' title='Next'> </i>"
@ -546,7 +546,7 @@ monitor.folders.render.summary = function (data) {
options.autoload = true
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" }

@ -114,9 +114,9 @@
<input id="folder_search" type="text" class="small left" placeholder="hostname" style="width:87%; padding-left:4px;" onkeyup="monitor.folders.search.init()"/>
<i class="fa fa-trash right action right" style="margin:4px; padding:4px; color:maroon" onclick="monitor.folders.search.reset()"></i>
</div>
<div style="margin-top:10px; height:150px">
<div style="margin-top:10px; height:170px">
<div id="gridfolders"></div>
<div id="folderspager"></div>
<div id="folderspager" class="small" style="height:22px"></div>
</div>
</div>
</div>

@ -293,9 +293,13 @@ class FileWatch(Analysis):
xo = np.array(ML.Extract(['size','age'],xo_raw))
if len(xo) == 0:
continue
name = re.findall("([a-z,A-Z,0-9]+$)",folder)
if len(name) == 0:
name = re.findall("([a-z,A-Z,0-9]+)",folder)
name = folder.split(os.sep)
if len(name) == 1:
name = [folder]
else:
i = len(name) -1
name = [name[i-1]+' '+name[i]]
name = name[0]
size = round(np.sum(xo[:,0]),2)

@ -80,6 +80,7 @@ class ICollector(Thread) :
row = {}
if label == 'folders':
row = [ dict({"id":self.id}, **_row) for _row in data]
else:
label = id
row = data

Loading…
Cancel
Save