mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
3610 add context menu options for priority changing to AID2.0
This commit is contained in:
parent
14d271bb28
commit
34ee030bd8
@ -37,8 +37,6 @@ import org.openide.util.NbBundle;
|
|||||||
import org.openide.util.NbBundle.Messages;
|
import org.openide.util.NbBundle.Messages;
|
||||||
import org.sleuthkit.autopsy.core.ServicesMonitor;
|
import org.sleuthkit.autopsy.core.ServicesMonitor;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
|
||||||
import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestMonitor.JobsSnapshot;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A dashboard for monitoring an automated ingest cluster.
|
* A dashboard for monitoring an automated ingest cluster.
|
||||||
@ -90,7 +88,7 @@ final class AutoIngestDashboard extends JPanel implements Observer {
|
|||||||
statusByService.put(ServicesMonitor.Service.REMOTE_KEYWORD_SEARCH.toString(), NbBundle.getMessage(AutoIngestDashboard.class, "AutoIngestDashboard.tbServicesStatusMessage.Message.Down"));
|
statusByService.put(ServicesMonitor.Service.REMOTE_KEYWORD_SEARCH.toString(), NbBundle.getMessage(AutoIngestDashboard.class, "AutoIngestDashboard.tbServicesStatusMessage.Message.Down"));
|
||||||
statusByService.put(ServicesMonitor.Service.MESSAGING.toString(), NbBundle.getMessage(AutoIngestDashboard.class, "AutoIngestDashboard.tbServicesStatusMessage.Message.Down"));
|
statusByService.put(ServicesMonitor.Service.MESSAGING.toString(), NbBundle.getMessage(AutoIngestDashboard.class, "AutoIngestDashboard.tbServicesStatusMessage.Message.Down"));
|
||||||
setServicesStatusMessage();
|
setServicesStatusMessage();
|
||||||
pendingJobsPanel = new AutoIngestJobsPanel(AutoIngestJobsNode.AutoIngestJobType.PENDING_JOB);
|
pendingJobsPanel = new AutoIngestJobsPanel(AutoIngestJobsNode.AutoIngestJobStatus.PENDING_JOB);
|
||||||
pendingJobsPanel.setSize(pendingScrollPane.getSize());
|
pendingJobsPanel.setSize(pendingScrollPane.getSize());
|
||||||
pendingScrollPane.add(pendingJobsPanel);
|
pendingScrollPane.add(pendingJobsPanel);
|
||||||
pendingScrollPane.setViewportView(pendingJobsPanel);
|
pendingScrollPane.setViewportView(pendingJobsPanel);
|
||||||
@ -111,8 +109,8 @@ final class AutoIngestDashboard extends JPanel implements Observer {
|
|||||||
this.deprioritizeJobButton.setEnabled(enableDeprioritizeButtons);
|
this.deprioritizeJobButton.setEnabled(enableDeprioritizeButtons);
|
||||||
this.deprioritizeCaseButton.setEnabled(enableDeprioritizeButtons);
|
this.deprioritizeCaseButton.setEnabled(enableDeprioritizeButtons);
|
||||||
});
|
});
|
||||||
pendingJobsPanel.setToolTipText(Bundle.AutoIngestDashboard_pendingTable.toolTipText());
|
pendingJobsPanel.setToolTipText(Bundle.AutoIngestDashboard_pendingTable_toolTipText());
|
||||||
runningJobsPanel = new AutoIngestJobsPanel(AutoIngestJobsNode.AutoIngestJobType.RUNNING_JOB);
|
runningJobsPanel = new AutoIngestJobsPanel(AutoIngestJobsNode.AutoIngestJobStatus.RUNNING_JOB);
|
||||||
runningJobsPanel.setSize(runningScrollPane.getSize());
|
runningJobsPanel.setSize(runningScrollPane.getSize());
|
||||||
runningScrollPane.add(runningJobsPanel);
|
runningScrollPane.add(runningJobsPanel);
|
||||||
runningScrollPane.setViewportView(runningJobsPanel);
|
runningScrollPane.setViewportView(runningJobsPanel);
|
||||||
@ -123,8 +121,8 @@ final class AutoIngestDashboard extends JPanel implements Observer {
|
|||||||
this.deprioritizeJobButton.setEnabled(enabled);
|
this.deprioritizeJobButton.setEnabled(enabled);
|
||||||
this.deprioritizeCaseButton.setEnabled(enabled);
|
this.deprioritizeCaseButton.setEnabled(enabled);
|
||||||
});
|
});
|
||||||
runningJobsPanel.setToolTipText(Bundle.AutoIngestDashboard_runningTable.toolTipText());
|
runningJobsPanel.setToolTipText(Bundle.AutoIngestDashboard_runningTable_toolTipText());
|
||||||
completedJobsPanel = new AutoIngestJobsPanel(AutoIngestJobsNode.AutoIngestJobType.COMPLETED_JOB);
|
completedJobsPanel = new AutoIngestJobsPanel(AutoIngestJobsNode.AutoIngestJobStatus.COMPLETED_JOB);
|
||||||
completedJobsPanel.setSize(completedScrollPane.getSize());
|
completedJobsPanel.setSize(completedScrollPane.getSize());
|
||||||
completedScrollPane.add(completedJobsPanel);
|
completedScrollPane.add(completedJobsPanel);
|
||||||
completedScrollPane.setViewportView(completedJobsPanel);
|
completedScrollPane.setViewportView(completedJobsPanel);
|
||||||
@ -135,7 +133,7 @@ final class AutoIngestDashboard extends JPanel implements Observer {
|
|||||||
this.deprioritizeJobButton.setEnabled(enabled);
|
this.deprioritizeJobButton.setEnabled(enabled);
|
||||||
this.deprioritizeCaseButton.setEnabled(enabled);
|
this.deprioritizeCaseButton.setEnabled(enabled);
|
||||||
});
|
});
|
||||||
completedJobsPanel.setToolTipText(Bundle.AutoIngestDashboard_completedTable.toolTipText());
|
completedJobsPanel.setToolTipText(Bundle.AutoIngestDashboard_completedTable_toolTipText());
|
||||||
/*
|
/*
|
||||||
* Must set this flag, otherwise pop up menus don't close properly.
|
* Must set this flag, otherwise pop up menus don't close properly.
|
||||||
*/
|
*/
|
||||||
@ -143,6 +141,14 @@ final class AutoIngestDashboard extends JPanel implements Observer {
|
|||||||
UIManager.put("PopupMenu.consumeEventOnClose", false);
|
UIManager.put("PopupMenu.consumeEventOnClose", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AutoIngestMonitor getMonitor() {
|
||||||
|
return autoIngestMonitor;
|
||||||
|
}
|
||||||
|
|
||||||
|
AutoIngestJobsPanel getPendingJobsPanel() {
|
||||||
|
return pendingJobsPanel;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update status of the services on the dashboard
|
* Update status of the services on the dashboard
|
||||||
*/
|
*/
|
||||||
@ -253,7 +259,9 @@ final class AutoIngestDashboard extends JPanel implements Observer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Observable observable, Object arg) {
|
public void update(Observable observable, Object arg) {
|
||||||
EventQueue.invokeLater(new RefreshComponentsTask((JobsSnapshot) arg));
|
EventQueue.invokeLater(() -> {
|
||||||
|
refreshTables();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -262,10 +270,10 @@ final class AutoIngestDashboard extends JPanel implements Observer {
|
|||||||
*
|
*
|
||||||
* @param jobsSnapshot The jobs snapshot.
|
* @param jobsSnapshot The jobs snapshot.
|
||||||
*/
|
*/
|
||||||
private void refreshTables(JobsSnapshot jobsSnapshot) {
|
private void refreshTables() {
|
||||||
pendingJobsPanel.refresh(jobsSnapshot);
|
pendingJobsPanel.refresh(autoIngestMonitor);
|
||||||
runningJobsPanel.refresh(jobsSnapshot);
|
runningJobsPanel.refresh(autoIngestMonitor);
|
||||||
completedJobsPanel.refresh(jobsSnapshot);
|
completedJobsPanel.refresh(autoIngestMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -473,46 +481,13 @@ final class AutoIngestDashboard extends JPanel implements Observer {
|
|||||||
*/
|
*/
|
||||||
private void refreshButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshButtonActionPerformed
|
private void refreshButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshButtonActionPerformed
|
||||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||||
JobsSnapshot jobsSnapshot = autoIngestMonitor.refreshJobsSnapshot();
|
refreshTables();
|
||||||
refreshTables(jobsSnapshot);
|
|
||||||
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
|
||||||
}//GEN-LAST:event_refreshButtonActionPerformed
|
}//GEN-LAST:event_refreshButtonActionPerformed
|
||||||
|
|
||||||
@Messages({"AutoIngestDashboard.errorMessage.jobPrioritization=Failed to prioritize job \"%s\"."})
|
|
||||||
private void prioritizeJobButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prioritizeJobButtonActionPerformed
|
|
||||||
AutoIngestJob job = pendingJobsPanel.getSelectedAutoIngestJob();
|
|
||||||
if (job != null) {
|
|
||||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
|
||||||
JobsSnapshot jobsSnapshot;
|
|
||||||
try {
|
|
||||||
jobsSnapshot = autoIngestMonitor.prioritizeJob(job);
|
|
||||||
refreshTables(jobsSnapshot);
|
|
||||||
} catch (AutoIngestMonitor.AutoIngestMonitorException ex) {
|
|
||||||
String errorMessage = String.format(Bundle.AutoIngestDashboard_errorMessage_jobPrioritization(), job.getManifest().getFilePath());
|
|
||||||
LOGGER.log(Level.SEVERE, errorMessage, ex);
|
|
||||||
MessageNotifyUtil.Message.error(errorMessage);
|
|
||||||
}
|
|
||||||
setCursor(Cursor.getDefaultCursor());
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_prioritizeJobButtonActionPerformed
|
|
||||||
|
|
||||||
@Messages({"AutoIngestDashboard.errorMessage.casePrioritization=Failed to prioritize case \"%s\"."})
|
@Messages({"AutoIngestDashboard.errorMessage.casePrioritization=Failed to prioritize case \"%s\"."})
|
||||||
private void prioritizeCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prioritizeCaseButtonActionPerformed
|
private void prioritizeCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prioritizeCaseButtonActionPerformed
|
||||||
AutoIngestJob job = pendingJobsPanel.getSelectedAutoIngestJob();
|
new PrioritizationAction.PrioritizeCaseAction(pendingJobsPanel.getSelectedAutoIngestJob()).actionPerformed(evt);
|
||||||
if (job != null) {
|
|
||||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
|
||||||
String caseName = job.getManifest().getCaseName();
|
|
||||||
JobsSnapshot jobsSnapshot;
|
|
||||||
try {
|
|
||||||
jobsSnapshot = autoIngestMonitor.prioritizeCase(caseName);
|
|
||||||
refreshTables(jobsSnapshot);
|
|
||||||
} catch (AutoIngestMonitor.AutoIngestMonitorException ex) {
|
|
||||||
String errorMessage = String.format(Bundle.AutoIngestDashboard_errorMessage_casePrioritization(), caseName);
|
|
||||||
LOGGER.log(Level.SEVERE, errorMessage, ex);
|
|
||||||
MessageNotifyUtil.Message.error(errorMessage);
|
|
||||||
}
|
|
||||||
setCursor(Cursor.getDefaultCursor());
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_prioritizeCaseButtonActionPerformed
|
}//GEN-LAST:event_prioritizeCaseButtonActionPerformed
|
||||||
|
|
||||||
private void clusterMetricsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clusterMetricsButtonActionPerformed
|
private void clusterMetricsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clusterMetricsButtonActionPerformed
|
||||||
@ -521,41 +496,19 @@ final class AutoIngestDashboard extends JPanel implements Observer {
|
|||||||
|
|
||||||
@Messages({"AutoIngestDashboard.errorMessage.jobDeprioritization=Failed to deprioritize job \"%s\"."})
|
@Messages({"AutoIngestDashboard.errorMessage.jobDeprioritization=Failed to deprioritize job \"%s\"."})
|
||||||
private void deprioritizeJobButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deprioritizeJobButtonActionPerformed
|
private void deprioritizeJobButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deprioritizeJobButtonActionPerformed
|
||||||
AutoIngestJob job = pendingJobsPanel.getSelectedAutoIngestJob();
|
new PrioritizationAction.DeprioritizeJobAction(pendingJobsPanel.getSelectedAutoIngestJob()).actionPerformed(evt);
|
||||||
if (job != null) {
|
|
||||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
|
||||||
JobsSnapshot jobsSnapshot;
|
|
||||||
try {
|
|
||||||
jobsSnapshot = autoIngestMonitor.deprioritizeJob(job);
|
|
||||||
refreshTables(jobsSnapshot);
|
|
||||||
} catch (AutoIngestMonitor.AutoIngestMonitorException ex) {
|
|
||||||
String errorMessage = String.format(Bundle.AutoIngestDashboard_errorMessage_jobDeprioritization(), job.getManifest().getFilePath());
|
|
||||||
LOGGER.log(Level.SEVERE, errorMessage, ex);
|
|
||||||
MessageNotifyUtil.Message.error(errorMessage);
|
|
||||||
}
|
|
||||||
setCursor(Cursor.getDefaultCursor());
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_deprioritizeJobButtonActionPerformed
|
}//GEN-LAST:event_deprioritizeJobButtonActionPerformed
|
||||||
|
|
||||||
@Messages({"AutoIngestDashboard.errorMessage.caseDeprioritization=Failed to deprioritize case \"%s\"."})
|
@Messages({"AutoIngestDashboard.errorMessage.caseDeprioritization=Failed to deprioritize case \"%s\"."})
|
||||||
private void deprioritizeCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deprioritizeCaseButtonActionPerformed
|
private void deprioritizeCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deprioritizeCaseButtonActionPerformed
|
||||||
AutoIngestJob job = pendingJobsPanel.getSelectedAutoIngestJob();
|
new PrioritizationAction.DeprioritizeCaseAction(pendingJobsPanel.getSelectedAutoIngestJob()).actionPerformed(evt);
|
||||||
if (job != null) {
|
|
||||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
|
||||||
String caseName = job.getManifest().getCaseName();
|
|
||||||
JobsSnapshot jobsSnapshot;
|
|
||||||
try {
|
|
||||||
jobsSnapshot = autoIngestMonitor.deprioritizeCase(caseName);
|
|
||||||
refreshTables(jobsSnapshot);
|
|
||||||
} catch (AutoIngestMonitor.AutoIngestMonitorException ex) {
|
|
||||||
String errorMessage = String.format(Bundle.AutoIngestDashboard_errorMessage_caseDeprioritization(), caseName);
|
|
||||||
LOGGER.log(Level.SEVERE, errorMessage, ex);
|
|
||||||
MessageNotifyUtil.Message.error(errorMessage);
|
|
||||||
}
|
|
||||||
setCursor(Cursor.getDefaultCursor());
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_deprioritizeCaseButtonActionPerformed
|
}//GEN-LAST:event_deprioritizeCaseButtonActionPerformed
|
||||||
|
|
||||||
|
@Messages({"AutoIngestDashboard.errorMessage.jobPrioritization=Failed to prioritize job \"%s\"."})
|
||||||
|
private void prioritizeJobButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prioritizeJobButtonActionPerformed
|
||||||
|
new PrioritizationAction.PrioritizeJobAction(pendingJobsPanel.getSelectedAutoIngestJob()).actionPerformed(evt);
|
||||||
|
}//GEN-LAST:event_prioritizeJobButtonActionPerformed
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JButton clusterMetricsButton;
|
private javax.swing.JButton clusterMetricsButton;
|
||||||
private javax.swing.JScrollPane completedScrollPane;
|
private javax.swing.JScrollPane completedScrollPane;
|
||||||
@ -573,29 +526,4 @@ final class AutoIngestDashboard extends JPanel implements Observer {
|
|||||||
private javax.swing.JScrollPane runningScrollPane;
|
private javax.swing.JScrollPane runningScrollPane;
|
||||||
private javax.swing.JTextField tbServicesStatusMessage;
|
private javax.swing.JTextField tbServicesStatusMessage;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
/**
|
|
||||||
* A task that refreshes the UI components on this panel to reflect a
|
|
||||||
* snapshot of the pending, running and completed auto ingest jobs lists of
|
|
||||||
* an auto ingest cluster.
|
|
||||||
*/
|
|
||||||
private class RefreshComponentsTask implements Runnable {
|
|
||||||
|
|
||||||
private final JobsSnapshot jobsSnapshot;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a task that refreshes the UI components on this panel to
|
|
||||||
* reflect a snapshot of the pending, running and completed auto ingest
|
|
||||||
* jobs lists of an auto ingest cluster.
|
|
||||||
*
|
|
||||||
* @param jobsSnapshot The jobs snapshot.
|
|
||||||
*/
|
|
||||||
RefreshComponentsTask(JobsSnapshot jobsSnapshot) {
|
|
||||||
this.jobsSnapshot = jobsSnapshot;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
refreshTables(jobsSnapshot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.experimental.autoingest;
|
package org.sleuthkit.autopsy.experimental.autoingest;
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -104,6 +105,24 @@ public final class AutoIngestDashboardTopComponent extends TopComponent {
|
|||||||
setName(Bundle.CTL_AutoIngestDashboardTopComponent());
|
setName(Bundle.CTL_AutoIngestDashboardTopComponent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AutoIngestMonitor getAutoIngestMonitor() {
|
||||||
|
for (Component comp : getComponents()) {
|
||||||
|
if (comp instanceof AutoIngestDashboard) {
|
||||||
|
return ((AutoIngestDashboard) comp).getMonitor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
AutoIngestJobsPanel getPendingJobsPanel() {
|
||||||
|
for (Component comp : getComponents()) {
|
||||||
|
if (comp instanceof AutoIngestDashboard) {
|
||||||
|
return ((AutoIngestDashboard) comp).getPendingJobsPanel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Mode> availableModes(List<Mode> modes) {
|
public List<Mode> availableModes(List<Mode> modes) {
|
||||||
/*
|
/*
|
||||||
|
@ -18,6 +18,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.experimental.autoingest;
|
package org.sleuthkit.autopsy.experimental.autoingest;
|
||||||
|
|
||||||
|
import java.awt.Cursor;
|
||||||
|
import java.awt.EventQueue;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import javax.swing.AbstractAction;
|
||||||
|
import javax.swing.Action;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -28,8 +33,9 @@ import org.openide.nodes.Children;
|
|||||||
import org.openide.nodes.Node;
|
import org.openide.nodes.Node;
|
||||||
import org.openide.nodes.Sheet;
|
import org.openide.nodes.Sheet;
|
||||||
import org.openide.util.NbBundle.Messages;
|
import org.openide.util.NbBundle.Messages;
|
||||||
|
import org.openide.windows.WindowManager;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||||
import org.sleuthkit.autopsy.datamodel.NodeProperty;
|
import org.sleuthkit.autopsy.datamodel.NodeProperty;
|
||||||
import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestMonitor.JobsSnapshot;
|
|
||||||
import org.sleuthkit.autopsy.guiutils.DurationCellRenderer;
|
import org.sleuthkit.autopsy.guiutils.DurationCellRenderer;
|
||||||
import org.sleuthkit.autopsy.guiutils.StatusIconCellRenderer;
|
import org.sleuthkit.autopsy.guiutils.StatusIconCellRenderer;
|
||||||
|
|
||||||
@ -54,8 +60,8 @@ final class AutoIngestJobsNode extends AbstractNode {
|
|||||||
/**
|
/**
|
||||||
* Construct a new AutoIngestJobsNode.
|
* Construct a new AutoIngestJobsNode.
|
||||||
*/
|
*/
|
||||||
AutoIngestJobsNode(JobsSnapshot snapshot, AutoIngestJobStatus status) {
|
AutoIngestJobsNode(AutoIngestMonitor autoIngestMonitor, AutoIngestJobStatus status) {
|
||||||
super(Children.create(new AutoIngestNodeChildren(snapshot, status), false));
|
super(Children.create(new AutoIngestNodeChildren(autoIngestMonitor, status), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,7 +70,7 @@ final class AutoIngestJobsNode extends AbstractNode {
|
|||||||
static class AutoIngestNodeChildren extends ChildFactory<AutoIngestJob> {
|
static class AutoIngestNodeChildren extends ChildFactory<AutoIngestJob> {
|
||||||
|
|
||||||
private final AutoIngestJobStatus autoIngestJobStatus;
|
private final AutoIngestJobStatus autoIngestJobStatus;
|
||||||
private final JobsSnapshot jobsSnapshot;
|
private final AutoIngestMonitor autoIngestMonitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create children nodes for the AutoIngestJobsNode which will each
|
* Create children nodes for the AutoIngestJobsNode which will each
|
||||||
@ -73,8 +79,8 @@ final class AutoIngestJobsNode extends AbstractNode {
|
|||||||
* @param snapshot the snapshot which contains the AutoIngestJobs
|
* @param snapshot the snapshot which contains the AutoIngestJobs
|
||||||
* @param status the status of the jobs being displayed
|
* @param status the status of the jobs being displayed
|
||||||
*/
|
*/
|
||||||
AutoIngestNodeChildren(JobsSnapshot snapshot, AutoIngestJobStatus status) {
|
AutoIngestNodeChildren(AutoIngestMonitor monitor, AutoIngestJobStatus status) {
|
||||||
jobsSnapshot = snapshot;
|
autoIngestMonitor = monitor;
|
||||||
autoIngestJobStatus = status;
|
autoIngestJobStatus = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,13 +89,13 @@ final class AutoIngestJobsNode extends AbstractNode {
|
|||||||
List<AutoIngestJob> jobs;
|
List<AutoIngestJob> jobs;
|
||||||
switch (autoIngestJobStatus) {
|
switch (autoIngestJobStatus) {
|
||||||
case PENDING_JOB:
|
case PENDING_JOB:
|
||||||
jobs = jobsSnapshot.getPendingJobs();
|
jobs = autoIngestMonitor.refreshJobsSnapshot().getPendingJobs();
|
||||||
break;
|
break;
|
||||||
case RUNNING_JOB:
|
case RUNNING_JOB:
|
||||||
jobs = jobsSnapshot.getRunningJobs();
|
jobs = autoIngestMonitor.refreshJobsSnapshot().getRunningJobs();
|
||||||
break;
|
break;
|
||||||
case COMPLETED_JOB:
|
case COMPLETED_JOB:
|
||||||
jobs = jobsSnapshot.getCompletedJobs();
|
jobs = autoIngestMonitor.refreshJobsSnapshot().getCompletedJobs();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
jobs = new ArrayList<>();
|
jobs = new ArrayList<>();
|
||||||
@ -180,6 +186,29 @@ final class AutoIngestJobsNode extends AbstractNode {
|
|||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Action[] getActions(boolean context) {
|
||||||
|
List<Action> actions = new ArrayList<>();
|
||||||
|
switch (jobStatus) {
|
||||||
|
case PENDING_JOB:
|
||||||
|
actions.add(new PrioritizationAction.PrioritizeJobAction(autoIngestJob));
|
||||||
|
actions.add(new PrioritizationAction.PrioritizeCaseAction(autoIngestJob));
|
||||||
|
PrioritizationAction.DeprioritizeJobAction deprioritizeJobAction = new PrioritizationAction.DeprioritizeJobAction(autoIngestJob);
|
||||||
|
deprioritizeJobAction.setEnabled(autoIngestJob.getPriority() > 0);
|
||||||
|
actions.add(deprioritizeJobAction);
|
||||||
|
PrioritizationAction.DeprioritizeCaseAction deprioritizeCaseAction = new PrioritizationAction.DeprioritizeCaseAction(autoIngestJob);
|
||||||
|
deprioritizeCaseAction.setEnabled(autoIngestJob.getPriority() > 0);
|
||||||
|
actions.add(deprioritizeCaseAction);
|
||||||
|
break;
|
||||||
|
case RUNNING_JOB:
|
||||||
|
break;
|
||||||
|
case COMPLETED_JOB:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
return actions.toArray(new Action[actions.size()]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,11 +129,11 @@ final class AutoIngestJobsPanel extends javax.swing.JPanel implements ExplorerMa
|
|||||||
* @param jobsSnapshot - the JobsSnapshot which will provide the new
|
* @param jobsSnapshot - the JobsSnapshot which will provide the new
|
||||||
* contents
|
* contents
|
||||||
*/
|
*/
|
||||||
void refresh(AutoIngestMonitor.JobsSnapshot jobsSnapshot) {
|
void refresh(AutoIngestMonitor autoIngestMonitor) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
outline.setRowSelectionAllowed(false);
|
outline.setRowSelectionAllowed(false);
|
||||||
Node[] selectedNodes = explorerManager.getSelectedNodes();
|
Node[] selectedNodes = explorerManager.getSelectedNodes();
|
||||||
AutoIngestJobsNode autoIngestNode = new AutoIngestJobsNode(jobsSnapshot, status);
|
AutoIngestJobsNode autoIngestNode = new AutoIngestJobsNode(autoIngestMonitor, status);
|
||||||
explorerManager.setRootContext(autoIngestNode);
|
explorerManager.setRootContext(autoIngestNode);
|
||||||
outline.setRowSelectionAllowed(true);
|
outline.setRowSelectionAllowed(true);
|
||||||
if (selectedNodes.length > 0) {
|
if (selectedNodes.length > 0) {
|
||||||
|
@ -0,0 +1,162 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.experimental.autoingest;
|
||||||
|
|
||||||
|
import java.awt.Cursor;
|
||||||
|
import java.awt.EventQueue;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import javax.swing.AbstractAction;
|
||||||
|
import org.openide.windows.WindowManager;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||||
|
|
||||||
|
abstract class PrioritizationAction extends AbstractAction {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private final AutoIngestJob job;
|
||||||
|
|
||||||
|
PrioritizationAction(AutoIngestJob selectedJob, String title) {
|
||||||
|
super(title);
|
||||||
|
job = selectedJob;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void modifyPriority(AutoIngestMonitor monitor, AutoIngestJobsPanel panel) throws AutoIngestMonitor.AutoIngestMonitorException;
|
||||||
|
|
||||||
|
protected abstract String getErrorMessage();
|
||||||
|
|
||||||
|
protected AutoIngestJob getJob() {
|
||||||
|
return job;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
} catch (AutoIngestMonitor.AutoIngestMonitorException ex) {
|
||||||
|
String errorMessage = getErrorMessage();
|
||||||
|
// LOGGER.log(Level.SEVERE, errorMessage, ex);
|
||||||
|
MessageNotifyUtil.Message.error(errorMessage);
|
||||||
|
} finally {
|
||||||
|
tc.getPendingJobsPanel().setCursor(Cursor.getDefaultCursor());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object clone() throws CloneNotSupportedException {
|
||||||
|
return super.clone(); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
|
|
||||||
|
static final class PrioritizeJobAction extends PrioritizationAction {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
PrioritizeJobAction(AutoIngestJob selectedJob) {
|
||||||
|
super(selectedJob, "Prioritize Job");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void modifyPriority(AutoIngestMonitor monitor, AutoIngestJobsPanel panel) throws AutoIngestMonitor.AutoIngestMonitorException {
|
||||||
|
monitor.prioritizeJob(getJob());
|
||||||
|
panel.refresh(monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getErrorMessage() {
|
||||||
|
return String.format(Bundle.AutoIngestDashboard_errorMessage_jobPrioritization(), getJob().getManifest().getFilePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object clone() throws CloneNotSupportedException {
|
||||||
|
return super.clone(); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static final class DeprioritizeJobAction extends PrioritizationAction {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
DeprioritizeJobAction(AutoIngestJob selectedJob) {
|
||||||
|
super(selectedJob, "Deprioritize Job");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void modifyPriority(AutoIngestMonitor monitor, AutoIngestJobsPanel panel) throws AutoIngestMonitor.AutoIngestMonitorException {
|
||||||
|
monitor.deprioritizeJob(getJob());
|
||||||
|
panel.refresh(monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getErrorMessage() {
|
||||||
|
return String.format(Bundle.AutoIngestDashboard_errorMessage_jobDeprioritization(), getJob().getManifest().getFilePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object clone() throws CloneNotSupportedException {
|
||||||
|
return super.clone(); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static final class PrioritizeCaseAction extends PrioritizationAction {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
PrioritizeCaseAction(AutoIngestJob selectedJob) {
|
||||||
|
super(selectedJob, "Prioritize Case");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void modifyPriority(AutoIngestMonitor monitor, AutoIngestJobsPanel panel) throws AutoIngestMonitor.AutoIngestMonitorException {
|
||||||
|
monitor.prioritizeCase(getJob().getManifest().getCaseName());
|
||||||
|
panel.refresh(monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getErrorMessage() {
|
||||||
|
return String.format(Bundle.AutoIngestDashboard_errorMessage_casePrioritization(), getJob().getManifest().getCaseName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object clone() throws CloneNotSupportedException {
|
||||||
|
return super.clone(); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static final class DeprioritizeCaseAction extends PrioritizationAction {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
DeprioritizeCaseAction(AutoIngestJob selectedJob) {
|
||||||
|
super(selectedJob, "Deprioritize Case");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void modifyPriority(AutoIngestMonitor monitor, AutoIngestJobsPanel panel) throws AutoIngestMonitor.AutoIngestMonitorException {
|
||||||
|
monitor.deprioritizeCase(getJob().getManifest().getCaseName());
|
||||||
|
panel.refresh(monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getErrorMessage() {
|
||||||
|
return String.format(Bundle.AutoIngestDashboard_errorMessage_caseDeprioritization(), getJob().getManifest().getCaseName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object clone() throws CloneNotSupportedException {
|
||||||
|
return super.clone(); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user