Ejemplo n.º 1
0
    def renderPageBody(self):
        if self.options.get("action", ""):
            self.handleAction()
            return HtmlGeneration.Redirect(
                self.withOptionsReset(
                    view=self.options.get("view")).urlString())

        view = self.currentView()

        if view == "commit_data":
            return self.renderCommitDataView()
        if view == "test_definitions":
            return self.renderCommitTestDefinitionsInfo()
        if view == "test_suites":
            return self.renderTestSuitesSummary()
        if view == "test_builds":
            return self.renderTestSuitesSummary(builds=True)
        if view == "test_results":
            return self.renderTestResultsGrid()
        if view == "repo_refs":
            return self.renderRepoReferencesGrid()

        return card(
            'Unknown view &quot;<span class="font-weight-bold">%s</span>&quot;'
            % view)
Ejemplo n.º 2
0
    def configurationView(self):
        if self.repo.branchCreateTemplates is None:
            self.repo.branchCreateTemplates = []

        if self.options.get('action', None) == "new_template":
            self.repo.branchCreateTemplates = list(self.repo.branchCreateTemplates) + [
                self.database.BranchCreateTemplate.New()
                ]

            return HtmlGeneration.Redirect(self.withOptions(action=None).urlString())
        if self.options.get('action', None) == "update_template":
            template = self.database.BranchCreateTemplate(str(self.options.get("identity")))
            assert template.exists() and template in self.repo.branchCreateTemplates

            template.globsToInclude = [str(x) for x in self.options.get("include_pats").split("\n")]
            template.globsToExclude = [str(x) for x in self.options.get("exclude_pats").split("\n")]
            template.suffix = str(self.options.get("suffix"))
            template.branchToCopyFrom = str(self.options.get("branch"))
            template.def_to_replace = str(self.options.get("def_to_replace"))
            template.disableOtherAutos = bool(self.options.get("disableOtherAutos"))
            template.autoprioritizeBranch = bool(self.options.get("autoprioritizeBranch"))
            template.deleteOnUnderlyingRemoval = bool(self.options.get("deleteOnUnderlyingRemoval"))

            return HtmlGeneration.Redirect(self.withOptions(action=None).urlString())
        
        result = ""

        for template in self.repo.branchCreateTemplates:
            result += card(self.renderTemplateUpdateForm(template))

        result += card(
            HtmlGeneration.Link(
                self.withOptions(action='new_template').urlString(),
                "Create new Branch Template",
                is_button=True,
                button_style=self.renderer.disable_if_cant_write('btn-primary btn-xs'),
                hover_text="Create a new branch-creation template."
                ).render()
            )

        return result