-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add role-mining aggregate statistics chart
- Loading branch information
1 parent
e5586bf
commit 1d70b72
Showing
8 changed files
with
536 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...lveum/midpoint/gui/impl/page/admin/role/mining/model/RoleAnalysisAggregateChartModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright (C) 2023 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.gui.impl.page.admin.role.mining.model; | ||
|
||
import java.util.List; | ||
|
||
import org.apache.commons.math3.util.MathArrays; | ||
import org.apache.wicket.model.LoadableDetachableModel; | ||
|
||
import com.evolveum.midpoint.gui.api.model.LoadableModel; | ||
import com.evolveum.wicket.chartjs.*; | ||
|
||
public class RoleAnalysisAggregateChartModel extends LoadableModel<ChartConfiguration> { | ||
|
||
LoadableDetachableModel<List<RoleAnalysisModel>> roleAnalysisModels; | ||
|
||
public RoleAnalysisAggregateChartModel(LoadableDetachableModel<List<RoleAnalysisModel>> roleAnalysisModel) { | ||
this.roleAnalysisModels = roleAnalysisModel; | ||
|
||
} | ||
|
||
@Override | ||
protected ChartConfiguration load() { | ||
return createChartConfiguration(); | ||
} | ||
|
||
private ChartConfiguration createChartConfiguration() { | ||
BarChartConfiguration chart = new BarChartConfiguration(); | ||
|
||
ChartData chartData = createDataset(); | ||
chart.setData(chartData); | ||
chart.setOptions(createChartOptions()); | ||
return chart; | ||
} | ||
|
||
private ChartData createDataset() { | ||
ChartData chartData = new ChartData(); | ||
|
||
ChartDataset datasetUsers = new ChartDataset(); | ||
datasetUsers.setLabel("Users"); | ||
datasetUsers.addBackgroudColor("Red"); | ||
|
||
ChartDataset datasetRoles = new ChartDataset(); | ||
datasetRoles.setLabel("Roles"); | ||
datasetRoles.addBackgroudColor("Green"); | ||
|
||
List<RoleAnalysisModel> object = roleAnalysisModels.getObject(); | ||
for (RoleAnalysisModel roleAnalysisModel : object) { | ||
int rolesCount = roleAnalysisModel.getRolesCount(); | ||
datasetUsers.addData(roleAnalysisModel.getUsersCount()); | ||
datasetRoles.addData(rolesCount); | ||
chartData.addLabel("Roles: " + rolesCount); | ||
} | ||
|
||
chartData.addDataset(datasetRoles); | ||
chartData.addDataset(datasetUsers); | ||
|
||
return chartData; | ||
} | ||
|
||
private ChartOptions createChartOptions() { | ||
ChartOptions options = new ChartOptions(); | ||
options.setLegend(createLegendOptions()); | ||
options.setIndexAxis(IndexAxis.AXIS_X.getValue()); | ||
return options; | ||
} | ||
|
||
private ChartLegendOption createLegendOptions() { | ||
ChartLegendOption legend = new ChartLegendOption(); | ||
legend.setDisplay(false); | ||
ChartLegendLabel label = new ChartLegendLabel(); | ||
label.setBoxWidth(15); | ||
legend.setLabels(label); | ||
return legend; | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
...n/java/com/evolveum/midpoint/gui/impl/page/admin/role/mining/model/RoleAnalysisModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (C) 2023 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.gui.impl.page.admin.role.mining.model; | ||
|
||
public class RoleAnalysisModel { | ||
|
||
int rolesCount; | ||
int usersCount; | ||
|
||
public RoleAnalysisModel(int rolesCount, int usersCount) { | ||
this.rolesCount = rolesCount; | ||
this.usersCount = usersCount; | ||
} | ||
|
||
public int getRolesCount() { | ||
return rolesCount; | ||
} | ||
|
||
public int getUsersCount() { | ||
return usersCount; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...eum/midpoint/gui/impl/page/admin/role/mining/page/panel/chart/RoleAnalysisChartPanel.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!-- | ||
~ Copyright (C) 2010-2023 Evolveum and contributors | ||
~ | ||
~ This work is dual-licensed under the Apache License 2.0 | ||
~ and European Union Public License. See LICENSE file for details. | ||
--> | ||
|
||
<wicket:panel xmlns:wicket="http://wicket.apache.org"> | ||
<div class="card card-light"> | ||
<div class="card-header"> | ||
<h3 class="card-title" wicket:id="cardTitle"></h3> | ||
<div class="card-tools"> | ||
<form wicket:id="toolForm" > | ||
|
||
<button wicket:id="scaleButton" type="button" class="btn btn-tool" id="scale">Reset Zoom</button> | ||
|
||
<button wicket:id="sortButton" type="button" class="btn btn-tool" id="sort">Swith Sort</button> | ||
|
||
<button wicket:id="exportButton" type="button" class="btn btn-tool" id="export">Swith Sort</button> | ||
|
||
<button type="button" class="btn btn-tool" data-card-widget="collapse"> | ||
<i class="fas fa-minus"></i> | ||
</button> | ||
</form> | ||
|
||
</div> | ||
</div> | ||
<div class="card-body"> | ||
<div id="chartScaleContainer" wicket:id="container"> | ||
<canvas wicket:id="chart"></canvas> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</wicket:panel> |
Oops, something went wrong.