3815 change arguement to AutoIngestJobsNode back to snapshot from monitor

This commit is contained in:
William Schaefer 2018-05-16 13:43:08 -04:00
parent 26cfb15f6b
commit 4a75775257
4 changed files with 12 additions and 12 deletions

View File

@ -261,9 +261,9 @@ final class AutoIngestDashboard extends JPanel implements Observer {
* @param nodeStateSnapshot The jobs snapshot. * @param nodeStateSnapshot The jobs snapshot.
*/ */
void refreshTables() { void refreshTables() {
pendingJobsPanel.refresh(autoIngestMonitor); pendingJobsPanel.refresh(autoIngestMonitor.getJobsSnapshot());
runningJobsPanel.refresh(autoIngestMonitor); runningJobsPanel.refresh(autoIngestMonitor.getJobsSnapshot());
completedJobsPanel.refresh(autoIngestMonitor); completedJobsPanel.refresh(autoIngestMonitor.getJobsSnapshot());
} }
/** /**

View File

@ -60,8 +60,8 @@ final class AutoIngestJobsNode extends AbstractNode {
/** /**
* Construct a new AutoIngestJobsNode. * Construct a new AutoIngestJobsNode.
*/ */
AutoIngestJobsNode(AutoIngestMonitor autoIngestMonitor, AutoIngestJobStatus status, EventBus eventBus) { AutoIngestJobsNode(JobsSnapshot jobsSnapshot, AutoIngestJobStatus status, EventBus eventBus) {
super(Children.create(new AutoIngestNodeChildren(autoIngestMonitor, status, eventBus), false)); super(Children.create(new AutoIngestNodeChildren(jobsSnapshot, status, eventBus), false));
refreshChildrenEventBus = eventBus; refreshChildrenEventBus = eventBus;
} }
@ -78,7 +78,7 @@ final class AutoIngestJobsNode extends AbstractNode {
static final class AutoIngestNodeChildren extends ChildFactory<AutoIngestJob> { static final class AutoIngestNodeChildren extends ChildFactory<AutoIngestJob> {
private final AutoIngestJobStatus autoIngestJobStatus; private final AutoIngestJobStatus autoIngestJobStatus;
private final AutoIngestMonitor autoIngestMonitor; private final JobsSnapshot jobsSnapshot;
private final RefreshChildrenSubscriber refreshChildrenSubscriber = new RefreshChildrenSubscriber(); private final RefreshChildrenSubscriber refreshChildrenSubscriber = new RefreshChildrenSubscriber();
private final EventBus refreshEventBus; private final EventBus refreshEventBus;
@ -89,8 +89,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(AutoIngestMonitor monitor, AutoIngestJobStatus status, EventBus eventBus) { AutoIngestNodeChildren(JobsSnapshot snapshot, AutoIngestJobStatus status, EventBus eventBus) {
autoIngestMonitor = monitor; jobsSnapshot = snapshot;
autoIngestJobStatus = status; autoIngestJobStatus = status;
refreshEventBus = eventBus; refreshEventBus = eventBus;
refreshChildrenSubscriber.register(refreshEventBus); refreshChildrenSubscriber.register(refreshEventBus);
@ -99,7 +99,6 @@ final class AutoIngestJobsNode extends AbstractNode {
@Override @Override
protected boolean createKeys(List<AutoIngestJob> list) { protected boolean createKeys(List<AutoIngestJob> list) {
List<AutoIngestJob> jobs; List<AutoIngestJob> jobs;
JobsSnapshot jobsSnapshot = autoIngestMonitor.getJobsSnapshot();
switch (autoIngestJobStatus) { switch (autoIngestJobStatus) {
case PENDING_JOB: case PENDING_JOB:
jobs = jobsSnapshot.getPendingJobs(); jobs = jobsSnapshot.getPendingJobs();

View File

@ -30,6 +30,7 @@ import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.datamodel.EmptyNode; import org.sleuthkit.autopsy.datamodel.EmptyNode;
import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestJobsNode.AutoIngestJobStatus; import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestJobsNode.AutoIngestJobStatus;
import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestJobsNode.JobNode; import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestJobsNode.JobNode;
import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestMonitor.JobsSnapshot;
/** /**
* A panel which displays an outline view with all jobs for a specified status. * A panel which displays an outline view with all jobs for a specified status.
@ -162,13 +163,13 @@ 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 autoIngestMonitor) { void refresh(JobsSnapshot jobsSnapshot) {
synchronized (this) { synchronized (this) {
outline.setRowSelectionAllowed(false); outline.setRowSelectionAllowed(false);
if (explorerManager.getRootContext() instanceof AutoIngestJobsNode) { if (explorerManager.getRootContext() instanceof AutoIngestJobsNode) {
((AutoIngestJobsNode)explorerManager.getRootContext()).refresh(); ((AutoIngestJobsNode)explorerManager.getRootContext()).refresh();
} else { } else {
explorerManager.setRootContext(new AutoIngestJobsNode(autoIngestMonitor, status, new EventBus("AutoIngestJobsNodeEventBus"))); explorerManager.setRootContext(new AutoIngestJobsNode(jobsSnapshot, status, new EventBus("AutoIngestJobsNodeEventBus")));
} }
outline.setRowSelectionAllowed(true); outline.setRowSelectionAllowed(true);
outline.setFocusable(true); outline.setFocusable(true);

View File

@ -88,7 +88,7 @@ abstract class PrioritizationAction extends AbstractAction {
EventQueue.invokeLater(() -> { EventQueue.invokeLater(() -> {
try { try {
modifyPriority(dashboard.getMonitor()); modifyPriority(dashboard.getMonitor());
dashboard.getPendingJobsPanel().refresh(dashboard.getMonitor()); dashboard.getPendingJobsPanel().refresh(dashboard.getMonitor().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);