Add resource service to widget context.
This commit is contained in:
parent
19a953428e
commit
9669da0442
@ -38,6 +38,7 @@ import { EntityRelationService } from '@core/http/entity-relation.service';
|
|||||||
import { EntityService } from '@core/http/entity.service';
|
import { EntityService } from '@core/http/entity.service';
|
||||||
import { DialogService } from '@core/services/dialog.service';
|
import { DialogService } from '@core/services/dialog.service';
|
||||||
import { CustomDialogService } from '@home/components/widget/dialog/custom-dialog.service';
|
import { CustomDialogService } from '@home/components/widget/dialog/custom-dialog.service';
|
||||||
|
import { ResourceService } from '@core/http/resource.service';
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { DomSanitizer } from '@angular/platform-browser';
|
import { DomSanitizer } from '@angular/platform-browser';
|
||||||
@ -76,6 +77,7 @@ export class DynamicWidgetComponent extends PageComponent implements IDynamicWid
|
|||||||
this.ctx.entityService = $injector.get(EntityService);
|
this.ctx.entityService = $injector.get(EntityService);
|
||||||
this.ctx.dialogs = $injector.get(DialogService);
|
this.ctx.dialogs = $injector.get(DialogService);
|
||||||
this.ctx.customDialog = $injector.get(CustomDialogService);
|
this.ctx.customDialog = $injector.get(CustomDialogService);
|
||||||
|
this.ctx.resourceService = $injector.get(ResourceService);
|
||||||
this.ctx.date = $injector.get(DatePipe);
|
this.ctx.date = $injector.get(DatePipe);
|
||||||
this.ctx.translate = $injector.get(TranslateService);
|
this.ctx.translate = $injector.get(TranslateService);
|
||||||
this.ctx.http = $injector.get(HttpClient);
|
this.ctx.http = $injector.get(HttpClient);
|
||||||
|
|||||||
@ -36,6 +36,7 @@ import { BroadcastService } from '@core/services/broadcast.service';
|
|||||||
import { ImportExportService } from '@home/components/import-export/import-export.service';
|
import { ImportExportService } from '@home/components/import-export/import-export.service';
|
||||||
import { DeviceProfileService } from '@core/http/device-profile.service';
|
import { DeviceProfileService } from '@core/http/device-profile.service';
|
||||||
import { OtaPackageService } from '@core/http/ota-package.service';
|
import { OtaPackageService } from '@core/http/ota-package.service';
|
||||||
|
import { ResourceService } from '@core/http/resource.service';
|
||||||
|
|
||||||
export const ServicesMap = new Map<string, Type<any>>(
|
export const ServicesMap = new Map<string, Type<any>>(
|
||||||
[
|
[
|
||||||
@ -59,6 +60,7 @@ export const ServicesMap = new Map<string, Type<any>>(
|
|||||||
['router', Router],
|
['router', Router],
|
||||||
['importExport', ImportExportService],
|
['importExport', ImportExportService],
|
||||||
['deviceProfileService', DeviceProfileService],
|
['deviceProfileService', DeviceProfileService],
|
||||||
['otaPackageService', OtaPackageService]
|
['otaPackageService', OtaPackageService],
|
||||||
|
['resourceService', ResourceService]
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|||||||
@ -72,6 +72,7 @@ import { EntityRelationService } from '@core/http/entity-relation.service';
|
|||||||
import { EntityService } from '@core/http/entity.service';
|
import { EntityService } from '@core/http/entity.service';
|
||||||
import { DialogService } from '@core/services/dialog.service';
|
import { DialogService } from '@core/services/dialog.service';
|
||||||
import { CustomDialogService } from '@home/components/widget/dialog/custom-dialog.service';
|
import { CustomDialogService } from '@home/components/widget/dialog/custom-dialog.service';
|
||||||
|
import { ResourceService } from '@core/http/resource.service';
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { PageLink } from '@shared/models/page/page-link';
|
import { PageLink } from '@shared/models/page/page-link';
|
||||||
@ -168,6 +169,7 @@ export class WidgetContext {
|
|||||||
entityService: EntityService;
|
entityService: EntityService;
|
||||||
dialogs: DialogService;
|
dialogs: DialogService;
|
||||||
customDialog: CustomDialogService;
|
customDialog: CustomDialogService;
|
||||||
|
resourceService: ResourceService;
|
||||||
date: DatePipe;
|
date: DatePipe;
|
||||||
translate: TranslateService;
|
translate: TranslateService;
|
||||||
http: HttpClient;
|
http: HttpClient;
|
||||||
|
|||||||
@ -100,6 +100,8 @@ export const importEntitiesResultInfoHref = '<a href="https://github.com/thingsb
|
|||||||
|
|
||||||
export const customDialogComponentHref = '<a href="https://github.com/thingsboard/thingsboard/blob/master/ui-ngx/src/app/modules/home/components/widget/dialog/custom-dialog.component.ts#L48">CustomDialogComponent</a>';
|
export const customDialogComponentHref = '<a href="https://github.com/thingsboard/thingsboard/blob/master/ui-ngx/src/app/modules/home/components/widget/dialog/custom-dialog.component.ts#L48">CustomDialogComponent</a>';
|
||||||
|
|
||||||
|
export const resourceInfoHref = '<a https://github.com/thingsboard/thingsboard/blob/b033b51712244d08e0f5e0beb8be60c9f8fa4cd2/ui-ngx/src/app/shared/models/resource.models.ts#L51">Resource info</a>';
|
||||||
|
|
||||||
export const pageLinkArg: FunctionArg = {
|
export const pageLinkArg: FunctionArg = {
|
||||||
name: 'pageLink',
|
name: 'pageLink',
|
||||||
type: '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/shared/models/page/page-link.ts#L68">PageLink</a>',
|
type: '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/shared/models/page/page-link.ts#L68">PageLink</a>',
|
||||||
@ -1300,6 +1302,23 @@ export const serviceCompletions: TbEditorCompletions = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
resourceService: {
|
||||||
|
description: 'Resource Service API<br>' +
|
||||||
|
'See <a href="https://github.com/thingsboard/thingsboard/blob/b033b51712244d08e0f5e0beb8be60c9f8fa4cd2/ui-ngx/src/app/core/http/resource.service.ts#L29">ResourceService</a> for API reference.',
|
||||||
|
meta: 'service',
|
||||||
|
type: '<a href="https://github.com/thingsboard/thingsboard/blob/b033b51712244d08e0f5e0beb8be60c9f8fa4cd2/ui-ngx/src/app/core/http/resource.service.ts#L29">ResourceService</a>',
|
||||||
|
children: {
|
||||||
|
getResources: {
|
||||||
|
description: 'Find resources by search text',
|
||||||
|
meta: 'function',
|
||||||
|
args: [
|
||||||
|
pageLinkArg,
|
||||||
|
requestConfigArg
|
||||||
|
],
|
||||||
|
return: observablePageDataReturnType(resourceInfoHref)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
dialogs: {
|
dialogs: {
|
||||||
description: 'Dialogs Service API<br>' +
|
description: 'Dialogs Service API<br>' +
|
||||||
'See <a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/core/services/dialog.service.ts#L39">DialogService</a> for API reference.',
|
'See <a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/core/services/dialog.service.ts#L39">DialogService</a> for API reference.',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user