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() d = gReader.read()
if 'folders' in d: if 'folders' in d:
d = d['folders'] d = d['folders']
index = len(d) - 1 hosts = set([row[0]['id'] for row in d])
d = d[index] 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 = {} # m = {}

@ -408,7 +408,7 @@ monitor.folders.search.init = function(){
term = term.replace(/\x32/g,'') term = term.replace(/\x32/g,'')
if (term.length == 0) { if (term.length == 0) {
monitor.folders.render.summary(data) monitor.folders.render.summary(data)
} else if (term.length > 3) { } else if (term.length > 0) {
data = jx.utils.patterns.visitor(data, function (row) { data = jx.utils.patterns.visitor(data, function (row) {
if (row.id.match(term)) { if (row.id.match(term)) {
@ -517,9 +517,9 @@ monitor.folders.render.summary = function (data) {
} }
options.paging = true options.paging = true
options.pageSize = 4 options.pageSize = 4
options.pageIndex = 1 options.pageIndex = 2
options.pageButtonCount = 4 options.pageButtonCount = 4
options.pagerContainer = '#latest_process_pager' options.pagerContainer = '#folderspager'
options.pagerFormat= "{prev} Page {pageIndex} of {pageCount} {next}" options.pagerFormat= "{prev} Page {pageIndex} of {pageCount} {next}"
options.pagePrevText= '<i class="fa fa-chevron-left"></i>' options.pagePrevText= '<i class="fa fa-chevron-left"></i>'
options.pageNextText= "<i class='fa fa-chevron-right small' title='Next'> </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.autoload = true
options.fields = [ options.fields = [
{ name: 'id', type: 'text', title: "Host", headercss: "small bold", css: "small"}, { 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: "size", type: "number", title: "Folder Size", type: "number", headercss: "small bold" },
{ name: "count", type: "number", title: "File Count", 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()"/> <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> <i class="fa fa-trash right action right" style="margin:4px; padding:4px; color:maroon" onclick="monitor.folders.search.reset()"></i>
</div> </div>
<div style="margin-top:10px; height:150px"> <div style="margin-top:10px; height:170px">
<div id="gridfolders"></div> <div id="gridfolders"></div>
<div id="folderspager"></div> <div id="folderspager" class="small" style="height:22px"></div>
</div> </div>
</div> </div>
</div> </div>

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

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

Loading…
Cancel
Save