3610 Priority column now displays yes or no for prioritized

This commit is contained in:
William Schaefer 2018-04-11 15:48:29 -04:00
parent 85dff9aee4
commit eb898c5fce
5 changed files with 61 additions and 80 deletions

View File

@ -106,32 +106,14 @@ public final class AutoIngestDashboardTopComponent extends TopComponent {
} }
/** /**
* Get the AutoIngestMonitor from the current AutoIngestDashboard if there * Get the current AutoIngestDashboard if there is one.
* is one.
* *
* @return the current AutoIngestMonitor or null if there is no * @return the current AutoIngestDashboard or null if there is not one
* AutoIngestDashboard
*/ */
AutoIngestMonitor getAutoIngestMonitor() { AutoIngestDashboard getAutoIngestDashboard() {
for (Component comp : getComponents()) { for (Component comp : getComponents()) {
if (comp instanceof AutoIngestDashboard) { if (comp instanceof AutoIngestDashboard) {
return ((AutoIngestDashboard) comp).getMonitor(); return (AutoIngestDashboard) comp;
}
}
return null;
}
/**
* Get the pending jobs panel from the current AutoIngestDashboard if there
* is one.
*
* @return the AutoIngestJobsPanel which contains the pending AutoIngestJobs
* or null if there is no AutoIngestDashboard
*/
AutoIngestJobsPanel getPendingJobsPanel() {
for (Component comp : getComponents()) {
if (comp instanceof AutoIngestDashboard) {
return ((AutoIngestDashboard) comp).getPendingJobsPanel();
} }
} }
return null; return null;

View File

@ -41,15 +41,15 @@ import org.sleuthkit.autopsy.guiutils.StatusIconCellRenderer;
final class AutoIngestJobsNode extends AbstractNode { final class AutoIngestJobsNode extends AbstractNode {
@Messages({ @Messages({
"AutoIngestNode.caseName.text=Case Name", "AutoIngestJobsNode.caseName.text=Case Name",
"AutoIngestNode.dataSource.text=Data Source", "AutoIngestJobsNode.dataSource.text=Data Source",
"AutoIngestNode.hostName.text=Host Name", "AutoIngestJobsNode.hostName.text=Host Name",
"AutoIngestNode.stage.text=Stage", "AutoIngestJobsNode.stage.text=Stage",
"AutoIngestNode.stageTime.text=Time in Stage", "AutoIngestJobsNode.stageTime.text=Time in Stage",
"AutoIngestNode.jobCreated.text=Job Created", "AutoIngestJobsNode.jobCreated.text=Job Created",
"AutoIngestNode.jobCompleted.text=Job Completed", "AutoIngestJobsNode.jobCompleted.text=Job Completed",
"AutoIngestNode.priority.text=Priority", "AutoIngestJobsNode.priority.text=Prioritized",
"AutoIngestNode.status.text=Status" "AutoIngestJobsNode.status.text=Status"
}) })
/** /**
@ -85,6 +85,7 @@ final class AutoIngestJobsNode extends AbstractNode {
switch (autoIngestJobStatus) { switch (autoIngestJobStatus) {
case PENDING_JOB: case PENDING_JOB:
jobs = jobsSnapshot.getPendingJobs(); jobs = jobsSnapshot.getPendingJobs();
jobs.sort(new AutoIngestJob.PriorityComparator());
break; break;
case RUNNING_JOB: case RUNNING_JOB:
jobs = jobsSnapshot.getRunningJobs(); jobs = jobsSnapshot.getRunningJobs();
@ -142,6 +143,9 @@ final class AutoIngestJobsNode extends AbstractNode {
} }
@Override @Override
@Messages({"AutoIngestJobsNode.prioritized.true=Yes",
"AutoIngestJobsNode.prioritized.false=No"
})
protected Sheet createSheet() { protected Sheet createSheet() {
Sheet s = super.createSheet(); Sheet s = super.createSheet();
Sheet.Set ss = s.get(Sheet.PROPERTIES); Sheet.Set ss = s.get(Sheet.PROPERTIES);
@ -149,32 +153,32 @@ final class AutoIngestJobsNode extends AbstractNode {
ss = Sheet.createPropertiesSet(); ss = Sheet.createPropertiesSet();
s.put(ss); s.put(ss);
} }
ss.put(new NodeProperty<>(Bundle.AutoIngestNode_caseName_text(), Bundle.AutoIngestNode_caseName_text(), Bundle.AutoIngestNode_caseName_text(), ss.put(new NodeProperty<>(Bundle.AutoIngestJobsNode_caseName_text(), Bundle.AutoIngestJobsNode_caseName_text(), Bundle.AutoIngestJobsNode_caseName_text(),
autoIngestJob.getManifest().getCaseName())); autoIngestJob.getManifest().getCaseName()));
ss.put(new NodeProperty<>(Bundle.AutoIngestNode_dataSource_text(), Bundle.AutoIngestNode_dataSource_text(), Bundle.AutoIngestNode_dataSource_text(), ss.put(new NodeProperty<>(Bundle.AutoIngestJobsNode_dataSource_text(), Bundle.AutoIngestJobsNode_dataSource_text(), Bundle.AutoIngestJobsNode_dataSource_text(),
autoIngestJob.getManifest().getDataSourcePath().getFileName().toString())); autoIngestJob.getManifest().getDataSourcePath().getFileName().toString()));
switch (jobStatus) { switch (jobStatus) {
case PENDING_JOB: case PENDING_JOB:
ss.put(new NodeProperty<>(Bundle.AutoIngestNode_jobCreated_text(), Bundle.AutoIngestNode_jobCreated_text(), Bundle.AutoIngestNode_jobCreated_text(), ss.put(new NodeProperty<>(Bundle.AutoIngestJobsNode_jobCreated_text(), Bundle.AutoIngestJobsNode_jobCreated_text(), Bundle.AutoIngestJobsNode_jobCreated_text(),
autoIngestJob.getManifest().getDateFileCreated())); autoIngestJob.getManifest().getDateFileCreated()));
ss.put(new NodeProperty<>(Bundle.AutoIngestNode_priority_text(), Bundle.AutoIngestNode_priority_text(), Bundle.AutoIngestNode_priority_text(), ss.put(new NodeProperty<>(Bundle.AutoIngestJobsNode_priority_text(), Bundle.AutoIngestJobsNode_priority_text(), Bundle.AutoIngestJobsNode_priority_text(),
autoIngestJob.getPriority())); autoIngestJob.getPriority() > 0 ? Bundle.AutoIngestJobsNode_prioritized_true() : Bundle.AutoIngestJobsNode_prioritized_false()));
break; break;
case RUNNING_JOB: case RUNNING_JOB:
AutoIngestJob.StageDetails status = autoIngestJob.getProcessingStageDetails(); AutoIngestJob.StageDetails status = autoIngestJob.getProcessingStageDetails();
ss.put(new NodeProperty<>(Bundle.AutoIngestNode_hostName_text(), Bundle.AutoIngestNode_hostName_text(), Bundle.AutoIngestNode_hostName_text(), ss.put(new NodeProperty<>(Bundle.AutoIngestJobsNode_hostName_text(), Bundle.AutoIngestJobsNode_hostName_text(), Bundle.AutoIngestJobsNode_hostName_text(),
autoIngestJob.getProcessingHostName())); autoIngestJob.getProcessingHostName()));
ss.put(new NodeProperty<>(Bundle.AutoIngestNode_stage_text(), Bundle.AutoIngestNode_stage_text(), Bundle.AutoIngestNode_stage_text(), ss.put(new NodeProperty<>(Bundle.AutoIngestJobsNode_stage_text(), Bundle.AutoIngestJobsNode_stage_text(), Bundle.AutoIngestJobsNode_stage_text(),
status.getDescription())); status.getDescription()));
ss.put(new NodeProperty<>(Bundle.AutoIngestNode_stageTime_text(), Bundle.AutoIngestNode_stageTime_text(), Bundle.AutoIngestNode_stageTime_text(), ss.put(new NodeProperty<>(Bundle.AutoIngestJobsNode_stageTime_text(), Bundle.AutoIngestJobsNode_stageTime_text(), Bundle.AutoIngestJobsNode_stageTime_text(),
DurationCellRenderer.longToDurationString((Date.from(Instant.now()).getTime()) - (status.getStartDate().getTime())))); DurationCellRenderer.longToDurationString((Date.from(Instant.now()).getTime()) - (status.getStartDate().getTime()))));
break; break;
case COMPLETED_JOB: case COMPLETED_JOB:
ss.put(new NodeProperty<>(Bundle.AutoIngestNode_jobCreated_text(), Bundle.AutoIngestNode_jobCreated_text(), Bundle.AutoIngestNode_jobCreated_text(), ss.put(new NodeProperty<>(Bundle.AutoIngestJobsNode_jobCreated_text(), Bundle.AutoIngestJobsNode_jobCreated_text(), Bundle.AutoIngestJobsNode_jobCreated_text(),
autoIngestJob.getManifest().getDateFileCreated())); autoIngestJob.getManifest().getDateFileCreated()));
ss.put(new NodeProperty<>(Bundle.AutoIngestNode_jobCompleted_text(), Bundle.AutoIngestNode_jobCompleted_text(), Bundle.AutoIngestNode_jobCompleted_text(), ss.put(new NodeProperty<>(Bundle.AutoIngestJobsNode_jobCompleted_text(), Bundle.AutoIngestJobsNode_jobCompleted_text(), Bundle.AutoIngestJobsNode_jobCompleted_text(),
autoIngestJob.getCompletedDate())); autoIngestJob.getCompletedDate()));
ss.put(new NodeProperty<>(Bundle.AutoIngestNode_status_text(), Bundle.AutoIngestNode_status_text(), Bundle.AutoIngestNode_status_text(), ss.put(new NodeProperty<>(Bundle.AutoIngestJobsNode_status_text(), Bundle.AutoIngestJobsNode_status_text(), Bundle.AutoIngestJobsNode_status_text(),
autoIngestJob.getErrorsOccurred() ? StatusIconCellRenderer.Status.WARNING : StatusIconCellRenderer.Status.OK)); autoIngestJob.getErrorsOccurred() ? StatusIconCellRenderer.Status.WARNING : StatusIconCellRenderer.Status.OK));
break; break;
default: default:

View File

@ -63,29 +63,27 @@ final class AutoIngestJobsPanel extends javax.swing.JPanel implements ExplorerMa
switch (status) { switch (status) {
case PENDING_JOB: case PENDING_JOB:
outlineView.setPropertyColumns(Bundle.AutoIngestNode_dataSource_text(), Bundle.AutoIngestNode_dataSource_text(), outlineView.setPropertyColumns(Bundle.AutoIngestJobsNode_dataSource_text(), Bundle.AutoIngestJobsNode_dataSource_text(),
Bundle.AutoIngestNode_jobCreated_text(), Bundle.AutoIngestNode_jobCreated_text(), Bundle.AutoIngestJobsNode_jobCreated_text(), Bundle.AutoIngestJobsNode_jobCreated_text(),
Bundle.AutoIngestNode_priority_text(), Bundle.AutoIngestNode_priority_text()); Bundle.AutoIngestJobsNode_priority_text(), Bundle.AutoIngestJobsNode_priority_text());
outline.setColumnSorted(3, false, 1);
outline.setColumnSorted(0, true, 2);
break; break;
case RUNNING_JOB: case RUNNING_JOB:
outlineView.setPropertyColumns(Bundle.AutoIngestNode_dataSource_text(), Bundle.AutoIngestNode_dataSource_text(), outlineView.setPropertyColumns(Bundle.AutoIngestJobsNode_dataSource_text(), Bundle.AutoIngestJobsNode_dataSource_text(),
Bundle.AutoIngestNode_hostName_text(), Bundle.AutoIngestNode_hostName_text(), Bundle.AutoIngestJobsNode_hostName_text(), Bundle.AutoIngestJobsNode_hostName_text(),
Bundle.AutoIngestNode_stage_text(), Bundle.AutoIngestNode_stage_text(), Bundle.AutoIngestJobsNode_stage_text(), Bundle.AutoIngestJobsNode_stage_text(),
Bundle.AutoIngestNode_stageTime_text(), Bundle.AutoIngestNode_stageTime_text()); Bundle.AutoIngestJobsNode_stageTime_text(), Bundle.AutoIngestJobsNode_stageTime_text());
outline.setColumnSorted(0, true, 1); outline.setColumnSorted(0, true, 1);
break; break;
case COMPLETED_JOB: case COMPLETED_JOB:
outlineView.setPropertyColumns(Bundle.AutoIngestNode_dataSource_text(), Bundle.AutoIngestNode_dataSource_text(), outlineView.setPropertyColumns(Bundle.AutoIngestJobsNode_dataSource_text(), Bundle.AutoIngestJobsNode_dataSource_text(),
Bundle.AutoIngestNode_jobCreated_text(), Bundle.AutoIngestNode_jobCreated_text(), Bundle.AutoIngestJobsNode_jobCreated_text(), Bundle.AutoIngestJobsNode_jobCreated_text(),
Bundle.AutoIngestNode_jobCompleted_text(), Bundle.AutoIngestNode_jobCompleted_text(), Bundle.AutoIngestJobsNode_jobCompleted_text(), Bundle.AutoIngestJobsNode_jobCompleted_text(),
Bundle.AutoIngestNode_status_text(), Bundle.AutoIngestNode_status_text()); Bundle.AutoIngestJobsNode_status_text(), Bundle.AutoIngestJobsNode_status_text());
outline.setColumnSorted(3, false, 1); outline.setColumnSorted(3, false, 1);
break; break;
default: default:
} }
((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel(Bundle.AutoIngestNode_caseName_text()); ((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel(Bundle.AutoIngestJobsNode_caseName_text());
outline.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); outline.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
outline.setRootVisible(false); outline.setRootVisible(false);

View File

@ -55,13 +55,11 @@ abstract class PrioritizationAction extends AbstractAction {
* *
* @param monitor - the AutoIngestMonitor which can be accessed to change * @param monitor - the AutoIngestMonitor which can be accessed to change
* the job or case priority * the job or case priority
* @param panel - the AutoIngestJobsPanel which will need to be updated
* after the priority is modified
* *
* @throws * @throws
* org.sleuthkit.autopsy.experimental.autoingest.AutoIngestMonitor.AutoIngestMonitorException * org.sleuthkit.autopsy.experimental.autoingest.AutoIngestMonitor.AutoIngestMonitorException
*/ */
protected abstract void modifyPriority(AutoIngestMonitor monitor, AutoIngestJobsPanel panel) throws AutoIngestMonitor.AutoIngestMonitorException; protected abstract void modifyPriority(AutoIngestMonitor monitor) throws AutoIngestMonitor.AutoIngestMonitorException;
/** /**
* Get the implementation specific error message for if modifyPriority fails * Get the implementation specific error message for if modifyPriority fails
@ -84,26 +82,25 @@ abstract class PrioritizationAction extends AbstractAction {
if (job != null) { if (job != null) {
final AutoIngestDashboardTopComponent tc = (AutoIngestDashboardTopComponent) WindowManager.getDefault().findTopComponent(AutoIngestDashboardTopComponent.PREFERRED_ID); final AutoIngestDashboardTopComponent tc = (AutoIngestDashboardTopComponent) WindowManager.getDefault().findTopComponent(AutoIngestDashboardTopComponent.PREFERRED_ID);
if (tc != null) { if (tc != null) {
tc.getPendingJobsPanel().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); AutoIngestDashboard dashboard = tc.getAutoIngestDashboard();
if (dashboard != null) {
dashboard.getPendingJobsPanel().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
EventQueue.invokeLater(() -> { EventQueue.invokeLater(() -> {
try { try {
AutoIngestMonitor monitor = tc.getAutoIngestMonitor(); modifyPriority(dashboard.getMonitor());
AutoIngestJobsPanel pendingPanel = tc.getPendingJobsPanel(); dashboard.getPendingJobsPanel().refresh(dashboard.getMonitor().getJobsSnapshot());
if (monitor != null && pendingPanel != null) {
modifyPriority(monitor, pendingPanel);
pendingPanel.refresh(monitor.getJobsSnapshot());
}
} catch (AutoIngestMonitor.AutoIngestMonitorException ex) { } catch (AutoIngestMonitor.AutoIngestMonitorException ex) {
String errorMessage = getErrorMessage(); String errorMessage = getErrorMessage();
logger.log(Level.SEVERE, errorMessage, ex); logger.log(Level.SEVERE, errorMessage, ex);
MessageNotifyUtil.Message.error(errorMessage); MessageNotifyUtil.Message.error(errorMessage);
} finally { } finally {
tc.getPendingJobsPanel().setCursor(Cursor.getDefaultCursor()); dashboard.getPendingJobsPanel().setCursor(Cursor.getDefaultCursor());
} }
}); });
} }
} }
} }
}
@Override @Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
@ -129,7 +126,7 @@ abstract class PrioritizationAction extends AbstractAction {
} }
@Override @Override
protected void modifyPriority(AutoIngestMonitor monitor, AutoIngestJobsPanel panel) throws AutoIngestMonitor.AutoIngestMonitorException { protected void modifyPriority(AutoIngestMonitor monitor) throws AutoIngestMonitor.AutoIngestMonitorException {
monitor.prioritizeJob(getJob()); monitor.prioritizeJob(getJob());
} }
@ -163,7 +160,7 @@ abstract class PrioritizationAction extends AbstractAction {
} }
@Override @Override
protected void modifyPriority(AutoIngestMonitor monitor, AutoIngestJobsPanel panel) throws AutoIngestMonitor.AutoIngestMonitorException { protected void modifyPriority(AutoIngestMonitor monitor) throws AutoIngestMonitor.AutoIngestMonitorException {
monitor.deprioritizeJob(getJob()); monitor.deprioritizeJob(getJob());
} }
@ -199,7 +196,7 @@ abstract class PrioritizationAction extends AbstractAction {
} }
@Override @Override
protected void modifyPriority(AutoIngestMonitor monitor, AutoIngestJobsPanel panel) throws AutoIngestMonitor.AutoIngestMonitorException { protected void modifyPriority(AutoIngestMonitor monitor) throws AutoIngestMonitor.AutoIngestMonitorException {
monitor.prioritizeCase(getJob().getManifest().getCaseName()); monitor.prioritizeCase(getJob().getManifest().getCaseName());
} }
@ -235,7 +232,7 @@ abstract class PrioritizationAction extends AbstractAction {
} }
@Override @Override
protected void modifyPriority(AutoIngestMonitor monitor, AutoIngestJobsPanel panel) throws AutoIngestMonitor.AutoIngestMonitorException { protected void modifyPriority(AutoIngestMonitor monitor) throws AutoIngestMonitor.AutoIngestMonitorException {
monitor.deprioritizeCase(getJob().getManifest().getCaseName()); monitor.deprioritizeCase(getJob().getManifest().getCaseName());
} }