- Timestamp:
- Mar 21, 2020 1:43:17 PM (5 years ago)
- Location:
- trunk/src/VBox/ValidationKit/testmanager
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/htdocs/css/common.css
r82968 r83360 528 528 } 529 529 530 /* 531 * Time navigation forms on a line with some padding between them. 532 */ 533 .tmtimenav form { 534 display: inline-block; 535 } 536 537 .tmtimenav form + form { 538 padding-left: 0.6em; 539 } 540 541 /* 542 * Items per page and next. 543 */ 544 .tmnextanditemsperpage form { 545 display: inline-block; 546 padding-left: 1em; 547 } 530 548 531 549 /* -
trunk/src/VBox/ValidationKit/testmanager/htdocs/js/common.js
r82968 r83360 480 480 481 481 return true; 482 } 483 484 485 /** 486 * Used by the time navigation to update the hidden efficient date field when 487 * either of the date or time fields changes. 488 * 489 * @param oForm The form. 490 */ 491 function timeNavigationUpdateHiddenEffDate(oForm, sIdSuffix) 492 { 493 var sDate = document.getElementById('EffDate' + sIdSuffix).value; 494 var sTime = document.getElementById('EffTime' + sIdSuffix).value; 495 496 var oField = document.getElementById('EffDateTime' + sIdSuffix); 497 oField.value = sDate + 'T' + sTime + '.00Z'; 482 498 } 483 499 -
trunk/src/VBox/ValidationKit/testmanager/webui/wuiadmin.py
r83341 r83360 428 428 429 429 tsEffective = self.getEffectiveDateParam(); 430 cItemsPerPage = self.getIntParam(self.ksParamItemsPerPage, iMin = 2, iMax = 9999, iDefault = 3 00);430 cItemsPerPage = self.getIntParam(self.ksParamItemsPerPage, iMin = 2, iMax = 9999, iDefault = 384); 431 431 iPage = self.getIntParam(self.ksParamPageNo, iMin = 0, iMax = 999999, iDefault = 0); 432 432 cDaysBack = self.getIntParam(self.ksParamDaysBack, iMin = 1, iMax = 366, iDefault = 14); -
trunk/src/VBox/ValidationKit/testmanager/webui/wuibase.py
r82968 r83360 819 819 """ 820 820 tsEffective = self.getEffectiveDateParam(); 821 cItemsPerPage = self.getIntParam(self.ksParamItemsPerPage, iMin = 2, iMax = 9999, iDefault = 3 00);821 cItemsPerPage = self.getIntParam(self.ksParamItemsPerPage, iMin = 2, iMax = 9999, iDefault = 384); 822 822 iPage = self.getIntParam(self.ksParamPageNo, iMin = 0, iMax = 999999, iDefault = 0); 823 823 aiSortColumnsDup = self.getListOfIntParams(self.ksParamSortColumns, -
trunk/src/VBox/ValidationKit/testmanager/webui/wuicontentbase.py
r83338 r83360 35 35 36 36 # Validation Kit imports. 37 from common import webutils;37 from common import utils, webutils; 38 38 from testmanager import config; 39 39 from testmanager.webui.wuibase import WuiDispatcherBase, WuiException; … … 849 849 return sRow + u' </tr>\n'; 850 850 851 def _generateTimeNavigation(self, sWhere): 851 @staticmethod 852 def generateTimeNavigationComboBox(sWhere, dParams, tsEffective): 853 """ 854 Generates the HTML for the xxxx ago combo box form. 855 """ 856 sNavigation = '<form name="TmTimeNavCombo-%s" method="GET">\n' % (sWhere,); 857 sNavigation += ' <select name="%s" onchange="window.location=' % (WuiDispatcherBase.ksParamEffectiveDate); 858 sNavigation += '\'?%s&%s=\' + ' % (webutils.encodeUrlParams(dParams), WuiDispatcherBase.ksParamEffectiveDate) 859 sNavigation += 'this.options[this.selectedIndex].value;" title="Effective date">\n'; 860 861 aoWayBackPoints = [ 862 ('+0000-00-00 00:00:00.00', 'Now', ' title="Present Day. Present Time."'), # lain :) 863 864 ('-0000-00-00 01:00:00.00', '1 hour ago', ''), 865 ('-0000-00-00 02:00:00.00', '2 hours ago', ''), 866 ('-0000-00-00 03:00:00.00', '3 hours ago', ''), 867 868 ('-0000-00-01 00:00:00.00', '1 day ago', ''), 869 ('-0000-00-02 00:00:00.00', '2 days ago', ''), 870 ('-0000-00-03 00:00:00.00', '3 days ago', ''), 871 872 ('-0000-00-07 00:00:00.00', '1 week ago', ''), 873 ('-0000-00-14 00:00:00.00', '2 weeks ago', ''), 874 ('-0000-00-21 00:00:00.00', '3 weeks ago', ''), 875 876 ('-0000-01-00 00:00:00.00', '1 month ago', ''), 877 ('-0000-02-00 00:00:00.00', '2 months ago', ''), 878 ('-0000-03-00 00:00:00.00', '3 months ago', ''), 879 ('-0000-04-00 00:00:00.00', '4 months ago', ''), 880 ('-0000-05-00 00:00:00.00', '5 months ago', ''), 881 ('-0000-06-00 00:00:00.00', 'Half a year ago', ''), 882 883 ('-0001-00-00 00:00:00.00', '1 year ago', ''), 884 ] 885 fSelected = False; 886 for sTimestamp, sWayBackPointCaption, sExtraAttrs in aoWayBackPoints: 887 if sTimestamp == tsEffective: 888 fSelected = True; 889 sNavigation += ' <option value="%s"%s%s>%s</option>\n' \ 890 % (webutils.quoteUrl(sTimestamp), 891 ' selected="selected"' if sTimestamp == tsEffective else '', 892 sExtraAttrs, sWayBackPointCaption, ); 893 if not fSelected and tsEffective != '': 894 sNavigation += ' <option value="%s" selected>%s</option>\n' \ 895 % (webutils.quoteUrl(tsEffective), WuiContentBase.formatTsShort(tsEffective)) 896 897 sNavigation += ' </select>\n' \ 898 '</form>\n'; 899 return sNavigation; 900 901 @staticmethod 902 def generateTimeNavigationDateTime(sWhere, dParams, sNow): 903 """ 904 Generates HTML for a form with date + time input fields. 905 906 Note! Modifies dParams! 907 """ 908 909 # 910 # Date + time input fields. We use a java script helper to combine the two 911 # into a hidden field as there is no portable datetime input field type. 912 # 913 sNavigation = '<form method="get" action="?" onchange="timeNavigationUpdateHiddenEffDate(this,\'%s\')">' % (sWhere,); 914 if sNow is None: 915 sNow = utils.getIsoTimestamp(); 916 else: 917 sNow = utils.normalizeIsoTimestampToZulu(sNow); 918 asSplit = sNow.split('T'); 919 sNavigation += ' <input type="date" value="%s" id="EffDate%s"/> ' % (asSplit[0], sWhere, ); 920 sNavigation += ' <input type="time" value="%s" id="EffTime%s"/> ' % (asSplit[1][:8], sWhere,); 921 sNavigation += ' <input type="hidden" name="%s" value="%s" id="EffDateTime%s"/>' \ 922 % (WuiDispatcherBase.ksParamEffectiveDate, webutils.escapeAttr(sNow), sWhere); 923 for sKey in dParams: 924 sNavigation += ' <input type="hidden" name="%s" value="%s"/>' \ 925 % (webutils.escapeAttr(sKey), webutils.escapeAttrToStr(dParams[sKey])); 926 sNavigation += ' <input type="submit" value="Set"/>\n' \ 927 '</form>\n'; 928 return sNavigation; 929 930 ## @todo move to better place! WuiMain uses it. 931 @staticmethod 932 def generateTimeNavigation(sWhere, dParams, tsEffectiveAbs, sPreamble = '', sPostamble = '', fKeepPageNo = False): 852 933 """ 853 934 Returns HTML for time navigation. 854 935 936 Note! Modifies dParams! 855 937 Note! Views without a need for a timescale just stubs this method. 856 938 """ 857 _ = sWhere; 858 sNavigation = ''; 859 860 dParams = self._oDisp.getParameters(); 861 dParams[WuiDispatcherBase.ksParamItemsPerPage] = self._cItemsPerPage; 862 dParams[WuiDispatcherBase.ksParamPageNo] = self._iPage; 863 864 if WuiDispatcherBase.ksParamEffectiveDate in dParams: 939 sNavigation = '<div class="tmtimenav-%s tmtimenav">%s' % (sWhere, sPreamble,); 940 941 # 942 # Prepare the URL parameters. 943 # 944 if WuiDispatcherBase.ksParamPageNo in dParams: # Forget about page No when changing a period 945 del dParams[WuiDispatcherBase.ksParamPageNo] 946 if not fKeepPageNo and WuiDispatcherBase.ksParamEffectiveDate in dParams: 947 tsEffectiveParam = dParams[WuiDispatcherBase.ksParamEffectiveDate]; 865 948 del dParams[WuiDispatcherBase.ksParamEffectiveDate]; 866 sNavigation += ' [<a href="?%s">Now</a>]' % (webutils.encodeUrlParams(dParams),); 867 868 dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-00 01:00:00.00'; 869 sNavigation += ' [<a href="?%s">1</a>' % (webutils.encodeUrlParams(dParams),); 870 871 dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-00 02:00:00.00'; 872 sNavigation += ', <a href="?%s">2</a>' % (webutils.encodeUrlParams(dParams),); 873 874 dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-00 06:00:00.00'; 875 sNavigation += ', <a href="?%s">6</a>' % (webutils.encodeUrlParams(dParams),); 876 877 dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-00 12:00:00.00'; 878 sNavigation += ', <a href="?%s">12</a>' % (webutils.encodeUrlParams(dParams),); 879 880 dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-01 00:00:00.00'; 881 sNavigation += ', or <a href="?%s">24</a> hours ago]' % (webutils.encodeUrlParams(dParams),); 882 883 884 dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-02 00:00:00.00'; 885 sNavigation += ' [<a href="?%s">2</a>' % (webutils.encodeUrlParams(dParams),); 886 887 dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-03 00:00:00.00'; 888 sNavigation += ', <a href="?%s">3</a>' % (webutils.encodeUrlParams(dParams),); 889 890 dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-05 00:00:00.00'; 891 sNavigation += ', <a href="?%s">5</a>' % (webutils.encodeUrlParams(dParams),); 892 893 dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-07 00:00:00.00'; 894 sNavigation += ', <a href="?%s">7</a>' % (webutils.encodeUrlParams(dParams),); 895 896 dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-14 00:00:00.00'; 897 sNavigation += ', <a href="?%s">14</a>' % (webutils.encodeUrlParams(dParams),); 898 899 dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-21 00:00:00.00'; 900 sNavigation += ', <a href="?%s">21</a>' % (webutils.encodeUrlParams(dParams),); 901 902 dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-28 00:00:00.00'; 903 sNavigation += ', or <a href="?%s">28</a> days ago]' % (webutils.encodeUrlParams(dParams),); 904 949 else: 950 tsEffectiveParam = '' 951 952 # 953 # Generate the individual parts. 954 # 955 sNavigation += WuiListContentBase.generateTimeNavigationDateTime(sWhere, dParams, tsEffectiveAbs); 956 sNavigation += WuiListContentBase.generateTimeNavigationComboBox(sWhere, dParams, tsEffectiveParam); 957 958 sNavigation += '%s</div>' % (sPostamble,); 905 959 return sNavigation; 960 961 def _generateTimeNavigation(self, sWhere, sPreamble = '', sPostamble = ''): 962 """ 963 Returns HTML for time navigation. 964 965 Note! Views without a need for a timescale just stubs this method. 966 """ 967 return self.generateTimeNavigation(sWhere, self._oDisp.getParameters(), self._oDisp.getEffectiveDateParam(), 968 sPreamble, sPostamble) 969 970 @staticmethod 971 def generateItemPerPageSelector(sWhere, dParams, cCurItemsPerPage): 972 """ 973 Generate HTML code for items per page selector. 974 Note! Modifies dParams! 975 """ 976 977 # Drop the current page count parameter. 978 if WuiDispatcherBase.ksParamItemsPerPage in dParams: 979 del dParams[WuiDispatcherBase.ksParamItemsPerPage]; 980 981 # Remove the current page number. 982 if WuiDispatcherBase.ksParamPageNo in dParams: 983 del dParams[WuiDispatcherBase.ksParamPageNo]; 984 985 sHtmlItemsPerPageSelector = '<form name="TmItemsPerPageForm-%s" method="GET" class="tmitemsperpage-%s tmitemsperpage">\n' \ 986 ' <select name="%s" onchange="window.location=\'?%s&%s=\' + ' \ 987 'this.options[this.selectedIndex].value;" title="Max items per page">\n' \ 988 % (sWhere, WuiDispatcherBase.ksParamItemsPerPage, sWhere, 989 webutils.encodeUrlParams(dParams), 990 WuiDispatcherBase.ksParamItemsPerPage) 991 992 acItemsPerPage = [16, 32, 64, 128, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096]; 993 for cItemsPerPage in acItemsPerPage: 994 sHtmlItemsPerPageSelector += ' <option value="%d" %s>%d per page</option>\n' \ 995 % (cItemsPerPage, 996 'selected="selected"' if cItemsPerPage == cCurItemsPerPage else '', 997 cItemsPerPage) 998 sHtmlItemsPerPageSelector += ' </select>\n' \ 999 '</form>\n'; 1000 1001 return sHtmlItemsPerPageSelector 906 1002 907 1003 … … 937 1033 sNavigation += '</td>'; 938 1034 939 # Next 1035 # page count and next. 1036 sNavigation += '<td align="right" class="tmnextanditemsperpage">\n'; 1037 940 1038 if len(self._aoEntries) > self._cItemsPerPage: 941 1039 dParams[WuiDispatcherBase.ksParamPageNo] = self._iPage + 1; 942 sNavigation += ' <td align="right"><a href="?%s">Next</a></td>\n' % (webutils.encodeUrlParams(dParams),); 943 else: 944 sNavigation += ' <td></td>\n'; 945 1040 sNavigation += ' <a href="?%s">Next</a>\n' % (webutils.encodeUrlParams(dParams),); 1041 sNavigation += self.generateItemPerPageSelector(sWhere, dParams, self._cItemsPerPage); 1042 sNavigation += '</td>\n'; 946 1043 sNavigation += ' </tr>\n' \ 947 1044 ' </table>\n' \ … … 1033 1130 sTitle += ' (page ' + unicode(self._iPage + 1) + ')' 1034 1131 if self._tsEffectiveDate is not None: 1035 sTitle += ' as per ' + unicode(self. _tsEffectiveDate); ## @todo shorten this.1132 sTitle += ' as per ' + unicode(self.formatTsShort(self._tsEffectiveDate)); 1036 1133 return sTitle; 1037 1134 -
trunk/src/VBox/ValidationKit/testmanager/webui/wuimain.py
r82968 r83360 393 393 fBracketed = False).toHtml(); 394 394 395 def _generateTimeSelector(self, dParams, sPreamble, sPostamble):396 """397 Generate HTML code for time selector.398 """399 400 if WuiDispatcherBase.ksParamEffectiveDate in dParams:401 tsEffective = dParams[WuiDispatcherBase.ksParamEffectiveDate]402 del dParams[WuiDispatcherBase.ksParamEffectiveDate]403 else:404 tsEffective = ''405 406 # Forget about page No when changing a period407 if WuiDispatcherBase.ksParamPageNo in dParams:408 del dParams[WuiDispatcherBase.ksParamPageNo]409 410 sHtmlTimeSelector = '<form name="TimeForm" method="GET">\n'411 sHtmlTimeSelector += sPreamble;412 sHtmlTimeSelector += '\n <select name="%s" onchange="window.location=' % WuiDispatcherBase.ksParamEffectiveDate413 sHtmlTimeSelector += '\'?%s&%s=\' + ' % (webutils.encodeUrlParams(dParams), WuiDispatcherBase.ksParamEffectiveDate)414 sHtmlTimeSelector += 'this.options[this.selectedIndex].value;" title="Effective date">\n'415 416 aoWayBackPoints = [417 ('+0000-00-00 00:00:00.00', 'Now', ' title="Present Day. Present Time."'), # lain :)418 419 ('-0000-00-00 01:00:00.00', '1 hour ago', ''),420 ('-0000-00-00 02:00:00.00', '2 hours ago', ''),421 ('-0000-00-00 03:00:00.00', '3 hours ago', ''),422 423 ('-0000-00-01 00:00:00.00', '1 day ago', ''),424 ('-0000-00-02 00:00:00.00', '2 days ago', ''),425 ('-0000-00-03 00:00:00.00', '3 days ago', ''),426 427 ('-0000-00-07 00:00:00.00', '1 week ago', ''),428 ('-0000-00-14 00:00:00.00', '2 weeks ago', ''),429 ('-0000-00-21 00:00:00.00', '3 weeks ago', ''),430 431 ('-0000-01-00 00:00:00.00', '1 month ago', ''),432 ('-0000-02-00 00:00:00.00', '2 months ago', ''),433 ('-0000-03-00 00:00:00.00', '3 months ago', ''),434 ('-0000-04-00 00:00:00.00', '4 months ago', ''),435 ('-0000-05-00 00:00:00.00', '5 months ago', ''),436 ('-0000-06-00 00:00:00.00', 'Half a year ago', ''),437 438 ('-0001-00-00 00:00:00.00', '1 year ago', ''),439 ]440 fSelected = False;441 for sTimestamp, sWayBackPointCaption, sExtraAttrs in aoWayBackPoints:442 if sTimestamp == tsEffective:443 fSelected = True;444 sHtmlTimeSelector += ' <option value="%s"%s%s>%s</option>\n' \445 % (webutils.quoteUrl(sTimestamp),446 ' selected="selected"' if sTimestamp == tsEffective else '',447 sExtraAttrs, sWayBackPointCaption)448 if not fSelected and tsEffective != '':449 sHtmlTimeSelector += ' <option value="%s" selected>%s</option>\n' \450 % (webutils.quoteUrl(tsEffective), tsEffective)451 452 sHtmlTimeSelector += ' </select>\n';453 sHtmlTimeSelector += sPostamble;454 sHtmlTimeSelector += '\n</form>\n'455 456 return sHtmlTimeSelector457 458 395 def _generateTimeWalker(self, dParams, tsEffective, sCurPeriod): 459 396 """ … … 487 424 sNext = ' >>'; 488 425 489 return self._generateTimeSelector(self.getParameters(), sPrev, sNext); 426 from wuicontentbase import WuiListContentBase; ## @todo move to better place. 427 return WuiListContentBase.generateTimeNavigation('top', self.getParameters(), self.getEffectiveDateParam(), 428 sPrev, sNext, False); 490 429 491 430 def _generateResultPeriodSelector(self, dParams, sCurPeriod): … … 603 542 """ 604 543 Generate HTML code for items per page selector 605 """ 606 607 if WuiDispatcherBase.ksParamItemsPerPage in dParams: 608 del dParams[WuiDispatcherBase.ksParamItemsPerPage] 609 610 # Forced reset of the page number 611 dParams[WuiDispatcherBase.ksParamPageNo] = 0 612 sHtmlItemsPerPageSelector = '<form name="AgesPerPageForm" method="GET">\n' \ 613 ' Max <select name="%s" onchange="window.location=\'?%s&%s=\' + ' \ 614 'this.options[this.selectedIndex].value;" title="Max items per page">\n' \ 615 % (WuiDispatcherBase.ksParamItemsPerPage, 616 webutils.encodeUrlParams(dParams), 617 WuiDispatcherBase.ksParamItemsPerPage) 618 619 aiItemsPerPage = [16, 32, 64, 128, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096]; 620 for iItemsPerPage in aiItemsPerPage: 621 sHtmlItemsPerPageSelector += ' <option value="%d" %s>%d</option>\n' \ 622 % (iItemsPerPage, 623 'selected="selected"' if iItemsPerPage == cItemsPerPage else '', 624 iItemsPerPage) 625 sHtmlItemsPerPageSelector += ' </select> items per page\n' \ 626 '</form>\n' 627 628 return sHtmlItemsPerPageSelector 544 Note! Modifies dParams! 545 """ 546 547 from wuicontentbase import WuiListContentBase; ## @todo move to better place. 548 return WuiListContentBase.generateItemPerPageSelector('top', dParams, cItemsPerPage); 629 549 630 550 def _generateResultNavigation(self, cItems, cItemsPerPage, iPage, tsEffective, sCurPeriod, fOnlyFailures,
Note:
See TracChangeset
for help on using the changeset viewer.