The tags column should be a virtual column
parent
182018786b
commit
23685694ad
|
@ -326,9 +326,9 @@ class Db
|
||||||
output = nil
|
output = nil
|
||||||
default_columns = ::Mdm::Host.column_names.sort
|
default_columns = ::Mdm::Host.column_names.sort
|
||||||
default_columns << 'tags' # Special case
|
default_columns << 'tags' # Special case
|
||||||
virtual_columns = [ 'svcs', 'vulns', 'workspace' ]
|
virtual_columns = [ 'svcs', 'vulns', 'workspace', 'tags' ]
|
||||||
|
|
||||||
col_search = [ 'address', 'mac', 'name', 'os_name', 'os_flavor', 'os_sp', 'purpose', 'info', 'comments', 'tags']
|
col_search = [ 'address', 'mac', 'name', 'os_name', 'os_flavor', 'os_sp', 'purpose', 'info', 'comments']
|
||||||
|
|
||||||
default_columns.delete_if {|v| (v[-2,2] == "id")}
|
default_columns.delete_if {|v| (v[-2,2] == "id")}
|
||||||
while (arg = args.shift)
|
while (arg = args.shift)
|
||||||
|
@ -469,13 +469,13 @@ class Db
|
||||||
when "svcs"; host.services.length
|
when "svcs"; host.services.length
|
||||||
when "vulns"; host.vulns.length
|
when "vulns"; host.vulns.length
|
||||||
when "workspace"; host.workspace.name
|
when "workspace"; host.workspace.name
|
||||||
end
|
when "tags"
|
||||||
# Otherwise, it's just an attribute
|
|
||||||
elsif n == 'tags'
|
|
||||||
found_tags = Mdm::Tag.includes(:hosts).where("hosts.workspace_id = ? and hosts.address = ?", framework.db.workspace.id, host.address).order("tags.id DESC")
|
found_tags = Mdm::Tag.includes(:hosts).where("hosts.workspace_id = ? and hosts.address = ?", framework.db.workspace.id, host.address).order("tags.id DESC")
|
||||||
tag_names = []
|
tag_names = []
|
||||||
found_tags.each {|t| tag_names << t.name}
|
found_tags.each {|t| tag_names << t.name}
|
||||||
found_tags * ", "
|
found_tags * ", "
|
||||||
|
end
|
||||||
|
# Otherwise, it's just an attribute
|
||||||
else
|
else
|
||||||
host.attributes[n] || ""
|
host.attributes[n] || ""
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue