Changeset 61502 in vbox for trunk/src/VBox/ValidationKit/testmanager/webui
- Timestamp:
- Jun 6, 2016 5:53:01 PM (9 years ago)
- Location:
- trunk/src/VBox/ValidationKit/testmanager/webui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/webui/wuiadmin.py
r61432 r61502 526 526 def _actionTestBoxAdd(self): 527 527 """ Action wrapper. """ 528 from testmanager.core.testbox import TestBoxData ;528 from testmanager.core.testbox import TestBoxDataEx; 529 529 from testmanager.webui.wuiadmintestbox import WuiTestBox; 530 return self._actionGenericFormAdd(TestBoxData , WuiTestBox);530 return self._actionGenericFormAdd(TestBoxDataEx, WuiTestBox); 531 531 532 532 def _actionTestBoxAddPost(self): 533 533 """ Action wrapper. """ 534 from testmanager.core.testbox import TestBoxData , TestBoxLogic;534 from testmanager.core.testbox import TestBoxDataEx, TestBoxLogic; 535 535 from testmanager.webui.wuiadmintestbox import WuiTestBox; 536 return self._actionGenericFormAddPost(TestBoxData , TestBoxLogic, WuiTestBox, self.ksActionTestBoxList);536 return self._actionGenericFormAddPost(TestBoxDataEx, TestBoxLogic, WuiTestBox, self.ksActionTestBoxList); 537 537 538 538 def _actionTestBoxDetails(self): 539 539 """ Action wrapper. """ 540 from testmanager.core.testbox import TestBoxData , TestBoxLogic;540 from testmanager.core.testbox import TestBoxDataEx, TestBoxLogic; 541 541 from testmanager.webui.wuiadmintestbox import WuiTestBox; 542 return self._actionGenericFormDetails(TestBoxData , TestBoxLogic, WuiTestBox, 'idTestBox', 'idGenTestBox');542 return self._actionGenericFormDetails(TestBoxDataEx, TestBoxLogic, WuiTestBox, 'idTestBox', 'idGenTestBox'); 543 543 544 544 def _actionTestBoxEdit(self): 545 545 """ Action wrapper. """ 546 from testmanager.core.testbox import TestBoxData ;546 from testmanager.core.testbox import TestBoxDataEx; 547 547 from testmanager.webui.wuiadmintestbox import WuiTestBox; 548 return self._actionGenericFormEdit(TestBoxData , WuiTestBox, TestBoxData.ksParam_idTestBox);548 return self._actionGenericFormEdit(TestBoxDataEx, WuiTestBox, TestBoxDataEx.ksParam_idTestBox); 549 549 550 550 def _actionTestBoxEditPost(self): 551 551 """ Action wrapper. """ 552 from testmanager.core.testbox import TestBoxData , TestBoxLogic;552 from testmanager.core.testbox import TestBoxDataEx, TestBoxLogic; 553 553 from testmanager.webui.wuiadmintestbox import WuiTestBox; 554 return self._actionGenericFormEditPost(TestBoxData , TestBoxLogic,WuiTestBox, self.ksActionTestBoxList);554 return self._actionGenericFormEditPost(TestBoxDataEx, TestBoxLogic,WuiTestBox, self.ksActionTestBoxList); 555 555 556 556 def _actionTestBoxRemovePost(self): -
trunk/src/VBox/ValidationKit/testmanager/webui/wuiadmintestbox.py
r61472 r61502 39 39 from testmanager.core.db import TMDatabaseConnection; 40 40 from testmanager.core.schedgroup import SchedGroupLogic, SchedGroupData; 41 from testmanager.core.testbox import TestBoxData ;41 from testmanager.core.testbox import TestBoxData, TestBoxDataEx; 42 42 from testmanager.core.testset import TestSetData; 43 43 from testmanager.core.db import isDbTimestampInfinity; … … 102 102 oForm.addText( TestBoxData.ksParam_sName, oData.sName, 'TestBox Name'); 103 103 oForm.addText( TestBoxData.ksParam_sDescription, oData.sDescription, 'TestBox Description'); 104 oForm.addComboBox( TestBoxData.ksParam_idSchedGroup, oData.idSchedGroup, 'Scheduling Group',105 SchedGroupLogic(TMDatabaseConnection()).getSchedGroupsForCombo());106 104 oForm.addCheckBox( TestBoxData.ksParam_fEnabled, oData.fEnabled, 'Enabled'); 107 105 oForm.addComboBox( TestBoxData.ksParam_enmLomKind, oData.enmLomKind, 'Lights-out-management', … … 110 108 oForm.addInt( TestBoxData.ksParam_pctScaleTimeout, oData.pctScaleTimeout, 'Timeout scale factor (%)'); 111 109 112 ## @todo Pretty format the read-only fields and use hidden fields for 113 # passing the actual values. (Yes, we need the values so we can 114 # display the form correctly on input error.) 110 oForm.addListOfSchedGroupsForTestBox(TestBoxDataEx.ksParam_aoInSchedGroups, 111 oData.aoInSchedGroups, 112 SchedGroupLogic(TMDatabaseConnection()).fetchOrderedByName(), 113 'Scheduling Group'); 114 # Command, comment and submit button. 115 if self._sMode == WuiFormContentBase.ksMode_Edit: 116 oForm.addComboBox(TestBoxData.ksParam_enmPendingCmd, oData.enmPendingCmd, 'Pending command', 117 TestBoxData.kaoTestBoxCmdDescs); 118 else: 119 oForm.addComboBoxRO(TestBoxData.ksParam_enmPendingCmd, oData.enmPendingCmd, 'Pending command', 120 TestBoxData.kaoTestBoxCmdDescs); 121 oForm.addMultilineText(TestBoxData.ksParam_sComment, oData.sComment, 'Comment'); 122 if self._sMode != WuiFormContentBase.ksMode_Show: 123 oForm.addSubmit('Create TestBox' if self._sMode == WuiFormContentBase.ksMode_Add else 'Change TestBox'); 124 125 return True; 126 127 128 def _generatePostFormContent(self, oData): 129 from testmanager.webui.wuihlpform import WuiHlpForm; 130 131 oForm = WuiHlpForm('testbox-machine-settable', '', fReadOnly = True); 115 132 oForm.addTextRO( TestBoxData.ksParam_sOs, oData.sOs, 'TestBox OS'); 116 133 oForm.addTextRO( TestBoxData.ksParam_sOsVersion, oData.sOsVersion, 'TestBox OS version'); … … 138 155 oForm.addIntRO( TestBoxData.ksParam_iPythonHexVersion, oData.iPythonHexVersion, 139 156 'Python version (hex)', sPostHtml = webutils.escapeElem(sHexVer)); 140 141 if self._sMode == WuiFormContentBase.ksMode_Edit: 142 oForm.addComboBox(TestBoxData.ksParam_enmPendingCmd, oData.enmPendingCmd, 'Pending command', 143 TestBoxData.kaoTestBoxCmdDescs); 144 else: 145 oForm.addComboBoxRO(TestBoxData.ksParam_enmPendingCmd, oData.enmPendingCmd, 'Pending command', 146 TestBoxData.kaoTestBoxCmdDescs); 147 148 oForm.addMultilineText(TestBoxData.ksParam_sComment, oData.sComment, 'Comment'); 149 150 if self._sMode != WuiFormContentBase.ksMode_Show: 151 oForm.addSubmit('Create TestBox' if self._sMode == WuiFormContentBase.ksMode_Add else 'Change TestBox'); 152 153 return True; 157 return [('Machine Only Settables', oForm.finalize()),]; 158 154 159 155 160 … … 173 178 174 179 def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp): 180 # type: (list[TestBoxDataForListing], int, int, datetime.datetime, ignore, WuiAdmin) -> None 175 181 WuiListContentWithActionBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, 176 182 sTitle = 'TestBoxes', sId = 'users', fnDPrint = fnDPrint, oDisp = oDisp); … … 237 243 oComment = self._formatCommentCell(oEntry.sComment); 238 244 239 # Group link. 240 oGroup = self._dSchedGroups.get(oEntry.idSchedGroup); 241 oGroupLink = WuiTmLink(oGroup.sName if oGroup is not None else str(oEntry.idSchedGroup), 242 WuiAdmin.ksScriptName, 243 { WuiAdmin.ksParamAction: WuiAdmin.ksActionSchedGroupEdit, 244 SchedGroupData.ksParam_idSchedGroup: oEntry.idSchedGroup, }, 245 sTitle = '#%u' % (oEntry.idSchedGroup,), 246 fBracketed = False); 245 # Group links. 246 aoGroups = []; 247 for oInGroup in oEntry.aoInSchedGroups: 248 oSchedGroup = oInGroup.oSchedGroup; 249 aoGroups.append(WuiTmLink(oSchedGroup.sName, WuiAdmin.ksScriptName, 250 { WuiAdmin.ksParamAction: WuiAdmin.ksActionSchedGroupEdit, 251 SchedGroupData.ksParam_idSchedGroup: oSchedGroup.idSchedGroup, }, 252 sTitle = '#%u' % (oSchedGroup.idSchedGroup,), 253 fBracketed = len(oEntry.aoInSchedGroups) > 1)); 247 254 248 255 # Reformat the OS version to take less space. … … 338 345 WuiSvnLink(oEntry.iTestBoxScriptRev), 339 346 oEntry.formatPythonVersion(), 340 oGroupLink,347 aoGroups, 341 348 aoOs, 342 349 oCpu, -
trunk/src/VBox/ValidationKit/testmanager/webui/wuibase.py
r61439 r61502 316 316 # 317 317 318 def getStringParam(self, sName, asValidValues = None, sDefault = None ):318 def getStringParam(self, sName, asValidValues = None, sDefault = None, fAllowNull = False): 319 319 """ 320 320 Gets a string parameter. … … 328 328 raise WuiException('%s parameter "%s" is given multiple times: "%s"' % (self._sAction, sName, sValue)); 329 329 sValue = sValue.strip(); 330 elif sDefault is None :330 elif sDefault is None and fAllowNull is not True: 331 331 raise WuiException('%s is missing parameters: "%s"' % (self._sAction, sName,)); 332 332 else: -
trunk/src/VBox/ValidationKit/testmanager/webui/wuihlpform.py
r61468 r61502 763 763 For WuiAdminSchedGroup. 764 764 """ 765 if self._fReadOnly:766 fReadOnly = True;765 if fReadOnly is None or self._fReadOnly: 766 fReadOnly = self._fReadOnly; 767 767 assert len(aoSchedGroupMembers) <= len(aoAllTestGroups); 768 768 self._addLabel(sName, sLabel); … … 857 857 u'</table>\n'); 858 858 859 def addListOfSchedGroupsForTestBox(self, sName, aoInSchedGroups, aoAllSchedGroups, sLabel, # pylint: disable=R0914 860 fReadOnly = None): 861 # type: (str, TestBoxInSchedGroupDataEx, SchedGroupData, str, bool) -> str 862 """ 863 For WuiTestGroup. 864 """ 865 from testmanager.core.testbox import TestBoxInSchedGroupData, TestBoxDataEx; 866 867 if fReadOnly is None or self._fReadOnly: 868 fReadOnly = self._fReadOnly; 869 assert len(aoInSchedGroups) <= len(aoAllSchedGroups); 870 871 # Only show selected groups in read-only mode. 872 if fReadOnly: 873 aoAllSchedGroups = [oCur.oSchedGroup for oCur in aoInSchedGroups] 874 875 self._addLabel(sName, sLabel); 876 if len(aoAllSchedGroups) == 0: 877 return self._add('<li>No scheduling groups available.</li>\n') 878 879 # Add special parameter with all the scheduling group IDs in the form. 880 self._add(u'<input name="%s" type="hidden" value="%s">\n' 881 % ( TestBoxDataEx.ksParam_aidSchedGroups, 882 ','.join([unicode(oSchedGroup.idSchedGroup) for oSchedGroup in aoAllSchedGroups]), )); 883 884 # Table header. 885 self._add(u'<table class="tmformtbl">\n' 886 u' <thead>\n' 887 u' <tr>\n' 888 u' <th rowspan="2"></th>\n' 889 u' <th rowspan="2">Schedulding Grooup</th>\n' 890 u' <th rowspan="2">Priority [0..31]</th>\n' 891 u' </tr>\n' 892 u' </thead>\n' 893 u' <tbody>\n' 894 ); 895 896 # Table body. 897 if self._fReadOnly: 898 fReadOnly = True; 899 sCheckBoxAttr = ' readonly onclick="return false" onkeydown="return false"' if fReadOnly else ''; 900 901 oDefMember = TestBoxInSchedGroupData(); 902 aoInSchedGroups = list(aoInSchedGroups); # Copy it so we can pop. 903 for iSchedGroup, oSchedGroup in enumerate(aoAllSchedGroups): 904 905 # Is it a member? 906 oMember = None; 907 for i, _ in enumerate(aoInSchedGroups): 908 if aoInSchedGroups[i].idSchedGroup == oSchedGroup.idSchedGroup: 909 oMember = aoInSchedGroups.pop(i); 910 break; 911 912 # Start on the rows... 913 sPrefix = u'%s[%d]' % (sName, oSchedGroup.idSchedGroup,); 914 self._add(u' <tr class="%s">\n' 915 u' <td>\n' 916 u' <input name="%s[%s]" type="hidden" value="%s">\n' # idSchedGroup 917 u' <input name="%s[%s]" type="hidden" value="%s">\n' # idTestBox 918 u' <input name="%s[%s]" type="hidden" value="%s">\n' # tsExpire 919 u' <input name="%s[%s]" type="hidden" value="%s">\n' # tsEffective 920 u' <input name="%s[%s]" type="hidden" value="%s">\n' # uidAuthor 921 u' <input name="%s" type="checkbox"%s%s value="%d" class="tmform-checkbox" title="#%d - %s">\n' #(list) 922 u' </td>\n' 923 % ( 'tmodd' if iSchedGroup & 1 else 'tmeven', 924 sPrefix, TestBoxInSchedGroupData.ksParam_idSchedGroup, oSchedGroup.idSchedGroup, 925 sPrefix, TestBoxInSchedGroupData.ksParam_idTestBox, -1 if oMember is None else oMember.idTestBox, 926 sPrefix, TestBoxInSchedGroupData.ksParam_tsExpire, '' if oMember is None else oMember.tsExpire, 927 sPrefix, TestBoxInSchedGroupData.ksParam_tsEffective, '' if oMember is None else oMember.tsEffective, 928 sPrefix, TestBoxInSchedGroupData.ksParam_uidAuthor, '' if oMember is None else oMember.uidAuthor, 929 TestBoxDataEx.ksParam_aoInSchedGroups, '' if oMember is None else ' checked', sCheckBoxAttr, 930 oSchedGroup.idSchedGroup, oSchedGroup.idSchedGroup, escapeElem(oSchedGroup.sName), 931 )); 932 self._add(u' <td align="left">%s</td>\n' % ( escapeElem(oSchedGroup.sName), )); 933 934 self._add(u' <td align="center">\n' 935 u' <input name="%s[%s]" type="text" value="%s" style="max-width:3em;" %s>\n' 936 u' </td>\n' 937 % ( sPrefix, TestBoxInSchedGroupData.ksParam_iSchedPriority, 938 (oMember if oMember is not None else oDefMember).iSchedPriority, 939 ' readonly class="tmform-input-readonly"' if fReadOnly else '', )); 940 self._add(u' </tr>\n'); 941 942 return self._add(u' </tbody>\n' 943 u'</table>\n'); 944 945 859 946 # 860 947 # Buttons.
Note:
See TracChangeset
for help on using the changeset viewer.