mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Reporting] Fixes and Cleanup Usage TS (#127412)
* [Reporting] Fixes and Cleanup Usage TS * fix ts * simplify Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
98e38807e1
commit
e2a9edb306
9 changed files with 57 additions and 112 deletions
|
@ -1726,7 +1726,7 @@ Object {
|
|||
"preserve_layout": 0,
|
||||
"print": 0,
|
||||
},
|
||||
"output_size": undefined,
|
||||
"sizes": undefined,
|
||||
"total": 4,
|
||||
},
|
||||
"csv_searchsource_immediate": Object {
|
||||
|
@ -1794,7 +1794,7 @@ Object {
|
|||
"preserve_layout": 0,
|
||||
"print": 0,
|
||||
},
|
||||
"output_size": undefined,
|
||||
"sizes": undefined,
|
||||
"total": 4,
|
||||
},
|
||||
"csv_searchsource_immediate": Object {
|
||||
|
@ -2136,7 +2136,7 @@ Object {
|
|||
"preserve_layout": 0,
|
||||
"print": 0,
|
||||
},
|
||||
"output_size": undefined,
|
||||
"sizes": undefined,
|
||||
"total": 1,
|
||||
},
|
||||
"PNGV2": Object {
|
||||
|
@ -2171,7 +2171,7 @@ Object {
|
|||
"preserve_layout": 0,
|
||||
"print": 0,
|
||||
},
|
||||
"output_size": undefined,
|
||||
"sizes": undefined,
|
||||
"total": 1,
|
||||
},
|
||||
"csv_searchsource_immediate": Object {
|
||||
|
@ -2206,7 +2206,7 @@ Object {
|
|||
"preserve_layout": 0,
|
||||
"print": 0,
|
||||
},
|
||||
"output_size": undefined,
|
||||
"sizes": undefined,
|
||||
"total": 1,
|
||||
},
|
||||
"PNGV2": Object {
|
||||
|
@ -2240,7 +2240,7 @@ Object {
|
|||
"preserve_layout": 0,
|
||||
"print": 0,
|
||||
},
|
||||
"output_size": undefined,
|
||||
"sizes": undefined,
|
||||
"total": 1,
|
||||
},
|
||||
"csv_searchsource_immediate": Object {
|
||||
|
@ -2274,7 +2274,7 @@ Object {
|
|||
"preserve_layout": 2,
|
||||
"print": 0,
|
||||
},
|
||||
"output_size": undefined,
|
||||
"sizes": undefined,
|
||||
"total": 2,
|
||||
},
|
||||
"printable_pdf_v2": Object {
|
||||
|
@ -2325,7 +2325,7 @@ Object {
|
|||
"preserve_layout": 2,
|
||||
"print": 0,
|
||||
},
|
||||
"output_size": undefined,
|
||||
"sizes": undefined,
|
||||
"total": 2,
|
||||
},
|
||||
"printable_pdf_v2": Object {
|
||||
|
@ -2379,7 +2379,7 @@ Object {
|
|||
"preserve_layout": 0,
|
||||
"print": 0,
|
||||
},
|
||||
"output_size": undefined,
|
||||
"sizes": undefined,
|
||||
"total": 1,
|
||||
},
|
||||
"PNGV2": Object {
|
||||
|
@ -2414,7 +2414,7 @@ Object {
|
|||
"preserve_layout": 0,
|
||||
"print": 0,
|
||||
},
|
||||
"output_size": undefined,
|
||||
"sizes": undefined,
|
||||
"total": 1,
|
||||
},
|
||||
"csv_searchsource_immediate": Object {
|
||||
|
@ -2554,7 +2554,7 @@ Object {
|
|||
"preserve_layout": 5,
|
||||
"print": 1,
|
||||
},
|
||||
"output_size": undefined,
|
||||
"sizes": undefined,
|
||||
"total": 6,
|
||||
},
|
||||
"printable_pdf_v2": Object {
|
||||
|
|
|
@ -109,7 +109,7 @@ test('Model of jobTypes', () => {
|
|||
"preserve_layout": 0,
|
||||
"print": 0,
|
||||
},
|
||||
"output_size": Object {
|
||||
"sizes": Object {
|
||||
"1.0": 5093470,
|
||||
"25.0": 5093470,
|
||||
"5.0": 5093470,
|
||||
|
@ -136,7 +136,7 @@ test('Model of jobTypes', () => {
|
|||
"preserve_layout": 0,
|
||||
"print": 0,
|
||||
},
|
||||
"output_size": Object {
|
||||
"sizes": Object {
|
||||
"1.0": 5093470,
|
||||
"25.0": 5093470,
|
||||
"5.0": 5093470,
|
||||
|
@ -163,7 +163,7 @@ test('Model of jobTypes', () => {
|
|||
"preserve_layout": 3,
|
||||
"print": 0,
|
||||
},
|
||||
"output_size": Object {
|
||||
"sizes": Object {
|
||||
"1.0": 5093470,
|
||||
"25.0": 5093470,
|
||||
"5.0": 5093470,
|
||||
|
@ -205,7 +205,7 @@ test('PNG counts, provided count of deprecated jobs explicitly', () => {
|
|||
"preserve_layout": 0,
|
||||
"print": 0,
|
||||
},
|
||||
"output_size": Object {
|
||||
"sizes": Object {
|
||||
"1.0": 5093470,
|
||||
"25.0": 5093470,
|
||||
"5.0": 5093470,
|
||||
|
|
|
@ -29,16 +29,16 @@ function getAvailableTotalForFeature(
|
|||
const deprecated = jobTypeIsDeprecated(typeKey) ? jobType.total : jobType.deprecated || 0;
|
||||
|
||||
// merge the additional stats for the jobType
|
||||
const availableTotal = {
|
||||
const availableTotal: AvailableTotal = {
|
||||
available: isAvailable(featureAvailability, typeKey),
|
||||
total: jobType.total,
|
||||
deprecated,
|
||||
output_size: jobType.sizes,
|
||||
sizes: jobType.sizes,
|
||||
app: { ...defaultTotalsForFeature.app, ...jobType.app },
|
||||
layout: { ...defaultTotalsForFeature.layout, ...jobType.layout },
|
||||
};
|
||||
|
||||
return availableTotal as AvailableTotal;
|
||||
return availableTotal;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import type { ElasticsearchClient } from 'kibana/server';
|
||||
import { get } from 'lodash';
|
||||
import type { ReportingConfig } from '../';
|
||||
import { REPORTING_SYSTEM_INDEX } from '../../common/constants';
|
||||
import type { ExportTypesRegistry } from '../lib/export_types_registry';
|
||||
import type { GetLicense } from './';
|
||||
|
@ -140,7 +139,6 @@ async function handleResponse(response: ESResponse): Promise<Partial<RangeStatSe
|
|||
}
|
||||
|
||||
export async function getReportingUsage(
|
||||
config: ReportingConfig,
|
||||
getLicense: GetLicense,
|
||||
esClient: ElasticsearchClient,
|
||||
exportTypesRegistry: ExportTypesRegistry
|
||||
|
|
|
@ -7,13 +7,11 @@
|
|||
|
||||
import { loggerMock } from '@kbn/logging-mocks';
|
||||
import type { ElasticsearchClientMock } from '../../../../../src/core/server/mocks';
|
||||
import { CollectorFetchContext } from 'src/plugins/usage_collection/server';
|
||||
import {
|
||||
Collector,
|
||||
createCollectorFetchContextMock,
|
||||
usageCollectionPluginMock,
|
||||
} from 'src/plugins/usage_collection/server/mocks';
|
||||
import { ReportingCore } from '../';
|
||||
import { getExportTypesRegistry } from '../lib/export_types_registry';
|
||||
import { createMockConfigSchema, createMockReportingCore } from '../test_helpers';
|
||||
import { FeaturesAvailability } from './';
|
||||
|
@ -44,16 +42,10 @@ const getMockFetchClients = (resp: any) => {
|
|||
const usageCollectionSetup = usageCollectionPluginMock.createSetupContract();
|
||||
|
||||
describe('license checks', () => {
|
||||
let mockCore: ReportingCore;
|
||||
beforeAll(async () => {
|
||||
mockCore = await createMockReportingCore(createMockConfigSchema());
|
||||
});
|
||||
|
||||
describe('with a basic license', () => {
|
||||
let usageStats: any;
|
||||
beforeAll(async () => {
|
||||
const collector = getReportingUsageCollector(
|
||||
mockCore,
|
||||
usageCollectionSetup,
|
||||
getLicenseMock('basic'),
|
||||
exportTypesRegistry,
|
||||
|
@ -81,7 +73,6 @@ describe('license checks', () => {
|
|||
let usageStats: any;
|
||||
beforeAll(async () => {
|
||||
const collector = getReportingUsageCollector(
|
||||
mockCore,
|
||||
usageCollectionSetup,
|
||||
getLicenseMock('none'),
|
||||
exportTypesRegistry,
|
||||
|
@ -109,7 +100,6 @@ describe('license checks', () => {
|
|||
let usageStats: any;
|
||||
beforeAll(async () => {
|
||||
const collector = getReportingUsageCollector(
|
||||
mockCore,
|
||||
usageCollectionSetup,
|
||||
getLicenseMock('platinum'),
|
||||
exportTypesRegistry,
|
||||
|
@ -137,7 +127,6 @@ describe('license checks', () => {
|
|||
let usageStats: any;
|
||||
beforeAll(async () => {
|
||||
const collector = getReportingUsageCollector(
|
||||
mockCore,
|
||||
usageCollectionSetup,
|
||||
getLicenseMock('basic'),
|
||||
exportTypesRegistry,
|
||||
|
@ -159,14 +148,8 @@ describe('license checks', () => {
|
|||
});
|
||||
|
||||
describe('data modeling', () => {
|
||||
let mockCore: ReportingCore;
|
||||
let collectorFetchContext: CollectorFetchContext;
|
||||
beforeAll(async () => {
|
||||
mockCore = await createMockReportingCore(createMockConfigSchema());
|
||||
});
|
||||
test('with usage data from the reporting/archived_reports es archive', async () => {
|
||||
const collector = getReportingUsageCollector(
|
||||
mockCore,
|
||||
usageCollectionSetup,
|
||||
getLicenseMock(),
|
||||
exportTypesRegistry,
|
||||
|
@ -174,7 +157,7 @@ describe('data modeling', () => {
|
|||
return Promise.resolve(true);
|
||||
}
|
||||
);
|
||||
collectorFetchContext = getMockFetchClients(
|
||||
const collectorFetchContext = getMockFetchClients(
|
||||
getResponseMock({
|
||||
aggregations: {
|
||||
ranges: {
|
||||
|
@ -365,7 +348,6 @@ describe('data modeling', () => {
|
|||
|
||||
test('usage data with meta.isDeprecated jobTypes', async () => {
|
||||
const collector = getReportingUsageCollector(
|
||||
mockCore,
|
||||
usageCollectionSetup,
|
||||
getLicenseMock(),
|
||||
exportTypesRegistry,
|
||||
|
@ -373,7 +355,7 @@ describe('data modeling', () => {
|
|||
return Promise.resolve(true);
|
||||
}
|
||||
);
|
||||
collectorFetchContext = getMockFetchClients(
|
||||
const collectorFetchContext = getMockFetchClients(
|
||||
getResponseMock({
|
||||
aggregations: {
|
||||
ranges: {
|
||||
|
@ -497,7 +479,6 @@ describe('data modeling', () => {
|
|||
|
||||
test('with sparse data', async () => {
|
||||
const collector = getReportingUsageCollector(
|
||||
mockCore,
|
||||
usageCollectionSetup,
|
||||
getLicenseMock(),
|
||||
exportTypesRegistry,
|
||||
|
@ -505,7 +486,7 @@ describe('data modeling', () => {
|
|||
return Promise.resolve(true);
|
||||
}
|
||||
);
|
||||
collectorFetchContext = getMockFetchClients(
|
||||
const collectorFetchContext = getMockFetchClients(
|
||||
getResponseMock({
|
||||
aggregations: {
|
||||
ranges: {
|
||||
|
@ -595,7 +576,6 @@ describe('data modeling', () => {
|
|||
|
||||
test('with empty data', async () => {
|
||||
const collector = getReportingUsageCollector(
|
||||
mockCore,
|
||||
usageCollectionSetup,
|
||||
getLicenseMock(),
|
||||
exportTypesRegistry,
|
||||
|
@ -604,7 +584,7 @@ describe('data modeling', () => {
|
|||
}
|
||||
);
|
||||
|
||||
collectorFetchContext = getMockFetchClients(
|
||||
const collectorFetchContext = getMockFetchClients(
|
||||
getResponseMock({
|
||||
aggregations: {
|
||||
ranges: {
|
||||
|
|
|
@ -18,7 +18,6 @@ import { reportingSchema } from './schema';
|
|||
* @return {Object} kibana usage stats type collection object
|
||||
*/
|
||||
export function getReportingUsageCollector(
|
||||
reporting: ReportingCore,
|
||||
usageCollection: UsageCollectionSetup,
|
||||
getLicense: GetLicense,
|
||||
exportTypesRegistry: ExportTypesRegistry,
|
||||
|
@ -27,8 +26,7 @@ export function getReportingUsageCollector(
|
|||
return usageCollection.makeUsageCollector<ReportingUsageType>({
|
||||
type: 'reporting',
|
||||
fetch: ({ esClient }: CollectorFetchContext) => {
|
||||
const config = reporting.getConfig();
|
||||
return getReportingUsage(config, getLicense, esClient, exportTypesRegistry);
|
||||
return getReportingUsage(getLicense, esClient, exportTypesRegistry);
|
||||
},
|
||||
isReady,
|
||||
schema: reportingSchema,
|
||||
|
@ -61,7 +59,6 @@ export function registerReportingUsageCollector(
|
|||
const collectionIsReady = reporting.pluginStartsUp.bind(reporting);
|
||||
|
||||
const collector = getReportingUsageCollector(
|
||||
reporting,
|
||||
usageCollection,
|
||||
getLicense,
|
||||
exportTypesRegistry,
|
||||
|
|
|
@ -23,8 +23,17 @@ interface SizeStats {
|
|||
sizes?: { values: SizePercentiles };
|
||||
}
|
||||
|
||||
// FIXME: find a way to get this from exportTypesHandler or common/constants
|
||||
export type BaseJobTypes =
|
||||
| 'csv_searchsource'
|
||||
| 'csv_searchsource_immediate'
|
||||
| 'PNG'
|
||||
| 'PNGV2'
|
||||
| 'printable_pdf'
|
||||
| 'printable_pdf_v2';
|
||||
|
||||
export interface KeyCountBucket extends DocCount, SizeStats {
|
||||
key: string;
|
||||
key: BaseJobTypes;
|
||||
isDeprecated?: DocCount;
|
||||
}
|
||||
|
||||
|
@ -87,15 +96,6 @@ export interface AvailableTotal {
|
|||
};
|
||||
}
|
||||
|
||||
// FIXME: find a way to get this from exportTypesHandler or common/constants
|
||||
type BaseJobTypes =
|
||||
| 'csv_searchsource'
|
||||
| 'csv_searchsource_immediate'
|
||||
| 'PNG'
|
||||
| 'PNGV2'
|
||||
| 'printable_pdf'
|
||||
| 'printable_pdf_v2';
|
||||
|
||||
export interface LayoutCounts {
|
||||
canvas: number;
|
||||
print: number;
|
||||
|
@ -133,14 +133,3 @@ export type ReportingUsageType = RangeStats & {
|
|||
};
|
||||
|
||||
export type FeatureAvailabilityMap = Record<string, boolean>;
|
||||
|
||||
export interface ReportingUsageSearchResponse {
|
||||
aggregations: {
|
||||
ranges: {
|
||||
buckets: {
|
||||
all: AggregationResultBuckets;
|
||||
last7Days: AggregationResultBuckets;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import expect from '@kbn/expect';
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
import { ReportingUsageStats } from '../services/usage';
|
||||
import { UsageStats } from '../services/usage';
|
||||
|
||||
// These all have the domain name portion stripped out. The api infrastructure assumes it when we post to it anyhow.
|
||||
const PDF_PRINT_DASHBOARD_6_3 =
|
||||
|
@ -18,19 +18,14 @@ const PDF_PRESERVE_PIE_VISUALIZATION_6_3 =
|
|||
'/api/reporting/generate/printablePdf?jobParams=(browserTimezone:America%2FNew_York,layout:(dimensions:(height:441,width:1002),id:preserve_layout),objectType:visualization,relativeUrls:!(%27%2Fapp%2Fkibana%23%2Fvisualize%2Fedit%2F3fe22200-3dcb-11e8-8660-4d65aa086b3c%3F_g%3D(refreshInterval:(display:Off,pause:!!f,value:0),time:(from:!%27Mon%2BApr%2B09%2B2018%2B17:56:08%2BGMT-0400!%27,mode:absolute,to:!%27Wed%2BApr%2B11%2B2018%2B17:56:08%2BGMT-0400!%27))%26_a%3D(filters:!!(),linked:!!f,query:(language:lucene,query:!%27!%27),uiState:(),vis:(aggs:!!((enabled:!!t,id:!%271!%27,params:(),schema:metric,type:count),(enabled:!!t,id:!%272!%27,params:(field:bytes,missingBucket:!!f,missingBucketLabel:Missing,order:desc,orderBy:!%271!%27,otherBucket:!!f,otherBucketLabel:Other,size:5),schema:segment,type:terms)),params:(addLegend:!!t,addTooltip:!!t,isDonut:!!t,labels:(last_level:!!t,show:!!f,truncate:100,values:!!t),legendPosition:right,type:pie),title:!%27Rendering%2BTest:%2Bpie!%27,type:pie))%27),title:%27Rendering%20Test:%20pie%27)';
|
||||
const PDF_PRINT_PIE_VISUALIZATION_FILTER_AND_SAVED_SEARCH_6_3 =
|
||||
'/api/reporting/generate/printablePdf?jobParams=(browserTimezone:America%2FNew_York,layout:(id:print),objectType:visualization,relativeUrls:!(%27%2Fapp%2Fkibana%23%2Fvisualize%2Fedit%2Fbefdb6b0-3e59-11e8-9fc3-39e49624228e%3F_g%3D(refreshInterval:(display:Off,pause:!!f,value:0),time:(from:!%27Mon%2BApr%2B09%2B2018%2B17:56:08%2BGMT-0400!%27,mode:absolute,to:!%27Wed%2BApr%2B11%2B2018%2B17:56:08%2BGMT-0400!%27))%26_a%3D(filters:!!((!%27$state!%27:(store:appState),meta:(alias:!!n,disabled:!!f,index:a0f483a0-3dc9-11e8-8660-4d65aa086b3c,key:animal.keyword,negate:!!f,params:(query:dog,type:phrase),type:phrase,value:dog),query:(match:(animal.keyword:(query:dog,type:phrase))))),linked:!!t,query:(language:lucene,query:!%27!%27),uiState:(),vis:(aggs:!!((enabled:!!t,id:!%271!%27,params:(),schema:metric,type:count),(enabled:!!t,id:!%272!%27,params:(field:name.keyword,missingBucket:!!f,missingBucketLabel:Missing,order:desc,orderBy:!%271!%27,otherBucket:!!f,otherBucketLabel:Other,size:5),schema:segment,type:terms)),params:(addLegend:!!t,addTooltip:!!t,isDonut:!!t,labels:(last_level:!!t,show:!!f,truncate:100,values:!!t),legendPosition:right,type:pie),title:!%27Filter%2BTest:%2Banimals:%2Blinked%2Bto%2Bsearch%2Bwith%2Bfilter!%27,type:pie))%27),title:%27Filter%20Test:%20animals:%20linked%20to%20search%20with%20filter%27)';
|
||||
|
||||
const JOB_PARAMS_CSV_DEFAULT_SPACE =
|
||||
`columns:!(order_date,category,customer_full_name,taxful_total_price,currency),objectType:search,searchSource:(fields:!((field:'*',include_unmapped:true))` +
|
||||
`/api/reporting/generate/csv_searchsource?jobParams=(columns:!(order_date,category,customer_full_name,taxful_total_price,currency),objectType:search,searchSource:(fields:!((field:'*',include_unmapped:true))` +
|
||||
`,filter:!((meta:(field:order_date,index:aac3e500-f2c7-11ea-8250-fb138aa491e7,params:()),query:(range:(order_date:(format:strict_date_optional_time,gte:'2019-06-02T12:28:40.866Z'` +
|
||||
`,lte:'2019-07-18T20:59:57.136Z'))))),index:aac3e500-f2c7-11ea-8250-fb138aa491e7,parent:(filter:!(),highlightAll:!t,index:aac3e500-f2c7-11ea-8250-fb138aa491e7` +
|
||||
`,query:(language:kuery,query:''),version:!t),sort:!((order_date:desc)),trackTotalHits:!t)`;
|
||||
`,query:(language:kuery,query:''),version:!t),sort:!((order_date:desc)),trackTotalHits:!t))`;
|
||||
const OSS_KIBANA_ARCHIVE_PATH = 'test/functional/fixtures/kbn_archiver/dashboard/current/kibana';
|
||||
const OSS_DATA_ARCHIVE_PATH = 'test/functional/fixtures/es_archiver/dashboard/current/data';
|
||||
|
||||
interface UsageStats {
|
||||
reporting: ReportingUsageStats;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function ({ getService }: FtrProviderContext) {
|
||||
const esArchiver = getService('esArchiver');
|
||||
|
@ -132,11 +127,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
|
||||
it('should handle csv_searchsource', async () => {
|
||||
await reportingAPI.expectAllJobsToFinishSuccessfully(
|
||||
await Promise.all([
|
||||
reportingAPI.postJob(
|
||||
`/api/reporting/generate/csv_searchsource?jobParams=(${JOB_PARAMS_CSV_DEFAULT_SPACE})`
|
||||
),
|
||||
])
|
||||
await Promise.all([reportingAPI.postJob(JOB_PARAMS_CSV_DEFAULT_SPACE)])
|
||||
);
|
||||
|
||||
const usage = await usageAPI.getUsageStats();
|
||||
|
|
|
@ -7,33 +7,19 @@
|
|||
|
||||
import expect from '@kbn/expect';
|
||||
import { indexTimestamp } from '../../../plugins/reporting/server/lib/store/index_timestamp';
|
||||
import {
|
||||
AvailableTotal,
|
||||
BaseJobTypes,
|
||||
LayoutCounts,
|
||||
ReportingUsageType,
|
||||
} from '../../../plugins/reporting/server/usage/types';
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
interface PDFAppCounts {
|
||||
app: {
|
||||
[appName: string]: number;
|
||||
};
|
||||
layout: {
|
||||
[layoutType: string]: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ReportingUsageStats {
|
||||
available: boolean;
|
||||
enabled: boolean;
|
||||
total: number;
|
||||
last_7_days: {
|
||||
total: number;
|
||||
printable_pdf: PDFAppCounts;
|
||||
[jobType: string]: any;
|
||||
};
|
||||
printable_pdf: PDFAppCounts;
|
||||
status: any;
|
||||
[jobType: string]: any;
|
||||
}
|
||||
|
||||
// NOTE: the usage stats come from an HTTP API, which converts key names to snake_case
|
||||
export interface UsageStats {
|
||||
reporting: ReportingUsageStats;
|
||||
reporting: ReportingUsageType & {
|
||||
last_7_days: ReportingUsageType['last7Days'];
|
||||
};
|
||||
}
|
||||
|
||||
export function createUsageServices({ getService }: FtrProviderContext) {
|
||||
|
@ -115,27 +101,31 @@ export function createUsageServices({ getService }: FtrProviderContext) {
|
|||
},
|
||||
|
||||
expectRecentPdfAppStats(stats: UsageStats, app: string, count: number) {
|
||||
expect(stats.reporting.last_7_days.printable_pdf.app[app]).to.be(count);
|
||||
expect(
|
||||
stats.reporting.last_7_days.printable_pdf.app![app as keyof AvailableTotal['app']]
|
||||
).to.be(count);
|
||||
},
|
||||
|
||||
expectAllTimePdfAppStats(stats: UsageStats, app: string, count: number) {
|
||||
expect(stats.reporting.printable_pdf.app[app]).to.be(count);
|
||||
expect(stats.reporting.printable_pdf.app![app as keyof AvailableTotal['app']]).to.be(count);
|
||||
},
|
||||
|
||||
expectRecentPdfLayoutStats(stats: UsageStats, layout: string, count: number) {
|
||||
expect(stats.reporting.last_7_days.printable_pdf.layout[layout]).to.be(count);
|
||||
expect(stats.reporting.last_7_days.printable_pdf.layout![layout as keyof LayoutCounts]).to.be(
|
||||
count
|
||||
);
|
||||
},
|
||||
|
||||
expectAllTimePdfLayoutStats(stats: UsageStats, layout: string, count: number) {
|
||||
expect(stats.reporting.printable_pdf.layout[layout]).to.be(count);
|
||||
expect(stats.reporting.printable_pdf.layout![layout as keyof LayoutCounts]).to.be(count);
|
||||
},
|
||||
|
||||
expectRecentJobTypeTotalStats(stats: UsageStats, jobType: string, count: number) {
|
||||
expect(stats.reporting.last_7_days[jobType].total).to.be(count);
|
||||
expect(stats.reporting.last_7_days[jobType as BaseJobTypes].total).to.be(count);
|
||||
},
|
||||
|
||||
expectAllTimeJobTypeTotalStats(stats: UsageStats, jobType: string, count: number) {
|
||||
expect(stats.reporting[jobType].total).to.be(count);
|
||||
expect(stats.reporting[jobType as BaseJobTypes].total).to.be(count);
|
||||
},
|
||||
|
||||
getCompletedReportCount(stats: UsageStats) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue