From cc224638746f0e92516badbc8b4d80df9ac16798 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Thu, 30 Jan 2020 19:07:22 +0100 Subject: [PATCH] Refactored raw/grouped view. --- .../april/agirstatool/cli/AgirStatoolCLI.java | 32 +++++----- .../april/agirstatool/core/AgirStatool.java | 30 +++------- .../agirstatool/core/pages/ProjectPage.java | 12 ++-- .../core/pages/issueAgeChartView.xhtml | 4 +- .../agirstatool/core/pages/project.xhtml | 60 +++++++++---------- 5 files changed, 61 insertions(+), 77 deletions(-) diff --git a/src/org/april/agirstatool/cli/AgirStatoolCLI.java b/src/org/april/agirstatool/cli/AgirStatoolCLI.java index 474906e..262b633 100644 --- a/src/org/april/agirstatool/cli/AgirStatoolCLI.java +++ b/src/org/april/agirstatool/cli/AgirStatoolCLI.java @@ -198,7 +198,7 @@ public final class AgirStatoolCLI { case "clear": { - logger.info("Clear command…"); + logger.info("Applying clear command…"); AgirStatoolConfigFile config = new AgirStatoolConfigFile(configurationFile); Connection connection = SQLUtils.getConnexion(config.getDabataseUrl(), config.getDabataseName(), config.getDabataseLogin(), config.getDabatasePassword()); AgirStatool statool = new AgirStatool(connection, new File(config.getTargetDirectory())); @@ -206,9 +206,20 @@ public final class AgirStatoolCLI } break; + case "forceupdate": + { + logger.info("Applying forceupdate command…"); + AgirStatoolConfigFile config = new AgirStatoolConfigFile(configurationFile); + Connection connection = SQLUtils.getConnexion(config.getDabataseUrl(), config.getDabataseName(), config.getDabataseLogin(), config.getDabatasePassword()); + AgirStatool statool = new AgirStatool(connection, new File(config.getTargetDirectory())); + statool.doClearAllPages(); + statool.doUpdatePages(); + } + break; + case "projects": { - logger.info("projects command…"); + logger.info("Applying projects command…"); AgirStatoolConfigFile config = new AgirStatoolConfigFile(configurationFile); Connection connection = SQLUtils.getConnexion(config.getDabataseUrl(), config.getDabataseName(), config.getDabataseLogin(), config.getDabatasePassword()); AgirStatool statool = new AgirStatool(connection, new File(config.getTargetDirectory())); @@ -219,7 +230,7 @@ public final class AgirStatoolCLI case "projects+": { - logger.info("projects+ command…"); + logger.info("Applying projects+ command…"); AgirStatoolConfigFile config = new AgirStatoolConfigFile(configurationFile); Connection connection = SQLUtils.getConnexion(config.getDabataseUrl(), config.getDabataseName(), config.getDabataseLogin(), config.getDabatasePassword()); AgirStatool statool = new AgirStatool(connection, new File(config.getTargetDirectory())); @@ -230,22 +241,11 @@ public final class AgirStatoolCLI case "update": { - logger.info("Update command…"); + logger.info("Applying update command…"); AgirStatoolConfigFile config = new AgirStatoolConfigFile(configurationFile); Connection connection = SQLUtils.getConnexion(config.getDabataseUrl(), config.getDabataseName(), config.getDabataseLogin(), config.getDabatasePassword()); AgirStatool statool = new AgirStatool(connection, new File(config.getTargetDirectory())); - statool.doRefreshPages(); - } - break; - - case "forceupdate": - { - logger.info("Force update command…"); - AgirStatoolConfigFile config = new AgirStatoolConfigFile(configurationFile); - Connection connection = SQLUtils.getConnexion(config.getDabataseUrl(), config.getDabataseName(), config.getDabataseLogin(), config.getDabatasePassword()); - AgirStatool statool = new AgirStatool(connection, new File(config.getTargetDirectory())); - statool.doClearAllPages(); - statool.doRefreshPages(); + statool.doUpdatePages(); } break; } diff --git a/src/org/april/agirstatool/core/AgirStatool.java b/src/org/april/agirstatool/core/AgirStatool.java index c7a7d0f..74701d6 100644 --- a/src/org/april/agirstatool/core/AgirStatool.java +++ b/src/org/april/agirstatool/core/AgirStatool.java @@ -201,7 +201,7 @@ public class AgirStatool * @throws AgirStatoolException * the agir statool exception */ - public void doRefreshPages() throws AgirStatoolException + public void doUpdatePages() throws AgirStatoolException { try { @@ -217,20 +217,16 @@ public class AgirStatool Project root = listProjectsAsTree(); // Create welcome page. - refreshPage(root); + updatePage(root); FileUtils.copyFile(new File(this.targetDirectory, "all.xhtml"), new File(this.targetDirectory, "index.xhtml")); // Create one page per project. for (Project project : root.subProjects()) { - refreshPage(project); + updatePage(project); for (Project subProject : project.subProjects()) { - refreshPage(subProject); - // if (project.getName().equals("Chapril")) - // { - // System.exit(0); - // } + updatePage(subProject); } } } @@ -744,13 +740,13 @@ public class AgirStatool } /** - * Checks for to refresh. + * Checks for to update. * * @param project * the project * @return true, if successful */ - public boolean hasToRefresh(final Project project) + public boolean hasToUpdate(final Project project) { boolean result; @@ -971,26 +967,18 @@ public class AgirStatool } /** - * Update. - */ - public void refreshChangedProjects() - { - - } - - /** - * Refresh page. + * Update page. * * @param project * the project * @throws AgirStatoolException * the agir statool exception */ - public void refreshPage(final Project project) throws AgirStatoolException + public void updatePage(final Project project) throws AgirStatoolException { try { - if (hasToRefresh(project)) + if (hasToUpdate(project)) { logger.info("Refresh project page for {}", project.getName()); String page = ProjectPage.build(project); diff --git a/src/org/april/agirstatool/core/pages/ProjectPage.java b/src/org/april/agirstatool/core/pages/ProjectPage.java index f86d019..7d95236 100644 --- a/src/org/april/agirstatool/core/pages/ProjectPage.java +++ b/src/org/april/agirstatool/core/pages/ProjectPage.java @@ -83,17 +83,15 @@ public class ProjectPage data.setContent("issueGroupedChart", IssueStatChartView.buildGrouped("Issue Grouped Count", project)); data.setContent("unassignedRawChart", UnassignedPolarChartView.build("Unassigned Raw Count", project)); data.setContent("unassignedGroupedChart", UnassignedPolarChartView.buildGrouped("Unassigned Grouped Count", project)); - data.setContent("createdClosed6MonthsChartA", CreatedClosedCountChartView.buildLastMonths("Created/closed 6 months CountA", project, 6)); - data.setContent("createdClosed6MonthsChartB", CreatedClosedCountChartView.buildLastMonths("Created/closed 6 months CountB", project, 6)); - - data.setContent("created-Closed6MonthsChartA", CreatedClosedDiffChartView.buildLastMonths("Created-closed 6 months CountA", project, 6)); - data.setContent("created-Closed6MonthsChartB", CreatedClosedDiffChartView.buildLastMonths("Created-closed 6 months CountB", project, 6)); + data.setContent("createdClosedChartMini", CreatedClosedCountChartView.buildLastMonths("Created/closed 6 months CountA", project, 6)); + data.setContent("created-ClosedChartMini", CreatedClosedDiffChartView.buildLastMonths("Created-closed Count Mini", project, 6)); + data.setContent("ageChartMini", IssueAgeChartView.buildLastMonths("Issue Age Chart Mini", project, 6)); String projectsRawView = ProjectsRawView.build(project); - data.setContent("projectsRawView", projectsRawView); + data.setContent("tableRawView", projectsRawView); String projectsGroupedView = ProjectsGroupedView.build(project); - data.setContent("projectsGroupedView", projectsGroupedView); + data.setContent("tableGroupedView", projectsGroupedView); result = PresenterUtils.dynamize("/org/april/agirstatool/core/pages/project.xhtml", data).toString(); } diff --git a/src/org/april/agirstatool/core/pages/issueAgeChartView.xhtml b/src/org/april/agirstatool/core/pages/issueAgeChartView.xhtml index dd3cf92..7f55ac4 100644 --- a/src/org/april/agirstatool/core/pages/issueAgeChartView.xhtml +++ b/src/org/april/agirstatool/core/pages/issueAgeChartView.xhtml @@ -11,7 +11,7 @@ -
+