Browse Source

Merge pull request #14917 from thingsboard/lts-4.2

Merge lts-4.2 to lts-4.3
pull/14920/head
Vladyslav Prykhodko 8 months ago
committed by GitHub
parent
commit
ee1c9f6df8
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 9
      ui-ngx/src/app/core/http/image.service.ts
  2. 4
      ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.scss
  3. 4
      ui-ngx/src/app/modules/home/components/widget/lib/chart/range-chart-widget.component.scss
  4. 7
      ui-ngx/src/app/shared/components/image/gallery-image-input.component.ts
  5. 2
      ui-ngx/src/app/shared/pipe/image.pipe.ts
  6. 8
      ui-ngx/src/assets/locale/locale.constant-en_US.json

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

@ -171,9 +171,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));
} }
@ -211,9 +211,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

@ -38,7 +38,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

@ -810,7 +810,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",
@ -2131,7 +2131,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.",
@ -3048,7 +3048,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.",
@ -3251,7 +3251,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