VirtualBox

Ignore:
Timestamp:
Jan 10, 2017 3:36:36 PM (8 years ago)
Author:
vboxsync
Message:

TestManager: Hacked up some basic testbox sorting during the weekly meeting.

Location:
trunk/src/VBox/ValidationKit/testmanager/webui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/webui/wuiadmintestbox.py

    r64986 r65226  
    3939from testmanager.core.db                import TMDatabaseConnection;
    4040from testmanager.core.schedgroup        import SchedGroupLogic, SchedGroupData;
    41 from testmanager.core.testbox           import TestBoxData, TestBoxDataEx;
     41from testmanager.core.testbox           import TestBoxData, TestBoxDataEx, TestBoxLogic;
    4242from testmanager.core.testset           import TestSetData;
    4343from testmanager.core.db                import isDbTimestampInfinity;
     
    192192                                       '', '', '', 'align="left"', 'align="right"', 'align="right"', 'align="right"',
    193193                                       'align="center"' ]);
     194        self._aaiColumnSorting.extend([
     195            (TestBoxLogic.kiSortColumn_sName,),
     196            None, # LOM
     197            None, # Status
     198            None, # Cmd
     199            None, # Note
     200            (TestBoxLogic.kiSortColumn_iTestBoxScriptRev,),
     201            (TestBoxLogic.kiSortColumn_iPythonHexVersion,),
     202            None, # Group
     203            (TestBoxLogic.kiSortColumn_sOs, TestBoxLogic.kiSortColumn_sOsVersion, TestBoxLogic.kiSortColumn_sCpuArch,),
     204            (TestBoxLogic.kiSortColumn_sCpuVendor, TestBoxLogic.kiSortColumn_lCpuRevision,),
     205            (TestBoxLogic.kiSortColumn_fNestedPaging,),
     206            (TestBoxLogic.kiSortColumn_cCpus,),
     207            (TestBoxLogic.kiSortColumn_cMbMemory,),
     208            (TestBoxLogic.kiSortColumn_cMbScratch,),
     209            None, # Actions
     210        ]);
     211        assert len(self._aaiColumnSorting) == len(self._asColumnHeaders);
    194212        self._aoActions     = list(self.kasTestBoxActionDescs);
    195213        self._sAction       = oDisp.ksActionTestBoxListPost;
  • trunk/src/VBox/ValidationKit/testmanager/webui/wuibase.py

    r65086 r65226  
    8282    ## The name of the list-action parameter (WuiListContentWithActionBase).
    8383    ksParamListAction    = 'ListAction';
     84
     85    ## One or more columns to sort by.
     86    ksParamSortColumns   = 'SortBy';
    8487
    8588    ## The name of the change log enabled/disabled parameter.
     
    801804        cItemsPerPage   = self.getIntParam(self.ksParamItemsPerPage, iMin = 2, iMax =   9999, iDefault = 300);
    802805        iPage           = self.getIntParam(self.ksParamPageNo,       iMin = 0, iMax = 999999, iDefault = 0);
     806        aiSortColumnsDup = self.getListOfIntParams(self.ksParamSortColumns, iMin = 0,
     807                                                   iMax = getattr(oLogicType, 'kcMaxSortColumns', 0), aiDefaults = []);
     808        aiSortColumns   = [];
     809        for iSortColumn in aiSortColumnsDup:
     810            if iSortColumn not in aiSortColumns:
     811                aiSortColumns.append(iSortColumn);
    803812        self._checkForUnknownParameters();
    804813
    805         aoEntries  = oLogicType(self._oDb).fetchForListing(iPage * cItemsPerPage, cItemsPerPage + 1, tsEffective);
     814        aoEntries  = oLogicType(self._oDb).fetchForListing(iPage * cItemsPerPage, cItemsPerPage + 1, tsEffective, aiSortColumns);
    806815        oContent   = oListContentType(aoEntries, iPage, cItemsPerPage, tsEffective,
    807816                                      fnDPrint = self._oSrvGlue.dprint, oDisp = self);
  • trunk/src/VBox/ValidationKit/testmanager/webui/wuicontentbase.py

    r65052 r65226  
    749749        self._asColumnHeaders   = [];
    750750        self._asColumnAttribs   = [];
     751        self._aaiColumnSorting  = [];   ##< list of list of integers
    751752
    752753    def _formatCommentCell(self, sComment, cMaxLines = 3, cchMaxLine = 63):
     
    944945
    945946        sHtml  = '  <thead class="tmheader"><tr>';
    946         for oHeader in self._asColumnHeaders:
     947        for iHeader, oHeader in enumerate(self._asColumnHeaders):
    947948            if isinstance(oHeader, WuiHtmlBase):
    948949                sHtml += '<th>' + oHeader.toHtml() + '</th>';
     950            elif iHeader < len(self._aaiColumnSorting) and self._aaiColumnSorting[iHeader] is not None:
     951                sHtml += '<th>'
     952                sHtml += '<a href="javascript:ahrefActionSortByColumns(\'%s\', [%s]);">' \
     953                       % (WuiDispatcherBase.ksParamSortColumns, ','.join([str(i) for i in self._aaiColumnSorting[iHeader]]));
     954                sHtml += webutils.escapeElem(oHeader) + '</a></th>';
    949955            else:
    950956                sHtml += '<th>' + webutils.escapeElem(oHeader) + '</th>';
     
    10241030                                             % ('' if sId is None else sId)), ];
    10251031        self._asColumnAttribs = [ 'align="center"', ];
     1032        self._aaiColumnSorting = [ None, ];
    10261033
    10271034    def _getCheckBoxColumn(self, iEntry, sValue):
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette