VirtualBox

Ignore:
Timestamp:
Jan 2, 2017 11:55:03 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
112548
Message:

testmanager: Test result filtering - work in progress.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/webui/template.html

    r65010 r65051  
    22<html lang="en">
    33    <head>
     4        <meta charset="UTF-8" />
    45        <meta http-equiv="content-type"             content="text/html; charset=UTF-8" />
    56        <meta http-equiv="content-language"         content="en" />
     
    3435
    3536            <div id="side-menu">
    36                 <form id="side-menu-form">
     37                <form id="side-menu-form"@@SIDE_MENU_FORM_ATTRS@@>
    3738                    <ul>
    3839                        @@SIDE_MENU_ITEMS@@
  • trunk/src/VBox/ValidationKit/testmanager/webui/wuiadminsystemchangelog.py

    r65046 r65051  
    386386                   % (sRowClass, cAttribsChanged + 1, cAttribsChanged + 1, sRowClass);
    387387            for j, oChange in enumerate(oChangeEntry.aoChanges):
     388                fLastRow = j + 1 == len(oChangeEntry.aoChanges);
    388389                sHtml += u'  <tr class="%s%s tmsyschlogattr%s">\n' \
    389                        % ( sRowClass, 'odd' if j & 1 else 'even',
    390                            ' tmsyschlogattrfinal' if j + 1 == len(oChangeEntry.aoChanges) else '',);
     390                       % ( sRowClass, 'odd' if j & 1 else 'even', ' tmsyschlogattrfinal' if fLastRow else '',);
    391391                if j == 0:
    392392                    sHtml += u'    <td class="%s tmsyschlogspacer" rowspan="%d"></td>\n' % (sRowClass, cAttribsChanged - 1,);
    393393
    394394                if isinstance(oChange, AttributeChangeEntryPre):
    395                     sHtml += u'    <td>%s</td>\n' \
     395                    sHtml += u'    <td class="%s%s">%s</td>\n' \
    396396                             u'    <td><div class="tdpre"><pre>%s</pre></div></td>\n' \
    397                              u'    <td><div class="tdpre"><pre>%s</pre></div></td>\n' \
    398                            % ( webutils.escapeElem(oChange.sAttr),
     397                             u'    <td class="%s%s"><div class="tdpre"><pre>%s</pre></div></td>\n' \
     398                           % ( ' tmtopleft' if j == 0 else '', ' tmbottomleft' if fLastRow else '',
     399                               webutils.escapeElem(oChange.sAttr),
    399400                               webutils.escapeElem(oChange.sOldText),
     401                               ' tmtopright' if j == 0 else '', ' tmbottomright' if fLastRow else '',
    400402                               webutils.escapeElem(oChange.sNewText), );
    401403                else:
    402                     sHtml += u'    <td>%s</td>\n' \
     404                    sHtml += u'    <td class="%s%s">%s</td>\n' \
    403405                             u'    <td>%s</td>\n' \
    404                              u'    <td>%s</td>\n' \
    405                            % ( webutils.escapeElem(oChange.sAttr),
     406                             u'    <td class="%s%s">%s</td>\n' \
     407                           % ( ' tmtopleft' if j == 0 else '', ' tmbottomleft' if fLastRow else '',
     408                               webutils.escapeElem(oChange.sAttr),
    406409                               webutils.escapeElem(oChange.sOldText),
     410                               ' tmtopright' if j == 0 else '', ' tmbottomright' if fLastRow else '',
    407411                               webutils.escapeElem(oChange.sNewText), );
    408412                sHtml += u'  </tr>\n';
  • trunk/src/VBox/ValidationKit/testmanager/webui/wuibase.py

    r64986 r65051  
    118118        self._sPageFilter       = '';           # The filter controls (optional).
    119119        self._sPageBody         = '$$TODO$$';   # The body text.
     120        self._dSideMenuFormAttrs = {};          # key/value with attributes for the side menu <form> tag.
    120121        self._sRedirectTo       = None;
    121122        self._sDebug            = '';
     
    266267            '@@SIDE_MENU_ITEMS@@':      sSideMenuItems,
    267268            '@@SIDE_FILTER_CONTROL@@':  self._sPageFilter,
     269            '@@SIDE_MENU_FORM_ATTRS@@': '',
    268270            '@@PAGE_BODY@@':            self._sPageBody,
    269271            '@@DEBUG@@':                '',
    270272        };
     273
     274        # Side menu form attributes.
     275        if len(self._dSideMenuFormAttrs) > 0:
     276            dReplacements['@@SIDE_MENU_FORM_ATTRS@@'] = ' '.join(['%s="%s"' % (sKey, webutils.escapeAttr(sValue))
     277                                                                  for sKey, sValue in self._dSideMenuFormAttrs.iteritems()]);
    271278
    272279        # Special current user handling.
     
    746753        for sKey, oValue in self._dParams.iteritems():
    747754            if sKey not in self.kasDbgParams:
    748                 sHtml += '  <input type="hidden" name="%s" value="%s"/>\n' \
    749                        % (webutils.escapeAttr(sKey), webutils.escapeAttrToStr(oValue),);
     755                if hasattr(oValue, 'startswith'):
     756                    sHtml += '  <input type="hidden" name="%s" value="%s"/>\n' \
     757                           % (webutils.escapeAttr(sKey), webutils.escapeAttrToStr(oValue),);
     758                else:
     759                    for oSubValue in oValue:
     760                        sHtml += '  <input type="hidden" name="%s" value="%s"/>\n' \
     761                               % (webutils.escapeAttr(sKey), webutils.escapeAttrToStr(oSubValue),);
    750762
    751763        for aoCheckBox in (
  • trunk/src/VBox/ValidationKit/testmanager/webui/wuicontentbase.py

    r65040 r65051  
    8484                if dParams[sKey] is None:
    8585                    dParams[sKey] = '';
    86             self.sUrl += '?' + webutils.encodeUrlParams(dParams)
     86            self.sUrl += '?' + webutils.encodeUrlParams(dParams);
    8787
    8888        if sFragmentId is not None:
  • trunk/src/VBox/ValidationKit/testmanager/webui/wuimain.py

    r64986 r65051  
    335335        """Show the default admin page."""
    336336        from testmanager.webui.wuitestresult import WuiGroupedResultList;
    337         from testmanager.core.testresults    import TestResultLogic;
     337        from testmanager.core.testresults    import TestResultLogic, TestResultFilter;
    338338        self._sAction = self.ksActionResultsUnGrouped
    339339        return self._actionGroupedResultsListing(TestResultLogic.ksResultsGroupingTypeNone,
    340                                                  TestResultLogic,
    341                                                  WuiGroupedResultList)
     340                                                 TestResultLogic, TestResultFilter, WuiGroupedResultList);
    342341
    343342    def _isMenuMatch(self, sMenuUrl, sActionParam):
     
    722721            enmResultsGroupingType,
    723722            oResultsLogicType,
     723            oResultFilterType,
    724724            oResultsListContentType):
    725725        """
    726726        Override generic listing action.
    727727
    728         oLogicType implements fetchForListing.
    729         oListContentType is a child of WuiListContentBase.
     728        oResultsLogicType implements getEntriesCount, fetchResultsForListing and more.
     729        oResultFilterType is a child of ModelFilterBase.
     730        oResultsListContentType is a child of WuiListContentBase.
    730731        """
    731732        from testmanager.core.testresults    import TestResultLogic;
     
    740741                                                  asValidValues = TestResultLogic.kasResultsSortBy,
    741742                                                  sDefault = TestResultLogic.ksResultsSortByRunningAndStart);
     743        oFilter = oResultFilterType().initFromParams(self);
    742744
    743745        # Get testing results period and validate it
     
    833835            cEntries = oResultLogic.getEntriesCount(tsNow = tsEffective,
    834836                                                    sInterval = sCurPeriod,
     837                                                    oFilter = oFilter,
    835838                                                    enmResultsGroupingType = enmResultsGroupingType,
    836839                                                    iResultsGroupingValue = idMember,
     
    843846                                                            tsNow = tsEffective,
    844847                                                            sInterval = sCurPeriod,
     848                                                            oFilter = oFilter,
    845849                                                            enmResultSortBy = enmResultSortBy,
    846850                                                            enmResultsGroupingType = enmResultsGroupingType,
     
    890894        # Now, generate a filter control panel for the side bar.
    891895        #
    892         self._sPageFilter = self._generateResultFilter(oResultLogic,
    893                                                        tsNow = tsEffective,
    894                                                        sInterval = sCurPeriod,
     896        self._sPageFilter = self._generateResultFilter(oFilter, oResultLogic, tsEffective, sCurPeriod,
    895897                                                       enmResultsGroupingType = enmResultsGroupingType,
    896898                                                       aoGroupMembers = aoGroupMembers,
     
    899901        return True;
    900902
    901     def _generateResultFilter(self, oResultLogic, tsNow, sInterval, enmResultsGroupingType, aoGroupMembers,
     903    def _generateResultFilter(self, oFilter, oResultLogic, tsNow, sPeriod, enmResultsGroupingType, aoGroupMembers,
    902904                              fOnlyFailures, fOnlyNeedingReason):
    903905        """
    904906        Generates the result filter for the left hand side.
    905907        """
    906         sHtml  = u'<div id="side-filters">\n' \
     908        _ = enmResultsGroupingType; _ = aoGroupMembers; _ = fOnlyFailures; _ = fOnlyNeedingReason;
     909        oResultLogic.fetchPossibleFilterOptions(oFilter, tsNow, sPeriod)
     910
     911        # Add non-filter parameters as hidden fields so we can use 'GET' and have URLs to bookmark.
     912        self._dSideMenuFormAttrs['method'] = 'GET';
     913        sHtml = u'';
     914        for sKey, oValue in self._oSrvGlue.getParameters().iteritems():
     915            if len(sKey) > 3:
     916                if hasattr(oValue, 'startswith'):
     917                    sHtml += u'<input type="hidden" name="%s" value="%s"/>\n' \
     918                           % (webutils.escapeAttr(sKey), webutils.escapeAttr(oValue),);
     919                else:
     920                    for oSubValue in oValue:
     921                        sHtml += u'<input type="hidden" name="%s" value="%s"/>\n' \
     922                               % (webutils.escapeAttr(sKey), webutils.escapeAttr(oSubValue),);
     923
     924        # Generate the filter panel.
     925        sHtml += u'<div id="side-filters">\n' \
    907926                 u' <p>Filters</p>\n' \
    908927                 u' <dl>\n';
    909928
    910         sHtml += u'  <dt class="sf-collapsable"><a href="javascript:void(0)" onclick="toggleCollapsableDtDd(this);">&#9660; Test filter 1</a></dd>\n';
    911         sHtml += u'  <dd class="sf-collapsable"><ul><li>stuff 1</li><li>stuff 2</li><ul></dd>\n'
    912 
    913         sHtml += u'  <dt class="sf-expandable"><a href="javascript:void(0)" onclick="toggleCollapsableDtDd(this);">&#9654; Test filter 2</a></dd>\n';
    914         sHtml += u'  <dd class="sf-expandable"><ul><li>stuff 3</li><li>stuff 4</li><ul></dd>\n'
    915 
    916 
    917         sHtml += u' </dl>\n' \
    918                  u'</div>\n';
     929        for iCrit, oCrit in enumerate(oFilter.aCriteria):
     930            sClass = 'sf-collapsable' if oCrit.sState == oCrit.ksState_Selected else 'sf-expandable';
     931            sChar  = '&#9660;'        if oCrit.sState == oCrit.ksState_Selected else '&#9654;';
     932            sHtml += u'  <dt class="%s"><a href="javascript:void(0)" onclick="toggleCollapsableDtDd(this);">%s'\
     933                     u' %s</a></dt>\n' \
     934                     u'  <dd class="%s">\n' \
     935                     u'   <ul>\n' \
     936                     % (sClass, sChar, webutils.escapeElem(oCrit.sName), sClass);
     937            for oDesc in oCrit.aoPossible:
     938                fChecked = oDesc.oValue in oCrit.aoSelected;
     939                sHtml += u'    <li><input type="checkbox" name="%s" value="%s"%s/>%s</li>\n' \
     940                       % (oCrit.sVarNm, oDesc.oValue, ' checked' if fChecked else '', webutils.escapeElem(oDesc.sDesc),);
     941
     942            sHtml += u'   </ul>\n';
     943            if iCrit + 1 < len(oFilter.aCriteria):                    ## @todo fix me.
     944                sHtml += u'   <div class="filterend">&nbsp;</div>\n'; ## @todo fix me.
     945            sHtml += u'  </dd>\n';
     946
     947        sHtml += u' </dl>\n';
     948        sHtml += u' <input type="submit" value="Apply"/>\n';
     949        sHtml += u'</div>\n';
    919950        return sHtml;
    920951
     
    922953        """ Action wrapper. """
    923954        from testmanager.webui.wuitestresult        import WuiGroupedResultList;
    924         from testmanager.core.testresults           import TestResultLogic;
     955        from testmanager.core.testresults           import TestResultLogic, TestResultFilter;
    925956        #return self._actionResultsListing(TestResultLogic, WuiGroupedResultList)?
    926957        return self._actionGroupedResultsListing(TestResultLogic.ksResultsGroupingTypeNone,
    927                                                  TestResultLogic, WuiGroupedResultList);
     958                                                 TestResultLogic, TestResultFilter, WuiGroupedResultList);
    928959
    929960    def _actionResultsGroupedByTestGroup(self):
    930961        """ Action wrapper. """
    931962        from testmanager.webui.wuitestresult        import WuiGroupedResultList;
    932         from testmanager.core.testresults           import TestResultLogic;
     963        from testmanager.core.testresults           import TestResultLogic, TestResultFilter;
    933964        return self._actionGroupedResultsListing(TestResultLogic.ksResultsGroupingTypeTestGroup,
    934                                                  TestResultLogic, WuiGroupedResultList);
     965                                                 TestResultLogic, TestResultFilter, WuiGroupedResultList);
    935966
    936967    def _actionResultsGroupedByBuildRev(self):
    937968        """ Action wrapper. """
    938969        from testmanager.webui.wuitestresult        import WuiGroupedResultList;
    939         from testmanager.core.testresults           import TestResultLogic;
     970        from testmanager.core.testresults           import TestResultLogic, TestResultFilter;
    940971        return self._actionGroupedResultsListing(TestResultLogic.ksResultsGroupingTypeBuildRev,
    941                                                  TestResultLogic, WuiGroupedResultList);
     972                                                 TestResultLogic, TestResultFilter, WuiGroupedResultList);
    942973
    943974    def _actionResultsGroupedByBuildCat(self):
    944975        """ Action wrapper. """
    945976        from testmanager.webui.wuitestresult        import WuiGroupedResultList;
    946         from testmanager.core.testresults           import TestResultLogic;
     977        from testmanager.core.testresults           import TestResultLogic, TestResultFilter;
    947978        return self._actionGroupedResultsListing(TestResultLogic.ksResultsGroupingTypeBuildCat,
    948                                                  TestResultLogic, WuiGroupedResultList);
     979                                                 TestResultLogic, TestResultFilter, WuiGroupedResultList);
    949980
    950981    def _actionResultsGroupedByTestBox(self):
    951982        """ Action wrapper. """
    952983        from testmanager.webui.wuitestresult        import WuiGroupedResultList;
    953         from testmanager.core.testresults           import TestResultLogic;
     984        from testmanager.core.testresults           import TestResultLogic, TestResultFilter;
    954985        return self._actionGroupedResultsListing(TestResultLogic.ksResultsGroupingTypeTestBox,
    955                                                  TestResultLogic, WuiGroupedResultList);
     986                                                 TestResultLogic, TestResultFilter, WuiGroupedResultList);
    956987
    957988    def _actionResultsGroupedByTestCase(self):
    958989        """ Action wrapper. """
    959990        from testmanager.webui.wuitestresult        import WuiGroupedResultList;
    960         from testmanager.core.testresults           import TestResultLogic;
     991        from testmanager.core.testresults           import TestResultLogic, TestResultFilter;
    961992        return self._actionGroupedResultsListing(TestResultLogic.ksResultsGroupingTypeTestCase,
    962                                                  TestResultLogic, WuiGroupedResultList);
     993                                                 TestResultLogic, TestResultFilter, WuiGroupedResultList);
    963994
    964995    def _actionResultsGroupedByOS(self):
    965996        """ Action wrapper. """
    966997        from testmanager.webui.wuitestresult        import WuiGroupedResultList;
    967         from testmanager.core.testresults           import TestResultLogic;
     998        from testmanager.core.testresults           import TestResultLogic, TestResultFilter;
    968999        return self._actionGroupedResultsListing(TestResultLogic.ksResultsGroupingTypeOS,
    969                                                  TestResultLogic, WuiGroupedResultList);
     1000                                                 TestResultLogic, TestResultFilter, WuiGroupedResultList);
    9701001
    9711002    def _actionResultsGroupedByArch(self):
    9721003        """ Action wrapper. """
    9731004        from testmanager.webui.wuitestresult        import WuiGroupedResultList;
    974         from testmanager.core.testresults           import TestResultLogic;
     1005        from testmanager.core.testresults           import TestResultLogic, TestResultFilter;
    9751006        return self._actionGroupedResultsListing(TestResultLogic.ksResultsGroupingTypeArch,
    976                                                  TestResultLogic, WuiGroupedResultList);
     1007                                                 TestResultLogic, TestResultFilter, WuiGroupedResultList);
    9771008
    9781009    def _actionResultsGroupedBySchedGroup(self):
    9791010        """ Action wrapper. """
    9801011        from testmanager.webui.wuitestresult        import WuiGroupedResultList;
    981         from testmanager.core.testresults           import TestResultLogic;
     1012        from testmanager.core.testresults           import TestResultLogic, TestResultFilter;
    9821013        return self._actionGroupedResultsListing(TestResultLogic.ksResultsGroupingTypeSchedGroup,
    983                                                  TestResultLogic, WuiGroupedResultList);
     1014                                                 TestResultLogic, TestResultFilter, WuiGroupedResultList);
    9841015
    9851016
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