Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yurem committed Sep 15, 2015
2 parents 6366bf0 + 867935e commit f292e23
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 14 deletions.
16 changes: 13 additions & 3 deletions server/src/main/java/org/gluu/oxtrust/service/MetricService.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import org.gluu.oxtrust.ldap.service.ApplianceService;
import org.gluu.oxtrust.ldap.service.OrganizationService;
import org.gluu.oxtrust.model.AuthenticationChartDto;
import org.gluu.oxtrust.model.GluuOrganization;
import org.gluu.oxtrust.util.OxTrustConstants;
import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.AutoCreate;
Expand All @@ -29,6 +31,7 @@
import org.xdi.model.ApplicationType;
import org.xdi.model.metric.MetricType;
import org.xdi.model.metric.ldap.MetricEntry;
import org.xdi.service.CacheService;

/**
* Store and retrieve metric
Expand All @@ -48,7 +51,10 @@ public class MetricService extends org.xdi.service.metric.MetricService {

@Logger
private Log log;


@In
private CacheService cacheService;

@In
private ApplianceService applianceService;

Expand All @@ -60,8 +66,12 @@ public class MetricService extends org.xdi.service.metric.MetricService {

public AuthenticationChartDto genereateAuthenticationChartDto(int countDays) {
AuthenticationChartDto authenticationChartDto = new AuthenticationChartDto();

Map<MetricType, List<MetricEntry>> entries = findAuthenticationMetrics(-countDays);
String key = OxTrustConstants.CACHE_METRICS_KEY;
Map<MetricType, List<MetricEntry>> entries = (Map<MetricType, List<MetricEntry>>) cacheService.get(OxTrustConstants.CACHE_METRICS_NAME, key);
if (entries== null) {
entries = findAuthenticationMetrics(-countDays);
cacheService.put(OxTrustConstants.CACHE_METRICS_NAME, key, entries);
}

String []labels = new String[countDays];
Map<String, Integer> successStats = calculateStatistics(countDays, entries.get(MetricType.OXAUTH_USER_AUTHENTICATION_SUCCESS));
Expand Down
7 changes: 7 additions & 0 deletions server/src/main/resources/ehcache.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,11 @@
timeToLiveSeconds="60"
memoryStoreEvictionPolicy="LRU"/>

<cache name="metricsCache"
maxElementsInMemory="1000"
eternal="false"
overflowToDisk="false"
timeToIdleSeconds="60"
timeToLiveSeconds="14400"
memoryStoreEvictionPolicy="LRU"/>
</ehcache>
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
</h:selectOneMenu>
</s:decorate>

<s:decorate template="/WEB-INF/incl/layout/edit.xhtml"
<!-- <s:decorate template="/WEB-INF/incl/layout/edit.xhtml"
id="federationHosting">
<ui:define name="label">Federation Hosting</ui:define>
<h:selectOneMenu value="#{_appliance.federationHostingEnabled}" styleClass="form-control"
Expand All @@ -131,7 +131,7 @@
var="_type" label="#{_type.displayName}" />
<s:convertEnum />
</h:selectOneMenu>
</s:decorate>
</s:decorate> -->

<s:decorate template="/WEB-INF/incl/layout/edit.xhtml"
id="passwordReset">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
</h:panelGrid>

<div id="filtersUpdate">
<a4j:commandButton value="Save" action="#{metadataFiltersAction.saveFilters}" oncomplete="#{rich:component('additionalTRParamsPanel')}.hide()" render="MetadataFilterMenu" />
<a4j:commandButton value="Back" onclick="#{rich:component('additionalTRParamsPanel')}.hide()" immediate="true" />
<a4j:commandButton styleClass="btn btn-primary" value="Save" action="#{metadataFiltersAction.saveFilters}" oncomplete="#{rich:component('additionalTRParamsPanel')}.hide()" render="MetadataFilterMenu" />
<a4j:commandButton styleClass="btn btn-primary" value="Back" onclick="#{rich:component('additionalTRParamsPanel')}.hide()" immediate="true" />
</div>
</h:form>
</rich:popupPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
<h:panelGroup id="urlId">
<s:decorate template="/WEB-INF/incl/layout/edit.xhtml" id="url"
required="true"
rendered="#{((_trustRelationship.spMetaDataSourceType.value eq 'file') and (not empty _trustRelationship.url))}">
rendered="#{((_trustRelationship.spMetaDataSourceType.value eq 'file') and (not empty _trustRelationship.url) or (_trustRelationship.spMetaDataSourceType.value eq 'generate'))}">
<ui:define name="label">URL</ui:define>
<h:inputText styleClass="form-control"
value="#{_trustRelationship.url}" rows="3" size="40"
Expand Down Expand Up @@ -316,7 +316,7 @@
id="configureSpecific">
<ui:define name="label">Configure specific RelyingParty</ui:define>
<h:panelGrid columns="2" width="100%" id="RelyingPartyConfig"
rendered="#{not (_new or _trustRelationship.isFederation())}">
>
<h:panelGrid columns="2">

<h:selectBooleanCheckbox
Expand Down
5 changes: 3 additions & 2 deletions server/src/main/webapp/attribute/attributeInventory.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@
<div id="formArea">
<h:panelGroup columns="1" border="0" cellpadding="0" cellspacing="0"
width="100%">
<h:form id="attributesFormId">
<s:link view="/attribute/addAttribute.xhtml"
styleClass="label label-success" value="Add Attribute" propagation="none" style="padding:6px;" />


<s:fragment rendered="#{attributeInventoryAction.showInactive}">
<a4j:commandLink value="Show only Active Attributes"
action="#{attributeInventoryAction.toggleShowInactive}"
render="attributesFormId" />
styleClass="label label-success" render="attributesFormId" style="margin-left:5px;padding:6px;" />
</s:fragment>

<s:fragment rendered="#{not attributeInventoryAction.showInactive}">
Expand All @@ -45,7 +46,7 @@
</s:fragment>


<h:form id="attributesFormId">

<div class="row" style="padding-top:20px">
<div class="col-xs-12">
<div class="nav-tabs-custom" style="margin-bottom: 0px;">
Expand Down
7 changes: 6 additions & 1 deletion server/src/main/webapp/resources/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ $(function () {
//-----------------------
//- Dashboard > Authentication Requests Chart -
//-----------------------
try{

// Get context with jQuery - using jQuery's .get() method.
var authenticationRequestsChartCanvas = $("#authenticationRequestsChart").get(0).getContext("2d");
// This will get the first returned node in the jQuery collection.
var authenticationRequestsChart = new Chart(authenticationRequestsChartCanvas);


var authChartData = JSON.parse($("#authenticationChartJson").val());
console.log("authentication chart data");
Expand Down Expand Up @@ -86,5 +88,8 @@ $(function () {
//Create the line chart
authenticationRequestsChart.Line(authenticationRequestsChartData, authenticationRequestsChartOptions);


}catch(error){
console.log(error);
}

});
4 changes: 2 additions & 2 deletions server/src/main/webapp/resources/ox/selectScopeDialog.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@

<h:form>

<h:panelGroup>
<h:panelGroup id = "scopePanelId">

<s:decorate template="/WEB-INF/incl/layout/edit.xhtml" id="searchPattern">
<ui:param name="_hideLabel" value="true" />

<h:inputText value="#{cc.attrs.searchPattern}" size="20" maxlength="30" id="searchScopePatternId" styleClass="searchParameters form-control"
alt="Search parameters like iNum, Name, Display Name" />

<a4j:commandButton style = "margin-top:5px;" styleClass = "btn btn-primary" value="Search" action="#{cc.attrs.searchMethod}" render="scopePanelId" />
<a4j:commandButton style = "margin-top:5px;" styleClass = "btn btn-primary" value="Search" action="#{cc.attrs.searchMethod}" render="scopePanelId" />
</s:decorate>

<h:panelGroup id="scopeNoResultId" rendered="#{cc.attrs.searchResult.size eq 0}">
Expand Down

0 comments on commit f292e23

Please sign in to comment.