Compare commits
2 commits
f3a8cded97
...
04a0736c9a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04a0736c9a | ||
|
|
4a2759a0e1 |
5 changed files with 20 additions and 4 deletions
|
|
@ -34,6 +34,8 @@ export class DashboardsDataService {
|
||||||
widget.widgetParams,
|
widget.widgetParams,
|
||||||
widget.dataLoaderParams,
|
widget.dataLoaderParams,
|
||||||
cfg,
|
cfg,
|
||||||
|
id,
|
||||||
|
widget.id,
|
||||||
);
|
);
|
||||||
if (loadRes.result) {
|
if (loadRes.result) {
|
||||||
counter++;
|
counter++;
|
||||||
|
|
@ -57,6 +59,8 @@ export class DashboardsDataService {
|
||||||
widget.widgetParams,
|
widget.widgetParams,
|
||||||
widget.dataLoaderParams,
|
widget.dataLoaderParams,
|
||||||
cfg,
|
cfg,
|
||||||
|
id,
|
||||||
|
widgetId,
|
||||||
);
|
);
|
||||||
if (loadRes.result) return loadRes.result;
|
if (loadRes.result) return loadRes.result;
|
||||||
throw createAppError('CANNOT_LOAD_DATA');
|
throw createAppError('CANNOT_LOAD_DATA');
|
||||||
|
|
@ -67,6 +71,8 @@ export class DashboardsDataService {
|
||||||
widgetParams: DashboardModel.WidgetParams,
|
widgetParams: DashboardModel.WidgetParams,
|
||||||
dataLoaderParams: DashboardModel.DataLoaderParams,
|
dataLoaderParams: DashboardModel.DataLoaderParams,
|
||||||
dashboardParams: DashboardModel.Data,
|
dashboardParams: DashboardModel.Data,
|
||||||
|
dashboardId: string,
|
||||||
|
widgetId: string,
|
||||||
): Promise<Result<any, AppError>> {
|
): Promise<Result<any, AppError>> {
|
||||||
const widgetResult = this.widgetsCollectionService.getWidgetByType(type);
|
const widgetResult = this.widgetsCollectionService.getWidgetByType(type);
|
||||||
if (widgetResult.error) return fail(createAppError(widgetResult.error));
|
if (widgetResult.error) return fail(createAppError(widgetResult.error));
|
||||||
|
|
@ -75,6 +81,8 @@ export class DashboardsDataService {
|
||||||
widgetParams,
|
widgetParams,
|
||||||
dataLoaderParams,
|
dataLoaderParams,
|
||||||
dashboardParams,
|
dashboardParams,
|
||||||
|
dashboardId,
|
||||||
|
widgetId,
|
||||||
);
|
);
|
||||||
return renderResult;
|
return renderResult;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,15 @@ export class InteractiveWidget
|
||||||
widgetParams: any,
|
widgetParams: any,
|
||||||
dataLoaderParams: any,
|
dataLoaderParams: any,
|
||||||
dashboardParams: any,
|
dashboardParams: any,
|
||||||
|
dashboardId: string,
|
||||||
|
widgetId: string,
|
||||||
): Promise<Result<any, AppError>> {
|
): Promise<Result<any, AppError>> {
|
||||||
const data = await this.dataLoader.load(dataLoaderParams, dashboardParams);
|
const data = await this.dataLoader.load(
|
||||||
|
dataLoaderParams,
|
||||||
|
dashboardParams,
|
||||||
|
dashboardId,
|
||||||
|
widgetId,
|
||||||
|
);
|
||||||
return data.error ? fail(data.error) : success(data.result);
|
return data.error ? fail(data.error) : success(data.result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,7 @@ export interface WidgetDataLoaderInterface<DLP, DBP, R> {
|
||||||
load(
|
load(
|
||||||
dataLoaderParams: DLP,
|
dataLoaderParams: DLP,
|
||||||
dashboardParams: DBP,
|
dashboardParams: DBP,
|
||||||
|
dashboardId: string,
|
||||||
|
widgetId: string,
|
||||||
): Promise<Result<R, AppError>>;
|
): Promise<Result<R, AppError>>;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,5 +15,7 @@ export interface WidgetInterface<WP, DLP, DBP, DLR, R> {
|
||||||
widgetParams: WP,
|
widgetParams: WP,
|
||||||
dataLoaderParams: DLP,
|
dataLoaderParams: DLP,
|
||||||
dashboardParams: DBP,
|
dashboardParams: DBP,
|
||||||
|
dashboardId: string,
|
||||||
|
widgetId: string,
|
||||||
): Promise<Result<R, AppError>>;
|
): Promise<Result<R, AppError>>;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,6 @@ export class DailyEccmV2ReportTaskRunnerService {
|
||||||
widget: Widget,
|
widget: Widget,
|
||||||
issues: RedmineTypes.Issue[],
|
issues: RedmineTypes.Issue[],
|
||||||
previousIssues?: RedmineTypes.Issue[],
|
previousIssues?: RedmineTypes.Issue[],
|
||||||
previousMetrics?: Record<string, any>,
|
|
||||||
): Promise<Record<string, any>> {
|
): Promise<Record<string, any>> {
|
||||||
this.logger.log(
|
this.logger.log(
|
||||||
`Analyzing issues metrics for dashboard ${dashboard.id}, widget ${widget.id}`,
|
`Analyzing issues metrics for dashboard ${dashboard.id}, widget ${widget.id}`,
|
||||||
|
|
@ -528,7 +527,6 @@ export class DailyEccmV2ReportTaskRunnerService {
|
||||||
});
|
});
|
||||||
const prevData = prevDataResponse.docs[0];
|
const prevData = prevDataResponse.docs[0];
|
||||||
const prevIssues = prevData ? prevData.reportIssues : [];
|
const prevIssues = prevData ? prevData.reportIssues : [];
|
||||||
const prevMetrics = prevData ? prevData.issuesMetrics : {};
|
|
||||||
if (prevData) {
|
if (prevData) {
|
||||||
prevData.latest = false;
|
prevData.latest = false;
|
||||||
await datasource.insert(prevData);
|
await datasource.insert(prevData);
|
||||||
|
|
@ -538,7 +536,6 @@ export class DailyEccmV2ReportTaskRunnerService {
|
||||||
widget,
|
widget,
|
||||||
issues,
|
issues,
|
||||||
prevIssues,
|
prevIssues,
|
||||||
prevMetrics,
|
|
||||||
);
|
);
|
||||||
const item: any = {
|
const item: any = {
|
||||||
_id: id,
|
_id: id,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue