chore: remove references to EE code in the stats collector (#32052)

pull/31994/merge
Pierre Lehnen 2 years ago committed by GitHub
parent d996d0b44c
commit b0630fff70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 27
      apps/meteor/app/statistics/server/lib/getEEStatistics.ts
  2. 2
      apps/meteor/app/statistics/server/lib/statistics.ts
  3. 5
      packages/core-typings/src/IStats.ts

@ -1,29 +1,15 @@
import { log } from 'console';
import { Analytics } from '@rocket.chat/core-services';
import type { IStats } from '@rocket.chat/core-typings';
import { License } from '@rocket.chat/license';
import { CannedResponse, OmnichannelServiceLevelAgreements, LivechatRooms, LivechatTag, LivechatUnit, Users } from '@rocket.chat/models';
type ENTERPRISE_STATISTICS = GenericStats & Partial<EEOnlyStats>;
type GenericStats = {
modules: string[];
tags: string[];
seatRequests: number;
};
type EEOnlyStats = {
livechatTags: number;
cannedResponses: number;
priorities: number;
slas: number;
businessUnits: number;
omnichannelPdfTranscriptRequested: number;
omnichannelPdfTranscriptSucceeded: number;
omnichannelRoomsWithSlas: number;
omnichannelRoomsWithPriorities: number;
livechatMonitors: number;
};
type ENTERPRISE_STATISTICS = IStats['enterprise'];
type GenericStats = Pick<ENTERPRISE_STATISTICS, 'modules' | 'tags' | 'seatRequests'>;
type EEOnlyStats = Omit<ENTERPRISE_STATISTICS, keyof GenericStats>;
export async function getStatistics(): Promise<ENTERPRISE_STATISTICS> {
const genericStats: GenericStats = {
@ -42,7 +28,6 @@ export async function getStatistics(): Promise<ENTERPRISE_STATISTICS> {
return statistics;
}
// These models are only available on EE license so don't import them inside CE license as it will break the build
async function getEEStatistics(): Promise<EEOnlyStats | undefined> {
if (!License.hasModule('livechat-enterprise')) {
return;

@ -29,7 +29,6 @@ import {
import { MongoInternals } from 'meteor/mongo';
import moment from 'moment';
import { getStatistics as getEnterpriseStatistics } from '../../../../ee/app/license/server/getStatistics';
import { readSecondaryPreferred } from '../../../../server/database/readSecondaryPreferred';
import { isRunningMs } from '../../../../server/lib/isRunningMs';
import { getControl } from '../../../../server/lib/migrations';
@ -40,6 +39,7 @@ import { settings } from '../../../settings/server';
import { Info } from '../../../utils/rocketchat.info';
import { getMongoInfo } from '../../../utils/server/functions/getMongoInfo';
import { getAppsStatistics } from './getAppsStatistics';
import { getStatistics as getEnterpriseStatistics } from './getEEStatistics';
import { getImporterStatistics } from './getImporterStatistics';
import { getServicesStatistics } from './getServicesStatistics';

@ -159,6 +159,11 @@ export interface IStats {
priorities?: number;
slas?: number;
businessUnits?: number;
omnichannelPdfTranscriptRequested?: number;
omnichannelPdfTranscriptSucceeded?: number;
omnichannelRoomsWithSlas?: number;
omnichannelRoomsWithPriorities?: number;
livechatMonitors?: number;
};
createdAt: Date | string;
totalOTR: number;

Loading…
Cancel
Save