Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New: Apps and integrations statistics #14878

Merged
merged 10 commits into from
Jul 19, 2019
20 changes: 20 additions & 0 deletions app/statistics/server/functions/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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;
};
35 changes: 34 additions & 1 deletion app/ui-admin/client/adminInfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,40 @@ <h3>{{_ "Usage"}}</h3>
<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}}
Expand Down
8 changes: 8 additions & 0 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down