def _makeVO(self, index, item):
     hostName = item['data']
     pingValue, pingStatus = g_preDefinedHosts.getHostPingData(hostName)
     pingValue = min(pingValue, self.__PING_MAX_VALUE)
     csisStatus = item['csisStatus']
     serverName = item['label']
     pingIndicatorState = self.__getUpdatedPingStatus(pingStatus, item)
     enabled = item.get('enabled',
                        csisStatus != HOST_AVAILABILITY.NOT_AVAILABLE)
     pingValueStr = formatPingStatus(csisStatus, self.__isColorBlind, False,
                                     pingStatus, pingValue)
     vo = {
         'id': item.get('id', 0),
         'data': hostName,
         'csisStatus': csisStatus,
         'label': serverName,
         'pingState': pingIndicatorState,
         'pingValue': pingValueStr,
         'enabled': enabled
     }
     if csisStatus == HOST_AVAILABILITY.NOT_RECOMMENDED:
         vo['tooltip'] = {
             'tooltip':
             _ms(TOOLTIPS.SERVER_NOTRECOMENDED,
                 icon=icons.serverAlert(),
                 server=serverName)
         }
     elif 'tooltip' in item:
         vo['tooltip'] = item['tooltip']
     return vo
 def _makeVO(self, index, item):
     hostName = item['data']
     pingValue, pingStatus = g_preDefinedHosts.getHostPingData(hostName)
     pingValue = min(pingValue, _PING_MAX_VALUE)
     csisStatus = item['csisStatus']
     serverName = item['label']
     pingIndicatorState = self.__getUpdatedPingStatus(pingStatus, item)
     enabled = csisStatus != HOST_AVAILABILITY.NOT_AVAILABLE
     strVal = _UNAVAILABLE_DATA_PLACEHOLDER if pingIndicatorState == PING_STATUSES.UNDEFINED else str(
         pingValue)
     if pingIndicatorState == PING_STATUSES.LOW:
         pingValueStr = text_styles.goodPing(strVal)
     else:
         pingValueStr = text_styles.standartPing(strVal)
     vo = {
         'id': item.get('id', 0),
         'data': hostName,
         'csisStatus': csisStatus,
         'label': serverName,
         'pingState': pingIndicatorState,
         'pingValue': pingValueStr,
         'colorBlind': self.__isColorBlind,
         'enabled': enabled
     }
     if csisStatus == HOST_AVAILABILITY.NOT_RECOMMENDED:
         vo['tooltip'] = _ms(TOOLTIPS.SERVER_NOTRECOMENDED,
                             icon=icons.serverAlert(),
                             server=serverName)
     return vo
    def __onSettingsChanged(self, diff):
        if 'isColorBlind' in diff:
            self.__isColorBlind = diff['isColorBlind']
            for item in self._list:
                pingValue, pingStatus = g_preDefinedHosts.getHostPingData(item['data'])
                pingValueStr = formatPingStatus(item['csisStatus'], self.__isColorBlind, False, pingStatus, pingValue)
                item['pingValue'] = pingValueStr

            self.refresh()
    def __updateList(self):
        hostsList = g_preDefinedHosts.getSimpleHostsList(
            g_preDefinedHosts.hostsWithRoaming(), withShortName=True)
        if self.connectionMgr.isStandalone():
            hostsList.insert(
                0, (self.connectionMgr.url, self.connectionMgr.serverUserName,
                    self.connectionMgr.serverUserNameShort,
                    HOST_AVAILABILITY.IGNORED, 0))
        serversList = []
        availableServersList = []
        for hostName, name, shortName, csisStatus, peripheryID in hostsList:
            primeTimeStatus, timeLeft, _ = self._getController(
            ).getPrimeTimeStatus(peripheryID)
            pingValue, _ = g_preDefinedHosts.getHostPingData(hostName)
            pingValue = min(pingValue, _PING_MAX_VALUE)
            if primeTimeStatus in (PRIME_TIME_STATUS.AVAILABLE,
                                   PRIME_TIME_STATUS.NOT_AVAILABLE):
                isAvailable = primeTimeStatus == PRIME_TIME_STATUS.AVAILABLE
                periphery = {
                    'label': name,
                    'id': peripheryID,
                    'csisStatus': csisStatus,
                    'data': hostName,
                    'enabled': isAvailable,
                    'timeLeft': timeLeft,
                    'shortname': shortName,
                    'pingValue': pingValue
                }
                serversList.append(periphery)
                if isAvailable:
                    availableServersList.append(periphery)

        self.__allServersList = serversList
        if availableServersList:
            self._isEnabled = True
            serversList = availableServersList
        else:
            self._isEnabled = False
        self.__serversList = serversList
        self.__serversDP.rebuildList(serversList)
        self.__updateServer()
Exemple #5
0
 def invalidatePingData(self):
     pingValue, self.__pingStatus = g_preDefinedHosts.getHostPingData(
         self.__hostName)
     self.__pingValue = min(pingValue, _PING_MAX_VALUE)
 def __updatePing(self):
     pingData = g_preDefinedHosts.getHostPingData(connectionManager.url)
     pingStatus = pingData.status
     pingStatus = PING_STATUSES.UNDEFINED if pingStatus == PING_STATUSES.REQUESTED else pingStatus
     self.as_updatePingStatusS(pingStatus,
                               self.settingsCore.getSetting('isColorBlind'))