@@ -4815,6 +4815,8 @@ public ShowInstrumentAction()
48154815 }
48164816
48174817 private static final String FOLDER_SUMMARY = "FolderSummary" ;
4818+ private static final String UTILIZATION_BY_DAY = "UtilizationByDay" ;
4819+ private static final String UTILIZATION_BY_MONTH = "UtilizationByMonth" ;
48184820
48194821 private InstrumentForm _form ;
48204822
@@ -4846,11 +4848,29 @@ protected QueryView createQueryView(InstrumentForm form, BindException errors, b
48464848 TargetedMSSchema schema = new TargetedMSSchema (getUser (), getContainer ());
48474849 return schema .createView (getViewContext (), settings , errors );
48484850 }
4851+ if (UTILIZATION_BY_DAY .equalsIgnoreCase (dataRegion ))
4852+ {
4853+ QuerySettings settings = new QuerySettings (getViewContext (), UTILIZATION_BY_DAY , "InstrumentUtilizationByDay" );
4854+ settings .setBaseSort (new Sort ("-AcquisitionDate" ));
4855+ settings .setBaseFilter (new SimpleFilter (FieldKey .fromParts ("InstrumentNickname" ), form .getName ()));
4856+ settings .setContainerFilterName (ContainerFilter .Type .AllFolders .name ());
4857+ TargetedMSSchema schema = new TargetedMSSchema (getUser (), getContainer ());
4858+ return schema .createView (getViewContext (), settings , errors );
4859+ }
4860+ if (UTILIZATION_BY_MONTH .equalsIgnoreCase (dataRegion ))
4861+ {
4862+ QuerySettings settings = new QuerySettings (getViewContext (), UTILIZATION_BY_MONTH , "InstrumentUtilizationByMonth" );
4863+ settings .setBaseSort (new Sort ("-MonthStart" ));
4864+ settings .setBaseFilter (new SimpleFilter (FieldKey .fromParts ("InstrumentNickname" ), form .getName ()));
4865+ settings .setContainerFilterName (ContainerFilter .Type .AllFolders .name ());
4866+ TargetedMSSchema schema = new TargetedMSSchema (getUser (), getContainer ());
4867+ return schema .createView (getViewContext (), settings , errors );
4868+ }
48494869 throw new NotFoundException ("Unknown dataRegion: " + dataRegion );
48504870 }
48514871
48524872 @ Override
4853- public ModelAndView getView (InstrumentForm form , BindException errors )
4873+ public ModelAndView getView (InstrumentForm form , BindException errors ) throws Exception
48544874 {
48554875 if (form .getName () == null )
48564876 {
@@ -4876,6 +4896,21 @@ public ModelAndView getView(InstrumentForm form, BindException errors)
48764896 result .addView (nameView );
48774897 }
48784898
4899+ var calendarView = new JspView <>("/org/labkey/targetedms/view/instrumentUtilizationCalendar.jsp" , form .getName ());
4900+ calendarView .setTitle ("Utilization Calendar" );
4901+ calendarView .setFrame (WebPartView .FrameType .PORTAL );
4902+ result .addView (calendarView );
4903+
4904+ QueryView byDayView = createInitializedQueryView (form , errors , false , UTILIZATION_BY_DAY );
4905+ byDayView .setFrame (WebPartView .FrameType .NONE );
4906+ QueryView byMonthView = createInitializedQueryView (form , errors , false , UTILIZATION_BY_MONTH );
4907+ byMonthView .setFrame (WebPartView .FrameType .NONE );
4908+
4909+ var utilizationView = new JspView <>("/org/labkey/targetedms/view/instrumentUtilizationGrids.jsp" , new InstrumentUtilizationBean (byDayView , byMonthView ));
4910+ utilizationView .setTitle ("Runs Acquired" );
4911+ utilizationView .setFrame (WebPartView .FrameType .PORTAL );
4912+ result .addView (utilizationView );
4913+
48794914 QueryView folderSummaryView = createQueryView (form , errors , false , FOLDER_SUMMARY );
48804915 folderSummaryView .setTitle ("Summary by Folder" );
48814916 folderSummaryView .setFrame (WebPartView .FrameType .PORTAL );
@@ -4891,6 +4926,28 @@ public ModelAndView getView(InstrumentForm form, BindException errors)
48914926 }
48924927 }
48934928
4929+ public static class InstrumentUtilizationBean
4930+ {
4931+ private final QueryView _byDayView ;
4932+ private final QueryView _byMonthView ;
4933+
4934+ public InstrumentUtilizationBean (QueryView byDayView , QueryView byMonthView )
4935+ {
4936+ _byDayView = byDayView ;
4937+ _byMonthView = byMonthView ;
4938+ }
4939+
4940+ public QueryView getByDayView ()
4941+ {
4942+ return _byDayView ;
4943+ }
4944+
4945+ public QueryView getByMonthView ()
4946+ {
4947+ return _byMonthView ;
4948+ }
4949+ }
4950+
48944951 @ RequiresPermission (ReadPermission .class )
48954952 public class ShowReplicatesAction extends ShowRunSingleDetailsAction <RunDetailsForm >
48964953 {
0 commit comments