VirtualBox

Ignore:
Timestamp:
Mar 23, 2020 9:47:01 AM (5 years ago)
Author:
vboxsync
Message:

TestManager: Adding test box selection to the scheduling group form (left over from r107843 where test boxes gained the ability to service more than one scheduling group).

File:
1 edited

Legend:

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

    r82968 r83364  
    4040from testmanager.core.testcaseargs  import TestCaseArgsData;
    4141from testmanager.core.testgroup     import TestGroupMemberData, TestGroupDataEx;
     42from testmanager.core.testbox       import TestBoxDataForSchedGroup;
    4243
    4344# Python 3 hacks:
     
    654655        self._addLabel(sName, sLabel);
    655656        if not aoAllTestCases:
    656             return self._add('<li>No testcases available.</li>\n')
     657            return self._add('<li>No testcases.</li>\n')
    657658
    658659        self._add(u'<input name="%s" type="hidden" value="%s">\n'
     
    763764                         u'</table>\n');
    764765
    765     def addListOfSchedGroupMembers(self, sName, aoSchedGroupMembers, aoAllTestGroups,  # pylint: disable=too-many-locals
     766    def addListOfSchedGroupMembers(self, sName, aoSchedGroupMembers, aoAllRelevantTestGroups,  # pylint: disable=too-many-locals
    766767                                   sLabel, fReadOnly = True):
    767768        """
     
    770771        if fReadOnly is None or self._fReadOnly:
    771772            fReadOnly = self._fReadOnly;
    772         assert len(aoSchedGroupMembers) <= len(aoAllTestGroups);
     773        assert len(aoSchedGroupMembers) <= len(aoAllRelevantTestGroups);
    773774        self._addLabel(sName, sLabel);
    774         if not aoAllTestGroups:
    775             return self._add(u'<li>No test groups available.</li>\n')
     775        if not aoAllRelevantTestGroups:
     776            return self._add(u'<li>No test groups.</li>\n')
    776777
    777778        self._add(u'<input name="%s" type="hidden" value="%s">\n'
    778779                  % ( SchedGroupDataEx.ksParam_aidTestGroups,
    779                       ','.join([unicode(oTestGroup.idTestGroup) for oTestGroup in aoAllTestGroups]), ));
     780                      ','.join([unicode(oTestGroup.idTestGroup) for oTestGroup in aoAllRelevantTestGroups]), ));
    780781
    781782        self._add(u'<table class="tmformtbl">\n'
     
    797798        oDefMember = SchedGroupMemberData();
    798799        aoSchedGroupMembers = list(aoSchedGroupMembers); # Copy it so we can pop.
    799         for iTestGroup, _ in enumerate(aoAllTestGroups):
    800             oTestGroup = aoAllTestGroups[iTestGroup];
     800        for iTestGroup, _ in enumerate(aoAllRelevantTestGroups):
     801            oTestGroup = aoAllRelevantTestGroups[iTestGroup];
    801802
    802803            # Is it a member?
     
    844845                          ' selected' if oMember is None or oMember.idTestGroupPreReq is None else '',
    845846                          ));
    846             for oTestGroup2 in aoAllTestGroups:
     847            for oTestGroup2 in aoAllRelevantTestGroups:
    847848                if oTestGroup2 != oTestGroup:
    848849                    fSelected = oMember is not None and oTestGroup2.idTestGroup == oMember.idTestGroupPreReq;
     
    862863                         u'</table>\n');
    863864
     865    def addListOfSchedGroupBoxes(self, sName, aoSchedGroupBoxes, aoAllRelevantTestBoxes,  # pylint: disable=too-many-locals
     866                                 sLabel, fReadOnly = True): # (str, list[TestBoxDataEx], list[TestBoxDataEx], str, bool) -> str
     867        """
     868        For WuiAdminSchedGroup.
     869        """
     870        if fReadOnly is None or self._fReadOnly:
     871            fReadOnly = self._fReadOnly;
     872        assert len(aoSchedGroupBoxes) <= len(aoAllRelevantTestBoxes);
     873        self._addLabel(sName, sLabel);
     874        if not aoAllRelevantTestBoxes:
     875            return self._add(u'<li>No test boxes.</li>\n')
     876
     877        self._add(u'<input name="%s" type="hidden" value="%s">\n'
     878                  % ( SchedGroupDataEx.ksParam_aidTestBoxes,
     879                      ','.join([unicode(oTestBox.idTestBox) for oTestBox in aoAllRelevantTestBoxes]), ));
     880
     881        ## @todo replace with tmform-field-list tricks.
     882        self._add(u'<table class="tmformtbl">\n'
     883                  u' <thead>\n'
     884                  u'  <tr>\n'
     885                  u'    <th></th>\n'
     886                  u'    <th>Test Box</th>\n'
     887                  u'    <th>Priority [0..31]</th>\n'
     888                  u'  </tr>\n'
     889                  u' </thead>\n'
     890                  u' <tbody>\n'
     891                  );
     892
     893        sCheckBoxAttr = u' readonly onclick="return false" onkeydown="return false"' if fReadOnly else '';
     894
     895        oDefMember = TestBoxDataForSchedGroup();
     896        aoSchedGroupBoxes = list(aoSchedGroupBoxes); # Copy it so we can pop.
     897        for iTestBox, _ in enumerate(aoAllRelevantTestBoxes):
     898            oTestBox = aoAllRelevantTestBoxes[iTestBox];
     899
     900            # Is it a member?
     901            oMember = None;
     902            for i, _ in enumerate(aoSchedGroupBoxes):
     903                if aoSchedGroupBoxes[i].oTestBox and aoSchedGroupBoxes[i].oTestBox.idTestBox == oTestBox.idTestBox:
     904                    oMember = aoSchedGroupBoxes.pop(i);
     905                    break;
     906
     907            # Start on the rows...
     908            sPrefix = u'%s[%d]' % (sName, oTestBox.idTestBox,);
     909            self._add(u'  <tr class="%s">\n'
     910                      u'    <td>\n'
     911                      u'      <input name="%s[%s]" type="hidden" value="%s">\n' # idTestBox
     912                      u'      <input name="%s[%s]" type="hidden" value="%s">\n' # idSchedGroup
     913                      u'      <input name="%s[%s]" type="hidden" value="%s">\n' # tsExpire
     914                      u'      <input name="%s[%s]" type="hidden" value="%s">\n' # tsEffective
     915                      u'      <input name="%s[%s]" type="hidden" value="%s">\n' # uidAuthor
     916                      u'      <input name="%s" type="checkbox"%s%s value="%d" class="tmform-checkbox" title="#%d - %s">\n' #(list)
     917                      u'    </td>\n'
     918                      % ( 'tmodd' if iTestBox & 1 else 'tmeven',
     919                          sPrefix, TestBoxDataForSchedGroup.ksParam_idTestBox,    oTestBox.idTestBox,
     920                          sPrefix, TestBoxDataForSchedGroup.ksParam_idSchedGroup, -1 if oMember is None else oMember.idSchedGroup,
     921                          sPrefix, TestBoxDataForSchedGroup.ksParam_tsExpire,     '' if oMember is None else oMember.tsExpire,
     922                          sPrefix, TestBoxDataForSchedGroup.ksParam_tsEffective,  '' if oMember is None else oMember.tsEffective,
     923                          sPrefix, TestBoxDataForSchedGroup.ksParam_uidAuthor,    '' if oMember is None else oMember.uidAuthor,
     924                          SchedGroupDataEx.ksParam_aoTestBoxes, '' if oMember is None else ' checked', sCheckBoxAttr,
     925                          oTestBox.idTestBox, oTestBox.idTestBox, escapeElem(oTestBox.sName),
     926                          ));
     927            self._add(u'    <td align="left">%s</td>\n' % ( escapeElem(oTestBox.sName), ));
     928
     929            self._add(u'    <td align="center">\n'
     930                      u'      <input name="%s[%s]" type="text" value="%s" style="max-width:3em;" %s>\n'
     931                      u'    </td>\n'
     932                      % ( sPrefix,
     933                          TestBoxDataForSchedGroup.ksParam_iSchedPriority,
     934                          (oMember if oMember is not None else oDefMember).iSchedPriority,
     935                          ' readonly class="tmform-input-readonly"' if fReadOnly else '', ));
     936
     937            self._add(u'  </tr>\n');
     938        return self._add(u' </tbody>\n'
     939                         u'</table>\n');
     940
    864941    def addListOfSchedGroupsForTestBox(self, sName, aoInSchedGroups, aoAllSchedGroups, sLabel,  # pylint: disable=too-many-locals
    865942                                       fReadOnly = None):
     
    880957        self._addLabel(sName, sLabel);
    881958        if not aoAllSchedGroups:
    882             return self._add('<li>No scheduling groups available.</li>\n')
     959            return self._add('<li>No scheduling groups.</li>\n')
    883960
    884961        # Add special parameter with all the scheduling group IDs in the form.
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