New: Apps and integrations statistics (#14878)

* Add Apps and integrations infos to statistics

* Add stats for integrations with script enabled
pull/14941/head^2
Marcos Spessatto Defendi 7 years ago committed by Diego Sampaio
parent 6a34189a23
commit ae796ac686
  1. 20
      app/statistics/server/functions/get.js
  2. 35
      app/ui-admin/client/adminInfo.html
  3. 8
      packages/rocketchat-i18n/i18n/en.i18n.json

@ -13,11 +13,13 @@ import {
Uploads,
Messages,
LivechatVisitors,
Integrations,
} from '../../../models/server';
import { settings } from '../../../settings/server';
import { Info, getMongoInfo } from '../../../utils/server';
import { Migrations } from '../../../migrations/server';
import { statistics } from '../statisticsNamespace';
import { Apps } from '../../../apps/server';
import { getStatistics as federationGetStatistics } from '../../../federation/server/methods/dashboard';
const wizardFields = [
@ -142,5 +144,23 @@ statistics.get = function _getStatistics() {
statistics.uniqueOSOfYesterday = Sessions.getUniqueOSOfYesterday();
statistics.uniqueOSOfLastMonth = Sessions.getUniqueOSOfLastMonth();
statistics.apps = {
enabled: Apps.isEnabled(),
engineVersion: Info.marketplaceApiVersion,
totalInstalled: Apps.getManager().get().length,
totalActive: Apps.getManager().get({ enabled: true }).length,
};
const integrations = Integrations.find().fetch();
statistics.integrations = {
totalIntegrations: integrations.length,
totalIncoming: integrations.filter((integration) => integration.type === 'webhook-incoming').length,
totalIncomingActive: integrations.filter((integration) => integration.enabled === true && integration.type === 'webhook-incoming').length,
totalOutgoing: integrations.filter((integration) => integration.type === 'webhook-outgoing').length,
totalOutgoingActive: integrations.filter((integration) => integration.enabled === true && integration.type === 'webhook-outgoing').length,
totalWithScriptEnabled: integrations.filter((integration) => integration.scriptEnabled === true).length,
};
return statistics;
};

@ -254,7 +254,40 @@
<th class="content-background-color border-component-color">{{_ "Stats_Total_Uploads_Size"}}</th>
<td class="border-component-color">{{inGB statistics.uploadsTotalSize}}</td>
</tr>
{{#if statistics.apps}}
<tr class="admin-table-row">
<th class="content-background-color border-component-color">{{_ "Stats_Total_Installed_Apps"}}</th>
<td class="border-component-color">{{statistics.apps.totalInstalled}}</td>
</tr>
<tr class="admin-table-row">
<th class="content-background-color border-component-color">{{_ "Stats_Total_Active_Apps"}}</th>
<td class="border-component-color">{{statistics.apps.totalActive}}</td>
</tr>
{{/if}}
<tr class="admin-table-row">
<th class="content-background-color border-component-color">{{_ "Stats_Total_Integrations"}}</th>
<td class="border-component-color">{{statistics.integrations.totalIntegrations}}</td>
</tr>
<tr class="admin-table-row">
<th class="content-background-color border-component-color">{{_ "Stats_Total_Incoming_Integrations"}}</th>
<td class="border-component-color">{{statistics.integrations.totalIncoming}}</td>
</tr>
<tr class="admin-table-row">
<th class="content-background-color border-component-color">{{_ "Stats_Total_Active_Incoming_Integrations"}}</th>
<td class="border-component-color">{{statistics.integrations.totalIncomingActive}}</td>
</tr>
<tr class="admin-table-row">
<th class="content-background-color border-component-color">{{_ "Stats_Total_Outgoing_Integrations"}}</th>
<td class="border-component-color">{{statistics.integrations.totalOutgoing}}</td>
</tr>
<tr class="admin-table-row">
<th class="content-background-color border-component-color">{{_ "Stats_Total_Active_Outgoing_Integrations"}}</th>
<td class="border-component-color">{{statistics.integrations.totalOutgoingActive}}</td>
</tr>
<tr class="admin-table-row">
<th class="content-background-color border-component-color">{{_ "Stats_Total_Integrations_With_Script_Enabled"}}</th>
<td class="border-component-color">{{statistics.integrations.totalWithScriptEnabled}}</td>
</tr>
</table>
{{#if instances}}

@ -2776,15 +2776,23 @@
"Stats_Non_Active_Users": "Deactivated Users",
"Stats_Offline_Users": "Offline Users",
"Stats_Online_Users": "Online Users",
"Stats_Total_Active_Apps": "Total Active Apps",
"Stats_Total_Active_Incoming_Integrations": "Total Active Incoming Integrations",
"Stats_Total_Active_Outgoing_Integrations": "Total Active Outgoing Integrations",
"Stats_Total_Connected_Users": "Total Connected Users",
"Stats_Total_Channels": "Total Channels",
"Stats_Total_Direct_Messages": "Total Direct Message Rooms",
"Stats_Total_Incoming_Integrations": "Total Incoming Integrations",
"Stats_Total_Installed_Apps": "Total Installed Apps",
"Stats_Total_Integrations": "Total Integrations",
"Stats_Total_Integrations_With_Script_Enabled": "Total Integrations With Script Enabled",
"Stats_Total_Livechat_Rooms": "Total Livechat Rooms",
"Stats_Total_Messages": "Total Messages",
"Stats_Total_Messages_Channel": "Total Messages in Channels",
"Stats_Total_Messages_Direct": "Total Messages in Direct Messages",
"Stats_Total_Messages_Livechat": "Total Messages in Livechats",
"Stats_Total_Messages_PrivateGroup": "Total Messages in Private Groups",
"Stats_Total_Outgoing_Integrations": "Total Outgoing Integrations",
"Stats_Total_Private_Groups": "Total Private Groups",
"Stats_Total_Rooms": "Total Rooms",
"Stats_Total_Users": "Total Users",

Loading…
Cancel
Save