mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 08:26:15 +00:00
Merge pull request #7294 from kellykelly3/8037-fixed-os-account-content-panel
8037 - OS account panel will not list all hosts
This commit is contained in:
commit
d81e89b402
@ -140,8 +140,12 @@ public class OsAccountDataPanel extends JPanel {
|
|||||||
String key = rowData.getKey();
|
String key = rowData.getKey();
|
||||||
String value = rowData.getValue();
|
String value = rowData.getValue();
|
||||||
|
|
||||||
|
if(value != null) {
|
||||||
addPropertyName(key, rowCnt);
|
addPropertyName(key, rowCnt);
|
||||||
addPropertyValue(value, rowCnt++);
|
addPropertyValue(value, rowCnt++);
|
||||||
|
} else {
|
||||||
|
addLabel(key, rowCnt++);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,6 +244,7 @@ public class OsAccountDataPanel extends JPanel {
|
|||||||
})
|
})
|
||||||
private SectionData buildHostData(Host host, List<OsAccountAttribute> attributeList) {
|
private SectionData buildHostData(Host host, List<OsAccountAttribute> attributeList) {
|
||||||
SectionData data = new SectionData(Bundle.OsAccountDataPanel_host_section_title(host.getName()));
|
SectionData data = new SectionData(Bundle.OsAccountDataPanel_host_section_title(host.getName()));
|
||||||
|
if(attributeList != null) {
|
||||||
for (OsAccountAttribute attribute : attributeList) {
|
for (OsAccountAttribute attribute : attributeList) {
|
||||||
String displayName = attribute.getAttributeType().getDisplayName();
|
String displayName = attribute.getAttributeType().getDisplayName();
|
||||||
String value = attribute.getDisplayString();
|
String value = attribute.getDisplayString();
|
||||||
@ -259,6 +264,9 @@ public class OsAccountDataPanel extends JPanel {
|
|||||||
|
|
||||||
data.addData(displayName, value);
|
data.addData(displayName, value);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
data.addData("No details available", null);
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -287,6 +295,18 @@ public class OsAccountDataPanel extends JPanel {
|
|||||||
add(label, getPropertyNameContraints(row));
|
add(label, getPropertyNameContraints(row));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a simple label to the given row.
|
||||||
|
*
|
||||||
|
* @param text The text to show.
|
||||||
|
* @param row The row in the layout.
|
||||||
|
*/
|
||||||
|
private void addLabel(String text, int row) {
|
||||||
|
JLabel label = new JLabel(text);
|
||||||
|
add(label, getPropertyNameContraints(row));
|
||||||
|
addPropertyValue("", row);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the property value at the given row in the layout.
|
* Add the property value at the given row in the layout.
|
||||||
*
|
*
|
||||||
@ -402,10 +422,9 @@ public class OsAccountDataPanel extends JPanel {
|
|||||||
List<Host> hosts = osAccountManager.getHosts(account);
|
List<Host> hosts = osAccountManager.getHosts(account);
|
||||||
List<OsAccountAttribute> attributeList = account.getExtendedOsAccountAttributes();
|
List<OsAccountAttribute> attributeList = account.getExtendedOsAccountAttributes();
|
||||||
|
|
||||||
if (attributeList != null) {
|
|
||||||
if (hosts != null) {
|
|
||||||
// Organize the attributes by hostId
|
// Organize the attributes by hostId
|
||||||
Map<Long, List<OsAccountAttribute>> idMap = new HashMap<>();
|
Map<Long, List<OsAccountAttribute>> idMap = new HashMap<>();
|
||||||
|
if (attributeList != null) {
|
||||||
for (OsAccountAttribute attribute : attributeList) {
|
for (OsAccountAttribute attribute : attributeList) {
|
||||||
List<OsAccountAttribute> atList = null;
|
List<OsAccountAttribute> atList = null;
|
||||||
Optional<Long> optionalId = attribute.getHostId();
|
Optional<Long> optionalId = attribute.getHostId();
|
||||||
@ -423,15 +442,18 @@ public class OsAccountDataPanel extends JPanel {
|
|||||||
|
|
||||||
atList.add(attribute);
|
atList.add(attribute);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add attribute lists to the hostMap
|
// Add attribute lists to the hostMap
|
||||||
|
if (hosts != null) {
|
||||||
for (Host host : hosts) {
|
for (Host host : hosts) {
|
||||||
List<OsAccountAttribute> atList = idMap.get(host.getHostId());
|
List<OsAccountAttribute> atList = idMap.get(host.getHostId());
|
||||||
if (atList != null) {
|
|
||||||
hostMap.put(host, atList);
|
hostMap.put(host, atList);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
hostMap.put(null, attributeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<OsAccountAttribute> atList = idMap.get(null);
|
List<OsAccountAttribute> atList = idMap.get(null);
|
||||||
if (atList != null) {
|
if (atList != null) {
|
||||||
hostMap.put(null, atList);
|
hostMap.put(null, atList);
|
||||||
@ -443,11 +465,6 @@ public class OsAccountDataPanel extends JPanel {
|
|||||||
instanceMap.put(instance.getDataSource().getHost(), instance.getDataSource());
|
instanceMap.put(instance.getDataSource().getHost(), instance.getDataSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
hostMap.put(null, attributeList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new WorkerResults(hostMap, instanceMap, realm);
|
return new WorkerResults(hostMap, instanceMap, realm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user