Browse Source

Refactored raw/grouped view.

master
Christian P. MOMON 2 years ago
parent
commit
cc22463874
  1. 30
      src/org/april/agirstatool/cli/AgirStatoolCLI.java
  2. 30
      src/org/april/agirstatool/core/AgirStatool.java
  3. 12
      src/org/april/agirstatool/core/pages/ProjectPage.java
  4. 4
      src/org/april/agirstatool/core/pages/issueAgeChartView.xhtml
  5. 60
      src/org/april/agirstatool/core/pages/project.xhtml

30
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,46 +206,46 @@ public final class AgirStatoolCLI
}
break;
case "projects":
case "forceupdate":
{
logger.info("projects command…");
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()));
StringList lines = statool.doBuildTextProjectList();
System.out.println(lines);
statool.doClearAllPages();
statool.doUpdatePages();
}
break;
case "projects+":
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()));
StringList lines = statool.doBuildTextProjectExtendedList();
StringList lines = statool.doBuildTextProjectList();
System.out.println(lines);
}
break;
case "update":
case "projects+":
{
logger.info("Update 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()));
statool.doRefreshPages();
StringList lines = statool.doBuildTextProjectExtendedList();
System.out.println(lines);
}
break;
case "forceupdate":
case "update":
{
logger.info("Force 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.doClearAllPages();
statool.doRefreshPages();
statool.doUpdatePages();
}
break;
}

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

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

4
src/org/april/agirstatool/core/pages/issueAgeChartView.xhtml

@ -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:
{

60
src/org/april/agirstatool/core/pages/project.xhtml

@ -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>
<br/>
<div>
<div id="projectsRawView">RAW VIEW PLACE</div>
</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>
<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>
<br/>
<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>

Loading…
Cancel
Save