Ejemplo n.º 1
0
Archivo: web.py Proyecto: fordguo/stdpm
 def render_GET(self, request):
   flash = IFlash(request.getSession())
   currentIp = request.args.get('ip')
   if currentIp is None and len(clientIpDict)>0:
     currentIp = iter(clientIpDict.keys()).next()
   elif currentIp:
     currentIp = currentIp[0]
   def procList(result):
     procDict = {}
     for row in result:
       grpName,procName = [row[0],row[1]]
       uniName = uniqueProcName(currentIp,grpName,procName)
       procStatus = getStatus(uniName)
       procRow = [procName,procStatus['status'],fmtDate(procStatus['lastUpdated']),uniName,fmtDate(procStatus.get('fileUpdated')),]
       procGrp =  procDict.get(grpName)
       if procGrp is None:
         procGrp = [procRow]
         procDict[grpName] = procGrp
       else:
         procGrp.append(procRow)
     request.write(getTemplateContent('proc',clientSideArgs=self._initClientSideArgs(currentIp),\
       procDict=procDict,currentIp=currentIp,flash=flash,**activeCssDict))
     finishRequest(None,request,flash)
   getDb().runQuery('SELECT procGroup,procName FROM Process WHERE clientIp = ?',[currentIp]).addCallback(procList).addBoth(finishRequest,request)
   return NOT_DONE_YET
Ejemplo n.º 2
0
Archivo: web.py Proyecto: fordguo/stdpm
 def _initClientSideArgs(self,currentIp):
   ips = clientIpDict.keys()
   clientSideArgs = {'actCssList':[],'labelCssList':[],'countList':[],'clientIps':ips,'currentIp':currentIp}
   for ip in ips:
     clientSideArgs['actCssList'].append('active' if currentIp==ip else '')
     if isRun(ip): 
       clientSideArgs['countList'].append(countStop(ip))
       clientSideArgs['labelCssList'].append('')
     else:
       clientSideArgs['countList'].append(0)
       clientSideArgs['labelCssList'].append('label')
   return clientSideArgs