Refactored raw/grouped view.

This commit is contained in:
Christian P. MOMON 2020-01-30 19:07:22 +01:00
parent 3a1a1e79d9
commit cc22463874
5 changed files with 61 additions and 77 deletions

View file

@ -198,7 +198,7 @@ public final class AgirStatoolCLI
{ {
case "clear": case "clear":
{ {
logger.info("Clear command…"); logger.info("Applying clear command…");
AgirStatoolConfigFile config = new AgirStatoolConfigFile(configurationFile); AgirStatoolConfigFile config = new AgirStatoolConfigFile(configurationFile);
Connection connection = SQLUtils.getConnexion(config.getDabataseUrl(), config.getDabataseName(), config.getDabataseLogin(), config.getDabatasePassword()); Connection connection = SQLUtils.getConnexion(config.getDabataseUrl(), config.getDabataseName(), config.getDabataseLogin(), config.getDabatasePassword());
AgirStatool statool = new AgirStatool(connection, new File(config.getTargetDirectory())); AgirStatool statool = new AgirStatool(connection, new File(config.getTargetDirectory()));
@ -206,9 +206,20 @@ public final class AgirStatoolCLI
} }
break; 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": case "projects":
{ {
logger.info("projects command…"); logger.info("Applying projects command…");
AgirStatoolConfigFile config = new AgirStatoolConfigFile(configurationFile); AgirStatoolConfigFile config = new AgirStatoolConfigFile(configurationFile);
Connection connection = SQLUtils.getConnexion(config.getDabataseUrl(), config.getDabataseName(), config.getDabataseLogin(), config.getDabatasePassword()); Connection connection = SQLUtils.getConnexion(config.getDabataseUrl(), config.getDabataseName(), config.getDabataseLogin(), config.getDabatasePassword());
AgirStatool statool = new AgirStatool(connection, new File(config.getTargetDirectory())); AgirStatool statool = new AgirStatool(connection, new File(config.getTargetDirectory()));
@ -219,7 +230,7 @@ public final class AgirStatoolCLI
case "projects+": case "projects+":
{ {
logger.info("projects+ command…"); logger.info("Applying projects+ command…");
AgirStatoolConfigFile config = new AgirStatoolConfigFile(configurationFile); AgirStatoolConfigFile config = new AgirStatoolConfigFile(configurationFile);
Connection connection = SQLUtils.getConnexion(config.getDabataseUrl(), config.getDabataseName(), config.getDabataseLogin(), config.getDabatasePassword()); Connection connection = SQLUtils.getConnexion(config.getDabataseUrl(), config.getDabataseName(), config.getDabataseLogin(), config.getDabatasePassword());
AgirStatool statool = new AgirStatool(connection, new File(config.getTargetDirectory())); AgirStatool statool = new AgirStatool(connection, new File(config.getTargetDirectory()));
@ -230,22 +241,11 @@ public final class AgirStatoolCLI
case "update": case "update":
{ {
logger.info("Update command…"); logger.info("Applying update command…");
AgirStatoolConfigFile config = new AgirStatoolConfigFile(configurationFile); AgirStatoolConfigFile config = new AgirStatoolConfigFile(configurationFile);
Connection connection = SQLUtils.getConnexion(config.getDabataseUrl(), config.getDabataseName(), config.getDabataseLogin(), config.getDabatasePassword()); Connection connection = SQLUtils.getConnexion(config.getDabataseUrl(), config.getDabataseName(), config.getDabataseLogin(), config.getDabatasePassword());
AgirStatool statool = new AgirStatool(connection, new File(config.getTargetDirectory())); AgirStatool statool = new AgirStatool(connection, new File(config.getTargetDirectory()));
statool.doRefreshPages(); statool.doUpdatePages();
}
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();
} }
break; break;
} }

View file

@ -201,7 +201,7 @@ public class AgirStatool
* @throws AgirStatoolException * @throws AgirStatoolException
* the agir statool exception * the agir statool exception
*/ */
public void doRefreshPages() throws AgirStatoolException public void doUpdatePages() throws AgirStatoolException
{ {
try try
{ {
@ -217,20 +217,16 @@ public class AgirStatool
Project root = listProjectsAsTree(); Project root = listProjectsAsTree();
// Create welcome page. // Create welcome page.
refreshPage(root); updatePage(root);
FileUtils.copyFile(new File(this.targetDirectory, "all.xhtml"), new File(this.targetDirectory, "index.xhtml")); FileUtils.copyFile(new File(this.targetDirectory, "all.xhtml"), new File(this.targetDirectory, "index.xhtml"));
// Create one page per project. // Create one page per project.
for (Project project : root.subProjects()) for (Project project : root.subProjects())
{ {
refreshPage(project); updatePage(project);
for (Project subProject : project.subProjects()) for (Project subProject : project.subProjects())
{ {
refreshPage(subProject); updatePage(subProject);
// if (project.getName().equals("Chapril"))
// {
// System.exit(0);
// }
} }
} }
} }
@ -744,13 +740,13 @@ public class AgirStatool
} }
/** /**
* Checks for to refresh. * Checks for to update.
* *
* @param project * @param project
* the project * the project
* @return true, if successful * @return true, if successful
*/ */
public boolean hasToRefresh(final Project project) public boolean hasToUpdate(final Project project)
{ {
boolean result; boolean result;
@ -971,26 +967,18 @@ public class AgirStatool
} }
/** /**
* Update. * Update page.
*/
public void refreshChangedProjects()
{
}
/**
* Refresh page.
* *
* @param project * @param project
* the project * the project
* @throws AgirStatoolException * @throws AgirStatoolException
* the agir statool exception * the agir statool exception
*/ */
public void refreshPage(final Project project) throws AgirStatoolException public void updatePage(final Project project) throws AgirStatoolException
{ {
try try
{ {
if (hasToRefresh(project)) if (hasToUpdate(project))
{ {
logger.info("Refresh project page for {}", project.getName()); logger.info("Refresh project page for {}", project.getName());
String page = ProjectPage.build(project); String page = ProjectPage.build(project);

View file

@ -83,17 +83,15 @@ public class ProjectPage
data.setContent("issueGroupedChart", IssueStatChartView.buildGrouped("Issue Grouped Count", project)); data.setContent("issueGroupedChart", IssueStatChartView.buildGrouped("Issue Grouped Count", project));
data.setContent("unassignedRawChart", UnassignedPolarChartView.build("Unassigned Raw Count", project)); data.setContent("unassignedRawChart", UnassignedPolarChartView.build("Unassigned Raw Count", project));
data.setContent("unassignedGroupedChart", UnassignedPolarChartView.buildGrouped("Unassigned Grouped 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("createdClosedChartMini", CreatedClosedCountChartView.buildLastMonths("Created/closed 6 months CountA", project, 6));
data.setContent("createdClosed6MonthsChartB", CreatedClosedCountChartView.buildLastMonths("Created/closed 6 months CountB", 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));
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));
String projectsRawView = ProjectsRawView.build(project); String projectsRawView = ProjectsRawView.build(project);
data.setContent("projectsRawView", projectsRawView); data.setContent("tableRawView", projectsRawView);
String projectsGroupedView = ProjectsGroupedView.build(project); 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(); result = PresenterUtils.dynamize("/org/april/agirstatool/core/pages/project.xhtml", data).toString();
} }

View file

@ -11,7 +11,7 @@
<script src="Chart.bundle.min.js"></script> <script src="Chart.bundle.min.js"></script>
</head> </head>
<body> <body>
<div style="width: 100%; height: 100%; text-align: center; margin: 0 0; border: 1px solid red;" title="Issues Age"> <div style="width: 100%; height: 100%; text-align: center; margin: 0 0; border: 1px solid red;" title="Active Issues Age">
<canvas id="myChart" width="100%" height="100%"></canvas> <canvas id="myChart" width="100%" height="100%"></canvas>
<script> <script>
var ctx = document.getElementById('myChart'); var ctx = document.getElementById('myChart');
@ -63,7 +63,7 @@ var myChart = new Chart(ctx,
maintainAspectRatio: false, maintainAspectRatio: false,
title: { title: {
display: false, display: false,
text: 'Issue Age' text: 'Active Issue Age'
}, },
scales: scales:
{ {

View file

@ -13,7 +13,7 @@
<body> <body>
<div style="margin: 5px 10px 10px 10px;"> <div style="margin: 5px 10px 10px 10px;">
<h1><a href="index.xhtml">Agir Statool</a><sup id="versionsup" style="font-size: 9px;">v0.0.14</sup> Project <a id="agirLink" href="#">n/a</a></h1> <h1><a href="index.xhtml">Agir Statool</a><sup id="versionsup" style="font-size: 9px;">v0.0.14</sup> Project <a id="agirLink" href="#">n/a</a></h1>
<div> <div id="mainCharts">
<div style="margin: 5px;"> <div style="margin: 5px;">
<a id="createClose3MonthsButton" href="#" class="button" onclick="javascript:createClosedSelect('3months');">3 months</a> <a id="createClose3MonthsButton" href="#" class="button" onclick="javascript:createClosedSelect('3months');">3 months</a>
<a id="createClose6MonthsButton" href="#" class="button" onclick="javascript:createClosedSelect('6months');">6 months</a> <a id="createClose6MonthsButton" href="#" class="button" onclick="javascript:createClosedSelect('6months');">6 months</a>
@ -21,7 +21,7 @@
<a id="createCloseFullButton" href="#" class="button" onclick="javascript:createClosedSelect('full');">Full</a> <a id="createCloseFullButton" href="#" class="button" onclick="javascript:createClosedSelect('full');">Full</a>
<a id="createClosePreviousYearButton" href="#" class="button" onclick="javascript:createClosedSelect('previousYear');">Previous Year</a> <a id="createClosePreviousYearButton" href="#" class="button" onclick="javascript:createClosedSelect('previousYear');">Previous Year</a>
<span style="margin-left: 50px;"> </span> <span style="margin-left: 50px;"> </span>
<a href="#part2" class="button" title="Go down to the table below.">⇊ ⇊</a> <a href="#rawgroupedswitch" class="button" title="Go down to the table below.">⇊ ⇊</a>
<span style="margin-left: 50px;"> </span> <span style="margin-left: 50px;"> </span>
<a href="index.xhtml" class="button">Root</a> <a href="index.xhtml" class="button">Root</a>
<a href="admins.xhtml" class="button">Admins</a> <a href="admins.xhtml" class="button">Admins</a>
@ -54,36 +54,26 @@
</div> </div>
</div> </div>
<div id="part2" style="margin: 4px;"> <div id="rawgroupedswitch" style="margin: 4px;">
<span style="display: inline-block; padding-top: 6px; vertical-align: text-top;"><a href="#part2">Grouped</a></span> <span style="display: inline-block; padding-top: 6px; vertical-align: text-top;"><a href="#part2">Grouped</a></span>
<label class="switch"> <label class="switch">
<input type="checkbox" onclick="javascript:projectsViewFlip();" /> <input type="checkbox" onclick="javascript:projectsViewFlip();" />
<span class="slider round"></span> <span class="slider round"></span>
</label> </label>
</div> </div>
<div id="rawView"> <div id="secondaryCharts">
<div>
<div id="issueRawChart" style="width: 400px; height: 200px; display: inline-block;">ISSUES BAR CHART</div> <div id="issueRawChart" style="width: 400px; height: 200px; display: inline-block;">ISSUES BAR CHART</div>
<div id="issueGroupedChart" style="width: 400px; height: 200px; display: none;">ISSUES BAR CHART</div>
<div id="unassignedRawChart" style="width: 360px; height: 200px; display: inline-block;"></div> <div id="unassignedRawChart" style="width: 360px; height: 200px; display: inline-block;"></div>
<div id="createdClosed6MonthsChartA" style="width: 220px; height: 200px; display: inline-block;">CREATED/CLOSED 6 MONTHS CHART A</div> <div id="unassignedGroupedChart" style="width: 360px; height: 200px; display: none;"></div>
<div id="created-Closed6MonthsChartA" style="width: 220px; height: 200px; display: inline-block;">CREATED-CLOSED 6 MONTHS CHART A</div> <div id="createdClosedChartMini" style="width: 220px; height: 200px; display: inline-block;">CREATED/CLOSED CHART MINI</div>
</div> <div id="created-ClosedChartMini" style="width: 220px; height: 200px; display: inline-block;">CREATED-CLOSED CHART MINI</div>
<br/> <div id="ageChartMini" style="width: 250px; height: 200px; display: inline-block;">CREATED-CLOSED MONTHS CHART MINI</div>
<div>
<div id="projectsRawView">RAW VIEW PLACE</div>
</div>
</div> </div>
<div id="groupedView" style="display: none;"> <br/>
<div> <div id="tableView">
<div id="issueGroupedChart" style="width: 400px; height: 200px; display: inline-block;">ISSUES BAR CHART</div> <div id="tableRawView">TABLE RAW VIEW</div>
<div id="unassignedGroupedChart" style="width: 360px; height: 200px; display: inline-block;"></div> <div id="tableGroupedView" style="display: none;">TABLE GROUPED VIEW</div>
<div id="createdClosed6MonthsChartB" style="width: 220px; height: 200px; display: inline-block;">CREATED/CLOSED 6 MONTHS CHARTB</div>
<div id="created-Closed6MonthsChartB" style="width: 220px; height: 200px; display: inline-block;">CREATED-CLOSED 6 MONTHS CHART B</div>
</div>
<br/>
<div>
<div id="projectsGroupedView">GROUPED VIEW PLACE</div>
</div>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
@ -129,21 +119,29 @@
} }
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
var showRawView = true; var showView = 'RAW';
function projectsViewFlip () function projectsViewFlip ()
{ {
if (showRawView == true) if (showView == 'GROUPED')
{ {
document.getElementById ('rawView').style.display = 'none'; document.getElementById ('issueRawChart').style.display = 'inline-block';
document.getElementById ('groupedView').style.display = 'inline'; document.getElementById ('issueGroupedChart').style.display = 'none';
showRawView = false; document.getElementById ('unassignedRawChart').style.display = 'inline-block';
document.getElementById ('unassignedGroupedChart').style.display = 'none';
document.getElementById ('tableRawView').style.display = 'block';
document.getElementById ('tableGroupedView').style.display = 'none';
showView = 'RAW';
} }
else else
{ {
document.getElementById ('rawView').style.display = 'block'; document.getElementById ('issueRawChart').style.display = 'none';
document.getElementById ('groupedView').style.display = 'none'; document.getElementById ('issueGroupedChart').style.display = 'inline-block';
showRawView = true; document.getElementById ('unassignedRawChart').style.display = 'none';
document.getElementById ('unassignedGroupedChart').style.display = 'inline-block';
document.getElementById ('tableRawView').style.display = 'none';
document.getElementById ('tableGroupedView').style.display = 'block';
showView = 'GROUPED';
} }
} }
</script> </script>