<?xml version="1.0" encoding="UTF-8"?>
<!--
  This file is part of the Meeds project (https://meeds.io/).

  Copyright (C) 2020 - 2024 Meeds Association contact@meeds.io

  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 3 of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public License
  along with this program; if not, write to the Free Software Foundation,
  Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-->
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
             version="2.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">

   <portlet>
     <portlet-name>AnalyticsPortlet</portlet-name>
     <display-name xml:lang="EN">Analytics Application</display-name>
     <portlet-class>io.meeds.analytics.portlet.AnalyticsPortlet</portlet-class>
     <init-param>
       <name>layout-content-editable</name>
       <value>true</value>
     </init-param>
     <expiration-cache>-1</expiration-cache>
     <cache-scope>PUBLIC</cache-scope>
     <supports>
       <mime-type>text/html</mime-type>
     </supports>
     <supported-locale>en</supported-locale>
     <resource-bundle>locale.portlet.Analytics</resource-bundle>
     <portlet-info>
       <title>Analytics Application</title>
       <keywords>Analytics Application</keywords>
     </portlet-info>
     <portlet-preferences>
      <preference>
        <name>settings</name>
        <value>
          {
            "title":"Chart title",
            "chartType":"line",
            "filters":[],
            "xAxisAggregations":[
              {
                "interval":"day",
                "sortDirection":"asc",
                "field":"timestamp",
                "type":"DATE"
              }
            ],
            "yAxisAggregation":{
              "interval":null,
              "sortDirection":null,
              "field":null,
              "type":"COUNT"
            },
            "displayComputingTime":true,
            "displaySamplesCount":true,
            "multipleCharts":false,
            "multipleChartsField":null
          }
        </value>
      </preference>
     </portlet-preferences>
     <security-role-ref>
       <role-name>admin</role-name>
       <role-link>admin</role-link>
     </security-role-ref>
   </portlet>

   <portlet>
     <portlet-name>SpacesListWidget</portlet-name>
     <display-name xml:lang="EN">Spaces List Widget</display-name>
     <portlet-class>io.meeds.analytics.portlet.AnalyticsQueryPortlet</portlet-class>
     <init-param>
       <name>portlet-view-dispatched-file-path</name>
       <value>/WEB-INF/jsp/spacesListWidget.jsp</value>
     </init-param>
     <init-param>
       <name>layout-content-editable</name>
       <value>true</value>
     </init-param>
     <init-param>
       <name>spacesList.recentlyVisitedURL</name>
       <value>
         {
          "chartType": "bar",
          "hideLabel": true,
          "filters": [{
            "field": "operation",
            "type": "EQUAL",
            "valueString": "pageDisplay"
          }, {
            "field": "spaceId",
            "type": "GREATER",
            "valueString": "1"
          }, {
            "field": "userId",
            "type": "EQUAL",
            "valueString": "{userIdentityId}"
          }, {
            "field": "timestamp",
            "type": "GREATER",
            "valueString": "{fromTimestamp}"
          }],
          "yAxisAggregation": {
            "type": "MAX",
            "field": "timestamp",
            "sortDirection": "desc"
          },
          "xAxisAggregations": [{
            "type": "TERMS",
            "field": "spaceId"
          }],
        }
       </value>
     </init-param>
     <init-param>
       <name>spacesList.recentlyVisitedURL.memberOnly</name>
       <value>
         {
          "chartType": "bar",
          "hideLabel": true,
          "filters": [{
            "field": "operation",
            "type": "EQUAL",
            "valueString": "pageDisplay"
          }, {
            "field": "userId",
            "type": "EQUAL",
            "valueString": "{userIdentityId}"
          }, {
            "field": "spaceId",
            "type": "IN_SET",
            "valueString": "{spaceMemberIds}"
          }, {
            "field": "timestamp",
            "type": "GREATER",
            "valueString": "{fromTimestamp}"
          }],
          "yAxisAggregation": {
            "type": "MAX",
            "field": "timestamp",
            "sortDirection": "desc"
          },
          "xAxisAggregations": [{
            "type": "TERMS",
            "field": "spaceId"
          }],
        }
       </value>
     </init-param>
     <init-param>
       <name>spacesList.mostActive</name>
       <value>
         {
          "chartType": "bar",
          "hideLabel": true,
          "filters": [{
            "field": "operation",
            "type": "IN_SET",
            "valueString": "noteCreated,noteUpdated,taskCreated,taskUpdated,taskCommented,taskCompleted,taskStatusChanged,createActivity,createComment,likeActivity,likeComment,sendKudos,contactSection,experienceSection,avatar"
          }, {
            "field": "spaceId",
            "type": "GREATER",
            "valueString": "1"
          }, {
            "field": "timestamp",
            "type": "GREATER",
            "valueString": "{fromTimestamp}"
          }],
          "yAxisAggregation": {
            "type": "COUNT",
            "field": "spaceId",
            "sortDirection": "desc"
          },
          "xAxisAggregations": [{
            "type": "TERMS",
            "field": "spaceId"
          }]
        }
       </value>
     </init-param>
     <init-param>
       <name>spacesList.mostActive.memberOnly</name>
       <value>
         {
          "chartType": "bar",
          "hideLabel": true,
          "filters": [{
            "field": "operation",
            "type": "IN_SET",
            "valueString": "noteCreated,noteUpdated,taskCreated,taskUpdated,taskCommented,taskCompleted,taskStatusChanged,createActivity,createComment,likeActivity,likeComment,sendKudos,contactSection,experienceSection,avatar"
          }, {
            "field": "spaceId",
            "type": "IN_SET",
            "valueString": "{spaceMemberIds}"
          }, {
            "field": "timestamp",
            "type": "GREATER",
            "valueString": "{fromTimestamp}"
          }],
          "yAxisAggregation": {
            "type": "COUNT",
            "field": "spaceId",
            "sortDirection": "desc"
          },
          "xAxisAggregations": [{
            "type": "TERMS",
            "field": "spaceId"
          }]
        }
       </value>
     </init-param>
     <supports>
       <mime-type>text/html</mime-type>
     </supports>
     <supported-locale>en</supported-locale>
     <resource-bundle>locale.portlet.Analytics</resource-bundle>
     <portlet-info>
       <title>Spaces List Widget</title>
       <keywords>Spaces List Widget</keywords>
     </portlet-info>
   </portlet>

  <portlet>
    <portlet-name>AnalyticsTablePortlet</portlet-name>
    <display-name xml:lang="EN">Analytics Table Application</display-name>
    <portlet-class>io.meeds.analytics.portlet.AnalyticsTablePortlet</portlet-class>
     <init-param>
       <name>layout-content-editable</name>
       <value>true</value>
     </init-param>
    <expiration-cache>-1</expiration-cache>
    <cache-scope>PUBLIC</cache-scope>
    <supports>
      <mime-type>text/html</mime-type>
    </supports>
    <supported-locale>en</supported-locale>
    <resource-bundle>locale.portlet.Analytics</resource-bundle>
    <portlet-info>
      <title>Analytics Table Application</title>
      <keywords>Analytics Table Application</keywords>
    </portlet-info>
    <portlet-preferences>
      <preference>
        <name>settings</name>
        <value>
          {
          "title":"Chart title",
          "chartType":"line",
          "filters":[],
          "xAxisAggregations":[
          {
          "interval":"day",
          "sortDirection":"asc",
          "field":"timestamp",
          "type":"DATE"
          }
          ],
          "yAxisAggregation":{
          "interval":null,
          "sortDirection":null,
          "field":null,
          "type":"COUNT"
          },
          "displayComputingTime":true,
          "displaySamplesCount":true,
          "multipleCharts":false,
          "multipleChartsField":null
          }
        </value>
      </preference>
    </portlet-preferences>
    <security-role-ref>
      <role-name>admin</role-name>
      <role-link>admin</role-link>
    </security-role-ref>
  </portlet>

  <portlet>
    <portlet-name>AnalyticsRatePortlet</portlet-name>
    <display-name xml:lang="EN">Analytics Rate Application</display-name>
    <portlet-class>io.meeds.analytics.portlet.AnalyticsRatePortlet</portlet-class>
     <init-param>
       <name>layout-content-editable</name>
       <value>true</value>
     </init-param>
    <expiration-cache>-1</expiration-cache>
    <cache-scope>PUBLIC</cache-scope>
    <supports>
      <mime-type>text/html</mime-type>
    </supports>
    <supported-locale>en</supported-locale>
    <resource-bundle>locale.portlet.Analytics</resource-bundle>
    <portlet-info>
      <title>Analytics Rate Application</title>
      <keywords>Analytics Rate Application</keywords>
    </portlet-info>
    <portlet-preferences>
      <preference>
        <name>settings</name>
        <value>
          {
            "title":"Chart title",
            "chartType":"percentageBar"
          }
        </value>
      </preference>
    </portlet-preferences>
    <security-role-ref>
      <role-name>admin</role-name>
      <role-link>admin</role-link>
    </security-role-ref>
  </portlet>

  <portlet>
    <portlet-name>StatisticsCollection</portlet-name>
    <portlet-class>io.meeds.analytics.portlet.StatisticDataCollectionPortlet</portlet-class>
    <init-param>
      <name>layout-css-class</name>
      <value>no-layout-style</value>
    </init-param>
    <expiration-cache>-1</expiration-cache>
    <supports>
      <mime-type>text/html</mime-type>
    </supports>
    <portlet-info>
      <title>Statistics collection application</title>
    </portlet-info>
  </portlet>

  <portlet>
    <portlet-name>AnalyticsDashboardBreadcrumb</portlet-name>
    <portlet-class>org.exoplatform.commons.api.portlet.GenericDispatchedViewPortlet</portlet-class>
    <init-param>
      <name>portlet-view-dispatched-file-path</name>
      <value>/WEB-INF/jsp/breadcrumb.jsp</value>
    </init-param>
    <expiration-cache>-1</expiration-cache>
    <cache-scope>PUBLIC</cache-scope>
    <supports>
      <mime-type>text/html</mime-type>
    </supports>
    <supported-locale>en</supported-locale>
    <resource-bundle>locale.portlet.Analytics</resource-bundle>
    <portlet-info>
      <title>Breadcrumb Analytics</title>
      <keywords>Breadcrumb Analytics</keywords>
    </portlet-info>
  </portlet>

</portlet-app>
