Esempio n. 1
0
 def generateJenkinsChanges(self, pageDir):
     cacheDir = os.path.join(os.path.dirname(pageDir), "jenkins_changes")
     bgColour = self.colourFinder.find("changes_header_bg")
     row = [HTMLgen.TD("Changes", bgcolor=bgColour)]
     hasData = False
     prevTag = None
     for tag in self.tags:
         allChanges = self.findJenkinsChanges(prevTag, tag, cacheDir)
         cont = HTMLgen.Container()
         aborted = False
         for i, (authorOrMessage, target, bugs) in enumerate(allChanges):
             if i:
                 cont.append(HTMLgen.BR())
             if target:
                 cont.append(HTMLgen.Href(target, authorOrMessage))
             else:
                 cont.append(HTMLgen.Font(authorOrMessage, color="red"))
                 aborted = "Aborted" in authorOrMessage
             for bugText, bugTarget in bugs:
                 cont.append(HTMLgen.Href(bugTarget, bugText))
             hasData = True
         row.append(HTMLgen.TD(cont, bgcolor=bgColour))
         if not aborted:
             prevTag = tag
     if hasData:
         return HTMLgen.TR(*row)
Esempio n. 2
0
 def generateSummaries(self, extraVersion=None):
     bgColour = self.colourFinder.find("column_header_bg")
     row = [HTMLgen.TD("Summary", bgcolor=bgColour)]
     for tag in self.tags:
         categoryHandler = self.categoryHandlers[tag]
         detailPageName = getDetailPageName(self.pageVersion, tag)
         summary = categoryHandler.generateHTMLSummary(
             detailPageName + "#" + self.version, extraVersion)
         row.append(HTMLgen.TD(summary, bgcolor=bgColour))
     return HTMLgen.TR(*row)
Esempio n. 3
0
    def generateTestRows(self, testName, extraVersion, results):
        bgColour = self.colourFinder.find("row_header_bg")
        testId = makeTestId(self.version, extraVersion, testName)
        description = self.descriptionInfo.get(testName, "")
        container = HTMLgen.Container(HTMLgen.Name(testId), testName)
        rows = []
        testRow = [
            HTMLgen.TD(container,
                       bgcolor=bgColour,
                       title=self.escapeForHtml(description))
        ]

        # Don't add empty rows to the table
        foundData = False
        bgcol = None
        for tag in self.tags:
            cellContent, bgcol, hasData = self.generateTestCell(
                tag, testName, testId, results)
            testRow.append(HTMLgen.TD(cellContent, bgcolor=bgcol))
            foundData |= hasData

        if foundData:
            # We only filter based on the final column
            self.usedColours.add(bgcol)
            rows.append(HTMLgen.TR(*testRow))
        else:
            return rows

        for resourceName in self.resourceNames:
            foundData = False
            resourceRow = [
                HTMLgen.TD(HTMLgen.Emphasis("(" + resourceName + ")"),
                           align="right")
            ]
            for tag in self.tags:
                cellContent, bgcol, hasData = self.generateTestCell(
                    tag, testName, testId, results, resourceName)
                resourceRow.append(
                    HTMLgen.TD(HTMLgen.Emphasis(cellContent),
                               bgcolor=bgcol,
                               align="right"))
                foundData |= hasData

            if foundData:
                rows.append(HTMLgen.TR(*resourceRow))
        return rows
Esempio n. 4
0
    def addTable(self, page, resourceNames, categoryHandlers, version,
                 loggedTests, selector, tableHeader, filePath, graphHeading,
                 repositoryDirs):
        graphDirname, graphFileRef = self.getGraphFileParts(filePath, version)
        testTable = self.getTestTable(self.getConfigValue, resourceNames,
                                      self.descriptionInfo,
                                      selector.selectedTags, categoryHandlers,
                                      self.pageVersion, version,
                                      os.path.join(graphDirname, graphFileRef))
        table = testTable.generate(loggedTests, self.pageDir, repositoryDirs)
        if table:
            cells = []
            if tableHeader:
                page.append(HTMLgen.HR())
                cells.append(self.makeTableHeaderCell(tableHeader))

            graphLink = None
            fullPath = os.path.abspath(os.path.join(graphDirname,
                                                    graphFileRef))
            if testTable.generateGraph(fullPath, graphHeading):
                graphLink = self.makeImageLink(graphFileRef.replace("\\", "/"))
                cells.append(HTMLgen.TD(graphLink))

            if len(cells):
                row = HTMLgen.TR(*cells)
                initialTable = HTMLgen.TableLite(align="center")
                initialTable.append(row)
                page.append(initialTable)

            extraVersions = list(loggedTests.keys())[1:]
            if len(extraVersions) > 0:
                page.append(testTable.generateExtraVersionLinks(extraVersions))

            page.append(table)
            return True, graphLink, testTable.usedColours
        else:
            return False, None, []
Esempio n. 5
0
 def makeTableHeaderCell(self, tableHeader):
     container = HTMLgen.Container()
     container.append(HTMLgen.Name(tableHeader))
     container.append(
         HTMLgen.U(HTMLgen.Heading(1, tableHeader, align='center')))
     return HTMLgen.TD(container)