Changeset 83403 in vbox for trunk/src/VBox
- Timestamp:
- Mar 25, 2020 12:09:58 PM (5 years ago)
- Location:
- trunk/src/VBox/ValidationKit/testmanager/webui
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/webui/wuiadminschedgroup.py
r83385 r83403 37 37 from testmanager.core.testbox import TestBoxData, TestBoxLogic; 38 38 from testmanager.webui.wuicontentbase import WuiFormContentBase, WuiListContentBase, WuiTmLink, WuiRawHtml; 39 from testmanager.webui.wuiadmintestbox import WuiTestBoxDetailsLink; 39 40 40 41 … … 154 155 oTestBox = oRelation.oTestBox; 155 156 if oTestBox: 156 aoTestBoxes.append(WuiTmLink(oTestBox.sName, WuiAdmin.ksScriptName, 157 { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestBoxDetails, 158 TestBoxData.ksParam_idTestBox: oTestBox.idTestBox, 159 WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, }, 160 sTitle = '#%s - %s / %s - %s.%s (%s)' 161 % (oTestBox.idTestBox, oTestBox.ip, oTestBox.uuidSystem, oTestBox.sOs, 162 oTestBox.sCpuArch, oTestBox.sOsVersion,))); 157 aoTestBoxes.append(WuiTestBoxDetailsLink(oTestBox, fBracketed = True, tsNow = self._tsEffectiveDate)); 163 158 else: 164 159 aoTestBoxes.append(WuiRawHtml('#%s' % (oRelation.idTestBox,))); -
trunk/src/VBox/ValidationKit/testmanager/webui/wuiadmintestbox.py
r83385 r83403 45 45 46 46 47 class WuiTestBoxDetailsLink (WuiTmLink):47 class WuiTestBoxDetailsLinkById(WuiTmLink): 48 48 """ Test box details link by ID. """ 49 49 50 def __init__(self, idTestBox, sName = WuiContentBase.ksShortDetailsLink, fBracketed = False, tsNow = None ):50 def __init__(self, idTestBox, sName = WuiContentBase.ksShortDetailsLink, fBracketed = False, tsNow = None, sTitle = None): 51 51 from testmanager.webui.wuiadmin import WuiAdmin; 52 52 dParams = { … … 56 56 if tsNow is not None: 57 57 dParams[WuiAdmin.ksParamEffectiveDate] = tsNow; ## ?? 58 WuiTmLink.__init__(self, sName, WuiAdmin.ksScriptName, dParams, fBracketed = fBracketed );58 WuiTmLink.__init__(self, sName, WuiAdmin.ksScriptName, dParams, fBracketed = fBracketed, sTitle = sTitle); 59 59 self.idTestBox = idTestBox; 60 60 61 62 class WuiTestBoxDetailsLink(WuiTestBoxDetailsLinkById): 63 """ Test box details link by TestBoxData instance. """ 64 65 def __init__(self, oTestBox, sName = None, fBracketed = False, tsNow = None): # (TestBoxData, str, bool, Any) -> None 66 WuiTestBoxDetailsLinkById.__init__(self, oTestBox.idTestBox, 67 sName if sName else oTestBox.sName, 68 fBracketed = fBracketed, 69 tsNow = tsNow, 70 sTitle = self.formatTitleText(oTestBox)); 71 self.oTestBox = oTestBox; 72 73 @staticmethod 74 def formatTitleText(oTestBox): # (TestBoxData) -> str 75 """ 76 Formats the title text for a TestBoxData object. 77 """ 78 79 # Note! Somewhat similar code is found in testresults.py 80 81 # 82 # Collect field/value tuples. 83 # 84 aasTestBoxTitle = [ 85 (u'Identifier:', '#%u' % (oTestBox.idTestBox,),), 86 (u'Name:', oTestBox.sName,), 87 ]; 88 if oTestBox.sCpuVendor: 89 aasTestBoxTitle.append((u'CPU\u00a0vendor:', oTestBox.sCpuVendor, )); 90 if oTestBox.sCpuName: 91 aasTestBoxTitle.append((u'CPU\u00a0name:', u'\u00a0'.join(oTestBox.sCpuName.split()),)); 92 if oTestBox.cCpus: 93 aasTestBoxTitle.append((u'CPU\u00a0threads:', u'%s' % ( oTestBox.cCpus, ),)); 94 95 asFeatures = []; 96 if oTestBox.fCpuHwVirt is True: 97 if oTestBox.sCpuVendor is None: 98 asFeatures.append(u'HW\u2011Virt'); 99 elif oTestBox.sCpuVendor in ['AuthenticAMD',]: 100 asFeatures.append(u'HW\u2011Virt(AMD\u2011V)'); 101 else: 102 asFeatures.append(u'HW\u2011Virt(VT\u2011x)'); 103 if oTestBox.fCpuNestedPaging is True: asFeatures.append(u'Nested\u2011Paging'); 104 if oTestBox.fCpu64BitGuest is True: asFeatures.append(u'64\u2011bit\u2011Guest'); 105 if oTestBox.fChipsetIoMmu is True: asFeatures.append(u'I/O\u2011MMU'); 106 aasTestBoxTitle.append((u'CPU\u00a0features:', u',\u00a0'.join(asFeatures),)); 107 108 if oTestBox.cMbMemory: 109 aasTestBoxTitle.append((u'System\u00a0RAM:', u'%s MiB' % ( oTestBox.cMbMemory, ),)); 110 if oTestBox.sOs: 111 aasTestBoxTitle.append((u'OS:', oTestBox.sOs, )); 112 if oTestBox.sCpuArch: 113 aasTestBoxTitle.append((u'OS\u00a0arch:', oTestBox.sCpuArch,)); 114 if oTestBox.sOsVersion: 115 aasTestBoxTitle.append((u'OS\u00a0version:', u'\u00a0'.join(oTestBox.sOsVersion.split()),)); 116 if oTestBox.ip: 117 aasTestBoxTitle.append((u'IP\u00a0address:', u'%s' % ( oTestBox.ip, ),)); 118 119 # 120 # Do a guestimation of the max field name width and pad short 121 # names when constructing the title text lines. 122 # 123 cchMaxWidth = 0; 124 for sEntry, _ in aasTestBoxTitle: 125 cchMaxWidth = max(WuiTestBoxDetailsLink.estimateStringWidth(sEntry), cchMaxWidth); 126 asTestBoxTitle = []; 127 for sEntry, sValue in aasTestBoxTitle: 128 asTestBoxTitle.append(u'%s%s\t\t%s' 129 % (sEntry, WuiTestBoxDetailsLink.getStringWidthPadding(sEntry, cchMaxWidth), sValue)); 130 131 return u'\n'.join(asTestBoxTitle); 132 133 134 class WuiTestBoxDetailsLinkShort(WuiTestBoxDetailsLink): 135 """ Test box details link by TestBoxData instance, but with ksShortDetailsLink as default name. """ 136 137 def __init__(self, oTestBox, sName = WuiContentBase.ksShortDetailsLink, fBracketed = False, 138 tsNow = None): # (TestBoxData, str, bool, Any) -> None 139 WuiTestBoxDetailsLink.__init__(self, oTestBox, sName = sName, fBracketed = fBracketed, tsNow = tsNow); 61 140 62 141 -
trunk/src/VBox/ValidationKit/testmanager/webui/wuicontentbase.py
r83397 r83403 116 116 sFmt = '<a %shref="%s">%s</a>'; 117 117 return sFmt % (sExtraAttrs, webutils.escapeAttr(self.sUrl), webutils.escapeElem(self.sName)); 118 119 @staticmethod 120 def estimateStringWidth(sString): 121 """ 122 Takes a string and estimate it's width so the caller can pad with 123 U+2002 before tab in a title text. This is very very rough. 124 """ 125 cchWidth = 0; 126 for ch in sString: 127 if ch.isupper() or ch in u'wm\u2007\u2003\u2001\u3000': 128 cchWidth += 2; 129 else: 130 cchWidth += 1; 131 return cchWidth; 132 133 @staticmethod 134 def getStringWidthPaddingEx(cchWidth, cchMaxWidth): 135 """ Works with estiamteStringWidth(). """ 136 if cchWidth + 2 <= cchMaxWidth: 137 return u'\u2002' * ((cchMaxWidth - cchWidth) * 2 // 3) 138 return u''; 139 140 @staticmethod 141 def getStringWidthPadding(sString, cchMaxWidth): 142 """ Works with estiamteStringWidth(). """ 143 return WuiLinkBase.getStringWidthPaddingEx(WuiLinkBase.estimateStringWidth(sString), cchMaxWidth); 144 145 @staticmethod 146 def padStringToWidth(sString, cchMaxWidth): 147 """ Works with estimateStringWidth. """ 148 cchWidth = WuiLinkBase.estimateStringWidth(sString); 149 if cchWidth < cchMaxWidth: 150 return sString + WuiLinkBase.getStringWidthPaddingEx(cchWidth, cchMaxWidth); 151 return sString; 118 152 119 153 -
trunk/src/VBox/ValidationKit/testmanager/webui/wuihlpform.py
r83396 r83403 886 886 from testmanager.webui.wuiadmin import WuiAdmin; 887 887 from testmanager.webui.wuicontentbase import WuiAdminLink; 888 from testmanager.webui.wuiadmintestbox import WuiTestBoxDetailsLink; 888 889 889 890 if not fUseTable: … … 927 928 escapeAttr("Priority [0..31]. Higher value means run more often.") )); 928 929 929 asFeatures = [];930 if oTestBox.fCpuHwVirt:931 asFeatures.append('AMD-V' if oTestBox.sCpuVendor in ['AuthenticAMD',] else 'VT-x');932 if oTestBox.fCpuNestedPaging:933 asFeatures.append('Nested-Paging');934 if oTestBox.fCpu64BitGuest:935 asFeatures.append('64-bit-Guest');936 if oTestBox.fChipsetIoMmu:937 asFeatures.append('IOMMU');938 930 self._add(u' <span class="tmform-testbox-name">%s</span>\n' 939 % ( WuiAdminLink('%s (%s)' % (oTestBox.sName, oTestBox.sOs), 940 WuiAdmin.ksActionTestBoxDetails, fBracketed = False, 941 dParams = { oTestBox.ksParam_idGenTestBox: oTestBox.idGenTestBox}, 942 sTitle = 'CPU: \t%s\n' 943 'Threads: \t%u - %s\n' 944 'Features:\t%s\n' 945 'RAM: \t%u MiB\n' 946 'OpSys: \t%s - %s\n' 947 'Arch: \t%s\n' 948 'IP-Addr: \t%s\n' 949 % ( ' '.join(oTestBox.sCpuName.split()), 950 oTestBox.cCpus, oTestBox.sCpuVendor, 951 ', '.join(asFeatures), 952 oTestBox.cMbMemory, 953 oTestBox.sOs, oTestBox.sOsVersion, 954 oTestBox.sCpuArch, 955 oTestBox.ip 956 )), )); 931 % ( WuiTestBoxDetailsLink(oTestBox, sName = '%s (%s)' % (oTestBox.sName, oTestBox.sOs,)),)); 957 932 self._add(u' </div>\n'); 958 933 return self._add(u' </div></div></div>\n' -
trunk/src/VBox/ValidationKit/testmanager/webui/wuireport.py
r82968 r83403 36 36 from testmanager.webui.wuitestresult import WuiTestSetLink, WuiTestResultsForTestCaseLink, WuiTestResultsForTestBoxLink; 37 37 from testmanager.webui.wuiadmintestcase import WuiTestCaseDetailsLink; 38 from testmanager.webui.wuiadmintestbox import WuiTestBoxDetailsLink ;38 from testmanager.webui.wuiadmintestbox import WuiTestBoxDetailsLinkShort; 39 39 from testmanager.core.report import ReportModelBase, ReportFilter; 40 40 from testmanager.core.testresults import TestResultFilter; … … 721 721 def _formatEdgeOccurenceSubject(self, oTransient): 722 722 sHtml = u'%s ' % ( webutils.escapeElem(oTransient.oSubject.sName),); 723 sHtml += WuiTestBoxDetailsLink (oTransient.oSubject.idTestBox, fBracketed = False).toHtml();723 sHtml += WuiTestBoxDetailsLinkShort(oTransient.oSubject).toHtml(); 724 724 return sHtml; 725 725 … … 732 732 sHtml += WuiTestResultsForTestBoxLink(idKey, oTestBox.sName, self._dExtraTestResultsParams).toHtml() 733 733 sHtml += u' '; 734 sHtml += WuiTestBoxDetailsLink (oTestBox.idTestBox).toHtml();734 sHtml += WuiTestBoxDetailsLinkShort(oTestBox).toHtml(); 735 735 sHtml += u' '; 736 736 sHtml += WuiReportSummaryLink(ReportModelBase.ksSubTestBox, oTestBox.idTestBox, -
trunk/src/VBox/ValidationKit/testmanager/webui/wuitestresult.py
r82968 r83403 886 886 sTestBoxTitle += 'OS version:\t%s\n' % ( oEntry.sOsVersion, ); 887 887 asFeatures = []; 888 if oEntry.fCpuHwVirt is True: asFeatures.append(u'HW\u2011Virt'); 888 if oEntry.fCpuHwVirt is True: 889 if oEntry.sCpuVendor is None: 890 asFeatures.append(u'HW\u2011Virt'); 891 elif oEntry.sCpuVendor in ['AuthenticAMD',]: 892 asFeatures.append(u'HW\u2011Virt(AMD\u2011V)'); 893 else: 894 asFeatures.append(u'HW\u2011Virt(VT\u2011x)'); 889 895 if oEntry.fCpuNestedPaging is True: asFeatures.append(u'Nested\u2011Paging'); 890 896 if oEntry.fCpu64BitGuest is True: asFeatures.append(u'64\u2011bit\u2011Guest');
Note:
See TracChangeset
for help on using the changeset viewer.