From eb898c5fcecba7323ec0805a86d302642a3b8f29 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 11 Apr 2018 15:48:29 -0400 Subject: [PATCH] 3610 Priority column now displays yes or no for prioritized --- .../AutoIngestDashboardTopComponent.form | 2 +- .../AutoIngestDashboardTopComponent.java | 26 ++--------- .../autoingest/AutoIngestJobsNode.java | 44 ++++++++++--------- .../autoingest/AutoIngestJobsPanel.java | 26 +++++------ .../autoingest/PrioritizationAction.java | 43 +++++++++--------- 5 files changed, 61 insertions(+), 80 deletions(-) diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboardTopComponent.form b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboardTopComponent.form index 63887aceb0..5f3eab1a5f 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboardTopComponent.form +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboardTopComponent.form @@ -25,4 +25,4 @@ - \ No newline at end of file + diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboardTopComponent.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboardTopComponent.java index 6b96c13609..9a5553519c 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboardTopComponent.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboardTopComponent.java @@ -106,32 +106,14 @@ public final class AutoIngestDashboardTopComponent extends TopComponent { } /** - * Get the AutoIngestMonitor from the current AutoIngestDashboard if there - * is one. + * Get the current AutoIngestDashboard if there is one. * - * @return the current AutoIngestMonitor or null if there is no - * AutoIngestDashboard + * @return the current AutoIngestDashboard or null if there is not one */ - AutoIngestMonitor getAutoIngestMonitor() { + AutoIngestDashboard getAutoIngestDashboard() { for (Component comp : getComponents()) { if (comp instanceof AutoIngestDashboard) { - return ((AutoIngestDashboard) comp).getMonitor(); - } - } - 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 (AutoIngestDashboard) comp; } } return null; diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsNode.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsNode.java index ed99ac80fa..0e5e94159c 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsNode.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsNode.java @@ -41,15 +41,15 @@ import org.sleuthkit.autopsy.guiutils.StatusIconCellRenderer; final class AutoIngestJobsNode extends AbstractNode { @Messages({ - "AutoIngestNode.caseName.text=Case Name", - "AutoIngestNode.dataSource.text=Data Source", - "AutoIngestNode.hostName.text=Host Name", - "AutoIngestNode.stage.text=Stage", - "AutoIngestNode.stageTime.text=Time in Stage", - "AutoIngestNode.jobCreated.text=Job Created", - "AutoIngestNode.jobCompleted.text=Job Completed", - "AutoIngestNode.priority.text=Priority", - "AutoIngestNode.status.text=Status" + "AutoIngestJobsNode.caseName.text=Case Name", + "AutoIngestJobsNode.dataSource.text=Data Source", + "AutoIngestJobsNode.hostName.text=Host Name", + "AutoIngestJobsNode.stage.text=Stage", + "AutoIngestJobsNode.stageTime.text=Time in Stage", + "AutoIngestJobsNode.jobCreated.text=Job Created", + "AutoIngestJobsNode.jobCompleted.text=Job Completed", + "AutoIngestJobsNode.priority.text=Prioritized", + "AutoIngestJobsNode.status.text=Status" }) /** @@ -85,6 +85,7 @@ final class AutoIngestJobsNode extends AbstractNode { switch (autoIngestJobStatus) { case PENDING_JOB: jobs = jobsSnapshot.getPendingJobs(); + jobs.sort(new AutoIngestJob.PriorityComparator()); break; case RUNNING_JOB: jobs = jobsSnapshot.getRunningJobs(); @@ -142,6 +143,9 @@ final class AutoIngestJobsNode extends AbstractNode { } @Override + @Messages({"AutoIngestJobsNode.prioritized.true=Yes", + "AutoIngestJobsNode.prioritized.false=No" + }) protected Sheet createSheet() { Sheet s = super.createSheet(); Sheet.Set ss = s.get(Sheet.PROPERTIES); @@ -149,32 +153,32 @@ final class AutoIngestJobsNode extends AbstractNode { ss = Sheet.createPropertiesSet(); 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())); - 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())); switch (jobStatus) { 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())); - ss.put(new NodeProperty<>(Bundle.AutoIngestNode_priority_text(), Bundle.AutoIngestNode_priority_text(), Bundle.AutoIngestNode_priority_text(), - autoIngestJob.getPriority())); + ss.put(new NodeProperty<>(Bundle.AutoIngestJobsNode_priority_text(), Bundle.AutoIngestJobsNode_priority_text(), Bundle.AutoIngestJobsNode_priority_text(), + autoIngestJob.getPriority() > 0 ? Bundle.AutoIngestJobsNode_prioritized_true() : Bundle.AutoIngestJobsNode_prioritized_false())); break; case RUNNING_JOB: 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())); - 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())); - 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())))); break; 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())); - 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())); - 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)); break; default: diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsPanel.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsPanel.java index 5186d8797b..e21d8f569c 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsPanel.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestJobsPanel.java @@ -63,29 +63,27 @@ final class AutoIngestJobsPanel extends javax.swing.JPanel implements ExplorerMa switch (status) { case PENDING_JOB: - outlineView.setPropertyColumns(Bundle.AutoIngestNode_dataSource_text(), Bundle.AutoIngestNode_dataSource_text(), - Bundle.AutoIngestNode_jobCreated_text(), Bundle.AutoIngestNode_jobCreated_text(), - Bundle.AutoIngestNode_priority_text(), Bundle.AutoIngestNode_priority_text()); - outline.setColumnSorted(3, false, 1); - outline.setColumnSorted(0, true, 2); + outlineView.setPropertyColumns(Bundle.AutoIngestJobsNode_dataSource_text(), Bundle.AutoIngestJobsNode_dataSource_text(), + Bundle.AutoIngestJobsNode_jobCreated_text(), Bundle.AutoIngestJobsNode_jobCreated_text(), + Bundle.AutoIngestJobsNode_priority_text(), Bundle.AutoIngestJobsNode_priority_text()); break; case RUNNING_JOB: - outlineView.setPropertyColumns(Bundle.AutoIngestNode_dataSource_text(), Bundle.AutoIngestNode_dataSource_text(), - Bundle.AutoIngestNode_hostName_text(), Bundle.AutoIngestNode_hostName_text(), - Bundle.AutoIngestNode_stage_text(), Bundle.AutoIngestNode_stage_text(), - Bundle.AutoIngestNode_stageTime_text(), Bundle.AutoIngestNode_stageTime_text()); + outlineView.setPropertyColumns(Bundle.AutoIngestJobsNode_dataSource_text(), Bundle.AutoIngestJobsNode_dataSource_text(), + Bundle.AutoIngestJobsNode_hostName_text(), Bundle.AutoIngestJobsNode_hostName_text(), + Bundle.AutoIngestJobsNode_stage_text(), Bundle.AutoIngestJobsNode_stage_text(), + Bundle.AutoIngestJobsNode_stageTime_text(), Bundle.AutoIngestJobsNode_stageTime_text()); outline.setColumnSorted(0, true, 1); break; case COMPLETED_JOB: - outlineView.setPropertyColumns(Bundle.AutoIngestNode_dataSource_text(), Bundle.AutoIngestNode_dataSource_text(), - Bundle.AutoIngestNode_jobCreated_text(), Bundle.AutoIngestNode_jobCreated_text(), - Bundle.AutoIngestNode_jobCompleted_text(), Bundle.AutoIngestNode_jobCompleted_text(), - Bundle.AutoIngestNode_status_text(), Bundle.AutoIngestNode_status_text()); + outlineView.setPropertyColumns(Bundle.AutoIngestJobsNode_dataSource_text(), Bundle.AutoIngestJobsNode_dataSource_text(), + Bundle.AutoIngestJobsNode_jobCreated_text(), Bundle.AutoIngestJobsNode_jobCreated_text(), + Bundle.AutoIngestJobsNode_jobCompleted_text(), Bundle.AutoIngestJobsNode_jobCompleted_text(), + Bundle.AutoIngestJobsNode_status_text(), Bundle.AutoIngestJobsNode_status_text()); outline.setColumnSorted(3, false, 1); break; default: } - ((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel(Bundle.AutoIngestNode_caseName_text()); + ((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel(Bundle.AutoIngestJobsNode_caseName_text()); outline.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); outline.setRootVisible(false); diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/PrioritizationAction.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/PrioritizationAction.java index 14e2fed384..d50a85f906 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/PrioritizationAction.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/PrioritizationAction.java @@ -55,13 +55,11 @@ abstract class PrioritizationAction extends AbstractAction { * * @param monitor - the AutoIngestMonitor which can be accessed to change * the job or case priority - * @param panel - the AutoIngestJobsPanel which will need to be updated - * after the priority is modified * * @throws * 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 @@ -84,23 +82,22 @@ abstract class PrioritizationAction extends AbstractAction { if (job != null) { final AutoIngestDashboardTopComponent tc = (AutoIngestDashboardTopComponent) WindowManager.getDefault().findTopComponent(AutoIngestDashboardTopComponent.PREFERRED_ID); if (tc != null) { - tc.getPendingJobsPanel().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - EventQueue.invokeLater(() -> { - try { - AutoIngestMonitor monitor = tc.getAutoIngestMonitor(); - AutoIngestJobsPanel pendingPanel = tc.getPendingJobsPanel(); - if (monitor != null && pendingPanel != null) { - modifyPriority(monitor, pendingPanel); - pendingPanel.refresh(monitor.getJobsSnapshot()); + AutoIngestDashboard dashboard = tc.getAutoIngestDashboard(); + if (dashboard != null) { + dashboard.getPendingJobsPanel().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + EventQueue.invokeLater(() -> { + try { + modifyPriority(dashboard.getMonitor()); + dashboard.getPendingJobsPanel().refresh(dashboard.getMonitor().getJobsSnapshot()); + } catch (AutoIngestMonitor.AutoIngestMonitorException ex) { + String errorMessage = getErrorMessage(); + logger.log(Level.SEVERE, errorMessage, ex); + MessageNotifyUtil.Message.error(errorMessage); + } finally { + dashboard.getPendingJobsPanel().setCursor(Cursor.getDefaultCursor()); } - } catch (AutoIngestMonitor.AutoIngestMonitorException ex) { - String errorMessage = getErrorMessage(); - logger.log(Level.SEVERE, errorMessage, ex); - MessageNotifyUtil.Message.error(errorMessage); - } finally { - tc.getPendingJobsPanel().setCursor(Cursor.getDefaultCursor()); - } - }); + }); + } } } } @@ -129,7 +126,7 @@ abstract class PrioritizationAction extends AbstractAction { } @Override - protected void modifyPriority(AutoIngestMonitor monitor, AutoIngestJobsPanel panel) throws AutoIngestMonitor.AutoIngestMonitorException { + protected void modifyPriority(AutoIngestMonitor monitor) throws AutoIngestMonitor.AutoIngestMonitorException { monitor.prioritizeJob(getJob()); } @@ -163,7 +160,7 @@ abstract class PrioritizationAction extends AbstractAction { } @Override - protected void modifyPriority(AutoIngestMonitor monitor, AutoIngestJobsPanel panel) throws AutoIngestMonitor.AutoIngestMonitorException { + protected void modifyPriority(AutoIngestMonitor monitor) throws AutoIngestMonitor.AutoIngestMonitorException { monitor.deprioritizeJob(getJob()); } @@ -199,7 +196,7 @@ abstract class PrioritizationAction extends AbstractAction { } @Override - protected void modifyPriority(AutoIngestMonitor monitor, AutoIngestJobsPanel panel) throws AutoIngestMonitor.AutoIngestMonitorException { + protected void modifyPriority(AutoIngestMonitor monitor) throws AutoIngestMonitor.AutoIngestMonitorException { monitor.prioritizeCase(getJob().getManifest().getCaseName()); } @@ -235,7 +232,7 @@ abstract class PrioritizationAction extends AbstractAction { } @Override - protected void modifyPriority(AutoIngestMonitor monitor, AutoIngestJobsPanel panel) throws AutoIngestMonitor.AutoIngestMonitorException { + protected void modifyPriority(AutoIngestMonitor monitor) throws AutoIngestMonitor.AutoIngestMonitorException { monitor.deprioritizeCase(getJob().getManifest().getCaseName()); }