Сквозная передача дополнительных аргументов dashboardId и widgetId
This commit is contained in:
parent
f3a8cded97
commit
4a2759a0e1
4 changed files with 20 additions and 1 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>>;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue