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":
{
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;
}

View file

@ -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);

View file

@ -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();
}

View file

@ -11,7 +11,7 @@
<script src="Chart.bundle.min.js"></script>
</head>
<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>
<script>
var ctx = document.getElementById('myChart');
@ -63,7 +63,7 @@ var myChart = new Chart(ctx,
maintainAspectRatio: false,
title: {
display: false,
text: 'Issue Age'
text: 'Active Issue Age'
},
scales:
{

View file

@ -13,7 +13,7 @@
<body>
<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>
<div>
<div id="mainCharts">
<div style="margin: 5px;">
<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>
@ -21,7 +21,7 @@
<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>
<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>
<a href="index.xhtml" class="button">Root</a>
<a href="admins.xhtml" class="button">Admins</a>
@ -54,36 +54,26 @@
</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>
<label class="switch">
<input type="checkbox" onclick="javascript:projectsViewFlip();" />
<span class="slider round"></span>
</label>
</div>
<div id="rawView">
<div>
<div id="secondaryCharts">
<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="createdClosed6MonthsChartA" style="width: 220px; height: 200px; display: inline-block;">CREATED/CLOSED 6 MONTHS CHART A</div>
<div id="created-Closed6MonthsChartA" 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="createdClosedChartMini" style="width: 220px; height: 200px; display: inline-block;">CREATED/CLOSED CHART MINI</div>
<div id="created-ClosedChartMini" style="width: 220px; height: 200px; display: inline-block;">CREATED-CLOSED CHART MINI</div>
<div id="ageChartMini" style="width: 250px; height: 200px; display: inline-block;">CREATED-CLOSED MONTHS CHART MINI</div>
</div>
<br/>
<div>
<div id="projectsRawView">RAW VIEW PLACE</div>
</div>
</div>
<div id="groupedView" style="display: none;">
<div>
<div id="issueGroupedChart" style="width: 400px; height: 200px; display: inline-block;">ISSUES BAR CHART</div>
<div id="unassignedGroupedChart" style="width: 360px; height: 200px; display: inline-block;"></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 id="tableView">
<div id="tableRawView">TABLE RAW VIEW</div>
<div id="tableGroupedView" style="display: none;">TABLE GROUPED VIEW</div>
</div>
</div>
<script type="text/javascript">
@ -129,21 +119,29 @@
}
</script>
<script type="text/javascript">
var showRawView = true;
var showView = 'RAW';
function projectsViewFlip ()
{
if (showRawView == true)
if (showView == 'GROUPED')
{
document.getElementById ('rawView').style.display = 'none';
document.getElementById ('groupedView').style.display = 'inline';
showRawView = false;
document.getElementById ('issueRawChart').style.display = 'inline-block';
document.getElementById ('issueGroupedChart').style.display = 'none';
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
{
document.getElementById ('rawView').style.display = 'block';
document.getElementById ('groupedView').style.display = 'none';
showRawView = true;
document.getElementById ('issueRawChart').style.display = 'none';
document.getElementById ('issueGroupedChart').style.display = 'inline-block';
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>