Browse Source

Merge branch 'lts-4.2' into feature/lts-4.2-angular-20

pull/14933/head
Igor Kulikov 8 months ago
parent
commit
3facd6f359
  1. 2
      application/src/main/resources/thingsboard.yml
  2. 9
      ui-ngx/src/app/core/http/image.service.ts
  3. 4
      ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.scss
  4. 4
      ui-ngx/src/app/modules/home/components/widget/lib/chart/range-chart-widget.component.scss
  5. 7
      ui-ngx/src/app/shared/components/image/gallery-image-input.component.ts
  6. 2
      ui-ngx/src/app/shared/pipe/image.pipe.ts
  7. 8
      ui-ngx/src/assets/locale/locale.constant-en_US.json

2
application/src/main/resources/thingsboard.yml

@ -208,7 +208,7 @@ ui:
# Help parameters # Help parameters
help: help:
# Base URL for UI help assets # Base URL for UI help assets
base-url: "${UI_HELP_BASE_URL:https://raw.githubusercontent.com/thingsboard/thingsboard-ui-help/release-4.2.1 }" base-url: "${UI_HELP_BASE_URL:https://raw.githubusercontent.com/thingsboard/thingsboard-ui-help/release-4.2.1}"
# Database telemetry parameters # Database telemetry parameters
database: database:

9
ui-ngx/src/app/core/http/image.service.ts

@ -31,7 +31,7 @@ import {
removeTbImagePrefix, removeTbImagePrefix,
ResourceSubType ResourceSubType
} from '@shared/models/resource.models'; } from '@shared/models/resource.models';
import { catchError, map, switchMap } from 'rxjs/operators'; import { catchError, finalize, map, switchMap } from 'rxjs/operators';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
import { blobToBase64, blobToText } from '@core/utils'; import { blobToBase64, blobToText } from '@core/utils';
import { ResourcesService } from '@core/services/resources.service'; import { ResourcesService } from '@core/services/resources.service';
@ -116,16 +116,15 @@ export class ImageService {
request = new ReplaySubject<Blob>(1); request = new ReplaySubject<Blob>(1);
this.imagesLoading[imageLink] = request; this.imagesLoading[imageLink] = request;
const options = defaultHttpOptionsFromConfig({ignoreLoading: true, ignoreErrors: true}); const options = defaultHttpOptionsFromConfig({ignoreLoading: true, ignoreErrors: true});
this.http.get(imageLink, {...options, ...{ responseType: 'blob' } }).subscribe({ this.http.get(imageLink, {...options, ...{ responseType: 'blob' } }).pipe(
finalize(()=> delete this.imagesLoading[imageLink])
).subscribe({
next: (value) => { next: (value) => {
request.next(value); request.next(value);
request.complete(); request.complete();
}, },
error: err => { error: err => {
request.error(err); request.error(err);
},
complete: () => {
delete this.imagesLoading[imageLink];
} }
}); });
} }

4
ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.scss

@ -20,9 +20,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8px; gap: 8px;
&.overlay { padding: 20px 24px 24px 24px;
padding: 20px 24px 24px 24px;
}
> div:not(.tb-bar-chart-overlay) { > div:not(.tb-bar-chart-overlay) {
z-index: 1; z-index: 1;
} }

4
ui-ngx/src/app/modules/home/components/widget/lib/chart/range-chart-widget.component.scss

@ -20,9 +20,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8px; gap: 8px;
&.overlay { padding: 20px 24px 24px 24px;
padding: 20px 24px 24px 24px;
}
> div:not(.tb-range-chart-overlay) { > div:not(.tb-range-chart-overlay) {
z-index: 1; z-index: 1;
} }

7
ui-ngx/src/app/shared/components/image/gallery-image-input.component.ts

@ -172,9 +172,9 @@ export class GalleryImageInputComponent extends PageComponent implements OnInit,
} }
} }
private updateModel(value: string) { private updateModel(value: string, forcedToUpdate = false): void {
this.cd.markForCheck(); this.cd.markForCheck();
if (this.imageUrl !== value) { if (this.imageUrl !== value || forcedToUpdate) {
this.imageUrl = value; this.imageUrl = value;
this.propagateChange(prependTbImagePrefix(this.imageUrl)); this.propagateChange(prependTbImagePrefix(this.imageUrl));
} }
@ -212,9 +212,10 @@ export class GalleryImageInputComponent extends PageComponent implements OnInit,
} }
}).afterClosed().subscribe((image) => { }).afterClosed().subscribe((image) => {
if (image) { if (image) {
const forcedToUpdate = this.imageUrl === image.link && this.imageResource?.descriptor?.etag !== image.descriptor.etag;
this.linkType = ImageLinkType.resource; this.linkType = ImageLinkType.resource;
this.imageResource = image; this.imageResource = image;
this.updateModel(image.link); this.updateModel(image.link, forcedToUpdate);
} }
}); });
} }

2
ui-ngx/src/app/shared/pipe/image.pipe.ts

@ -39,7 +39,7 @@ export class ImagePipe implements PipeTransform {
private sanitizer: DomSanitizer, private sanitizer: DomSanitizer,
private zone: NgZone) { } private zone: NgZone) { }
transform(urlData: string | UrlHolder, args?: any): Observable<SafeUrl | string> { transform(urlData: string | UrlHolder, args?: any, triggerUpdate?: number): Observable<SafeUrl | string> {
const ignoreLoadingImage = !!args?.ignoreLoadingImage; const ignoreLoadingImage = !!args?.ignoreLoadingImage;
const asString = !!args?.asString; const asString = !!args?.asString;
const emptyUrl = args?.emptyUrl || NO_IMAGE_DATA_URI; const emptyUrl = args?.emptyUrl || NO_IMAGE_DATA_URI;

8
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -795,7 +795,7 @@
"no-assets-matching": "No assets matching '{{entity}}' were found.", "no-assets-matching": "No assets matching '{{entity}}' were found.",
"asset-required": "Asset is required", "asset-required": "Asset is required",
"name-starts-with": "Asset name expression", "name-starts-with": "Asset name expression",
"help-text": "Use '%' according to need: '%asset_name_contains%', '%asset_name_ends', 'asset_starts_with'.", "help-text": "Use '%' according to need: '%asset_name_contains%', '%asset_name_ends', 'asset_starts_with%'.",
"import": "Import assets", "import": "Import assets",
"asset-file": "Asset file", "asset-file": "Asset file",
"label": "Label", "label": "Label",
@ -1655,7 +1655,7 @@
"remove-alias": "Remove device alias", "remove-alias": "Remove device alias",
"add-alias": "Add device alias", "add-alias": "Add device alias",
"name-starts-with": "Device name expression", "name-starts-with": "Device name expression",
"help-text": "Use '%' according to need: '%device_name_contains%', '%device_name_ends', 'device_starts_with'.", "help-text": "Use '%' according to need: '%device_name_contains%', '%device_name_ends', 'device_starts_with%'.",
"device-list": "Device list", "device-list": "Device list",
"use-device-name-filter": "Use filter", "use-device-name-filter": "Use filter",
"device-list-empty": "No devices selected.", "device-list-empty": "No devices selected.",
@ -2568,7 +2568,7 @@
"no-entities-text": "No entities found", "no-entities-text": "No entities found",
"no-entity-types-matching": "No entity types matching '{{entityType}}' were found.", "no-entity-types-matching": "No entity types matching '{{entityType}}' were found.",
"name-starts-with": "Name expression", "name-starts-with": "Name expression",
"help-text": "Use '%' according to need: '%entity_name_contains%', '%entity_name_ends', 'entity_starts_with'.", "help-text": "Use '%' according to need: '%entity_name_contains%', '%entity_name_ends', 'entity_starts_with%'.",
"use-entity-name-filter": "Use filter", "use-entity-name-filter": "Use filter",
"entity-list-empty": "No entities selected.", "entity-list-empty": "No entities selected.",
"entity-type-list-required": "At least one entity type should be selected.", "entity-type-list-required": "At least one entity type should be selected.",
@ -2760,7 +2760,7 @@
"remove-alias": "Remove entity view alias", "remove-alias": "Remove entity view alias",
"add-alias": "Add entity view alias", "add-alias": "Add entity view alias",
"name-starts-with": "Entity View name expression", "name-starts-with": "Entity View name expression",
"help-text": "Use '%' according to need: '%entity-view_name_contains%', '%entity-view_name_ends', 'entity-view_starts_with'.", "help-text": "Use '%' according to need: '%entity-view_name_contains%', '%entity-view_name_ends', 'entity-view_starts_with%'.",
"entity-view-list": "Entity View list", "entity-view-list": "Entity View list",
"use-entity-view-name-filter": "Use filter", "use-entity-view-name-filter": "Use filter",
"entity-view-list-empty": "No entity views selected.", "entity-view-list-empty": "No entity views selected.",

Loading…
Cancel
Save