VirtualBox

Changeset 64719 in vbox


Ignore:
Timestamp:
Nov 19, 2016 7:17:11 PM (8 years ago)
Author:
vboxsync
Message:

WuiTestBoxList: Adding summary at the bottom of the page (untested).

File:
1 edited

Legend:

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

    r62484 r64719  
    177177    ];
    178178
     179    ## Boxes which doesn't report in for more than 15 min are considered dead.
     180    kcSecMaxStatusDeltaAlive = 15*60
     181
    179182    def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
    180183        # type: (list[TestBoxDataForListing], int, int, datetime.datetime, ignore, WuiAdmin) -> None
     
    193196        self._sCheckboxName = TestBoxData.ksParam_idTestBox;
    194197
     198    def show(self, fShowNavigation = True):
     199        """ Adds some stats at the bottom of the page """
     200        (sTitle, sBody) = super(WuiTestBoxList, self).show(fShowNavigation);
     201
     202        # Count boxes in interesting states.
     203        if len(self._aoEntries) > 0:
     204            cActive = 0;
     205            cDead   = 0;
     206            for oTestBox in self._aoEntries:
     207                oDelta = oTestBox.tsCurrent - oTestBox.oStatus.tsUpdated;
     208                if oDelta.days <= 0 and oDelta.seconds <= self.kcSecMaxStatusDeltaAlive:
     209                    if oTestBox.fEnabled:
     210                        cActive += 1;
     211                else:
     212                    cDead += 1;
     213            sBody += '<div id="testboxsummary"><p>\n' \
     214                     '%s testboxes of which %s are active and %s dead' \
     215                     '</p></div>\n' \
     216                     % (len(self._aoEntries), cActive, cDead,)
     217        return (sTitle, sBody);
     218
    195219    def _formatListEntry(self, iEntry): # pylint: disable=R0914
    196220        from testmanager.webui.wuiadmin import WuiAdmin;
     
    219243        else:
    220244            oDelta = oEntry.tsCurrent - oEntry.oStatus.tsUpdated;
    221             if oDelta.days <= 0 and oDelta.seconds <= 15*60: # 15 mins and we consider you dead.
     245            if oDelta.days <= 0 and oDelta.seconds <= self.kcSecMaxStatusDeltaAlive:
    222246                oSeen = WuiSpanText('tmspan-online',  u'%s\u00a0s\u00a0ago' % (oDelta.days * 24 * 3600 + oDelta.seconds,));
    223247            else:
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