Commit 38847216cdcf8aa6903ad46244e79ed7c7e68b48

Authored by Igor Kulikov
2 parents 868234f1 e5e103be

Merge branch 'master' into develop/3.2

@@ -25,5 +25,5 @@ @@ -25,5 +25,5 @@
25 'info-toast': notification.type === 'info' 25 'info-toast': notification.type === 'info'
26 }"> 26 }">
27 <div class="toast-text" [innerHTML]="notification.message"></div> 27 <div class="toast-text" [innerHTML]="notification.message"></div>
28 - <button #actionButton mat-button (click)="action()">{{ 'action.close' | translate }}</button> 28 + <button #actionButton type="button" mat-button (click)="action()">{{ 'action.close' | translate }}</button>
29 </div> 29 </div>
@@ -16,6 +16,33 @@ @@ -16,6 +16,33 @@
16 :host { 16 :host {
17 display: inline-block; 17 display: inline-block;
18 pointer-events: all; 18 pointer-events: all;
  19 + &.toast-panel {
  20 + position: absolute;
  21 + top: 0;
  22 + bottom: 0;
  23 + left: 0;
  24 + right: 0;
  25 + z-index: 1000;
  26 + display: flex;
  27 + &.left {
  28 + justify-content: flex-start;
  29 + }
  30 + &.right {
  31 + justify-content: flex-end;
  32 + }
  33 + &.top {
  34 + align-items: flex-start;
  35 + }
  36 + &.bottom {
  37 + align-items: flex-end;
  38 + }
  39 + &.h-center {
  40 + justify-content: center;
  41 + }
  42 + &.v-center {
  43 + align-items: center;
  44 + }
  45 + }
19 .tb-toast { 46 .tb-toast {
20 box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12); 47 box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12);
21 color: #fff; 48 color: #fff;
@@ -16,9 +16,9 @@ @@ -16,9 +16,9 @@
16 16
17 import { 17 import {
18 AfterViewInit, ChangeDetectorRef, 18 AfterViewInit, ChangeDetectorRef,
19 - Component, ComponentRef, 19 + Component, ComponentFactoryResolver, ComponentRef,
20 Directive, 20 Directive,
21 - ElementRef, 21 + ElementRef, HostBinding,
22 Inject, 22 Inject,
23 Input, 23 Input,
24 NgZone, 24 NgZone,
@@ -34,8 +34,7 @@ import { BreakpointObserver } from '@angular/cdk/layout'; @@ -34,8 +34,7 @@ import { BreakpointObserver } from '@angular/cdk/layout';
34 import { MediaBreakpoints } from '@shared/models/constants'; 34 import { MediaBreakpoints } from '@shared/models/constants';
35 import { MatButton } from '@angular/material/button'; 35 import { MatButton } from '@angular/material/button';
36 import Timeout = NodeJS.Timeout; 36 import Timeout = NodeJS.Timeout;
37 -import { ConnectedPosition, Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay';  
38 -import { ComponentPortal, PortalInjector } from '@angular/cdk/portal'; 37 +import { PortalInjector } from '@angular/cdk/portal';
39 38
40 @Directive({ 39 @Directive({
41 selector: '[tb-toast]' 40 selector: '[tb-toast]'
@@ -49,7 +48,6 @@ export class ToastDirective implements AfterViewInit, OnDestroy { @@ -49,7 +48,6 @@ export class ToastDirective implements AfterViewInit, OnDestroy {
49 private hideNotificationSubscription: Subscription = null; 48 private hideNotificationSubscription: Subscription = null;
50 49
51 private snackBarRef: MatSnackBarRef<any> = null; 50 private snackBarRef: MatSnackBarRef<any> = null;
52 - private overlayRef: OverlayRef;  
53 private toastComponentRef: ComponentRef<TbSnackBarComponent>; 51 private toastComponentRef: ComponentRef<TbSnackBarComponent>;
54 private currentMessage: NotificationMessage = null; 52 private currentMessage: NotificationMessage = null;
55 53
@@ -58,7 +56,7 @@ export class ToastDirective implements AfterViewInit, OnDestroy { @@ -58,7 +56,7 @@ export class ToastDirective implements AfterViewInit, OnDestroy {
58 constructor(private elementRef: ElementRef, 56 constructor(private elementRef: ElementRef,
59 private viewContainerRef: ViewContainerRef, 57 private viewContainerRef: ViewContainerRef,
60 private notificationService: NotificationService, 58 private notificationService: NotificationService,
61 - private overlay: Overlay, 59 + private componentFactoryResolver: ComponentFactoryResolver,
62 private snackBar: MatSnackBar, 60 private snackBar: MatSnackBar,
63 private ngZone: NgZone, 61 private ngZone: NgZone,
64 private breakpointObserver: BreakpointObserver, 62 private breakpointObserver: BreakpointObserver,
@@ -104,9 +102,11 @@ export class ToastDirective implements AfterViewInit, OnDestroy { @@ -104,9 +102,11 @@ export class ToastDirective implements AfterViewInit, OnDestroy {
104 if (this.snackBarRef) { 102 if (this.snackBarRef) {
105 this.snackBarRef.dismiss(); 103 this.snackBarRef.dismiss();
106 } 104 }
107 -  
108 - const position = this.overlay.position();  
109 - let panelClass = ['tb-toast-panel']; 105 + if (this.toastComponentRef) {
  106 + this.viewContainerRef.detach(0);
  107 + this.toastComponentRef.destroy();
  108 + }
  109 + let panelClass = ['tb-toast-panel', 'toast-panel'];
110 if (notificationMessage.panelClass) { 110 if (notificationMessage.panelClass) {
111 if (typeof notificationMessage.panelClass === 'string') { 111 if (typeof notificationMessage.panelClass === 'string') {
112 panelClass.push(notificationMessage.panelClass); 112 panelClass.push(notificationMessage.panelClass);
@@ -114,46 +114,35 @@ export class ToastDirective implements AfterViewInit, OnDestroy { @@ -114,46 +114,35 @@ export class ToastDirective implements AfterViewInit, OnDestroy {
114 panelClass = panelClass.concat(notificationMessage.panelClass); 114 panelClass = panelClass.concat(notificationMessage.panelClass);
115 } 115 }
116 } 116 }
117 - const overlayConfig = new OverlayConfig({  
118 - panelClass,  
119 - backdropClass: 'cdk-overlay-transparent-backdrop',  
120 - hasBackdrop: false,  
121 - disposeOnNavigation: true  
122 - });  
123 - let originX;  
124 - let originY;  
125 const horizontalPosition = notificationMessage.horizontalPosition || 'left'; 117 const horizontalPosition = notificationMessage.horizontalPosition || 'left';
126 const verticalPosition = notificationMessage.verticalPosition || 'top'; 118 const verticalPosition = notificationMessage.verticalPosition || 'top';
127 if (horizontalPosition === 'start' || horizontalPosition === 'left') { 119 if (horizontalPosition === 'start' || horizontalPosition === 'left') {
128 - originX = 'start'; 120 + panelClass.push('left');
129 } else if (horizontalPosition === 'end' || horizontalPosition === 'right') { 121 } else if (horizontalPosition === 'end' || horizontalPosition === 'right') {
130 - originX = 'end'; 122 + panelClass.push('right');
131 } else { 123 } else {
132 - originX = 'center'; 124 + panelClass.push('h-center');
133 } 125 }
134 if (verticalPosition === 'top') { 126 if (verticalPosition === 'top') {
135 - originY = 'top'; 127 + panelClass.push('top');
136 } else { 128 } else {
137 - originY = 'bottom'; 129 + panelClass.push('bottom');
138 } 130 }
139 - const connectedPosition: ConnectedPosition = {  
140 - originX,  
141 - originY,  
142 - overlayX: originX,  
143 - overlayY: originY  
144 - };  
145 - overlayConfig.positionStrategy = position.flexibleConnectedTo(this.elementRef)  
146 - .withPositions([connectedPosition]);  
147 - this.overlayRef = this.overlay.create(overlayConfig); 131 +
  132 + const componentFactory = this.componentFactoryResolver.resolveComponentFactory(TbSnackBarComponent);
148 const data: ToastPanelData = { 133 const data: ToastPanelData = {
149 - notification: notificationMessage 134 + notification: notificationMessage,
  135 + panelClass,
  136 + destroyToastComponent: () => {
  137 + this.viewContainerRef.detach(0);
  138 + this.toastComponentRef.destroy();
  139 + }
150 }; 140 };
151 const injectionTokens = new WeakMap<any, any>([ 141 const injectionTokens = new WeakMap<any, any>([
152 - [MAT_SNACK_BAR_DATA, data],  
153 - [OverlayRef, this.overlayRef] 142 + [MAT_SNACK_BAR_DATA, data]
154 ]); 143 ]);
155 const injector = new PortalInjector(this.viewContainerRef.injector, injectionTokens); 144 const injector = new PortalInjector(this.viewContainerRef.injector, injectionTokens);
156 - this.toastComponentRef = this.overlayRef.attach(new ComponentPortal(TbSnackBarComponent, this.viewContainerRef, injector)); 145 + this.toastComponentRef = this.viewContainerRef.createComponent(componentFactory, 0, injector);
157 this.cd.detectChanges(); 146 this.cd.detectChanges();
158 147
159 if (notificationMessage.duration && notificationMessage.duration > 0) { 148 if (notificationMessage.duration && notificationMessage.duration > 0) {
@@ -173,7 +162,6 @@ export class ToastDirective implements AfterViewInit, OnDestroy { @@ -173,7 +162,6 @@ export class ToastDirective implements AfterViewInit, OnDestroy {
173 clearTimeout(this.dismissTimeout); 162 clearTimeout(this.dismissTimeout);
174 this.dismissTimeout = null; 163 this.dismissTimeout = null;
175 } 164 }
176 - this.overlayRef = null;  
177 this.toastComponentRef = null; 165 this.toastComponentRef = null;
178 this.currentMessage = null; 166 this.currentMessage = null;
179 }); 167 });
@@ -181,43 +169,45 @@ export class ToastDirective implements AfterViewInit, OnDestroy { @@ -181,43 +169,45 @@ export class ToastDirective implements AfterViewInit, OnDestroy {
181 } 169 }
182 170
183 private showSnackBar(notificationMessage: NotificationMessage, isGtSm: boolean) { 171 private showSnackBar(notificationMessage: NotificationMessage, isGtSm: boolean) {
184 - const data: ToastPanelData = {  
185 - notification: notificationMessage,  
186 - parent: this.elementRef  
187 - };  
188 - const config: MatSnackBarConfig = {  
189 - horizontalPosition: notificationMessage.horizontalPosition || 'left',  
190 - verticalPosition: !isGtSm ? 'bottom' : (notificationMessage.verticalPosition || 'top'),  
191 - viewContainerRef: this.viewContainerRef,  
192 - duration: notificationMessage.duration,  
193 - panelClass: notificationMessage.panelClass,  
194 - data  
195 - };  
196 this.ngZone.run(() => { 172 this.ngZone.run(() => {
197 if (this.snackBarRef) { 173 if (this.snackBarRef) {
198 this.snackBarRef.dismiss(); 174 this.snackBarRef.dismiss();
199 } 175 }
  176 + const data: ToastPanelData = {
  177 + notification: notificationMessage,
  178 + parent: this.elementRef,
  179 + panelClass: [],
  180 + destroyToastComponent: () => {}
  181 + };
  182 + const config: MatSnackBarConfig = {
  183 + horizontalPosition: notificationMessage.horizontalPosition || 'left',
  184 + verticalPosition: !isGtSm ? 'bottom' : (notificationMessage.verticalPosition || 'top'),
  185 + viewContainerRef: this.viewContainerRef,
  186 + duration: notificationMessage.duration,
  187 + panelClass: notificationMessage.panelClass,
  188 + data
  189 + };
200 this.snackBarRef = this.snackBar.openFromComponent(TbSnackBarComponent, config); 190 this.snackBarRef = this.snackBar.openFromComponent(TbSnackBarComponent, config);
201 - });  
202 - if (notificationMessage.duration && notificationMessage.duration > 0 && notificationMessage.forceDismiss) {  
203 - if (this.dismissTimeout !== null) {  
204 - clearTimeout(this.dismissTimeout);  
205 - this.dismissTimeout = null;  
206 - }  
207 - this.dismissTimeout = setTimeout(() => {  
208 - if (this.snackBarRef) {  
209 - this.snackBarRef.instance.actionButton._elementRef.nativeElement.click(); 191 + if (notificationMessage.duration && notificationMessage.duration > 0 && notificationMessage.forceDismiss) {
  192 + if (this.dismissTimeout !== null) {
  193 + clearTimeout(this.dismissTimeout);
  194 + this.dismissTimeout = null;
210 } 195 }
211 - this.dismissTimeout = null;  
212 - }, notificationMessage.duration);  
213 - }  
214 - this.snackBarRef.afterDismissed().subscribe(() => {  
215 - if (this.dismissTimeout !== null) {  
216 - clearTimeout(this.dismissTimeout);  
217 - this.dismissTimeout = null; 196 + this.dismissTimeout = setTimeout(() => {
  197 + if (this.snackBarRef) {
  198 + this.snackBarRef.instance.actionButton._elementRef.nativeElement.click();
  199 + }
  200 + this.dismissTimeout = null;
  201 + }, notificationMessage.duration);
218 } 202 }
219 - this.snackBarRef = null;  
220 - this.currentMessage = null; 203 + this.snackBarRef.afterDismissed().subscribe(() => {
  204 + if (this.dismissTimeout !== null) {
  205 + clearTimeout(this.dismissTimeout);
  206 + this.dismissTimeout = null;
  207 + }
  208 + this.snackBarRef = null;
  209 + this.currentMessage = null;
  210 + });
221 }); 211 });
222 } 212 }
223 213
@@ -235,8 +225,9 @@ export class ToastDirective implements AfterViewInit, OnDestroy { @@ -235,8 +225,9 @@ export class ToastDirective implements AfterViewInit, OnDestroy {
235 } 225 }
236 226
237 ngOnDestroy(): void { 227 ngOnDestroy(): void {
238 - if (this.overlayRef) {  
239 - this.overlayRef.dispose(); 228 + if (this.toastComponentRef) {
  229 + this.viewContainerRef.detach(0);
  230 + this.toastComponentRef.destroy();
240 } 231 }
241 if (this.notificationSubscription) { 232 if (this.notificationSubscription) {
242 this.notificationSubscription.unsubscribe(); 233 this.notificationSubscription.unsubscribe();
@@ -250,6 +241,8 @@ export class ToastDirective implements AfterViewInit, OnDestroy { @@ -250,6 +241,8 @@ export class ToastDirective implements AfterViewInit, OnDestroy {
250 interface ToastPanelData { 241 interface ToastPanelData {
251 notification: NotificationMessage; 242 notification: NotificationMessage;
252 parent?: ElementRef; 243 parent?: ElementRef;
  244 + panelClass: string[];
  245 + destroyToastComponent: () => void;
253 } 246 }
254 247
255 import { 248 import {
@@ -288,6 +281,11 @@ export class TbSnackBarComponent implements AfterViewInit, OnDestroy { @@ -288,6 +281,11 @@ export class TbSnackBarComponent implements AfterViewInit, OnDestroy {
288 281
289 @ViewChild('actionButton', {static: true}) actionButton: MatButton; 282 @ViewChild('actionButton', {static: true}) actionButton: MatButton;
290 283
  284 + @HostBinding('class')
  285 + get panelClass(): string[] {
  286 + return this.data.panelClass;
  287 + }
  288 +
291 private parentEl: HTMLElement; 289 private parentEl: HTMLElement;
292 private snackBarContainerEl: HTMLElement; 290 private snackBarContainerEl: HTMLElement;
293 private parentScrollSubscription: Subscription = null; 291 private parentScrollSubscription: Subscription = null;
@@ -305,9 +303,7 @@ export class TbSnackBarComponent implements AfterViewInit, OnDestroy { @@ -305,9 +303,7 @@ export class TbSnackBarComponent implements AfterViewInit, OnDestroy {
305 private data: ToastPanelData, 303 private data: ToastPanelData,
306 private elementRef: ElementRef, 304 private elementRef: ElementRef,
307 @Optional() 305 @Optional()
308 - private snackBarRef: MatSnackBarRef<TbSnackBarComponent>,  
309 - @Optional()  
310 - private overlayRef: OverlayRef) { 306 + private snackBarRef: MatSnackBarRef<TbSnackBarComponent>) {
311 this.animationState = !!this.snackBarRef ? 'default' : 'opened'; 307 this.animationState = !!this.snackBarRef ? 'default' : 'opened';
312 this.notification = data.notification; 308 this.notification = data.notification;
313 } 309 }
@@ -319,9 +315,8 @@ export class TbSnackBarComponent implements AfterViewInit, OnDestroy { @@ -319,9 +315,8 @@ export class TbSnackBarComponent implements AfterViewInit, OnDestroy {
319 this.snackBarContainerEl.style.position = 'absolute'; 315 this.snackBarContainerEl.style.position = 'absolute';
320 this.updateContainerRect(); 316 this.updateContainerRect();
321 this.updatePosition(this.snackBarRef.containerInstance.snackBarConfig); 317 this.updatePosition(this.snackBarRef.containerInstance.snackBarConfig);
322 - const snackBarComponent = this;  
323 this.parentScrollSubscription = onParentScrollOrWindowResize(this.parentEl).subscribe(() => { 318 this.parentScrollSubscription = onParentScrollOrWindowResize(this.parentEl).subscribe(() => {
324 - snackBarComponent.updateContainerRect(); 319 + this.updateContainerRect();
325 }); 320 });
326 } 321 }
327 } 322 }
@@ -373,7 +368,7 @@ export class TbSnackBarComponent implements AfterViewInit, OnDestroy { @@ -373,7 +368,7 @@ export class TbSnackBarComponent implements AfterViewInit, OnDestroy {
373 const isFadeOut = (toState as ToastAnimationState) === 'closing'; 368 const isFadeOut = (toState as ToastAnimationState) === 'closing';
374 const itFinished = this.animationState === 'closing'; 369 const itFinished = this.animationState === 'closing';
375 if (isFadeOut && itFinished) { 370 if (isFadeOut && itFinished) {
376 - this.overlayRef.dispose(); 371 + this.data.destroyToastComponent();
377 } 372 }
378 } 373 }
379 } 374 }
@@ -24,7 +24,7 @@ export const alarmDataHref = '<a href="https://github.com/thingsboard/thingsboar @@ -24,7 +24,7 @@ export const alarmDataHref = '<a href="https://github.com/thingsboard/thingsboar
24 24
25 export const alarmDataQueryHref = '<a href="https://github.com/thingsboard/thingsboard/blob/master/ui-ngx/src/app/shared/models/query/query.models.ts#L558">Alarm data query</a>'; 25 export const alarmDataQueryHref = '<a href="https://github.com/thingsboard/thingsboard/blob/master/ui-ngx/src/app/shared/models/query/query.models.ts#L558">Alarm data query</a>';
26 26
27 -export const attributeScopeHref ='<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts#L37">Attribute scope</a>'; 27 +export const attributeScopeHref = '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts#L37">Attribute scope</a>';
28 28
29 export const entityTypeHref = '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/shared/models/entity-type.models.ts#L36">EntityType</a>'; 29 export const entityTypeHref = '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/shared/models/entity-type.models.ts#L36">EntityType</a>';
30 30
@@ -32,7 +32,7 @@ export const pageDataHref = '<a href="https://github.com/thingsboard/thingsboard @@ -32,7 +32,7 @@ export const pageDataHref = '<a href="https://github.com/thingsboard/thingsboard
32 32
33 export const deviceInfoHref = '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/shared/models/device.models.ts#L33">DeviceInfo</a>'; 33 export const deviceInfoHref = '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/shared/models/device.models.ts#L33">DeviceInfo</a>';
34 34
35 -export const assetInfoHref = '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/shared/models/asset.models.ts#L32">AssetInfo</a>' 35 +export const assetInfoHref = '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/shared/models/asset.models.ts#L32">AssetInfo</a>';
36 36
37 export const entityViewInfoHref = '<a href = "https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/shared/models/entity-view.models.ts#L47">EntityViewInfo</a>'; 37 export const entityViewInfoHref = '<a href = "https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/shared/models/entity-view.models.ts#L47">EntityViewInfo</a>';
38 38
@@ -84,15 +84,15 @@ export const stateParamsHref = '<a href="https://github.com/thingsboard/thingsbo @@ -84,15 +84,15 @@ export const stateParamsHref = '<a href="https://github.com/thingsboard/thingsbo
84 84
85 export const aliasInfoHref = '<a href="https://github.com/thingsboard/thingsboard/blob/master/ui-ngx/src/app/core/api/widget-api.models.ts#L88">Alias info</a>'; 85 export const aliasInfoHref = '<a href="https://github.com/thingsboard/thingsboard/blob/master/ui-ngx/src/app/core/api/widget-api.models.ts#L88">Alias info</a>';
86 86
87 -export const entityAliasFilterHref = '<a href="https://github.com/thingsboard/thingsboard/blob/master/ui-ngx/src/app/shared/models/alias.models.ts#L134">Entity alias filter</a>' 87 +export const entityAliasFilterHref = '<a href="https://github.com/thingsboard/thingsboard/blob/master/ui-ngx/src/app/shared/models/alias.models.ts#L134">Entity alias filter</a>';
88 88
89 -export const entityAliasFilterResultHref = '<a href="https://github.com/thingsboard/thingsboard/blob/master/ui-ngx/src/app/shared/models/alias.models.ts#L158">Entity alias filter result</a>' 89 +export const entityAliasFilterResultHref = '<a href="https://github.com/thingsboard/thingsboard/blob/master/ui-ngx/src/app/shared/models/alias.models.ts#L158">Entity alias filter result</a>';
90 90
91 -export const importEntityDataHref = '<a href="https://github.com/thingsboard/thingsboard/blob/master/ui-ngx/src/app/shared/models/entity.models.ts#L28">Import entity data</a>' 91 +export const importEntityDataHref = '<a href="https://github.com/thingsboard/thingsboard/blob/master/ui-ngx/src/app/shared/models/entity.models.ts#L28">Import entity data</a>';
92 92
93 -export const importEntitiesResultInfoHref = '<a href="https://github.com/thingsboard/thingsboard/blob/master/ui-ngx/src/app/shared/models/entity.models.ts#L42">Import entities result info</a>' 93 +export const importEntitiesResultInfoHref = '<a href="https://github.com/thingsboard/thingsboard/blob/master/ui-ngx/src/app/shared/models/entity.models.ts#L42">Import entities result info</a>';
94 94
95 -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>' 95 +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>';
96 96
97 export const pageLinkArg: FunctionArg = { 97 export const pageLinkArg: FunctionArg = {
98 name: 'pageLink', 98 name: 'pageLink',
@@ -135,21 +135,20 @@ export function observableArrayReturnType(objectType: string): FunctionArgType { @@ -135,21 +135,20 @@ export function observableArrayReturnType(objectType: string): FunctionArgType {
135 }; 135 };
136 } 136 }
137 137
138 -export function observableBaseDataReturnType(objectType: string): FunctionArgType { 138 +export function observableBaseDataReturnType(): FunctionArgType {
139 return { 139 return {
140 - type: `Observable&lt;${baseDataHref}&lt;${objectType}&gt;&gt;`,  
141 - description: `An <code>Observable</code> of page result as a <code>${baseDataHref}</code> holding array of <code>${objectType}</code> objects.` 140 + type: `Observable&lt;${baseDataHref}&lt;${entityIdHref}&gt;&gt;`,
  141 + description: `An <code>Observable</code> of <code>${baseDataHref}</code> object.`
142 }; 142 };
143 } 143 }
144 144
145 -export function observableArrayBaseDataReturnType(objectType: string): FunctionArgType { 145 +export function observableArrayBaseDataReturnType(): FunctionArgType {
146 return { 146 return {
147 - type: `Observable&lt;Array&lt;${baseDataHref}&lt;${objectType}&gt;&gt;&gt;`,  
148 - description: `An <code>Observable</code> of page result as a <code>${baseDataHref}</code> holding array of <code>${objectType}</code> objects.` 147 + type: `Observable&lt;Array&lt;${baseDataHref}&lt;${entityIdHref}&gt;&gt;&gt;`,
  148 + description: `An <code>Observable</code> of array of <code>${baseDataHref}</code> objects.`
149 }; 149 };
150 } 150 }
151 151
152 -  
153 export function observablePageDataReturnType(objectType: string): FunctionArgType { 152 export function observablePageDataReturnType(objectType: string): FunctionArgType {
154 return { 153 return {
155 type: `Observable&lt;${pageDataHref}&lt;${objectType}&gt;&gt;`, 154 type: `Observable&lt;${pageDataHref}&lt;${objectType}&gt;&gt;`,
@@ -157,8 +156,6 @@ export function observablePageDataReturnType(objectType: string): FunctionArgTyp @@ -157,8 +156,6 @@ export function observablePageDataReturnType(objectType: string): FunctionArgTyp
157 }; 156 };
158 } 157 }
159 158
160 -  
161 -  
162 export const serviceCompletions: TbEditorCompletions = { 159 export const serviceCompletions: TbEditorCompletions = {
163 deviceService: { 160 deviceService: {
164 description: 'Device Service API<br>' + 161 description: 'Device Service API<br>' +
@@ -362,7 +359,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -362,7 +359,7 @@ export const serviceCompletions: TbEditorCompletions = {
362 type: '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/core/http/asset.service.ts#L29">AssetService</a>', 359 type: '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/core/http/asset.service.ts#L29">AssetService</a>',
363 children: { 360 children: {
364 getTenantAssetInfos: { 361 getTenantAssetInfos: {
365 - description: 'Get tenant asset', 362 + description: 'Get tenant assets',
366 meta: 'function', 363 meta: 'function',
367 args: [ 364 args: [
368 pageLinkArg, 365 pageLinkArg,
@@ -530,7 +527,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -530,7 +527,7 @@ export const serviceCompletions: TbEditorCompletions = {
530 description: 'Get entity view info by id', 527 description: 'Get entity view info by id',
531 meta: 'function', 528 meta: 'function',
532 args: [ 529 args: [
533 - {name: 'entityViewId', type: 'string', description: 'Id of the entities view'}, 530 + {name: 'entityViewId', type: 'string', description: 'Id of the entity view'},
534 requestConfigArg 531 requestConfigArg
535 ], 532 ],
536 return: observableReturnType(entityViewInfoHref) 533 return: observableReturnType(entityViewInfoHref)
@@ -575,7 +572,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -575,7 +572,7 @@ export const serviceCompletions: TbEditorCompletions = {
575 meta: 'function', 572 meta: 'function',
576 args: [ 573 args: [
577 {name: 'customerId', type: 'string', description: 'Id of the customer'}, 574 {name: 'customerId', type: 'string', description: 'Id of the customer'},
578 - {name: 'entityViewId', type: 'string', description: 'Id of the entity viewId'}, 575 + {name: 'entityViewId', type: 'string', description: 'Id of the entity view'},
579 requestConfigArg 576 requestConfigArg
580 ], 577 ],
581 return: observableReturnType(entityViewHref) 578 return: observableReturnType(entityViewHref)
@@ -596,7 +593,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -596,7 +593,7 @@ export const serviceCompletions: TbEditorCompletions = {
596 { 593 {
597 name: 'query', 594 name: 'query',
598 type: '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/shared/models/asset.models.ts#L37">AssetSearchQuery</a>', 595 type: '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/shared/models/asset.models.ts#L37">AssetSearchQuery</a>',
599 - description: 'Asset search query object' 596 + description: 'Entity view search query object'
600 }, 597 },
601 requestConfigArg 598 requestConfigArg
602 ], 599 ],
@@ -655,7 +652,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -655,7 +652,7 @@ export const serviceCompletions: TbEditorCompletions = {
655 type: '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/core/http/dashboard.service.ts#L32">DashboardService</a>', 652 type: '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/core/http/dashboard.service.ts#L32">DashboardService</a>',
656 children: { 653 children: {
657 getTenantDashboards: { 654 getTenantDashboards: {
658 - description: 'Get tenant dashboard', 655 + description: 'Get tenant dashboards',
659 meta: 'function', 656 meta: 'function',
660 args: [ 657 args: [
661 pageLinkArg, 658 pageLinkArg,
@@ -664,16 +661,17 @@ export const serviceCompletions: TbEditorCompletions = { @@ -664,16 +661,17 @@ export const serviceCompletions: TbEditorCompletions = {
664 return: observablePageDataReturnType(dashboardInfoHref) 661 return: observablePageDataReturnType(dashboardInfoHref)
665 }, 662 },
666 getTenantDashboardsByTenantId: { 663 getTenantDashboardsByTenantId: {
667 - description: 'Get tenant dashboards by id', 664 + description: 'Get dashboards by tenant id',
668 meta: 'function', 665 meta: 'function',
669 args: [ 666 args: [
670 {name: 'tenantId', type: 'string', description: 'Id of the tenant'}, 667 {name: 'tenantId', type: 'string', description: 'Id of the tenant'},
671 - pageLinkArg 668 + pageLinkArg,
  669 + requestConfigArg
672 ], 670 ],
673 return: observablePageDataReturnType(dashboardInfoHref) 671 return: observablePageDataReturnType(dashboardInfoHref)
674 }, 672 },
675 getCustomerDashboards: { 673 getCustomerDashboards: {
676 - description: 'Get customer dashboard by id', 674 + description: 'Get dashboards by customer id',
677 meta: 'function', 675 meta: 'function',
678 args: [ 676 args: [
679 {name: 'customerId', type: 'string', description: 'Id of the customer'}, 677 {name: 'customerId', type: 'string', description: 'Id of the customer'},
@@ -713,7 +711,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -713,7 +711,7 @@ export const serviceCompletions: TbEditorCompletions = {
713 description: 'Delete dashboard by id', 711 description: 'Delete dashboard by id',
714 meta: 'function', 712 meta: 'function',
715 args: [ 713 args: [
716 - {name: 'dashboardId', type: 'string', description: 'Id of the entity view'}, 714 + {name: 'dashboardId', type: 'string', description: 'Id of the dashboard'},
717 requestConfigArg 715 requestConfigArg
718 ], 716 ],
719 return: observableVoid() 717 return: observableVoid()
@@ -729,7 +727,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -729,7 +727,7 @@ export const serviceCompletions: TbEditorCompletions = {
729 return: observableReturnType(dashboardHref) 727 return: observableReturnType(dashboardHref)
730 }, 728 },
731 unassignDashboardFromCustomer: { 729 unassignDashboardFromCustomer: {
732 - description: 'Unassign dashboard from any customer', 730 + description: 'Unassign dashboard from specific customer',
733 meta: 'function', 731 meta: 'function',
734 args: [ 732 args: [
735 {name: 'customerId', type: 'string', description: 'Id of the customer'}, 733 {name: 'customerId', type: 'string', description: 'Id of the customer'},
@@ -757,7 +755,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -757,7 +755,7 @@ export const serviceCompletions: TbEditorCompletions = {
757 return: observableReturnType(dashboardHref) 755 return: observableReturnType(dashboardHref)
758 }, 756 },
759 updateDashboardCustomers: { 757 updateDashboardCustomers: {
760 - description: 'Update dashboard by id', 758 + description: 'Update customers assigned to dashboard by ids',
761 meta: 'function', 759 meta: 'function',
762 args: [ 760 args: [
763 {name: 'dashboardId', type: 'string', description: 'Id of the dashboard'}, 761 {name: 'dashboardId', type: 'string', description: 'Id of the dashboard'},
@@ -767,7 +765,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -767,7 +765,7 @@ export const serviceCompletions: TbEditorCompletions = {
767 return: observableReturnType(dashboardHref) 765 return: observableReturnType(dashboardHref)
768 }, 766 },
769 addDashboardCustomers: { 767 addDashboardCustomers: {
770 - description: 'Add dashboard customers by ids', 768 + description: 'Assign (Add) customers to dashboard by ids',
771 meta: 'function', 769 meta: 'function',
772 args: [ 770 args: [
773 {name: 'dashboardId', type: 'string', description: 'Id of the dashboard'}, 771 {name: 'dashboardId', type: 'string', description: 'Id of the dashboard'},
@@ -777,14 +775,14 @@ export const serviceCompletions: TbEditorCompletions = { @@ -777,14 +775,14 @@ export const serviceCompletions: TbEditorCompletions = {
777 return: observableReturnType(dashboardHref) 775 return: observableReturnType(dashboardHref)
778 }, 776 },
779 removeDashboardCustomers: { 777 removeDashboardCustomers: {
780 - description: 'Remove dashboard customers dy ids', 778 + description: 'Unassign (Remove) customers from dashboard by ids',
781 meta: 'function', 779 meta: 'function',
782 args: [ 780 args: [
783 {name: 'dashboardId', type: 'string', description: 'Id of the dashboard'}, 781 {name: 'dashboardId', type: 'string', description: 'Id of the dashboard'},
784 {name: 'customerIds', type: `Array&lt;string&gt;`, description: 'Id of the customers'}, 782 {name: 'customerIds', type: `Array&lt;string&gt;`, description: 'Id of the customers'},
785 requestConfigArg 783 requestConfigArg
786 ], 784 ],
787 - return: observableArrayReturnType(dashboardHref) 785 + return: observableReturnType(dashboardHref)
788 }, 786 },
789 getPublicDashboardLink: { 787 getPublicDashboardLink: {
790 description: 'Get public dashboard link', 788 description: 'Get public dashboard link',
@@ -798,7 +796,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -798,7 +796,7 @@ export const serviceCompletions: TbEditorCompletions = {
798 } 796 }
799 }, 797 },
800 getServerTimeDiff: { 798 getServerTimeDiff: {
801 - description: 'remove dashboard customers ', 799 + description: 'Get time difference',
802 meta: 'function', 800 meta: 'function',
803 args: [ 801 args: [
804 ], 802 ],
@@ -822,7 +820,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -822,7 +820,7 @@ export const serviceCompletions: TbEditorCompletions = {
822 return: observablePageDataReturnType(userHref) 820 return: observablePageDataReturnType(userHref)
823 }, 821 },
824 getTenantAdmins: { 822 getTenantAdmins: {
825 - description: 'Get tenant admins by id', 823 + description: 'Get tenant admins by id',
826 meta: 'function', 824 meta: 'function',
827 args: [ 825 args: [
828 {name: 'tenantId', type: 'string', description: 'Id of the tenant'}, 826 {name: 'tenantId', type: 'string', description: 'Id of the tenant'},
@@ -832,10 +830,10 @@ export const serviceCompletions: TbEditorCompletions = { @@ -832,10 +830,10 @@ export const serviceCompletions: TbEditorCompletions = {
832 return: observablePageDataReturnType(userHref) 830 return: observablePageDataReturnType(userHref)
833 }, 831 },
834 getCustomerUsers: { 832 getCustomerUsers: {
835 - description: 'Get customer users by id', 833 + description: 'Get customer users by id',
836 meta: 'function', 834 meta: 'function',
837 args: [ 835 args: [
838 - {name: 'customerId', type: 'string', description: 'id of the customer'}, 836 + {name: 'customerId', type: 'string', description: 'Id of the customer'},
839 pageLinkArg, 837 pageLinkArg,
840 requestConfigArg 838 requestConfigArg
841 ], 839 ],
@@ -845,7 +843,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -845,7 +843,7 @@ export const serviceCompletions: TbEditorCompletions = {
845 description: 'Get user by id', 843 description: 'Get user by id',
846 meta: 'function', 844 meta: 'function',
847 args: [ 845 args: [
848 - {name: 'userId', type: 'string', description: 'id of the user'}, 846 + {name: 'userId', type: 'string', description: 'Id of the user'},
849 requestConfigArg 847 requestConfigArg
850 ], 848 ],
851 return: observableReturnType(userHref) 849 return: observableReturnType(userHref)
@@ -855,6 +853,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -855,6 +853,7 @@ export const serviceCompletions: TbEditorCompletions = {
855 meta: 'function', 853 meta: 'function',
856 args: [ 854 args: [
857 {name: 'user', type: userHref, description: 'User object to save'}, 855 {name: 'user', type: userHref, description: 'User object to save'},
  856 + {name: 'sendActivationMail', type: 'boolean', description: 'Send activation email', optional: true},
858 requestConfigArg 857 requestConfigArg
859 ], 858 ],
860 return: observableReturnType(userHref) 859 return: observableReturnType(userHref)
@@ -876,7 +875,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -876,7 +875,7 @@ export const serviceCompletions: TbEditorCompletions = {
876 {name: 'userCredentialsEnabled', type: 'boolean', description: 'User credentials enabled'}, 875 {name: 'userCredentialsEnabled', type: 'boolean', description: 'User credentials enabled'},
877 requestConfigArg 876 requestConfigArg
878 ], 877 ],
879 - return: observableReturnType(userHref) 878 + return: observableReturnTypeVariable('any')
880 }, 879 },
881 getActivationLink: { 880 getActivationLink: {
882 description: 'Get activation link by id', 881 description: 'Get activation link by id',
@@ -885,7 +884,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -885,7 +884,7 @@ export const serviceCompletions: TbEditorCompletions = {
885 {name: 'userId', type: 'string', description: 'Id of the user'}, 884 {name: 'userId', type: 'string', description: 'Id of the user'},
886 requestConfigArg 885 requestConfigArg
887 ], 886 ],
888 - return:observableReturnTypeVariable('string') 887 + return: observableReturnTypeVariable('string')
889 }, 888 },
890 sendActivationEmail: { 889 sendActivationEmail: {
891 description: 'Send activation email', 890 description: 'Send activation email',
@@ -928,8 +927,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -928,8 +927,7 @@ export const serviceCompletions: TbEditorCompletions = {
928 description: 'Delete relations by entity id', 927 description: 'Delete relations by entity id',
929 meta: 'function', 928 meta: 'function',
930 args: [ 929 args: [
931 - {name: 'entityId', type: entityIdHref, description: 'Id to the entity'},  
932 - {name: 'relationType', type: 'string', description: 'Relation type'}, 930 + {name: 'entityId', type: entityIdHref, description: 'Entity Id'},
933 requestConfigArg 931 requestConfigArg
934 ], 932 ],
935 return: observableVoid() 933 return: observableVoid()
@@ -1005,7 +1003,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -1005,7 +1003,7 @@ export const serviceCompletions: TbEditorCompletions = {
1005 description: 'Find by query', 1003 description: 'Find by query',
1006 meta: 'function', 1004 meta: 'function',
1007 args: [ 1005 args: [
1008 - {name: 'query', type: entityRelationsQueryHref, description: 'Query'}, 1006 + {name: 'query', type: entityRelationsQueryHref, description: 'Entity relations query'},
1009 requestConfigArg 1007 requestConfigArg
1010 ], 1008 ],
1011 return: observableArrayReturnType(entityRelationHref) 1009 return: observableArrayReturnType(entityRelationHref)
@@ -1014,7 +1012,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -1014,7 +1012,7 @@ export const serviceCompletions: TbEditorCompletions = {
1014 description: 'Find info by query', 1012 description: 'Find info by query',
1015 meta: 'function', 1013 meta: 'function',
1016 args: [ 1014 args: [
1017 - {name: 'query', type: entityRelationsQueryHref, description: 'Query'}, 1015 + {name: 'query', type: entityRelationsQueryHref, description: 'Entity relations query'},
1018 requestConfigArg 1016 requestConfigArg
1019 ], 1017 ],
1020 return: observableArrayReturnType(entityRelationInfoHref) 1018 return: observableArrayReturnType(entityRelationInfoHref)
@@ -1032,8 +1030,8 @@ export const serviceCompletions: TbEditorCompletions = { @@ -1032,8 +1030,8 @@ export const serviceCompletions: TbEditorCompletions = {
1032 meta: 'function', 1030 meta: 'function',
1033 args: [ 1031 args: [
1034 {name: 'entityId', type: entityIdHref, description: 'Id of the entity'}, 1032 {name: 'entityId', type: entityIdHref, description: 'Id of the entity'},
1035 - {name: 'attributeScope', type: attributeScopeHref, description: 'Atribute scope'},  
1036 - {name: 'keys', type:`Array&lt;string&gt;`, description: 'Array of the keys'}, 1033 + {name: 'attributeScope', type: attributeScopeHref, description: 'Attribute scope'},
  1034 + {name: 'keys', type: `Array&lt;string&gt;`, description: 'Array of the keys'},
1037 requestConfigArg 1035 requestConfigArg
1038 ], 1036 ],
1039 return: observableArrayReturnType(attributeDataHref) 1037 return: observableArrayReturnType(attributeDataHref)
@@ -1043,8 +1041,8 @@ export const serviceCompletions: TbEditorCompletions = { @@ -1043,8 +1041,8 @@ export const serviceCompletions: TbEditorCompletions = {
1043 meta: 'function', 1041 meta: 'function',
1044 args: [ 1042 args: [
1045 {name: 'entityId', type: entityIdHref, description: 'Id of the entity'}, 1043 {name: 'entityId', type: entityIdHref, description: 'Id of the entity'},
1046 - {name: 'attributeScope', type: attributeScopeHref, description: 'Atribute scope'},  
1047 - {name: 'attributes', type: `array&lt;${attributeDataHref}&gt;`, description: 'Array of the attributes'}, 1044 + {name: 'attributeScope', type: attributeScopeHref, description: 'Attribute scope'},
  1045 + {name: 'attributes', type: `array&lt;${attributeDataHref}&gt;`, description: 'Array of the attributes data'},
1048 requestConfigArg 1046 requestConfigArg
1049 ], 1047 ],
1050 return: observableReturnTypeVariable('any') 1048 return: observableReturnTypeVariable('any')
@@ -1054,11 +1052,11 @@ export const serviceCompletions: TbEditorCompletions = { @@ -1054,11 +1052,11 @@ export const serviceCompletions: TbEditorCompletions = {
1054 meta: 'function', 1052 meta: 'function',
1055 args: [ 1053 args: [
1056 {name: 'entityId', type: entityIdHref, description: 'Id of the entity'}, 1054 {name: 'entityId', type: entityIdHref, description: 'Id of the entity'},
1057 - {name: 'timeseries', type: `Array&lt;${attributeDataHref}&gt;>`, description: 'Array of the timeseries'},  
1058 - {name: 'deleteAllDataForKeys', type: 'boolean',optional: true, description: 'Delete all data for keys'}, 1055 + {name: 'timeseries', type: `Array&lt;${attributeDataHref}&gt;>`, description: 'Array of the timeseries data'},
  1056 + {name: 'deleteAllDataForKeys', type: 'boolean', optional: true, description: 'Delete all data for keys'},
1059 requestConfigArg 1057 requestConfigArg
1060 ], 1058 ],
1061 - return:observableReturnTypeVariable('any') 1059 + return: observableReturnTypeVariable('any')
1062 }, 1060 },
1063 saveEntityAttributes: { 1061 saveEntityAttributes: {
1064 description: 'Save entity attributes', 1062 description: 'Save entity attributes',
@@ -1066,7 +1064,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -1066,7 +1064,7 @@ export const serviceCompletions: TbEditorCompletions = {
1066 args: [ 1064 args: [
1067 {name: 'entityId', type: entityIdHref, description: 'Id of the entity'}, 1065 {name: 'entityId', type: entityIdHref, description: 'Id of the entity'},
1068 {name: 'attributeScope', type: attributeScopeHref, description: 'Attribute scope'}, 1066 {name: 'attributeScope', type: attributeScopeHref, description: 'Attribute scope'},
1069 - {name: 'attributes', type: 'Array&lt;${attributeDataHref}&gt;>', description: 'Array of the attributes'}, 1067 + {name: 'attributes', type: 'Array&lt;${attributeDataHref}&gt;>', description: 'Array of the attributes data'},
1070 requestConfigArg 1068 requestConfigArg
1071 ], 1069 ],
1072 return: observableReturnTypeVariable('any') 1070 return: observableReturnTypeVariable('any')
@@ -1077,10 +1075,10 @@ export const serviceCompletions: TbEditorCompletions = { @@ -1077,10 +1075,10 @@ export const serviceCompletions: TbEditorCompletions = {
1077 args: [ 1075 args: [
1078 {name: 'entityId', type: entityIdHref, description: 'Id of the entity'}, 1076 {name: 'entityId', type: entityIdHref, description: 'Id of the entity'},
1079 {name: 'timeseriesScope', type: 'string', description: 'Timeseries scope'}, 1077 {name: 'timeseriesScope', type: 'string', description: 'Timeseries scope'},
1080 - {name: 'timeseries', type: `Array&lt;attributeDataHref&gt;`, description: 'Array of the timeseries'}, 1078 + {name: 'timeseries', type: `Array&lt;attributeDataHref&gt;`, description: 'Array of the timeseries data'},
1081 requestConfigArg 1079 requestConfigArg
1082 ], 1080 ],
1083 - return:observableReturnTypeVariable('any') 1081 + return: observableReturnTypeVariable('any')
1084 }, 1082 },
1085 } 1083 }
1086 }, 1084 },
@@ -1098,7 +1096,7 @@ export const serviceCompletions: TbEditorCompletions = { @@ -1098,7 +1096,7 @@ export const serviceCompletions: TbEditorCompletions = {
1098 {name: 'entityId', type: 'string', description: 'Id of the entity'}, 1096 {name: 'entityId', type: 'string', description: 'Id of the entity'},
1099 requestConfigArg 1097 requestConfigArg
1100 ], 1098 ],
1101 - return:observableBaseDataReturnType(entityIdHref) 1099 + return: observableBaseDataReturnType()
1102 }, 1100 },
1103 getEntities: { 1101 getEntities: {
1104 description: 'Get entities by ids', 1102 description: 'Get entities by ids',
@@ -1108,181 +1106,174 @@ export const serviceCompletions: TbEditorCompletions = { @@ -1108,181 +1106,174 @@ export const serviceCompletions: TbEditorCompletions = {
1108 {name: 'entityIds', type: `Array&lt;string&gt;`, description: 'Ids of the entities'}, 1106 {name: 'entityIds', type: `Array&lt;string&gt;`, description: 'Ids of the entities'},
1109 requestConfigArg 1107 requestConfigArg
1110 ], 1108 ],
1111 - return:observableArrayBaseDataReturnType(entityIdHref) 1109 + return: observableArrayBaseDataReturnType()
1112 }, 1110 },
1113 getEntitiesByNameFilter: { 1111 getEntitiesByNameFilter: {
1114 description: 'Get entities by name filter', 1112 description: 'Get entities by name filter',
1115 meta: 'function', 1113 meta: 'function',
1116 args: [ 1114 args: [
1117 {name: 'entityType', type: entityTypeHref, description: 'Entity type'}, 1115 {name: 'entityType', type: entityTypeHref, description: 'Entity type'},
1118 - {name: 'entityNameFilter', type: 'string', description: 'Name filter of the entity'}, 1116 + {name: 'entityNameFilter', type: 'string', description: 'Name filter for the entity'},
1119 {name: 'pageSize', type: 'number', description: 'Size of the page'}, 1117 {name: 'pageSize', type: 'number', description: 'Size of the page'},
1120 - {name: 'subType', type: 'string',optional: true, description: 'Subtype'}, 1118 + {name: 'subType', type: 'string', optional: true, description: 'Subtype'},
1121 requestConfigArg 1119 requestConfigArg
1122 ], 1120 ],
1123 - return:observableArrayBaseDataReturnType(entityIdHref) 1121 + return: observableArrayBaseDataReturnType()
1124 }, 1122 },
1125 findEntityDataByQuery: { 1123 findEntityDataByQuery: {
1126 description: 'Find entity data by query', 1124 description: 'Find entity data by query',
1127 meta: 'function', 1125 meta: 'function',
1128 args: [ 1126 args: [
1129 - {name: 'query', type: entityDataQueryHref, description: 'Query'},  
1130 - 1127 + {name: 'query', type: entityDataQueryHref, description: 'Entity data query'},
1131 requestConfigArg 1128 requestConfigArg
1132 ], 1129 ],
1133 - return:observablePageDataReturnType(entityDataHref) 1130 + return: observablePageDataReturnType(entityDataHref)
1134 }, 1131 },
1135 findAlarmDataByQuery: { 1132 findAlarmDataByQuery: {
1136 description: 'Find alarm data by query', 1133 description: 'Find alarm data by query',
1137 meta: 'function', 1134 meta: 'function',
1138 args: [ 1135 args: [
1139 - {name: 'query', type: alarmDataQueryHref, description: 'Query'}, 1136 + {name: 'query', type: alarmDataQueryHref, description: 'Alarm data query'},
1140 requestConfigArg 1137 requestConfigArg
1141 ], 1138 ],
1142 - return:observablePageDataReturnType(alarmDataHref) 1139 + return: observablePageDataReturnType(alarmDataHref)
1143 }, 1140 },
1144 findEntityInfosByFilterAndName: { 1141 findEntityInfosByFilterAndName: {
1145 description: 'Find entity infos by filter and name', 1142 description: 'Find entity infos by filter and name',
1146 meta: 'function', 1143 meta: 'function',
1147 args: [ 1144 args: [
1148 - {name: 'filter', type: entityFilterHref, description: 'Filter of the entity'}, 1145 + {name: 'filter', type: entityFilterHref, description: 'Filter for the entities'},
1149 {name: 'searchText', type: 'string', description: 'Search text'}, 1146 {name: 'searchText', type: 'string', description: 'Search text'},
1150 requestConfigArg 1147 requestConfigArg
1151 ], 1148 ],
1152 - return:observablePageDataReturnType(entityInfoHref) 1149 + return: observablePageDataReturnType(entityInfoHref)
1153 }, 1150 },
1154 findSingleEntityInfoByEntityFilter: { 1151 findSingleEntityInfoByEntityFilter: {
1155 - description: 'Find single entity infos by filter of the entity ', 1152 + description: 'Find single entity infos by filter',
1156 meta: 'function', 1153 meta: 'function',
1157 args: [ 1154 args: [
1158 - {name: 'filter', type: entityFilterHref, description: 'Filter of the entity'},  
1159 - {name: 'searchText', type: 'string', description: 'search text'}, 1155 + {name: 'filter', type: entityFilterHref, description: 'Filter for the entity'},
1160 requestConfigArg 1156 requestConfigArg
1161 ], 1157 ],
1162 - return:observableReturnType(entityInfoHref) 1158 + return: observableReturnType(entityInfoHref)
1163 }, 1159 },
1164 getAliasFilterTypesByEntityTypes: { 1160 getAliasFilterTypesByEntityTypes: {
1165 - description: 'Get alias filter types by entity type', 1161 + description: 'Get alias filter types by entity types',
1166 meta: 'function', 1162 meta: 'function',
1167 args: [ 1163 args: [
1168 - {name: 'entityTypes', type:`Array&lt;${entityTypeHref}|${aliasEntityTypeHref}&gt;`, description: 'Entity types'},  
1169 - {name: 'searchText', type: 'string', description: 'Search text'} 1164 + {name: 'entityTypes', type: `Array&lt;${entityTypeHref}|${aliasEntityTypeHref}&gt;`, description: 'Entity types'}
1170 ], 1165 ],
1171 - return:{  
1172 - type:`Array&lt;${aliasFilterTypeHref}$gt;`,  
1173 - description:`Array of ${aliasFilterTypeHref} objects` 1166 + return: {
  1167 + type: `Array&lt;${aliasFilterTypeHref}$gt;`,
  1168 + description: `Array of ${aliasFilterTypeHref} objects`
1174 } 1169 }
1175 }, 1170 },
1176 filterAliasByEntityTypes: { 1171 filterAliasByEntityTypes: {
1177 - description: 'Filter alias by entity type', 1172 + description: 'Filter alias by entity types',
1178 meta: 'function', 1173 meta: 'function',
1179 args: [ 1174 args: [
1180 - {name: 'entityAlias', type:entityAliasHref, description: 'Alias of the entity'},  
1181 - {name: 'entityTypes', type:`Array&lt;${entityTypeHref}|${aliasEntityTypeHref}&gt;`, description: 'Entity types'} 1175 + {name: 'entityAlias', type: entityAliasHref, description: 'Alias of the entity'},
  1176 + {name: 'entityTypes', type: `Array&lt;${entityTypeHref}|${aliasEntityTypeHref}&gt;`, description: 'Entity types'}
1182 ], 1177 ],
1183 - return:{  
1184 - type:'boolean',  
1185 - description:`Returns <code>boolean</code> variable based on the filter` 1178 + return: {
  1179 + type: 'boolean',
  1180 + description: `Returns <code>boolean</code> variable based on the filter`
1186 } 1181 }
1187 }, 1182 },
1188 prepareAllowedEntityTypesList: { 1183 prepareAllowedEntityTypesList: {
1189 - description: 'Prepare allowed types of the entity list', 1184 + description: 'Prepare allowed entity types list',
1190 meta: 'function', 1185 meta: 'function',
1191 args: [ 1186 args: [
1192 - {name: 'allowedEntityTypes', type:`Array&lt;${entityTypeHref}|${aliasEntityTypeHref}&gt;`, description: 'Entity types'},  
1193 - {name: 'useAliasEntityTypes', type:'boolean', description: 'Use alias entity types'}, 1187 + {name: 'allowedEntityTypes', type: `Array&lt;${entityTypeHref}|${aliasEntityTypeHref}&gt;`, description: 'Entity types'},
  1188 + {name: 'useAliasEntityTypes', type: 'boolean', description: 'Use alias entity types'},
1194 ], 1189 ],
1195 - return:{  
1196 - type:`Array&lt;${entityTypeHref}|${aliasEntityTypeHref}&gt;`,  
1197 - description:`Returns entity types array` 1190 + return: {
  1191 + type: `Array&lt;${entityTypeHref}|${aliasEntityTypeHref}&gt;`,
  1192 + description: `Returns entity types array`
1198 } 1193 }
1199 }, 1194 },
1200 getEntityKeys: { 1195 getEntityKeys: {
1201 description: 'Get entity keys by id', 1196 description: 'Get entity keys by id',
1202 meta: 'function', 1197 meta: 'function',
1203 args: [ 1198 args: [
1204 - {name: 'entityId', type:entityIdHref, description: 'id of the entity'},  
1205 - {name: 'query', type:'string', description: 'Query'},  
1206 - {name: 'type', type:dataKeyTypeHref, description: 'Query'}, 1199 + {name: 'entityId', type: entityIdHref, description: 'Id of the entity'},
  1200 + {name: 'query', type: 'string', description: 'Key name starts with'},
  1201 + {name: 'type', type: dataKeyTypeHref, description: 'Datakey type'},
1207 requestConfigArg 1202 requestConfigArg
1208 ], 1203 ],
1209 - return:{  
1210 - type:`Observable&lt;Array&lt;string&gt;&gt;`,  
1211 - description:`An <code>Observable</code> of <code>string</code> variable.` 1204 + return: {
  1205 + type: `Observable&lt;Array&lt;string&gt;&gt;`,
  1206 + description: `An <code>Observable</code> of array of <code>string</code> variables.`
1212 } 1207 }
1213 - // observableArrayReturnType('string')  
1214 }, 1208 },
1215 createDatasourcesFromSubscriptionsInfo: { 1209 createDatasourcesFromSubscriptionsInfo: {
1216 - description: 'Create database from subscriptions info', 1210 + description: 'Create datasources from subscriptions info',
1217 meta: 'function', 1211 meta: 'function',
1218 args: [ 1212 args: [
1219 - {name: 'subscriptionsInfo', type:'array<subscriptionInfoHref>', description: 'Subscriptions info'} 1213 + {name: 'subscriptionsInfo', type: 'array<subscriptionInfoHref>', description: 'Subscriptions info'}
1220 ], 1214 ],
1221 - return:{  
1222 - type:`Array&lt;${dataSourceHref}&gt;`,  
1223 - description:`Array of <code>${dataSourceHref}</code> objects` 1215 + return: {
  1216 + type: `Array&lt;${dataSourceHref}&gt;`,
  1217 + description: `Array of <code>${dataSourceHref}</code> objects`
1224 } 1218 }
1225 }, 1219 },
1226 createAlarmSourceFromSubscriptionInfo: { 1220 createAlarmSourceFromSubscriptionInfo: {
1227 description: 'Create alarm source from subscriptions info', 1221 description: 'Create alarm source from subscriptions info',
1228 meta: 'function', 1222 meta: 'function',
1229 args: [ 1223 args: [
1230 - {name: 'subscriptionInfo', type:subscriptionInfoHref, description: 'Subscription info'} 1224 + {name: 'subscriptionInfo', type: subscriptionInfoHref, description: 'Subscription info'}
1231 ], 1225 ],
1232 - return:{  
1233 - type:`${dataSourceHref}`,  
1234 - description:`<code>${dataSourceHref}</code> object` 1226 + return: {
  1227 + type: `${dataSourceHref}`,
  1228 + description: `<code>${dataSourceHref}</code> object`
1235 } 1229 }
1236 }, 1230 },
1237 resolveAlias: { 1231 resolveAlias: {
1238 description: 'Resolve alias', 1232 description: 'Resolve alias',
1239 meta: 'function', 1233 meta: 'function',
1240 args: [ 1234 args: [
1241 - {name: 'entityAlias', type:entityAliasHref, description: 'Alias of the entity'},  
1242 - {name: 'stateParams', type:stateParamsHref, description: 'State params'}, 1235 + {name: 'entityAlias', type: entityAliasHref, description: 'Entity alias'},
  1236 + {name: 'stateParams', type: stateParamsHref, description: 'State params'},
1243 ], 1237 ],
1244 - return:observableReturnType(aliasInfoHref) 1238 + return: observableReturnType(aliasInfoHref)
1245 }, 1239 },
1246 resolveAliasFilter: { 1240 resolveAliasFilter: {
1247 description: 'Resolve alias filter', 1241 description: 'Resolve alias filter',
1248 meta: 'function', 1242 meta: 'function',
1249 args: [ 1243 args: [
1250 - {name: 'filter', type:entityAliasFilterHref, description: 'Entity alias filter'},  
1251 - {name: 'stateParams', type:stateParamsHref, description: 'State params'}, 1244 + {name: 'filter', type: entityAliasFilterHref, description: 'Entity alias filter'},
  1245 + {name: 'stateParams', type: stateParamsHref, description: 'State params'},
1252 ], 1246 ],
1253 - return:observableReturnType(entityAliasFilterResultHref) 1247 + return: observableReturnType(entityAliasFilterResultHref)
1254 }, 1248 },
1255 checkEntityAlias: { 1249 checkEntityAlias: {
1256 description: 'Check entity alias', 1250 description: 'Check entity alias',
1257 meta: 'function', 1251 meta: 'function',
1258 args: [ 1252 args: [
1259 - {name: 'entityAlias', type:entityAliasHref, description: 'Alias of the entity'}, 1253 + {name: 'entityAlias', type: entityAliasHref, description: 'Entity alias'},
1260 ], 1254 ],
1261 - return:observableReturnTypeVariable('boolean')  
1262 - // observableReturnType('boolean') 1255 + return: observableReturnTypeVariable('boolean')
1263 }, 1256 },
1264 saveEntityParameters: { 1257 saveEntityParameters: {
1265 description: 'Save entity parameters', 1258 description: 'Save entity parameters',
1266 meta: 'function', 1259 meta: 'function',
1267 args: [ 1260 args: [
1268 - {name: 'entityType', type:entityTypeHref, description: 'Entity type'},  
1269 - {name: 'entityData', type:importEntityDataHref, description: 'Data of the entity'},  
1270 - {name: 'update', type:'boolean', description: 'Update'}, 1261 + {name: 'entityType', type: entityTypeHref, description: 'Entity type'},
  1262 + {name: 'entityData', type: importEntityDataHref, description: 'Entity data'},
  1263 + {name: 'update', type: 'boolean', description: 'Update'},
1271 requestConfigArg 1264 requestConfigArg
1272 ], 1265 ],
1273 - return:observableReturnType(importEntitiesResultInfoHref) 1266 + return: observableReturnType(importEntitiesResultInfoHref)
1274 }, 1267 },
1275 saveEntityData: { 1268 saveEntityData: {
1276 description: 'Save entity data', 1269 description: 'Save entity data',
1277 meta: 'function', 1270 meta: 'function',
1278 args: [ 1271 args: [
1279 - {name: 'entityId', type:entityIdHref, description: 'Id of the entity'},  
1280 - {name: 'entityData', type:importEntityDataHref, description: 'Data of the entity'}, 1272 + {name: 'entityId', type: entityIdHref, description: 'Id of the entity'},
  1273 + {name: 'entityData', type: importEntityDataHref, description: 'Entity data'},
1281 requestConfigArg 1274 requestConfigArg
1282 ], 1275 ],
1283 - return:observableReturnTypeVariable('any')  
1284 -  
1285 - // observableReturnType('any') 1276 + return: observableReturnTypeVariable('any')
1286 }, 1277 },
1287 } 1278 }
1288 }, 1279 },
@@ -1296,54 +1287,54 @@ export const serviceCompletions: TbEditorCompletions = { @@ -1296,54 +1287,54 @@ export const serviceCompletions: TbEditorCompletions = {
1296 description: 'Confirm', 1287 description: 'Confirm',
1297 meta: 'function', 1288 meta: 'function',
1298 args: [ 1289 args: [
1299 - {name: 'title', type:'string', description: 'Title'},  
1300 - {name: 'message', type:'string', description: 'Message'},  
1301 - {name: 'cancel', type:'string',optional: true, description: 'Cancel'},  
1302 - {name: 'ok', type:'string',optional: true, description: 'Ok'},  
1303 - {name: 'fullscreen', type:'boolean',optional: true, description: 'Fullscreen'}, 1290 + {name: 'title', type: 'string', description: 'Title'},
  1291 + {name: 'message', type: 'string', description: 'Message'},
  1292 + {name: 'cancel', type: 'string', optional: true, description: 'Cancel'},
  1293 + {name: 'ok', type: 'string', optional: true, description: 'Ok'},
  1294 + {name: 'fullscreen', type: 'boolean', optional: true, description: 'Fullscreen'},
1304 ], 1295 ],
1305 - return:observableReturnTypeVariable('boolean') 1296 + return: observableReturnTypeVariable('boolean')
1306 }, 1297 },
1307 alert: { 1298 alert: {
1308 description: 'Alert', 1299 description: 'Alert',
1309 meta: 'function', 1300 meta: 'function',
1310 args: [ 1301 args: [
1311 - {name: 'title', type:'string', description: 'Title'},  
1312 - {name: 'message', type:'string', description: 'Message'},  
1313 - {name: 'ok', type:'string',optional: true, description: 'Ok'},  
1314 - {name: 'fullscreen', type:'boolean',optional: true, description: 'Fullscreen'}, 1302 + {name: 'title', type: 'string', description: 'Title'},
  1303 + {name: 'message', type: 'string', description: 'Message'},
  1304 + {name: 'ok', type: 'string', optional: true, description: 'Ok'},
  1305 + {name: 'fullscreen', type: 'boolean', optional: true, description: 'Fullscreen'},
1315 ], 1306 ],
1316 - return:observableReturnTypeVariable('boolean') 1307 + return: observableReturnTypeVariable('boolean')
1317 }, 1308 },
1318 colorPicker: { 1309 colorPicker: {
1319 description: 'Color picker', 1310 description: 'Color picker',
1320 meta: 'function', 1311 meta: 'function',
1321 args: [ 1312 args: [
1322 - {name: 'color', type:'string', description: 'Сolor'}, 1313 + {name: 'color', type: 'string', description: 'Сolor'},
1323 ], 1314 ],
1324 - return:observableReturnTypeVariable('string') 1315 + return: observableReturnTypeVariable('string')
1325 }, 1316 },
1326 materialIconPicker: { 1317 materialIconPicker: {
1327 description: 'Material icon picker', 1318 description: 'Material icon picker',
1328 meta: 'function', 1319 meta: 'function',
1329 args: [ 1320 args: [
1330 - {name: 'icon', type:'string', description: 'Icon'}, 1321 + {name: 'icon', type: 'string', description: 'Icon'},
1331 ], 1322 ],
1332 - return:observableReturnTypeVariable('string') 1323 + return: observableReturnTypeVariable('string')
1333 }, 1324 },
1334 forbidden: { 1325 forbidden: {
1335 description: 'Forbidden', 1326 description: 'Forbidden',
1336 meta: 'function', 1327 meta: 'function',
1337 args: [ 1328 args: [
1338 ], 1329 ],
1339 - return:observableReturnTypeVariable('boolean') 1330 + return: observableReturnTypeVariable('boolean')
1340 }, 1331 },
1341 todo: { 1332 todo: {
1342 description: 'To do', 1333 description: 'To do',
1343 meta: 'function', 1334 meta: 'function',
1344 args: [ 1335 args: [
1345 ], 1336 ],
1346 - return:observableReturnTypeVariable('any') 1337 + return: observableReturnTypeVariable('any')
1347 }, 1338 },
1348 } 1339 }
1349 }, 1340 },
@@ -1352,16 +1343,16 @@ export const serviceCompletions: TbEditorCompletions = { @@ -1352,16 +1343,16 @@ export const serviceCompletions: TbEditorCompletions = {
1352 'See <a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/modules/home/components/widget/dialog/custom-dialog.service.ts#L33">CustomDialogService</a> for API reference.', 1343 'See <a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/modules/home/components/widget/dialog/custom-dialog.service.ts#L33">CustomDialogService</a> for API reference.',
1353 meta: 'service', 1344 meta: 'service',
1354 type: '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/modules/home/components/widget/dialog/custom-dialog.service.ts#L33">CustomDialogService</a>', 1345 type: '<a href="https://github.com/thingsboard/thingsboard/blob/13e6b10b7ab830e64d31b99614a9d95a1a25928a/ui-ngx/src/app/modules/home/components/widget/dialog/custom-dialog.service.ts#L33">CustomDialogService</a>',
1355 - children:{ 1346 + children: {
1356 customDialog: { 1347 customDialog: {
1357 description: 'Custom Dialog', 1348 description: 'Custom Dialog',
1358 meta: 'function', 1349 meta: 'function',
1359 args: [ 1350 args: [
1360 - {name: 'template', type:'string', description: 'Template'},  
1361 - {name: 'controller', type:customDialogComponentHref, description: 'Controller'},  
1362 - {name: 'data', type:'any', description: 'Data'}, 1351 + {name: 'template', type: 'string', description: 'Template'},
  1352 + {name: 'controller', type: customDialogComponentHref, description: 'Controller'},
  1353 + {name: 'data', type: 'any', description: 'Data', optional: true},
1363 ], 1354 ],
1364 - return:observableReturnTypeVariable('any') 1355 + return: observableReturnTypeVariable('any')
1365 }, 1356 },
1366 } 1357 }
1367 }, 1358 },
@@ -1389,4 +1380,4 @@ export const serviceCompletions: TbEditorCompletions = { @@ -1389,4 +1380,4 @@ export const serviceCompletions: TbEditorCompletions = {
1389 meta: 'service', 1380 meta: 'service',
1390 type: '<a href="https://angular.io/api/platform-browser/DomSanitizer">DomSanitizer</a>' 1381 type: '<a href="https://angular.io/api/platform-browser/DomSanitizer">DomSanitizer</a>'
1391 } 1382 }
1392 -} 1383 +};