Browse Source

Merge remote-tracking branch 'origin/hotfix-4.4' into internal-hotfix-4.4

# Conflicts:
#	application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java
pull/16844/head
Viacheslav Klimov 3 weeks ago
parent
commit
87375b2b61
Failed to extract signature
  1. 8
      application/src/main/resources/thingsboard.yml
  2. 108
      application/src/test/java/org/thingsboard/server/config/StaticResourceCompressionTest.java
  3. 1
      application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java
  4. 2
      msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/DevicePageElements.java
  5. 36
      msa/web-report/chromium.js
  6. 13
      msa/web-report/docker/Dockerfile
  7. 2
      msa/web-report/docker/start-web-report.sh
  8. 147
      msa/web-report/install.js
  9. 1
      msa/web-report/package.json
  10. 64
      msa/web-report/pom.xml
  11. 19
      msa/web-report/sbom-check.js
  12. 3
      msa/web-report/server.ts
  13. 9
      msa/web-report/yarn.lock
  14. 12
      msa/web-ui/negotiator.d.ts
  15. 3
      msa/web-ui/package.json
  16. 83
      msa/web-ui/server.ts
  17. 5
      msa/web-ui/tsconfig.json
  18. 68
      msa/web-ui/yarn.lock
  19. 4
      pom.xml
  20. 20
      tools/src/main/python/license-headers/curations.json
  21. 82
      ui-ngx/compress-build.js
  22. 47
      ui-ngx/esbuild/tb-esbuild-plugins.ts
  23. 1
      ui-ngx/package.json
  24. 9
      ui-ngx/pom.xml
  25. 114
      ui-ngx/src/app/modules/home/components/converter/converter.component.ts
  26. 79
      ui-ngx/src/app/modules/home/components/device/device-info-filter.component.html
  27. 261
      ui-ngx/src/app/modules/home/components/device/device-info-filter.component.ts
  28. 12
      ui-ngx/src/app/modules/home/components/entity/entities-table.component.scss
  29. 6
      ui-ngx/src/app/modules/home/components/integration/configuration/azure-services-bus-integration-form/azure-services-bus-integration-form.component.html
  30. 8
      ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.html
  31. 1
      ui-ngx/src/app/modules/home/components/integration/configuration/opc-ua-integration-form/opc-ua-integration-form.component.html
  32. 10
      ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/install-form-renderer/install-form-renderer.component.html
  33. 17
      ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.html
  34. 5
      ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.ts
  35. 6
      ui-ngx/src/app/modules/home/components/profile/device-profile-autocomplete.component.html
  36. 1
      ui-ngx/src/app/modules/home/components/profile/device-profile-autocomplete.component.ts
  37. 2
      ui-ngx/src/app/modules/home/components/role/registration-permissions.component.html
  38. 22
      ui-ngx/src/app/modules/home/components/wizard/integration-wizard-dialog.component.ts
  39. 19
      ui-ngx/src/app/modules/home/dialogs/home-dialogs.service.ts
  40. 39
      ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-header.component.html
  41. 11
      ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-header.component.ts
  42. 39
      ui-ngx/src/app/modules/home/pages/admin/resource/resources-table-header.component.html
  43. 11
      ui-ngx/src/app/modules/home/pages/admin/resource/resources-table-header.component.ts
  44. 29
      ui-ngx/src/app/modules/home/pages/asset/asset-table-header.component.html
  45. 6
      ui-ngx/src/app/modules/home/pages/asset/asset-table-header.component.scss
  46. 11
      ui-ngx/src/app/modules/home/pages/asset/asset-table-header.component.ts
  47. 5
      ui-ngx/src/app/modules/home/pages/dashboard/dashboard-group-config.factory.ts
  48. 4
      ui-ngx/src/app/modules/home/pages/dashboard/dashboard.module.ts
  49. 5
      ui-ngx/src/app/modules/home/pages/dashboard/dashboards-table-config.resolver.ts
  50. 50
      ui-ngx/src/app/modules/home/pages/dashboard/import-dashboard-file-dialog.component.html
  51. 77
      ui-ngx/src/app/modules/home/pages/dashboard/import-dashboard-file-dialog.component.ts
  52. 13
      ui-ngx/src/app/modules/home/pages/device/device-table-header.component.html
  53. 26
      ui-ngx/src/app/modules/home/pages/device/device-table-header.component.ts
  54. 25
      ui-ngx/src/app/modules/home/pages/edge/edge-table-header.component.html
  55. 1
      ui-ngx/src/app/modules/home/pages/edge/edge-table-header.component.ts
  56. 26
      ui-ngx/src/app/modules/home/pages/entity-view/entity-view-table-header.component.html
  57. 6
      ui-ngx/src/app/modules/home/pages/entity-view/entity-view-table-header.component.scss
  58. 1
      ui-ngx/src/app/modules/home/pages/entity-view/entity-view-table-header.component.ts
  59. 41
      ui-ngx/src/app/shared/components/button/filter-button.component.html
  60. 204
      ui-ngx/src/app/shared/components/button/filter-button.component.ts
  61. 13
      ui-ngx/src/app/shared/components/entity/entity-subtype-select.component.html
  62. 9
      ui-ngx/src/app/shared/components/entity/entity-subtype-select.component.ts
  63. 2
      ui-ngx/src/app/shared/components/role/group-permissions.component.html
  64. 7
      ui-ngx/src/app/shared/components/time/timezone-select.component.ts
  65. 102
      ui-ngx/src/app/shared/import-export/import-export.service.ts
  66. 6
      ui-ngx/src/app/shared/shared.module.ts
  67. 3
      ui-ngx/src/assets/locale/locale.constant-ar_AE.json
  68. 2
      ui-ngx/src/assets/locale/locale.constant-ca_ES.json
  69. 4
      ui-ngx/src/assets/locale/locale.constant-da_DK.json
  70. 4
      ui-ngx/src/assets/locale/locale.constant-de_DE.json
  71. 4
      ui-ngx/src/assets/locale/locale.constant-el_GR.json
  72. 10
      ui-ngx/src/assets/locale/locale.constant-en_US.json
  73. 4
      ui-ngx/src/assets/locale/locale.constant-es_ES.json
  74. 4
      ui-ngx/src/assets/locale/locale.constant-fr_FR.json
  75. 4
      ui-ngx/src/assets/locale/locale.constant-hi_IN.json
  76. 4
      ui-ngx/src/assets/locale/locale.constant-it_IT.json
  77. 4
      ui-ngx/src/assets/locale/locale.constant-ja_JP.json
  78. 2
      ui-ngx/src/assets/locale/locale.constant-ka_GE.json
  79. 4
      ui-ngx/src/assets/locale/locale.constant-ko_KR.json
  80. 4
      ui-ngx/src/assets/locale/locale.constant-lt_LT.json
  81. 2
      ui-ngx/src/assets/locale/locale.constant-lv_LV.json
  82. 4
      ui-ngx/src/assets/locale/locale.constant-nl_BE.json
  83. 4
      ui-ngx/src/assets/locale/locale.constant-nl_NL.json
  84. 4
      ui-ngx/src/assets/locale/locale.constant-no_NO.json
  85. 4
      ui-ngx/src/assets/locale/locale.constant-pl_PL.json
  86. 4
      ui-ngx/src/assets/locale/locale.constant-pt_BR.json
  87. 4
      ui-ngx/src/assets/locale/locale.constant-sl_SI.json
  88. 4
      ui-ngx/src/assets/locale/locale.constant-tr_TR.json
  89. 4
      ui-ngx/src/assets/locale/locale.constant-uk_UA.json
  90. 4
      ui-ngx/src/assets/locale/locale.constant-zh_CN.json
  91. 4
      ui-ngx/src/assets/locale/locale.constant-zh_TW.json
  92. 9
      ui-ngx/src/scss/filter-button.scss

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

@ -1210,11 +1210,9 @@ spring.main.allow-circular-references: "true" # Spring Boot configuration proper
spring.freemarker.checkTemplateLocation: "false" # spring freemarker configuration
spring.mvc.async.request-timeout: "${SPRING_MVC_ASYNC_REQUEST_TIMEOUT:30000}" # The default timeout for asynchronous requests in milliseconds
spring.mvc.pathmatch.matching-strategy: "ANT_PATH_MATCHER" # For endpoints matching in Swagger
spring.resources.chain:
compressed: "true" # This property enables or disables support for serving pre-compressed resources (for example, a .gzip or .br file)
strategy:
content:
enabled: "true" # This property enables or disables the content Version Strategy. This strategy allows Spring to generate a unique version for static resources, which is based on the content of the resource
spring.web.resources.chain:
enabled: "true" # Enables the Spring resource chain explicitly instead of relying on a webjars locator being on the classpath
compressed: "true" # Serve the pre-compressed .br/.gz copies of the UI files built by ui-ngx when the client accepts them
spring.servlet.multipart.max-file-size: "${SPRING_SERVLET_MULTIPART_MAX_FILE_SIZE:50MB}" # Total file size cannot exceed 50MB when configuring file uploads
spring.servlet.multipart.max-request-size: "${SPRING_SERVLET_MULTIPART_MAX_REQUEST_SIZE:50MB}" # Total request size for a multipart/form-data cannot exceed 50MB

108
application/src/test/java/org/thingsboard/server/config/StaticResourceCompressionTest.java

@ -0,0 +1,108 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
package org.thingsboard.server.config;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.springframework.test.web.servlet.MockMvc;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.zip.GZIPOutputStream;
import static org.hamcrest.Matchers.containsString;
import static org.springframework.http.HttpHeaders.ACCEPT_ENCODING;
import static org.springframework.http.HttpHeaders.CONTENT_ENCODING;
import static org.springframework.http.HttpHeaders.VARY;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Loads the real thingsboard.yml, so the test fails if its static resource chain keys stop binding again.
*/
@SpringBootTest(classes = StaticResourceCompressionTest.WebMvcConfig.class, properties = "spring.config.name=thingsboard")
@AutoConfigureMockMvc(addFilters = false)
public class StaticResourceCompressionTest {
private static final byte[] JS = "console.log('ThingsBoard');\n".repeat(100).getBytes(StandardCharsets.UTF_8);
private static final byte[] JS_GZ = gzip(JS);
private static final byte[] CSS = "@font-face { src: url(font.woff2); }\n".getBytes(StandardCharsets.UTF_8);
@TempDir
static Path webRoot;
@Autowired
private MockMvc mvc;
@DynamicPropertySource
static void staticLocations(DynamicPropertyRegistry registry) {
registry.add("spring.web.resources.static-locations", () -> webRoot.toUri().toString());
}
@BeforeAll
static void createStaticFiles() throws IOException {
Files.write(webRoot.resolve("main.js"), JS);
Files.write(webRoot.resolve("main.js.gz"), JS_GZ);
Files.write(webRoot.resolve("styles.css"), CSS);
Files.write(webRoot.resolve("font.woff2"), new byte[]{1, 2, 3});
}
@Test
public void servesPrebuiltGzipWhenClientAcceptsIt() throws Exception {
mvc.perform(get("/main.js").header(ACCEPT_ENCODING, "gzip, deflate, br"))
.andExpect(status().isOk())
.andExpect(header().string(CONTENT_ENCODING, "gzip"))
.andExpect(header().string(VARY, containsString(ACCEPT_ENCODING)))
.andExpect(content().contentTypeCompatibleWith("text/javascript"))
.andExpect(content().bytes(JS_GZ));
}
@Test
public void servesRawFileWhenClientDoesNotAcceptGzip() throws Exception {
mvc.perform(get("/main.js"))
.andExpect(status().isOk())
.andExpect(header().doesNotExist(CONTENT_ENCODING))
.andExpect(content().bytes(JS));
}
@Test
public void servesStylesheetUnchanged() throws Exception {
// the content version strategy would rewrite url(font.woff2) to url(font-<md5>.woff2)
mvc.perform(get("/styles.css").header(ACCEPT_ENCODING, "gzip"))
.andExpect(status().isOk())
.andExpect(header().doesNotExist(CONTENT_ENCODING))
.andExpect(content().bytes(CSS));
}
// not @Configuration: @ComponentScan("org.thingsboard.server") in other tests would pick it up
@ImportAutoConfiguration({DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class})
static class WebMvcConfig {
}
private static byte[] gzip(byte[] data) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try (GZIPOutputStream gzip = new GZIPOutputStream(out)) {
gzip.write(data);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
return out.toByteArray();
}
}

1
application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java

@ -780,6 +780,7 @@ class DefaultIotHubServiceTest {
mockTenant();
IntegrationId integrationId = new IntegrationId(UUID.randomUUID());
Converter converter = new Converter(new ConverterId(UUID.randomUUID()));
converter.setTenantId(tenantId);
when(converterService.findConverterById(tenantId, converter.getId())).thenReturn(converter);
IotHubInstalledItem deleted = devicePackage(converter.getId(), integrationId);
// The converter and the integration steps shared the name: the integration's state replaced the converter's

2
msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ui/pages/DevicePageElements.java

@ -42,7 +42,7 @@ public class DevicePageElements extends OtherPageElementsHelper {
private static final String DEVICE_LABEL_EDIT = "//input[@formcontrolname='label']";
private static final String DEVICE_DEVICE_PROFILE_PAGE = DEVICE + "/ancestor::mat-row//mat-cell[contains(@class,'cdk-column-type')]/span";
protected static final String CHANGE_OWNER_BTN = "//mat-icon[text() = 'assignment_ind']/parent::button";
private static final String FILTER_BTN = "//tb-device-info-filter/button";
private static final String FILTER_BTN = "//tb-device-table-header//tb-filter-button/button";
private static final String DEVICE_PROFILE_FIELD = "(//input[@formcontrolname='deviceProfile'])[2]";
private static final String DEVICE_STATE_SELECT = "//div[contains(@class,'tb-filter-panel')]//mat-select[@role='combobox']";
private static final String LIST_OF_DEVICES_STATE = "//div[@class='status']";

36
msa/web-report/chromium.js

@ -0,0 +1,36 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
// The Chromium builds shipped with the packages. They must be the Chromium release that playwright-core is released with,
// which install.js checks, so a Playwright upgrade needs new builds here. The Docker image has the chromium package of
// Debian instead: see docker/Dockerfile.
//
// The Chromium project publishes builds of the main branch only, so these are the builds from where the release was
// branched off, without the fixes made on the release branch later. The Debian package of the image has those fixes.
//
// To update after a Playwright upgrade, for the version that the error of install.js names:
// 1. Find where the release was branched off: chromium_main_branch_position in
// https://chromiumdash.appspot.com/fetch_version?version=<version>
// 2. For Linux_x64 and for Win_x64, take the highest snapshot build that is not above that position. Builds are listed by
// the start of their number, so shorten the start until one appears:
// https://www.googleapis.com/storage/v1/b/chromium-browser-snapshots/o?delimiter=/&fields=prefixes&prefix=Linux_x64/<start of the position>
// 3. Set the version (the release from the error, ending in .0) and the two paths, and build the module. It fails with
// the SHA-256 of an archive: put it in the sha256 of that platform and build again, until both pass.
// install.js also fails if an unpacked build is not the version set here.
module.exports = {
// The packages: snapshot builds of the open source code, published by the Chromium project.
// exclude: glob patterns of the files that are not packaged
// strip: glob patterns of the executables to strip of their symbols, when GNU strip is installed
snapshot: {
version: '156.0.8078.0',
baseUrl: 'https://commondatastorage.googleapis.com/chromium-browser-snapshots',
// The .pak.info files, 70 MB, are left from the build of the translations; the browser does not read them
linux: { path: 'Linux_x64/1706520/chrome-linux.zip', sha256: '6b62846a868ea3ee675f77600790877a428dfb2428c940f8eff99db1038f9815',
exclude: ['locales/*.pak.info'],
// The Linux builds come with their symbols, 180 MB
strip: ['chrome', 'chrome_crashpad_handler', 'chrome_sandbox', '*.so*'] },
// interactive_ui_tests.exe is a test program of 348 MB that the service does not need
windows: { path: 'Win_x64/1706509/chrome-win.zip', sha256: '6bdfecb33dbfa7159e5666798bdc28c76347bef913573e899cb43930b78d26cc',
exclude: ['interactive_ui_tests.exe'] }
}
};

13
msa/web-report/docker/Dockerfile

@ -10,7 +10,8 @@ ARG DEBIAN_FRONTEND=noninteractive
ENV NODE_ENV production
ENV DOCKER_MODE true
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
# The browser is the chromium package of Debian, installed below
ENV CHROME_EXECUTABLE=/usr/bin/chromium
COPY start-web-report.sh /tmp/
@ -26,17 +27,13 @@ COPY src/config ./config
COPY src/inspectorShim.js src/server.js ./
RUN apt-get update \
&& apt-get install -yq --no-install-recommends fonts-noto-cjk-extra fonts-roboto fonts-noto-color-emoji fonts-unifont libfreetype6 xfonts-scalable fonts-liberation \
fonts-ipafont-gothic fonts-wqy-zenhei fonts-tlwg-loma-otf fonts-freefont-ttf fontconfig libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 \
libcairo2 libcups2 libdbus-1-3 libdrm2 libgbm1 libglib2.0-0 libnspr4 libnss3 libpango-1.0-0 libwayland-client0 libx11-6 libxcb1 libxcomposite1 \
libxdamage1 libxext6 libxfixes3 libxkbcommon0 libxrandr2 \
&& apt-get install -yq --no-install-recommends chromium fontconfig fonts-noto-cjk-extra fonts-roboto fonts-noto-color-emoji fonts-unifont \
xfonts-scalable fonts-liberation fonts-ipafont-gothic fonts-wqy-zenhei fonts-tlwg-loma-otf fonts-freefont-ttf \
&& rm -rf /var/lib/apt/lists/* \
&& chmod a+x /tmp/*.sh \
&& mv /tmp/start-web-report.sh /usr/bin \
&& chown -R node:node ${pkg.installFolder} \
&& mkdir /ms-playwright \
&& yarn install --production --non-interactive --network-concurrency 4 --network-timeout 100000 --mutex network && yarn cache clean --all \
&& chmod -R 777 /ms-playwright
&& yarn install --production --non-interactive --network-concurrency 4 --network-timeout 100000 --mutex network && yarn cache clean --all
USER node

2
msa/web-report/docker/start-web-report.sh

@ -14,7 +14,5 @@ source "${CONF_FOLDER}/${configfile}"
cd ${pkg.installFolder}
export CHROME_EXECUTABLE=$(node -e "console.log(require('playwright-chromium').chromium.executablePath());")
# This will forward this PID 1 to the node.js and forward SIGTERM for graceful shutdown as well
exec node server.js

147
msa/web-report/install.js

@ -1,46 +1,149 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
const fs = require('fs');
const fse = require('fs-extra');
const path = require('path');
const { execFileSync } = require('child_process');
const crypto = require('crypto');
const { execFile, execFileSync } = require('child_process');
const { promisify } = require('util');
const { Transform } = require('stream');
const { pipeline } = require('stream/promises');
// The helpers that Playwright downloads its browsers with: httpRequest follows HTTPS_PROXY and redirects, extractZip needs no unzip tool
const { httpRequest, extractZip } = require('playwright-core/lib/coreBundle').utils;
const { snapshot } = require('./chromium');
const DOWNLOAD_ATTEMPTS = 3;
// Chromium builds packaged with the service, downloaded by the Playwright CLI as if it ran on the target platform.
const PLATFORMS = {
linux: { hostPlatform: 'ubuntu24.04-x64', downloadDir: 'chromiumLinux', chromeDir: 'chrome-linux64', binary: 'tb-web-report', pkgOutput: 'thingsboard-web-report-linux' },
windows: { hostPlatform: 'win64', downloadDir: 'chromiumWin', chromeDir: 'chrome-win64', binary: 'tb-web-report.exe', pkgOutput: 'thingsboard-web-report-win.exe' }
linux: {
...snapshot.linux, binary: 'tb-web-report', pkgOutput: 'thingsboard-web-report-linux',
// The version is written into the executable
hasVersion: dir => fileContains(path.join(dir, 'chrome'), snapshot.version)
},
windows: {
...snapshot.windows, binary: 'tb-web-report.exe', pkgOutput: 'thingsboard-web-report-win.exe',
hasVersion: dir => fse.pathExists(path.join(dir, `${snapshot.version}.manifest`))
}
};
(async() => {
for (const [targetDir, platform] of Object.entries(PLATFORMS)) {
const downloadDir = path.join(projectRoot(), 'target', platform.downloadDir);
installChromium(platform.hostPlatform, downloadDir);
const chromiumDir = path.join(targetPackageDir(targetDir), 'chromium');
await fse.emptyDir(chromiumDir);
await fse.copy(path.join(downloadDir, chromiumRevisionDir(), platform.chromeDir), chromiumDir);
checkPlaywrightVersion();
await Promise.all(Object.entries(PLATFORMS).map(async ([targetDir, platform]) => {
await installChromium(platform, path.join(projectRoot(), 'target', 'chromium-' + targetDir),
path.join(targetPackageDir(targetDir), 'chromium'));
await fse.move(path.join(projectRoot(), 'target', platform.pkgOutput),
path.join(targetPackageDir(targetDir), 'bin', platform.binary),
{overwrite: true});
}
}));
})().catch(e => {
console.error(e);
process.exit(1);
});
function installChromium(hostPlatform, downloadDir) {
execFileSync(process.execPath, [path.join(path.dirname(require.resolve('playwright-core/package.json')), 'cli.js'), 'install', '--no-shell', 'chromium'], {
stdio: 'inherit',
env: {
...process.env,
PLAYWRIGHT_HOST_PLATFORM_OVERRIDE: hostPlatform,
PLAYWRIGHT_BROWSERS_PATH: downloadDir,
PLAYWRIGHT_SKIP_BROWSER_GC: '1'
function checkPlaywrightVersion() {
const browsers = fse.readJsonSync(path.join(path.dirname(require.resolve('playwright-core/package.json')), 'browsers.json')).browsers;
const chromium = browsers.find(browser => browser.name === 'chromium');
if (!chromium) {
throw new Error('playwright-core/browsers.json does not list chromium');
}
// The release is the first three numbers; the last one counts the fixes on its branch and differs between builds
const build = version => version.split('.').slice(0, 3).join('.');
if (build(chromium.browserVersion) !== build(snapshot.version)) {
throw new Error(`playwright-core expects Chromium ${chromium.browserVersion}, the snapshot build in chromium.js is ${snapshot.version}`);
}
}
async function installChromium(platform, downloadDir, chromiumDir) {
await fse.emptyDir(downloadDir);
const archive = path.join(downloadDir, 'chromium.zip');
await download(`${snapshot.baseUrl}/${platform.path}`, archive, platform.sha256);
await extractZip(archive, { dir: downloadDir });
const unpacked = path.join(downloadDir, path.basename(platform.path, '.zip'));
for await (const excluded of fs.promises.glob(platform.exclude || [], { cwd: unpacked })) {
await fse.remove(path.join(unpacked, excluded));
}
if (platform.strip) {
await stripExecutables(unpacked, platform.strip);
}
if (!await platform.hasVersion(unpacked)) {
throw new Error(`${platform.path} is not Chromium ${snapshot.version}; check the build number in chromium.js`);
}
await fse.move(unpacked, chromiumDir, { overwrite: true });
await fse.remove(downloadDir);
}
// Fails unless the SHA-256 of the downloaded file is the expected one. Tries again when the connection or the server
// fails, but not for an answer such as 404, which would be the same again.
async function download(url, file, sha256) {
let actual;
for (let attempt = 1; actual === undefined; attempt++) {
try {
actual = await downloadOnce(url, file);
} catch (e) {
if (e.statusCode < 500 || attempt === DOWNLOAD_ATTEMPTS) {
throw e;
}
console.warn(`${e.message}; trying again`);
}
}
if (actual !== sha256) {
throw new Error(`${url} has SHA-256 ${actual}, expected ${sha256}`);
}
}
// Writes the file while it is downloaded, and gives its SHA-256
function downloadOnce(url, file) {
return new Promise((resolve, reject) => {
const fail = (reason, statusCode) => reject(Object.assign(new Error(`Cannot download ${url}: ${reason}`), { statusCode }));
httpRequest({ url, socketTimeout: 60000 }, response => {
if (response.statusCode !== 200) {
response.resume();
fail(`HTTP ${response.statusCode}`, response.statusCode);
return;
}
const hash = crypto.createHash('sha256');
const hashing = new Transform({
transform(chunk, encoding, callback) {
hash.update(chunk);
callback(null, chunk);
}
});
pipeline(response, hashing, fs.createWriteStream(file)).then(() => resolve(hash.digest('hex')), e => fail(e.message));
}, e => fail(e.message));
});
}
function chromiumRevisionDir() {
const browsers = fse.readJsonSync(path.join(projectRoot(), 'node_modules', 'playwright-core', 'browsers.json')).browsers;
return 'chromium-' + browsers.find(b => b.name === 'chromium').revision;
// Strips the symbols with GNU strip, which reads the Linux executables on any build machine. Without it, as on macOS
// or where binutils is not installed, the executables are packaged as they are.
async function stripExecutables(dir, patterns) {
if (!hasGnuStrip()) {
console.warn('strip not found, Linux Chromium left unstripped (+~180 MB); install GNU binutils to strip it');
return;
}
for await (const file of fs.promises.glob(patterns, { cwd: dir })) {
await promisify(execFile)('strip', ['--strip-unneeded', path.join(dir, file)]);
}
}
function hasGnuStrip() {
try {
return execFileSync('strip', ['--version'], { encoding: 'utf8' }).includes('GNU strip');
} catch {
return false;
}
}
async function fileContains(file, text) {
const needle = Buffer.from(text);
let tail = Buffer.alloc(0);
for await (const chunk of fs.createReadStream(file)) {
const data = Buffer.concat([tail, chunk]);
if (data.includes(needle)) {
return true;
}
tail = data.subarray(data.length - needle.length + 1);
}
return false;
}
function projectRoot() {

1
msa/web-report/package.json

@ -18,7 +18,6 @@
"config": "~4.4.2",
"express": "~5.3.0",
"js-yaml": "^4.3.2",
"playwright-chromium": "~1.64.1",
"playwright-core": "~1.64.1",
"winston": "~3.19.0",
"winston-daily-rotate-file": "~5.0.0"

64
msa/web-report/pom.xml

@ -321,15 +321,16 @@
</component>
<component>
<type>application</type>
<name>chrome-for-testing</name>
<name>chromium</name>
<version>${chromium.version}</version>
<description>Chrome for Testing build downloaded by Playwright, used to render reports.</description>
<purl>pkg:generic/google/chrome-for-testing@${chromium.version}?os=linux</purl>
<description>Chromium snapshot build of the Chromium project, used to render reports.</description>
<purl>pkg:generic/chromium/chromium@${chromium.version}?os=linux</purl>
<cpe>cpe:2.3:a:google:chrome:${chromium.version}:*:*:*:*:*:*:*</cpe>
<license>BSD-3-Clause</license>
<supplier>
<name>Google LLC</name>
<name>The Chromium Authors</name>
<urls>
<url>https://googlechromelabs.github.io/chrome-for-testing/</url>
<url>https://www.chromium.org</url>
</urls>
</supplier>
<file>${pkg.linux.dist}/chromium/chrome</file>
@ -340,15 +341,16 @@
</component>
<component>
<type>application</type>
<name>chrome-for-testing</name>
<name>chromium</name>
<version>${chromium.version}</version>
<description>Chrome for Testing build downloaded by Playwright, used to render reports.</description>
<purl>pkg:generic/google/chrome-for-testing@${chromium.version}?os=windows</purl>
<description>Chromium snapshot build of the Chromium project, used to render reports.</description>
<purl>pkg:generic/chromium/chromium@${chromium.version}?os=windows</purl>
<cpe>cpe:2.3:a:google:chrome:${chromium.version}:*:*:*:*:*:*:*</cpe>
<license>BSD-3-Clause</license>
<supplier>
<name>Google LLC</name>
<name>The Chromium Authors</name>
<urls>
<url>https://googlechromelabs.github.io/chrome-for-testing/</url>
<url>https://www.chromium.org</url>
</urls>
</supplier>
<file>${pkg.win.dist}/chromium/chrome.exe</file>
@ -367,48 +369,6 @@
<sbom>${project.build.directory}/sbom/tb-web-report.cdx.json</sbom>
<installDir>${pkg.installFolder}</installDir>
</component>
<component>
<type>application</type>
<name>chrome-for-testing</name>
<version>${chromium.version}</version>
<description>Chrome for Testing build downloaded by Playwright to /ms-playwright, used to render reports.</description>
<purl>pkg:generic/google/chrome-for-testing@${chromium.version}?os=linux&amp;arch=@{architecture}</purl>
<cpe>cpe:2.3:a:google:chrome:${chromium.version}:*:*:*:*:*:*:*</cpe>
<supplier>
<name>Google LLC</name>
<urls>
<url>https://googlechromelabs.github.io/chrome-for-testing/</url>
</urls>
</supplier>
</component>
<component>
<type>application</type>
<name>chrome-headless-shell</name>
<version>${chromium-headless-shell.version}</version>
<description>Chrome Headless Shell build downloaded by Playwright to /ms-playwright.</description>
<purl>pkg:generic/google/chrome-headless-shell@${chromium-headless-shell.version}?os=linux&amp;arch=@{architecture}</purl>
<cpe>cpe:2.3:a:google:chrome:${chromium-headless-shell.version}:*:*:*:*:*:*:*</cpe>
<supplier>
<name>Google LLC</name>
<urls>
<url>https://googlechromelabs.github.io/chrome-for-testing/</url>
</urls>
</supplier>
</component>
<component>
<type>application</type>
<name>playwright-ffmpeg</name>
<version>${ffmpeg.revision}</version>
<description>FFmpeg build by Playwright (revision ${ffmpeg.revision}), downloaded to /ms-playwright.</description>
<purl>pkg:generic/microsoft/playwright-ffmpeg@${ffmpeg.revision}?os=linux&amp;arch=@{architecture}</purl>
<license>LGPL-2.1-or-later</license>
<supplier>
<name>Microsoft Corporation</name>
<urls>
<url>https://playwright.dev</url>
</urls>
</supplier>
</component>
</components>
</configuration>
</execution>

19
msa/web-report/sbom-check.js

@ -12,7 +12,7 @@ const BASE_BINARY = /fetched-v(\d+\.\d+\.\d+)-/;
(() => {
const listed = listedPackages(JSON.parse(fs.readFileSync(SBOM_FILE, 'utf8')));
const versions = playwrightVersions();
const versions = { 'chromium.version': require('./chromium').snapshot.version };
for (const [os, log] of Object.entries(PKG_LOGS)) {
const output = fs.readFileSync(path.join(TARGET_DIR, log), 'utf8').replace(/\x1b\[[0-9;]*m/g, '');
const baseBinary = BASE_BINARY.exec(output);
@ -74,20 +74,3 @@ function packageDir(file) {
}
return parts.slice(0, index + (scoped ? 3 : 2)).join(path.sep);
}
function playwrightVersions() {
const browsers = JSON.parse(fs.readFileSync(path.join(path.dirname(require.resolve('playwright-core/package.json')), 'browsers.json'), 'utf8')).browsers;
const browser = name => {
const found = browsers.find(candidate => candidate.name === name);
if (!found) {
throw new Error(`playwright-core/browsers.json does not list ${name}`);
}
return found;
};
return {
'chromium.version': browser('chromium').browserVersion,
'chromium-headless-shell.version': browser('chromium-headless-shell').browserVersion,
'ffmpeg.revision': browser('ffmpeg').revision
};
}

3
msa/web-report/server.ts

@ -5,8 +5,7 @@ import express from 'express';
import bodyParser from 'body-parser';
import config from 'config';
import { _logger } from './config/logger';
import { chromium } from 'playwright-chromium';
import { Browser, LaunchOptions } from 'playwright-core';
import { Browser, chromium, LaunchOptions } from 'playwright-core';
import { route } from './api/routes/tbWebReportRoutes';
import { TbWebReportPageQueue } from './api/controllers/tbWebReportPageQueue';

9
msa/web-report/yarn.lock

@ -1307,14 +1307,7 @@ picomatch@^4.0.2, picomatch@^4.0.4:
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.7.tgz#6313360034ccb36b3dc61ecbdff78121f90fe21f"
integrity sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==
playwright-chromium@~1.64.1:
version "1.64.1"
resolved "https://registry.yarnpkg.com/playwright-chromium/-/playwright-chromium-1.64.1.tgz#81aec8925514050c0ac5bc08fa231ed189ab0e86"
integrity sha512-lvAzvvIRtbHaeLwl7XoUkhSNuWHKshbrYv2sjqYgLQS4SsTTwgSTlg9BwU5LeGxYkHxBXTnKtNDEQdZSOj/01g==
dependencies:
playwright-core "1.64.1"
playwright-core@1.64.1, playwright-core@~1.64.1:
playwright-core@~1.64.1:
version "1.64.1"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.64.1.tgz#ca9ec82d7da6ced1b2326ec59ef097aaa9a29f94"
integrity sha512-BC4s8y6SEVA6Q1rSxZTto8hI1KUI3xXlHGZgvGqP4IqPdI/a6FX9H29IDNz7vKo9l21b6LfYosScPL6M3xxyDQ==

12
msa/web-ui/negotiator.d.ts

@ -0,0 +1,12 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
// negotiator 1.x ships no types, and @types/negotiator (0.6) lacks the `preferred` option
declare module 'negotiator' {
import { IncomingMessage } from 'http';
export default class Negotiator {
constructor(request: IncomingMessage);
encoding(available: string[], options?: { preferred?: string[] }): string | undefined;
}
}

3
msa/web-ui/package.json

@ -14,18 +14,17 @@
"sbom": "node ../../tools/src/main/javascript/yarn-sbom.js target/sbom/tb-web-ui.cdx.json application --all-platforms"
},
"dependencies": {
"compression": "^1.8.2",
"config": "^4.4.2",
"connect-history-api-fallback": "^2.0.0",
"express": "^5.3.0",
"http-proxy": "^1.18.1",
"js-yaml": "^4.3.2",
"negotiator": "^1.1.0",
"winston": "^3.19.0",
"winston-daily-rotate-file": "^5.0.0"
},
"devDependencies": {
"@cyclonedx/cyclonedx-library": "10.3.0",
"@types/compression": "^1.8.1",
"@types/connect-history-api-fallback": "1.5.4",
"@types/express": "~5.0.6",
"@types/http-proxy": "^1.17.17",

83
msa/web-ui/server.ts

@ -1,14 +1,16 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
import express from 'express';
import config from 'config';
import { _logger} from './config/logger';
import path from 'path';
import http, { ServerResponse } from 'http';
import httpProxy from 'http-proxy';
import compression from 'compression';
import fs from 'fs';
import historyApiFallback from 'connect-history-api-fallback';
import { Socket } from 'net';
import Negotiator from 'negotiator';
import { RequestHandler } from 'express';
const logger = _logger('main');
@ -16,6 +18,18 @@ const logger = _logger('main');
let server: http.Server | null;
let connections: Socket[] = [];
// in server preference order; must match the encoders in ui-ngx/compress-build.js
const precompressedEncodings = [
{encoding: 'br', ext: '.br'},
{encoding: 'gzip', ext: '.gz'}
];
interface PrecompressedVariant {
encoding: string;
ext: string;
files: Set<string>;
}
(async() => {
try {
logger.info('Starting ThingsBoard Web UI Microservice...');
@ -115,12 +129,20 @@ let connections: Socket[] = [];
}
app.use(historyApiFallback());
if (compressionEnabled) {
app.use(compression());
}
const root = path.join(webDir, 'public');
// No per-request compression: zlib/brotli fragment native memory that glibc never returns, until OOM
if (compressionEnabled) {
const variants = listPrecompressedFiles(root);
if (variants.some(({files}) => files.size)) {
logger.info('Pre-compressed files: %s', variants.map(({encoding, files}) => `${encoding} ${files.size}`).join(', '));
} else {
logger.warn('No pre-compressed (.br/.gz) UI files in %s: UI files are served uncompressed', root);
}
app.use(precompressedStatic(root, variants));
}
const staticServe = express.static(root);
const indexHtmlFallback: RequestHandler = (req, res, next) => {
@ -167,6 +189,57 @@ process.on('exit', async (code: number) => {
logger.info(`ThingsBoard Web UI Microservice has been stopped. Exit code: ${code}.`);
});
function listPrecompressedFiles(root: string): PrecompressedVariant[] {
const variants = precompressedEncodings.map(encoding => ({...encoding, files: new Set<string>()}));
if (fs.existsSync(root)) {
for (const file of fs.readdirSync(root, {recursive: true, encoding: 'utf8'})) {
const variant = variants.find(({ext}) => file.endsWith(ext));
variant?.files.add('/' + file.slice(0, -variant.ext.length).split(path.sep).join('/'));
}
}
return variants;
}
function precompressedStatic(root: string, variants: PrecompressedVariant[]): RequestHandler {
return (req, res, next) => {
if (req.method !== 'GET' && req.method !== 'HEAD') {
return next();
}
let filePath: string;
try {
filePath = decodeURIComponent(req.path);
} catch {
return next();
}
const available = variants.filter(({files}) => files.has(filePath));
if (!available.length) {
return next();
}
res.vary('Accept-Encoding');
// highest q wins; on a tie the server's order does, as browsers list gzip before br
const encodings = available.map(({encoding}) => encoding);
const best = new Negotiator(req).encoding([...encodings, 'identity'], {preferred: encodings});
const variant = available.find(({encoding}) => encoding === best);
if (!variant) {
return next();
}
res.setHeader('Content-Encoding', variant.encoding);
res.type(path.extname(filePath));
res.sendFile(filePath + variant.ext, {root}, (err?: NodeJS.ErrnoException & { status?: number }) => {
// the client went away; express.static ignores these too
if (!err || err.code === 'ECONNABORTED' || err.syscall === 'write') {
return;
}
if (res.headersSent) {
return next(err);
}
res.removeHeader('Content-Encoding');
// the copy was removed after startup: fall through to the original
next(err.status === 404 ? undefined : err);
});
};
}
async function exit(status: number) {
logger.info('Exiting with status: %d ...', status);
if (server) {

5
msa/web-ui/tsconfig.json

@ -9,5 +9,8 @@
"skipLibCheck": true,
"strictPropertyInitialization": false
},
"exclude": ["node_modules", "target"]
"exclude": ["node_modules", "target"],
"ts-node": {
"files": true
}
}

68
msa/web-ui/yarn.lock

@ -317,14 +317,6 @@
"@types/connect" "*"
"@types/node" "*"
"@types/compression@^1.8.1":
version "1.8.1"
resolved "https://registry.yarnpkg.com/@types/compression/-/compression-1.8.1.tgz#57cd1a5c0c585aca56124ab4daef1d254d6f5a7d"
integrity sha512-kCFuWS0ebDbmxs0AXYn6e2r2nrGAb5KwQhknjSPSPgJcGd8+HVSILlUyFhGqML2gk39HcG7D1ydW9/qpYkN00Q==
dependencies:
"@types/express" "*"
"@types/node" "*"
"@types/connect-history-api-fallback@1.5.4":
version "1.5.4"
resolved "https://registry.yarnpkg.com/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.5.4.tgz#7de71645a103056b48ac3ce07b3520b819c1d5b3"
@ -350,7 +342,7 @@
"@types/range-parser" "*"
"@types/send" "*"
"@types/express@*", "@types/express@~5.0.6":
"@types/express@~5.0.6":
version "5.0.6"
resolved "https://registry.yarnpkg.com/@types/express/-/express-5.0.6.tgz#2d724b2c990dcb8c8444063f3580a903f6d500cc"
integrity sha512-sKYVuV7Sv9fbPIt/442koC7+IIwK5olP1KWeD88e/idgoJqDm3JV/YUiPwkoKK92ylff2MGxSz1CSjsXelx0YA==
@ -588,7 +580,7 @@ buffer@^5.5.0:
base64-js "^1.3.1"
ieee754 "^1.1.13"
bytes@3.1.2, bytes@^3.1.2, bytes@~3.1.2:
bytes@^3.1.2, bytes@~3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5"
integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==
@ -672,27 +664,6 @@ commander@^9.4.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30"
integrity sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==
compressible@~2.0.18:
version "2.0.18"
resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba"
integrity sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==
dependencies:
mime-db ">= 1.43.0 < 2"
compression@^1.8.2:
version "1.8.2"
resolved "https://registry.yarnpkg.com/compression/-/compression-1.8.2.tgz#781397127ae2da00c0c5f7c76bda5b2a9b32a49f"
integrity sha512-o8vI5RE5A6EVVOd9o41jKp41aJom+QTEO/Bx8MYNjexMo/Bv2WOjUfZr+aL0WnYSgymUy6zeguqLTsIhV0gMvQ==
dependencies:
bytes "3.1.2"
compressible "~2.0.18"
debug "2.6.9"
destroy "1.2.0"
negotiator "~0.6.4"
on-headers "~1.1.0"
safe-buffer "5.2.1"
vary "~1.1.2"
config@^4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/config/-/config-4.4.2.tgz#adab67a87fcb5f84edcacb3f159ccdb31ad8b901"
@ -735,13 +706,6 @@ create-require@^1.1.0:
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
debug@2.6.9:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==
dependencies:
ms "2.0.0"
debug@^4.3.1, debug@^4.4.0, debug@^4.4.3:
version "4.4.3"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a"
@ -766,11 +730,6 @@ depd@^2.0.0, depd@~2.0.0:
resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df"
integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==
destroy@1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015"
integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==
detect-libc@^2.0.0:
version "2.1.2"
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.1.2.tgz#689c5dcdc1900ef5583a4cb9f6d7b473742074ad"
@ -1236,7 +1195,7 @@ merge-descriptors@^2.0.0:
resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-2.0.0.tgz#ea922f660635a2249ee565e0449f951e6b603808"
integrity sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==
"mime-db@>= 1.43.0 < 2", mime-db@^1.54.0:
mime-db@^1.54.0:
version "1.54.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.54.0.tgz#cddb3ee4f9c64530dff640236661d42cb6a314f5"
integrity sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==
@ -1280,11 +1239,6 @@ moment@^2.29.1:
resolved "https://registry.yarnpkg.com/moment/-/moment-2.31.0.tgz#6e19184e8005a9dfc61c9351263d4d6ea2ace7aa"
integrity sha512-0acOTfMiWOheYS4eoWb80yYMb/JLvVv9SHbs2PehaDzfUG0Bw855SKyk0IKTnPGa5+U2bmi3W68l1+sGLX/pvw==
ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==
ms@^2.1.1, ms@^2.1.3:
version "2.1.3"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
@ -1303,18 +1257,13 @@ napi-build-utils@^2.0.0:
resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-2.0.0.tgz#13c22c0187fcfccce1461844136372a47ddc027e"
integrity sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==
negotiator@^1.0.0:
negotiator@^1.0.0, negotiator@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-1.1.0.tgz#16e003d0db4ac24fd9df168edf871625deeae3df"
integrity sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==
dependencies:
content-type "^2.1.0"
negotiator@~0.6.4:
version "0.6.4"
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.4.tgz#777948e2452651c570b712dd01c23e262713fff7"
integrity sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==
node-abi@^3.3.0:
version "3.100.0"
resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.100.0.tgz#31aa9623841051d14f52415557e18101bc0de7ca"
@ -1353,11 +1302,6 @@ on-finished@^2.4.1:
dependencies:
ee-first "1.1.1"
on-headers@~1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.1.0.tgz#59da4f91c45f5f989c6e4bcedc5a3b0aed70ff65"
integrity sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A==
once@^1.3.1, once@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
@ -1544,7 +1488,7 @@ router@^2.2.0:
parseurl "^1.3.3"
path-to-regexp "^8.0.0"
safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@~5.2.0:
safe-buffer@^5.0.1, safe-buffer@~5.2.0:
version "5.2.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
@ -1939,7 +1883,7 @@ validate-npm-package-license@^3.0.4:
spdx-correct "^3.0.0"
spdx-expression-parse "^3.0.0"
vary@^1.1.2, vary@~1.1.2:
vary@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==

4
pom.xml

@ -93,7 +93,7 @@
<tomcat.version>10.1.61</tomcat.version> <!-- to fix CVE-2026-53434, CVE-2026-55955, CVE-2026-65182, CVE-2026-65905, CVE-2026-68525, CVE-2026-76183, CVE-2026-101296 and CVE-2026-101356. Pinned via the tomcat-embed overrides below: spring-boot-dependencies is imported as a BOM, so this property alone would not win. TODO: remove when fixed in spring-boot-dependencies -->
<httpcore5.version>5.4.3</httpcore5.version> <!-- to fix CVE-2026-54399 and CVE-2026-54428 (no fix exists on the 5.3.x line; the httpclient5 5.6.4 pin below requires httpcore5 5.4.3). Pinned via the httpcore5 overrides below: spring-boot-dependencies is imported as a BOM, so this property alone would not win. TODO: remove when fixed in spring-boot-dependencies -->
<logback.version>1.5.38</logback.version> <!-- to fix CVE-2026-13006 (1.5.36 as reported by the scanner is still vulnerable; 1.5.37 removed Janino conditional processing entirely, 1.5.38 adds a HardenedObjectInputStream fix). Pinned via the logback overrides below: spring-boot-dependencies is imported as a BOM, so this property alone would not win. TODO: remove when fixed in spring-boot-dependencies -->
<jackson-bom.version>2.21.7</jackson-bom.version> <!-- to fix CVE-2026-59889, CVE-2026-68497, CVE-2026-89425 and CVE-2026-91777. Pinned via the jackson-bom import below: spring-boot-dependencies re-imports jackson-bom with its own placeholder, so this property alone would not win. TODO: remove when fixed in spring-boot-dependencies -->
<jackson-bom.version>2.21.8</jackson-bom.version> <!-- to fix CVE-2026-59889, CVE-2026-68497, CVE-2026-89425, CVE-2026-91777, CVE-2026-106554 and CVE-2026-110879. Pinned via the jackson-bom import below: spring-boot-dependencies re-imports jackson-bom with its own placeholder, so this property alone would not win. TODO: remove when fixed in spring-boot-dependencies -->
<postgresql.version>42.7.14</postgresql.version> <!-- to fix CVE-2026-54291 and CVE-2026-107314. Pinned via the postgresql override below: spring-boot-dependencies is imported as a BOM, so this property alone would not win. TODO: remove when fixed in spring-boot-dependencies -->
<lz4-java.version>1.11.4</lz4-java.version> <!-- to fix CVE-2026-59949, CVE-2026-106450 and CVE-2026-106451. Transitive dependency of amazon-kinesis-producer 0.15.12 and kafka-clients 3.9.2; not managed by any BOM, so the override below is the sole source of the version. TODO: remove once amazon-kinesis-producer and kafka-clients pull lz4-java >= 1.11.4 -->
<amqp-client.version>5.34.0</amqp-client.version> <!-- to fix CVE-2026-63337, CVE-2026-69219, CVE-2026-69220 and CVE-2026-75516. Pinned via the amqp-client override below: spring-boot-dependencies is imported as a BOM, so this property alone would not win. TODO: remove when fixed in spring-boot-dependencies -->
@ -158,7 +158,7 @@
<bucket4j.version>8.10.1</bucket4j.version>
<antlr.version>3.5.3</antlr.version>
<amazon-kinesis-producer>0.15.12</amazon-kinesis-producer>
<org.json.version>20250517</org.json.version> <!-- Transitive dependency by amazon-kinesis-producer 0.15.10, 0.15.12 to address CVE-2023-5072 -->
<org.json.version>20260719</org.json.version> <!-- Transitive dependency by amazon-kinesis-producer 0.15.10, 0.15.12 and jedis; to fix CVE-2023-5072 and CVE-2026-59171 -->
<amazon-kinesis-client>3.1.2</amazon-kinesis-client>
<apache-avro.version>1.11.4</apache-avro.version> <!--vulnerability fix, related to the kinesis client-->
<aws.sdk.version>1.12.701</aws.sdk.version>

20
tools/src/main/python/license-headers/curations.json

@ -1199,7 +1199,7 @@
"path": "msa/web-report/pom.xml",
"header": "busl",
"reason": "Build descriptor of the PE-only web-report module; CE has no web-report module. The only CE version is an empty file (blob e69de29bb2d) added by stray commit 2b1c5d92f3a, pushed to fix/maven-node-lts-4.3 after #16417 merged and carried into lts-4.4 via #16419; it never reached CE lts-4.3 and is not the origin of this file.",
"contentHash": "sha256:48ee3956937386c95ebb2b95a4981506203c00ce276aa6003fecfc0ddaf04218"
"contentHash": "sha256:9ddddeec7898c7232abc7b16c696fdad4f3825d15d3810369f621609f2678f65"
},
{
"path": "report/src/main/conf/logback.xml",
@ -1393,12 +1393,6 @@
"reason": "PE agent entity tabs component added in f5e28c9cc42 as part of the PE agent feature introduced on lts-4.4, which has no counterpart in CE. The candidate CE ui-ngx/src/app/modules/home/pages/edge/edge-tabs.component.ts shares only the entity tabs component boilerplate. Reviewed candidate at a0aff29ef42d3636473b017115a9334b48d54d15 (blob 58bc88a8db4).",
"contentHash": "sha256:774979b5f77b5d58e1d7dfabc31f6271a46cfa346b8f43e6bb18db92e0cb2429"
},
{
"path": "ui-ngx/src/app/modules/home/pages/asset/asset-table-header.component.scss",
"header": "ce-modified",
"reason": "Retained CE file subsequently deleted on the CE mainline in d81add6fd73 (Angular 15 migration). PE keeps the assets table header stylesheet and updated it for the MDC slide toggle. Reviewed against last CE path version 80430897422ae13b600ee9c9dbc57f7d558a3b4b^1 (blob 488e5b4c27e).",
"contentHash": "sha256:57aabaed35a0bf7d372df84d6d3c7e7562eeccc06bd19655f94000bd2693f3c0"
},
{
"path": "ui-ngx/src/app/modules/home/pages/converter/converter.module.ts",
"header": "busl",
@ -1441,12 +1435,6 @@
"reason": "New PE file implementing a PE feature. It was written by adapting CE ui-ngx/src/app/modules/home/pages/dashboard/make-dashboard-public-dialog.component.ts, which PE still carries at its own path, so this is not a CE file with PE modifications. Adaptation from CE does not make it CE-derived. Maintainer rule (2026-09-09): a file that exists in CE and carries PE changes is modified CE; a file that does not exist in CE and implements a PE feature is PE-only, however closely it resembles a CE file.",
"contentHash": "sha256:07f295f637db24d600798215d33391f4e966954899f644a41b9735f5ed5392db"
},
{
"path": "ui-ngx/src/app/modules/home/pages/entity-view/entity-view-table-header.component.scss",
"header": "ce-modified",
"reason": "Retained CE file subsequently deleted on the CE mainline in d81add6fd73 (Angular 15 migration). PE keeps the entity views table header stylesheet and updated it for the MDC slide toggle. Reviewed against last CE path version 80430897422ae13b600ee9c9dbc57f7d558a3b4b^1 (blob 66a9d55fb35).",
"contentHash": "sha256:6c7ddc99037190175a49c49f17e30954e2e46d03f7e91cb02ae5e40381a4850b"
},
{
"path": "ui-ngx/src/app/modules/home/pages/iframe/iframe-view.module.ts",
"header": "busl",
@ -1710,6 +1698,12 @@
"header": "busl",
"reason": "ID wrapper for a PE-only entity. Maintainer resolved ConverterId and comparable PE-only entity wrappers as PE-authored; extending the common ID type and repeating its annotations/type tag is template use. Reviewed similarity candidate ui-ngx/src/app/shared/models/id/asset-id.ts at 0d3b41e002f958887a317ca8366fdc4efa549058 (blob 86ca874a92346a950b6912d78116f1f7ee6bb654).",
"contentHash": "sha256:5427b1c6bf59f9e9372c47717fee96bf94bddeaf65ad920b77647b16539bf5f9"
},
{
"path": "ui-ngx/src/scss/filter-button.scss",
"header": "ce-modified",
"reason": "Shared filter button styles extracted from the CE device filter component, which now uses this file instead of its own copy; the rules are the CE implementation with the panel class renamed. Reviewed against CE ui-ngx/src/app/modules/home/components/device/device-info-filter.component.scss at 269bc8dc73a4892e93cf61db6a8a41ea377c8636 (blob 4a79c6c9ce599e85209d5a6ee9062b6f713ac0f1).",
"contentHash": "sha256:3b19b678564aa147c087269d91d7996a5c2a58d7ff058afbe6610c5cda56cc0e"
}
]
}

82
ui-ngx/compress-build.js

@ -0,0 +1,82 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
// Writes .br and .gz copies of the production build's files, served as-is by the monolith and msa/web-ui.
// Not an esbuild plugin: Angular gives custom plugins only the browser code bundle, not polyfills,
// global styles/scripts or copied assets.
const os = require('node:os');
// zlib runs on the libuv thread pool (4 threads by default), which must be sized before its first use.
// More than 8 threads gains nothing: the largest chunk alone takes ~5 s.
const concurrency = Math.min(os.availableParallelism(), 8);
process.env.UV_THREADPOOL_SIZE = String(concurrency);
const fs = require('node:fs');
const path = require('node:path');
const { promisify } = require('node:util');
const zlib = require('node:zlib');
const gzip = promisify(zlib.gzip);
const brotliCompress = promisify(zlib.brotliCompress);
const buildDir = path.join(__dirname, 'target', 'generated-resources', 'public');
// already-compressed formats (png, webp, woff2, ...) are left out
const compressibleExtensions = new Set(['.js', '.mjs', '.css', '.html', '.json', '.svg', '.txt', '.md', '.ttf', '.otf', '.eot']);
const minSize = 10240;
// brotli quality 11 is only ~2% smaller than 10 but 3x slower; must match precompressedEncodings in msa/web-ui
const encoders = [
{
ext: '.br',
encode: content => brotliCompress(content, {
params: {
[zlib.constants.BROTLI_PARAM_QUALITY]: 10,
[zlib.constants.BROTLI_PARAM_SIZE_HINT]: content.length
}
})
},
{
ext: '.gz',
encode: content => gzip(content, { level: zlib.constants.Z_BEST_COMPRESSION })
}
];
function listFiles(dir) {
return fs.readdirSync(dir, { recursive: true, withFileTypes: true })
.filter(entry => entry.isFile())
.map(entry => path.join(entry.parentPath, entry.name));
}
async function compress(file, { ext, encode }) {
const content = await fs.promises.readFile(file);
const compressed = await encode(content);
if (compressed.length < content.length) {
await fs.promises.writeFile(file + ext, compressed);
}
}
async function main() {
// largest first, so the main chunk does not start last
const files = listFiles(buildDir)
.map(file => ({ file, size: fs.statSync(file).size }))
.filter(({ file, size }) => compressibleExtensions.has(path.extname(file).toLowerCase()) && size >= minSize)
.sort((a, b) => b.size - a.size)
.map(({ file }) => file);
const jobs = files.flatMap(file => encoders.map(encoder => () => compress(file, encoder)));
let next = 0;
const worker = async () => {
while (next < jobs.length) {
await jobs[next++]();
}
};
const start = Date.now();
await Promise.all(Array.from({ length: concurrency }, worker));
console.log(`Compressed ${files.length} files (${encoders.map(e => e.ext).join(', ')}) in ${path.relative(__dirname, buildDir)} ` +
`in ${((Date.now() - start) / 1000).toFixed(1)} s on ${concurrency} threads`);
}
main().catch(error => {
console.error(error);
process.exit(1);
});

47
ui-ngx/esbuild/tb-esbuild-plugins.ts

@ -1,10 +1,8 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
import type { Plugin, PluginBuild, OutputFile } from 'esbuild';
import type { Plugin, PluginBuild } from 'esbuild';
import dirTree from 'directory-tree';
import * as packageJson from '../package.json';
import { gzip } from 'node:zlib';
import * as path from 'node:path';
const defineTbVariablesPlugin: Plugin = {
name: 'tb-define-variables',
@ -36,47 +34,6 @@ const resolveJQueryPlugin: Plugin = {
}
};
const compressFileTypes = ['.js', '.css', '.html', '.svg', '.png', '.jpg', '.ttf', '.gif', '.woff', '.woff2', '.eot', '.json'];
const compressThreshold = 10240;
const compressorPlugin: Plugin = {
name: 'tb-compressor-plugin',
setup(build) {
build.onEnd(async result => {
if (!result.outputFiles || !isProduction()) return;
const outputExt = '.gz';
const gzippedFiles: OutputFile[] = [];
for (const file of result.outputFiles) {
if (!compressFileTypes.some((ext) => ext === path.extname(file.path))) continue;
if (file.contents.byteLength <= compressThreshold) continue;
const compressedContent = await gzipContent(file.contents);
const compressedFilePath = `${file.path}${outputExt}`;
gzippedFiles.push(
{
path: compressedFilePath,
hash: file.hash,
contents: new Uint8Array(compressedContent),
text: '',
}
);
}
result.outputFiles.push(...gzippedFiles);
});
},
};
async function gzipContent(content): Promise<Buffer> {
return new Promise((resolve, reject) => {
gzip(content, (error, result) => {
if (error) {
reject(error);
} else {
resolve(result);
}
});
});
}
function isProduction(): boolean {
const configurationIndex = process.argv.indexOf('--configuration');
let production = false;
@ -87,4 +44,4 @@ function isProduction(): boolean {
return production;
}
export default [defineTbVariablesPlugin, resolveJQueryPlugin, compressorPlugin];
export default [defineTbVariablesPlugin, resolveJQueryPlugin];

1
ui-ngx/package.json

@ -6,6 +6,7 @@
"start": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng serve --configuration development --host 0.0.0.0 --open",
"build": "ng build",
"build:prod": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --configuration production",
"compress": "node compress-build.js",
"build:types": "node generate-types.js",
"build:icon-metadata": "node generate-icon-metadata.js",
"sbom": "node ../tools/src/main/javascript/yarn-sbom.js target/generated-resources/META-INF/sbom/ui-ngx.cdx.json library",

9
ui-ngx/pom.xml

@ -127,6 +127,15 @@
<arguments>--mutex network run build:prod</arguments>
</configuration>
</execution>
<execution>
<id>yarn compress</id>
<goals>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>run compress</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

114
ui-ngx/src/app/modules/home/components/converter/converter.component.ts

@ -47,8 +47,8 @@ import {
} from '@shared/models/integration.models';
import { capitalize, deepClone, isDefinedAndNotNull, isEmptyStr, isNotEmptyStr } from '@core/utils';
import { NULL_UUID } from '@shared/models/id/has-uuid';
import { catchError, filter, map, startWith } from 'rxjs/operators';
import { combineLatest, defer, forkJoin, merge, Observable, of, shareReplay } from 'rxjs';
import { catchError, filter, map, startWith, switchMap, tap } from 'rxjs/operators';
import { combineLatest, defer, forkJoin, merge, Observable, of, shareReplay, Subscription } from 'rxjs';
import { ContentType } from '@shared/models/constants';
import { ConverterLibraryService } from '@core/http/converter-library.service';
import { EntityType } from '@shared/models/entity-type.models';
@ -61,6 +61,12 @@ import { EventsDialogComponent, EventsDialogData } from '@home/dialogs/events-di
import { Operation, Resource } from '@shared/models/security.models';
import { UserPermissionsService } from '@core/http/user-permissions.service';
interface ConverterDefaults {
updateOnlyKeys: DefaultUpdateOnlyKeys;
converterV2Config: Record<IntegrationType, ConverterConfigV2>;
integrationsConvertersInfo: IntegrationsConvertersInfo;
}
@Component({
selector: 'tb-converter',
templateUrl: './converter.component.html',
@ -149,6 +155,10 @@ export class ConverterComponent extends EntityComponent<Converter> implements On
private defaultUpdateOnlyKeysByIntegrationType: DefaultUpdateOnlyKeys = {};
private defaultConverterV2Configuration: Record<IntegrationType, ConverterConfigV2> = {} as Record<IntegrationType, ConverterConfigV2>;
// Emits once, when the data above is loaded; replays at once to later subscribers
private readonly defaults$: Observable<ConverterDefaults>;
private scriptTemplateSubscriptions: Record<string, Subscription> = {};
constructor(protected store: Store<AppState>,
protected translate: TranslateService,
private converterService: ConverterService,
@ -163,13 +173,21 @@ export class ConverterComponent extends EntityComponent<Converter> implements On
private destroyRef: DestroyRef,
private userPermissionsService: UserPermissionsService) {
super(store, fb, entityValue, entitiesTableConfigValue, cd);
forkJoin({
updateOnlyKeys: this.resourcesService.loadJsonResource<DefaultUpdateOnlyKeys>('/assets/converters/default-update-only-keys.json'),
converterV2Config: this.resourcesService.loadJsonResource<Record<IntegrationType, ConverterConfigV2>>('/assets/converters/default-converters-v2-configuration.json'),
// A failed request falls back to the initial value of its field
this.defaults$ = forkJoin({
updateOnlyKeys: this.resourcesService.loadJsonResource<DefaultUpdateOnlyKeys>('/assets/converters/default-update-only-keys.json')
.pipe(catchError(() => of(this.defaultUpdateOnlyKeysByIntegrationType))),
converterV2Config: this.resourcesService.loadJsonResource<Record<IntegrationType, ConverterConfigV2>>('/assets/converters/default-converters-v2-configuration.json')
.pipe(catchError(() => of(this.defaultConverterV2Configuration))),
integrationsConvertersInfo: this.integrationService.getIntegrationsConvertersInfoCached()
.pipe(catchError(() => of(this.integrationsConvertersInfo)))
}).pipe(
shareReplay(1)
);
// Subscribed first, so the fields are set before any other subscriber of defaults$ runs
this.defaults$.pipe(
takeUntilDestroyed()
).subscribe((value) =>{
).subscribe((value) => {
this.defaultUpdateOnlyKeysByIntegrationType = value.updateOnlyKeys;
this.defaultConverterV2Configuration = value.converterV2Config;
this.integrationsConvertersInfo = value.integrationsConvertersInfo;
@ -200,11 +218,11 @@ export class ConverterComponent extends EntityComponent<Converter> implements On
const typeControl = this.entityForm.get('integrationType');
// The type can be set before the template subscribes (e.g. preset from the integration form)
this.integrationInfo$ = combineLatest([
this.integrationService.getIntegrationsConvertersInfoCached(),
this.defaults$,
defer(() => typeControl.valueChanges.pipe(startWith(typeControl.value)))
]).pipe(
filter(([, type]) => !!type),
map(([info, type]) => info?.[type]),
map(([defaults, type]) => defaults.integrationsConvertersInfo?.[type]),
shareReplay(1)
);
}
@ -214,24 +232,12 @@ export class ConverterComponent extends EntityComponent<Converter> implements On
this.entityForm.get('type').valueChanges,
this.entityForm.get('integrationType').valueChanges
).pipe(
tap(() => this.onTypesChanged()),
// The version, the scripts and the default configuration need the loaded defaults:
// at once when they are loaded, otherwise once, for the latest types, when they arrive
switchMap(() => this.defaults$),
takeUntilDestroyed(this.destroyRef)
).subscribe(() => {
this.resetToNewTab();
let converterType: ConverterType = this.entityForm.get('type').value;
const integrationType: IntegrationType = this.entityForm.get('integrationType').value;
this.hideDownlink = integrationTypeInfoMap.get(integrationType)?.hideDownlink ?? false;
if (this.hideDownlink && converterType === ConverterType.DOWNLINK) {
converterType = ConverterType.UPLINK;
this.entityForm.get('type').setValue(converterType, {emitEvent: false});
}
this.updateConverterVersion();
this.onConverterTypeChanged(converterType);
if (converterType === ConverterType.UPLINK) {
this.updateDefaultConfiguration(integrationType);
}
this.updatedConverterScriptLangDisableState();
});
).subscribe(() => this.applyTypesDefaults());
this.entityForm.get('configuration.scriptLang').valueChanges.pipe(
takeUntilDestroyed(this.destroyRef)
).subscribe(() => {
@ -245,6 +251,41 @@ export class ConverterComponent extends EntityComponent<Converter> implements On
this.checkIsNewConverter(this.entity, this.entityForm, true);
}
private onTypesChanged(): void {
this.resetToNewTab();
const integrationType: IntegrationType = this.entityForm.get('integrationType').value;
this.hideDownlink = integrationTypeInfoMap.get(integrationType)?.hideDownlink ?? false;
if (this.hideDownlink && this.entityForm.get('type').value === ConverterType.DOWNLINK) {
this.entityForm.get('type').setValue(ConverterType.UPLINK, {emitEvent: false});
}
}
private applyTypesDefaults(): void {
// A library converter selected while the defaults were loading keeps its version and scripts
if (this.entityForm.get('converterLibrary').value) {
return;
}
const converterType: ConverterType = this.entityForm.get('type').value;
const integrationType: IntegrationType = this.entityForm.get('integrationType').value;
this.updateConverterVersion();
this.onConverterTypeChanged(converterType);
if (converterType === ConverterType.UPLINK) {
this.updateDefaultConfiguration(integrationType);
}
this.updatedConverterScriptLangDisableState();
this.cd.markForCheck();
}
// Runs the action at once when the defaults are loaded, otherwise when they arrive
private whenDefaultsLoaded(action: () => void): void {
this.defaults$.pipe(
takeUntilDestroyed(this.destroyRef)
).subscribe(() => {
action();
this.cd.markForCheck();
});
}
private resetToNewTab() {
this.prevLibraryConverterFormValue = null;
this.prevNewConverterFormValue = null;
@ -384,12 +425,12 @@ export class ConverterComponent extends EntityComponent<Converter> implements On
form.get('configuration.scriptLang').patchValue(
this.tbelEnabled ? ScriptLanguage.TBEL : ScriptLanguage.JS, {emitEvent});
if (!emitEvent) {
this.updateConverterVersion();
this.whenDefaultsLoaded(() => this.updateConverterVersion());
} else {
form.get('integrationType').updateValueAndValidity({onlySelf: true});
}
} else {
this.updatedPredefinedConverterKeys();
this.whenDefaultsLoaded(() => this.updatedPredefinedConverterKeys());
this.updatedConverterVersionDisableState();
this.updatedConverterScriptLangDisableState(entity);
form.updateValueAndValidity();
@ -403,10 +444,10 @@ export class ConverterComponent extends EntityComponent<Converter> implements On
form.get('configuration.scriptLang').patchValue(scriptLang, {emitEvent: true});
}
if (isDefinedAndNotNull(entity?.converterVersion)) {
this.updatedPredefinedConverterKeys();
this.whenDefaultsLoaded(() => this.updatedPredefinedConverterKeys());
this.updatedConverterVersionDisableState();
} else {
this.updateConverterVersion();
this.whenDefaultsLoaded(() => this.updateConverterVersion());
}
}
}
@ -489,8 +530,9 @@ export class ConverterComponent extends EntityComponent<Converter> implements On
const converterType: ConverterType = this.entityForm.get('type').value;
const integrationType: IntegrationType = this.entityForm.get('integrationType').value;
const converterInfo: ConverterInfo = this.integrationsConvertersInfo?.[integrationType]?.[converterType.toLocaleLowerCase()];
this.predefinedConverterKeys = converterInfo.keys.map(value => ({name: value, value}));
this.predefinedKeys = deepClone(converterInfo.keys);
const keys = converterInfo?.keys ?? [];
this.predefinedConverterKeys = keys.map(value => ({name: value, value}));
this.predefinedKeys = deepClone(keys);
} else {
this.predefinedConverterKeys = null;
this.predefinedKeys = [];
@ -515,11 +557,15 @@ export class ConverterComponent extends EntityComponent<Converter> implements On
if (!isNotEmptyStr(scriptBody)) {
const targetTemplateUrl = getTargetTemplateUrl(converterType, scriptLang, integrationType, converterVersion);
this.resourcesService.loadJsonResource(targetTemplateUrl)
this.scriptTemplateSubscriptions[targetField]?.unsubscribe();
this.scriptTemplateSubscriptions[targetField] = this.resourcesService.loadJsonResource<string>(targetTemplateUrl)
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(template => {
this.entityForm.get('configuration').get(targetField)
.patchValue(template, { emitEvent: false });
const scriptControl = this.entityForm.get('configuration').get(targetField);
// A template that arrives late does not replace a script set in the meantime
if (!isNotEmptyStr(scriptControl.value)) {
scriptControl.patchValue(template, {emitEvent: false});
}
});
}
}

79
ui-ngx/src/app/modules/home/components/device/device-info-filter.component.html

@ -1,95 +1,30 @@
<!--
SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
-->
@if (panelMode) {
<ng-container *ngTemplateOutlet="deviceFilterPanel"></ng-container>
} @else {
@if (buttonMode) {
<button color="primary"
matTooltip="{{buttonDisplayValue}}"
matTooltipPosition="above"
mat-stroked-button
(click)="toggleDeviceFilterPanel($event)">
<mat-icon>filter_list</mat-icon>{{buttonDisplayValue}}
</button>
} @else {
<div class="tb-device-filter-config-component tb-form-panel no-padding no-border" [formGroup]="deviceInfoFilterForm">
<div class="tb-form-row column-xs">
<div class="fixed-title-width" translate>device-profile.device-profile</div>
<tb-device-profile-autocomplete
class="flex-1"
formControlName="deviceProfileId"
[inlineField]="true"
[displayAllOnEmpty]="true"
(deviceProfileChanged)="deviceProfileChanged($event)"
[editProfileEnabled]="false"
[addNewProfile]="false">
</tb-device-profile-autocomplete>
</div>
<div class="tb-form-row column-xs">
<div class="fixed-title-width" translate>device.device-state</div>
<mat-form-field class="flex-1" appearance="outline" subscriptSizing="dynamic">
<mat-select formControlName="active" placeholder="{{ 'device.any' | translate }}">
<mat-option>{{ 'device.any' | translate }}</mat-option>
<mat-option [value]="true">{{ 'device.active' | translate }}</mat-option>
<mat-option [value]="false">{{ 'device.inactive' | translate }}</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
}
}
<ng-template #deviceFilterPanel>
<form class="mat-content mat-padding flex flex-col" (ngSubmit)="update()">
<ng-container *ngTemplateOutlet="deviceFilter"></ng-container>
<div class="tb-panel-actions flex flex-row items-center justify-end">
<button type="button"
mat-button
color="primary"
(click)="reset()">
{{ 'action.reset' | translate }}
</button>
<span class="flex-1"></span>
<button type="button"
mat-button
(click)="cancel()">
{{ 'action.cancel' | translate }}
</button>
<button type="submit"
mat-raised-button
color="primary"
[disabled]="deviceInfoFilterForm.invalid || !deviceInfoFilterForm.dirty">
{{ 'action.update' | translate }}
</button>
</div>
</form>
</ng-template>
<ng-template #deviceFilter>
<div class="tb-device-filter-config-component tb-form-panel no-padding no-border" [formGroup]="deviceInfoFilterForm">
<ng-container [formGroup]="deviceInfoFilterForm">
<div class="tb-form-row column-xs">
<div class="fixed-title-width" translate>device-profile.device-profile</div>
<tb-device-profile-autocomplete
class="flex-1"
class="min-w-0 flex-1"
formControlName="deviceProfileId"
[inlineField]="true"
[displayAllOnEmpty]="true"
(deviceProfileChanged)="deviceProfileChanged($event)"
[editProfileEnabled]="false"
[addNewProfile]="false">
</tb-device-profile-autocomplete>
</div>
<div class="tb-form-row column-xs">
<div class="fixed-title-width" translate>device.device-state</div>
<mat-form-field class="flex-1" appearance="outline" subscriptSizing="dynamic">
<mat-select formControlName="active" placeholder="{{ 'device.any' | translate }}">
<mat-form-field class="min-w-0 flex-1" appearance="outline" subscriptSizing="dynamic">
<mat-select formControlName="active" placeholder="{{ 'device.any' | translate }}" [aria-label]="'device.device-state' | translate">
<mat-option>{{ 'device.any' | translate }}</mat-option>
<mat-option [value]="true">{{ 'device.active' | translate }}</mat-option>
<mat-option [value]="false">{{ 'device.inactive' | translate }}</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</ng-template>
</ng-container>

261
ui-ngx/src/app/modules/home/components/device/device-info-filter.component.ts

@ -1,45 +1,16 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
import {
ChangeDetectorRef,
Component,
DestroyRef,
ElementRef,
forwardRef,
Inject,
InjectionToken,
Input,
OnInit,
Optional,
TemplateRef,
ViewChild,
ViewContainerRef
} from '@angular/core';
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR } from '@angular/forms';
import { coerceBoolean } from '@shared/decorators/coercion';
import { ConnectedPosition, Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay';
import { TemplatePortal } from '@angular/cdk/portal';
import { TranslateService } from '@ngx-translate/core';
import { DeviceInfoFilter } from '@shared/models/device.models';
import { deepClone, isDefinedAndNotNull, isEmpty, isUndefinedOrNull } from '@core/utils';
import { EntityInfoData } from '@shared/models/entity.models';
import { DeviceProfileService } from '@core/http/device-profile.service';
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
import { ChangeDetectionStrategy, Component, DestroyRef, forwardRef, inject } from '@angular/core';
import { ControlValueAccessor, FormBuilder, NG_VALUE_ACCESSOR } from '@angular/forms';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { fromEvent, Subscription } from 'rxjs';
export const DEVICE_FILTER_CONFIG_DATA = new InjectionToken<any>('DeviceFilterConfigData');
export interface DeviceFilterConfigData {
panelMode: boolean;
deviceInfoFilter: DeviceInfoFilter;
initialFilterConfig?: DeviceInfoFilter;
}
import { DeviceInfoFilter } from '@shared/models/device.models';
// @dynamic
@Component({
selector: 'tb-device-info-filter',
templateUrl: './device-info-filter.component.html',
styleUrls: ['./device-info-filter.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {class: 'contents'},
providers: [
{
provide: NG_VALUE_ACCESSOR,
@ -49,78 +20,25 @@ export interface DeviceFilterConfigData {
],
standalone: false
})
export class DeviceInfoFilterComponent implements OnInit, ControlValueAccessor {
@ViewChild('deviceFilterPanel')
deviceFilterPanel: TemplateRef<any>;
@Input() disabled: boolean;
@coerceBoolean()
@Input()
buttonMode = true;
@Input()
initialDeviceFilterConfig: DeviceInfoFilter = {
deviceProfileId: null,
active: null
};
panelMode = false;
buttonDisplayValue = this.translate.instant('device.device-filter-title');
deviceInfoFilterForm: FormGroup;
deviceFilterOverlayRef: OverlayRef;
export class DeviceInfoFilterComponent implements ControlValueAccessor {
panelResult: DeviceInfoFilter = null;
private fb = inject(FormBuilder);
private destroyRef = inject(DestroyRef);
private deviceProfileInfo: EntityInfoData;
private deviceInfoFilter: DeviceInfoFilter;
private resizeWindows: Subscription;
deviceInfoFilterForm = this.fb.group({
deviceProfileId: [null as DeviceInfoFilter['deviceProfileId']],
active: [null as boolean]
});
private propagateChange = (_: any) => {};
private propagateChange = (_: DeviceInfoFilter) => {};
constructor(@Optional() @Inject(DEVICE_FILTER_CONFIG_DATA)
private data: DeviceFilterConfigData | undefined,
@Optional()
private overlayRef: OverlayRef,
private fb: FormBuilder,
private translate: TranslateService,
private overlay: Overlay,
private nativeElement: ElementRef,
private viewContainerRef: ViewContainerRef,
private deviceProfileService: DeviceProfileService,
private cd: ChangeDetectorRef,
private destroyRef: DestroyRef) {
}
ngOnInit(): void {
if (this.data) {
this.panelMode = this.data.panelMode;
this.deviceInfoFilter = this.data.deviceInfoFilter;
this.initialDeviceFilterConfig = this.data.initialFilterConfig;
if (this.panelMode && !this.initialDeviceFilterConfig) {
this.initialDeviceFilterConfig = deepClone(this.deviceInfoFilter);
}
}
this.deviceInfoFilterForm = this.fb.group({
deviceProfileId: [null, []],
active: ['', []]
});
constructor() {
this.deviceInfoFilterForm.valueChanges.pipe(
takeUntilDestroyed(this.destroyRef)
).subscribe(
() => {
if (!this.buttonMode) {
this.deviceFilterUpdated(this.deviceInfoFilterForm.value);
}
}
);
if (this.panelMode) {
this.updateDeviceInfoFilterForm(this.deviceInfoFilter);
}
).subscribe(value => this.propagateChange({
deviceProfileId: value.deviceProfileId ?? null,
active: value.active ?? null
}));
}
registerOnChange(fn: any): void {
@ -131,8 +49,7 @@ export class DeviceInfoFilterComponent implements OnInit, ControlValueAccessor {
}
setDisabledState(isDisabled: boolean): void {
this.disabled = isDisabled;
if (this.disabled) {
if (isDisabled) {
this.deviceInfoFilterForm.disable({emitEvent: false});
} else {
this.deviceInfoFilterForm.enable({emitEvent: false});
@ -140,145 +57,9 @@ export class DeviceInfoFilterComponent implements OnInit, ControlValueAccessor {
}
writeValue(deviceInfoFilter?: DeviceInfoFilter): void {
this.deviceInfoFilter = deviceInfoFilter;
if (!this.initialDeviceFilterConfig && deviceInfoFilter) {
this.initialDeviceFilterConfig = deepClone(deviceInfoFilter);
}
this.updateButtonDisplayValue();
this.updateDeviceInfoFilterForm(deviceInfoFilter);
}
toggleDeviceFilterPanel($event: Event) {
if ($event) {
$event.stopPropagation();
}
const config = new OverlayConfig({
panelClass: 'tb-filter-panel',
backdropClass: 'cdk-overlay-transparent-backdrop',
hasBackdrop: true,
maxHeight: '80vh',
height: 'min-content',
minWidth: ''
});
config.hasBackdrop = true;
const connectedPosition: ConnectedPosition = {
originX: 'start',
originY: 'bottom',
overlayX: 'start',
overlayY: 'top'
};
config.positionStrategy = this.overlay.position().flexibleConnectedTo(this.nativeElement)
.withPositions([connectedPosition]);
this.deviceFilterOverlayRef = this.overlay.create(config);
this.deviceFilterOverlayRef.backdropClick().subscribe(() => {
this.deviceFilterOverlayRef.dispose();
});
this.deviceFilterOverlayRef.attach(new TemplatePortal(this.deviceFilterPanel,
this.viewContainerRef));
this.resizeWindows = fromEvent(window, 'resize').subscribe(() => {
this.deviceFilterOverlayRef.updatePosition();
});
}
cancel() {
this.updateDeviceInfoFilterForm(this.deviceInfoFilter);
this.deviceInfoFilterForm.markAsPristine();
if (this.overlayRef) {
this.overlayRef.dispose();
} else {
this.resizeWindows.unsubscribe();
this.deviceFilterOverlayRef.dispose();
}
}
update() {
this.deviceFilterUpdated(this.deviceInfoFilterForm.value);
this.deviceInfoFilterForm.markAsPristine();
if (this.panelMode) {
this.panelResult = this.deviceInfoFilter;
}
if (this.overlayRef) {
this.overlayRef.dispose();
} else {
this.resizeWindows.unsubscribe();
this.deviceFilterOverlayRef.dispose();
}
}
reset() {
const deviceInfoFilter = this.deviceFilterFromFormValue(this.deviceInfoFilterForm.value);
if (!this.deviceInfoFilterConfigEquals(deviceInfoFilter, this.initialDeviceFilterConfig)) {
this.updateDeviceInfoFilterForm(this.initialDeviceFilterConfig);
this.deviceInfoFilterForm.markAsDirty();
}
}
deviceProfileChanged(deviceProfileInfo: EntityInfoData) {
this.deviceProfileInfo = deviceProfileInfo;
this.updateButtonDisplayValue();
}
private deviceInfoFilterConfigEquals = (filter1?: DeviceInfoFilter, filter2?: DeviceInfoFilter): boolean => {
if (filter1 === filter2) {
return true;
}
if ((isUndefinedOrNull(filter1) || isEmpty(filter1)) && (isUndefinedOrNull(filter2) || isEmpty(filter2))) {
return true;
} else if (isDefinedAndNotNull(filter1) && isDefinedAndNotNull(filter2)) {
if (filter1.active !== filter2.active) {
return false;
}
return filter1.deviceProfileId === filter2.deviceProfileId;
}
return false;
};
private updateDeviceInfoFilterForm(deviceInfoFilter?: DeviceInfoFilter) {
this.deviceInfoFilterForm.patchValue({
deviceProfileId: deviceInfoFilter?.deviceProfileId ?? null,
active: deviceInfoFilter?.active ?? null
}, {emitEvent: false});
}
private deviceFilterUpdated(deviceInfoFilter: DeviceInfoFilter) {
this.deviceInfoFilter = this.deviceFilterFromFormValue(deviceInfoFilter);
this.updateButtonDisplayValue();
this.propagateChange(this.deviceInfoFilter);
}
private updateButtonDisplayValue() {
if (this.buttonMode) {
const filterTextParts: string[] = [];
if (isDefinedAndNotNull(this.deviceInfoFilter?.deviceProfileId)) {
if (!this.deviceProfileInfo) {
this.deviceProfileService.getDeviceProfileInfo(this.deviceInfoFilter?.deviceProfileId.id,
{ignoreLoading: true, ignoreErrors: true}).subscribe(
(deviceProfileInfo) => {
this.deviceProfileChanged(deviceProfileInfo);
});
return;
} else {
filterTextParts.push(this.deviceProfileInfo.name);
}
}
if (isDefinedAndNotNull(this.deviceInfoFilter?.active)) {
const translationKey = this.deviceInfoFilter?.active ? 'device.active' : 'device.inactive';
filterTextParts.push(this.translate.instant(translationKey));
}
if (!filterTextParts.length) {
this.buttonDisplayValue = this.translate.instant('device.device-filter-title');
} else {
this.buttonDisplayValue = this.translate.instant('device.filter-title') + `: ${filterTextParts.join(', ')}`;
}
this.cd.detectChanges();
}
}
private deviceFilterFromFormValue(formValue: any): DeviceInfoFilter {
return {
deviceProfileId: formValue?.deviceProfileId ?? null,
active: formValue?.active ?? null
};
}
}

12
ui-ngx/src/app/modules/home/components/entity/entities-table.component.scss

@ -32,6 +32,18 @@
.title-container{
overflow: hidden;
height: 100%;
min-width: 0;
.tb-entity-table-title {
flex: 0 1 auto;
min-width: 64px;
}
::ng-deep > :not(.tb-entity-table-title, button) {
min-width: 0;
flex-shrink: 10000;
.mat-mdc-slide-toggle .mdc-label {
white-space: normal;
}
}
}
.tb-entity-table-title {

6
ui-ngx/src/app/modules/home/components/integration/configuration/azure-services-bus-integration-form/azure-services-bus-integration-form.component.html

@ -42,11 +42,13 @@
<ng-template matExpansionPanelContent>
<tb-secret-key-input formControlName="downlinkConnectionString" class="mat-block flex-1" appearance="outline"
label="{{ 'integration.downlink-connection-string' | translate }}">
[required]="isSetDownLink"
label="{{ 'integration.downlink-connection-string' | translate }}"
requiredText="{{ 'integration.downlink-connection-string-required' | translate }}">
</tb-secret-key-input>
<mat-form-field appearance="outline" class="mat-block">
<mat-label translate>integration.downlink-topic-name</mat-label>
<input matInput formControlName="downlinkTopicName">
<input matInput [required]="isSetDownLink" formControlName="downlinkTopicName">
@if (azureServicesBusIntegrationConfigForm.get('downlinkTopicName').hasError('required')) {
<mat-error translate>
integration.downlink-topic-name-required

8
ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.html

@ -78,10 +78,14 @@
<legend class="group-title" translate>integration.downlink-credentials</legend>
<div class="flex flex-col gt-xs:gap-2">
<tb-secret-key-input formControlName="apiId" class="mat-block flex-1" appearance="outline"
label="{{ 'integration.api-id' | translate }}">
required
label="{{ 'integration.api-id' | translate }}"
requiredText="{{ 'integration.api-id-required' | translate }}">
</tb-secret-key-input>
<tb-secret-key-input formControlName="apiKey" class="mat-block flex-1" appearance="outline"
label="{{ 'integration.api-key' | translate }}">
required
label="{{ 'integration.api-key' | translate }}"
requiredText="{{ 'integration.api-key-required' | translate }}">
</tb-secret-key-input>
</div>
</fieldset>

1
ui-ngx/src/app/modules/home/components/integration/configuration/opc-ua-integration-form/opc-ua-integration-form.component.html

@ -78,6 +78,7 @@
<tb-secret-file-input formControlName="fileContent"
label="{{ 'integration.opc-ua-keystore-location' | translate }}"
inputId="location"
required
[existingFileName]="opcIntegrationConfigForm.get('keystore.location').value"
(fileNameChanged)="opcIntegrationConfigForm.get('keystore.location').setValue($event)">
</tb-secret-file-input>

10
ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/install-form-renderer/install-form-renderer.component.html

@ -93,7 +93,7 @@
</div>
}
@case (FormFieldType.SELECT) {
<mat-form-field appearance="outline" [class.tb-install-form-field-new]="isNewField(field)" [subscriptSizing]="row.hasHintBox ? 'dynamic' : 'fixed'"
<mat-form-field appearance="outline" [class.tb-install-form-field-new]="isNewField(field)" [subscriptSizing]="row.hasHintBox || helpTextOf(field) ? 'dynamic' : 'fixed'"
[floatLabel]="field.placeholder ? 'always' : 'auto'">
<mat-label>{{ field.label }}@if (isNewField(field)) {<span> · {{ 'iot-hub.device-update-new' | translate }}</span>}</mat-label>
<mat-select [formControlName]="field.key">
@ -110,7 +110,7 @@
</mat-form-field>
}
@case (FormFieldType.STRING_AUTOCOMPLETE) {
<mat-form-field appearance="outline" [class.tb-install-form-field-new]="isNewField(field)" [subscriptSizing]="row.hasHintBox ? 'dynamic' : 'fixed'"
<mat-form-field appearance="outline" [class.tb-install-form-field-new]="isNewField(field)" [subscriptSizing]="row.hasHintBox || helpTextOf(field) ? 'dynamic' : 'fixed'"
[floatLabel]="field.placeholder ? 'always' : 'auto'">
<mat-label>{{ field.label }}@if (isNewField(field)) {<span> · {{ 'iot-hub.device-update-new' | translate }}</span>}</mat-label>
<input matInput [formControlName]="field.key" [placeholder]="field.placeholder ?? ''" [matAutocomplete]="auto"
@ -136,7 +136,7 @@
</mat-form-field>
}
@case (FormFieldType.PASSWORD) {
<mat-form-field appearance="outline" [class.tb-install-form-field-new]="isNewField(field)" [subscriptSizing]="row.hasHintBox ? 'dynamic' : 'fixed'"
<mat-form-field appearance="outline" [class.tb-install-form-field-new]="isNewField(field)" [subscriptSizing]="row.hasHintBox || helpTextOf(field) ? 'dynamic' : 'fixed'"
[floatLabel]="field.placeholder ? 'always' : 'auto'">
<mat-label>{{ field.label }}@if (isNewField(field)) {<span> · {{ 'iot-hub.device-update-new' | translate }}</span>}</mat-label>
<input matInput [type]="passwordVisible[field.key] ? 'text' : 'password'"
@ -170,7 +170,7 @@
</mat-form-field>
}
@case (FormFieldType.INTEGER) {
<mat-form-field appearance="outline" [class.tb-install-form-field-new]="isNewField(field)" [subscriptSizing]="row.hasHintBox ? 'dynamic' : 'fixed'"
<mat-form-field appearance="outline" [class.tb-install-form-field-new]="isNewField(field)" [subscriptSizing]="row.hasHintBox || helpTextOf(field) ? 'dynamic' : 'fixed'"
[floatLabel]="field.placeholder ? 'always' : 'auto'">
<mat-label>{{ field.label }}@if (isNewField(field)) {<span> · {{ 'iot-hub.device-update-new' | translate }}</span>}</mat-label>
<input matInput type="number" [formControlName]="field.key" [placeholder]="field.placeholder ?? ''"
@ -191,7 +191,7 @@
</mat-form-field>
}
@default {
<mat-form-field appearance="outline" [class.tb-install-form-field-new]="isNewField(field)" [subscriptSizing]="row.hasHintBox ? 'dynamic' : 'fixed'"
<mat-form-field appearance="outline" [class.tb-install-form-field-new]="isNewField(field)" [subscriptSizing]="row.hasHintBox || helpTextOf(field) ? 'dynamic' : 'fixed'"
[floatLabel]="field.placeholder ? 'always' : 'auto'">
<mat-label>{{ field.label }}@if (isNewField(field)) {<span> · {{ 'iot-hub.device-update-new' | translate }}</span>}</mat-label>
<input matInput [formControlName]="field.key" [placeholder]="field.placeholder ?? ''"

17
ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.html

@ -5,11 +5,19 @@
SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
-->
<mat-form-field [formGroup]="selectAssetProfileFormGroup" class="mat-block" [subscriptSizing]="subscriptSizing" [appearance]="appearance">
<mat-label>{{ 'asset-profile.asset-profile' | translate }}</mat-label>
<mat-form-field [formGroup]="selectAssetProfileFormGroup"
[class.tb-inline-field]="inlineField"
[class.flex]="inlineField"
class="mat-block"
[appearance]="inlineField ? 'outline' : appearance"
[subscriptSizing]="inlineField ? 'dynamic' : subscriptSizing">
@if (!inlineField) {
<mat-label>{{ 'asset-profile.asset-profile' | translate }}</mat-label>
}
<input matInput type="text"
#assetProfileInput
formControlName="assetProfile"
[attr.aria-label]="inlineField ? ('asset-profile.asset-profile' | translate) : null"
(focusin)="onFocus()"
[required]="required"
(keydown)="assetProfileEnter($event)"
@ -54,12 +62,13 @@
(closed)="onPanelClosed()"
#assetProfileAutocomplete="matAutocomplete"
[displayWith]="displayAssetProfileFn">
@for (assetProfile of filteredAssetProfiles | async; track assetProfile) {
@let assetProfiles = filteredAssetProfiles | async;
@for (assetProfile of assetProfiles; track assetProfile) {
<mat-option [value]="assetProfile">
<span [innerHTML]="assetProfile.name | highlight:searchText"></span>
</mat-option>
}
@if (!(filteredAssetProfiles | async)?.length) {
@if (assetProfiles && !assetProfiles.length) {
<mat-option [value]="null" class="tb-not-found">
<div class="tb-not-found-content" (click)="$event.stopPropagation()">
@if (!textIsNotEmpty(searchText) || !addNewProfile) {

5
ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.ts

@ -93,6 +93,10 @@ export class AssetProfileAutocompleteComponent implements ControlValueAccessor,
@Input()
appearance: MatFormFieldAppearance = 'fill';
@Input()
@coerceBoolean()
inlineField: boolean;
@Output()
assetProfileUpdated = new EventEmitter<AssetProfileId>();
@ -306,6 +310,7 @@ export class AssetProfileAutocompleteComponent implements ControlValueAccessor,
setTimeout(() => {
this.assetProfileInput.nativeElement.blur();
this.assetProfileInput.nativeElement.focus();
this.ignoreClosedPanel = false;
}, 0);
}

6
ui-ngx/src/app/modules/home/components/profile/device-profile-autocomplete.component.html

@ -17,6 +17,7 @@
<input matInput type="text"
#deviceProfileInput
formControlName="deviceProfile"
[attr.aria-label]="inlineField ? ('device-profile.device-profile' | translate) : null"
(focusin)="onFocus()"
[required]="required"
(keydown)="deviceProfileEnter($event)"
@ -58,12 +59,13 @@
(closed)="onPanelClosed()"
#deviceProfileAutocomplete="matAutocomplete"
[displayWith]="displayDeviceProfileFn">
@for (deviceProfile of filteredDeviceProfiles | async; track deviceProfile) {
@let deviceProfiles = filteredDeviceProfiles | async;
@for (deviceProfile of deviceProfiles; track deviceProfile) {
<mat-option [value]="deviceProfile">
<span [innerHTML]="deviceProfile.name | highlight:searchText"></span>
</mat-option>
}
@if (!(filteredDeviceProfiles | async)?.length) {
@if (deviceProfiles && !deviceProfiles.length) {
<mat-option [value]="null" class="tb-not-found">
<div class="tb-not-found-content" (click)="$event.stopPropagation()">
@if (!textIsNotEmpty(searchText) || !addNewProfile) {

1
ui-ngx/src/app/modules/home/components/profile/device-profile-autocomplete.component.ts

@ -332,6 +332,7 @@ export class DeviceProfileAutocompleteComponent implements ControlValueAccessor,
setTimeout(() => {
this.deviceProfileInput.nativeElement.blur();
this.deviceProfileInput.nativeElement.focus();
this.ignoreClosedPanel = false;
}, 0);
}

2
ui-ngx/src/app/modules/home/components/role/registration-permissions.component.html

@ -5,7 +5,7 @@
-->
<tb-group-permissions
class="flex-1"
class="flex-1 py-2 gt-sm:py-4"
[registrationPermissions]="registrationPermissions"
[active]="true"
[readonly]="disabled"

22
ui-ngx/src/app/modules/home/components/wizard/integration-wizard-dialog.component.ts

@ -49,7 +49,25 @@ export class IntegrationWizardDialogComponent extends
@ViewChild('addIntegrationWizardStepper', {static: true}) addIntegrationWizardStepper: MatStepper;
@ViewChild('uplinkDataConverter', {static: true}) uplinkDataConverterComponent: ConverterComponent;
@ViewChild('downlinkDataConverter') downlinkDataConverterComponent: ConverterComponent;
private _downlinkDataConverterComponent: ConverterComponent;
// The downlink step is re-created when the integration type changes, so its form is re-attached here
@ViewChild('downlinkDataConverter')
set downlinkDataConverterComponent(component: ConverterComponent) {
if (component === this._downlinkDataConverterComponent) {
return;
}
this._downlinkDataConverterComponent = component;
if (component) {
this.downlinkConverterForm.setControl('newDownlinkConverter', component.entityForm, {emitEvent: false});
this.downlinkConverterForm.get('newDownlinkConverter').disable({emitEvent: false});
}
}
get downlinkDataConverterComponent(): ConverterComponent {
return this._downlinkDataConverterComponent;
}
selectedIndex = 0;
converterType = ConverterType;
@ -216,8 +234,6 @@ export class IntegrationWizardDialogComponent extends
ngAfterViewInit() {
setTimeout(() => {
this.uplinkConverterForm.setControl('newUplinkConverter', this.uplinkDataConverterComponent.entityForm, {emitEvent: false});
this.downlinkConverterForm.setControl('newDownlinkConverter', this.downlinkDataConverterComponent.entityForm, {emitEvent: false});
this.downlinkConverterForm.get('newDownlinkConverter').disable({emitEvent: false});
}, 0);
}

19
ui-ngx/src/app/modules/home/dialogs/home-dialogs.service.ts

@ -36,11 +36,6 @@ import {
EntityGroupWizardDialogData,
EntityGroupWizardDialogResult
} from '@home/components/wizard/entity-group-wizard-dialog.component';
import { DashboardInfo } from '@shared/models/dashboard.models';
import {
DashboardInfoDialogData,
ImportDashboardFileDialogComponent
} from '@home/pages/dashboard/import-dashboard-file-dialog.component';
@Injectable()
export class HomeDialogsService {
@ -141,20 +136,6 @@ export class HomeDialogsService {
}).afterClosed();
}
public importDashboardFile($event: Event, dashboard: DashboardInfo): Observable<boolean> {
if ($event) {
$event.stopPropagation();
}
return this.dialog.open<ImportDashboardFileDialogComponent, DashboardInfoDialogData,
boolean>(ImportDashboardFileDialogComponent, {
disableClose: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
data: {
dashboard
}
}).afterClosed();
}
public selectOwner($event: Event, selectOwnerTitle: string, confirmSelectTitle: string,
placeholderText: string, notFoundText: string, requiredText: string,
onOwnerSelected?: (targetOwnerId: EntityId) => Observable<boolean>,

39
ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-header.component.html

@ -1,21 +1,28 @@
<!--
SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
-->
<mat-form-field class="mat-block" subscriptSizing="dynamic">
<mat-label translate>javascript.script-type</mat-label>
<mat-select [ngModel]="entitiesTableConfig.componentsData.resourceSubType"
(ngModelChange)="jsResourceSubTypeChanged($event)"
placeholder="{{ 'javascript.javascript-type' | translate }}">
<mat-option value="">
{{ "javascript.all-types" | translate }}
</mat-option>
@for (jsResourceSubType of jsResourceSubTypes; track jsResourceSubType) {
<mat-option [value]="jsResourceSubType">
{{ resourceSubTypesTranslationMap.get(jsResourceSubType) | translate }}
</mat-option>
}
</mat-select>
</mat-form-field>
<tb-filter-button emptyLabel="javascript.script-filter-title"
emptyValue=""
[valueLabel]="jsResourceSubTypeLabel"
[ngModel]="entitiesTableConfig.componentsData.resourceSubType"
(ngModelChange)="jsResourceSubTypeChanged($event)">
<ng-template let-control>
<div class="tb-form-row column-xs">
<div class="fixed-title-width" translate>javascript.script-type</div>
<mat-form-field class="min-w-0 flex-1" appearance="outline" subscriptSizing="dynamic">
<mat-select [formControl]="control" [aria-label]="'javascript.script-type' | translate">
<mat-option value="">{{ 'javascript.all-types' | translate }}</mat-option>
@for (jsResourceSubType of jsResourceSubTypes; track jsResourceSubType) {
<mat-option [value]="jsResourceSubType">
{{ resourceSubTypesTranslationMap.get(jsResourceSubType) | translate }}
</mat-option>
}
</mat-select>
</mat-form-field>
</div>
</ng-template>
</tb-filter-button>

11
ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-header.component.ts

@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
import { Component } from '@angular/core';
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
import { Component, inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityTableHeaderComponent } from '@home/components/entity/entity-table-header.component';
@ -18,6 +20,11 @@ export class JsLibraryTableHeaderComponent extends EntityTableHeaderComponent<Re
readonly jsResourceSubTypes: ResourceSubType[] = [ResourceSubType.EXTENSION, ResourceSubType.MODULE];
readonly resourceSubTypesTranslationMap = ResourceSubTypeTranslationMap;
private translate = inject(TranslateService);
readonly jsResourceSubTypeLabel = (resourceSubType: ResourceSubType): string =>
this.translate.instant(this.resourceSubTypesTranslationMap.get(resourceSubType) ?? resourceSubType);
constructor(protected store: Store<AppState>) {
super(store);
}

39
ui-ngx/src/app/modules/home/pages/admin/resource/resources-table-header.component.html

@ -1,21 +1,28 @@
<!--
SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
-->
<mat-form-field class="mat-block" subscriptSizing="dynamic">
<mat-label translate>resource.resource-type</mat-label>
<mat-select [ngModel]="entitiesTableConfig.componentsData.resourceType"
(ngModelChange)="resourceTypeChanged($event)"
placeholder="{{ 'resource.resource-type' | translate }}">
<mat-option value="">
{{ "resource.all-types" | translate }}
</mat-option>
@for (resourceType of resourceTypes; track resourceType) {
<mat-option [value]="resourceType">
{{ resourceTypesTranslationMap.get(resourceType) | translate }}
</mat-option>
}
</mat-select>
</mat-form-field>
<tb-filter-button emptyLabel="resource.resource-filter-title"
emptyValue=""
[valueLabel]="resourceTypeLabel"
[ngModel]="entitiesTableConfig.componentsData.resourceType"
(ngModelChange)="resourceTypeChanged($event)">
<ng-template let-control>
<div class="tb-form-row column-xs">
<div class="fixed-title-width" translate>resource.resource-type</div>
<mat-form-field class="min-w-0 flex-1" appearance="outline" subscriptSizing="dynamic">
<mat-select [formControl]="control" [aria-label]="'resource.resource-type' | translate">
<mat-option value="">{{ 'resource.all-types' | translate }}</mat-option>
@for (resourceType of resourceTypes; track resourceType) {
<mat-option [value]="resourceType">
{{ resourceTypesTranslationMap.get(resourceType) | translate }}
</mat-option>
}
</mat-select>
</mat-form-field>
</div>
</ng-template>
</tb-filter-button>

11
ui-ngx/src/app/modules/home/pages/admin/resource/resources-table-header.component.ts

@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
import { Component } from '@angular/core';
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
import { Component, inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityTableHeaderComponent } from '@home/components/entity/entity-table-header.component';
@ -18,6 +20,11 @@ export class ResourcesTableHeaderComponent extends EntityTableHeaderComponent<Re
readonly resourceTypes = [ResourceType.LWM2M_MODEL, ResourceType.PKCS_12, ResourceType.JKS, ResourceType.GENERAL];
readonly resourceTypesTranslationMap = ResourceTypeTranslationMap;
private translate = inject(TranslateService);
readonly resourceTypeLabel = (resourceType: ResourceType): string =>
this.translate.instant(this.resourceTypesTranslationMap.get(resourceType) ?? resourceType);
constructor(protected store: Store<AppState>) {
super(store);
}

29
ui-ngx/src/app/modules/home/pages/asset/asset-table-header.component.html

@ -5,16 +5,25 @@
SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
-->
<div class="flex flex-row items-center justify-start">
<tb-asset-profile-autocomplete
class="min-w-0 flex-1"
subscriptSizing="dynamic"
[ngModel]="entitiesTableConfig.componentsData.assetProfileId"
(ngModelChange)="assetProfileChanged($event)"
[addNewProfile]="false"
[displayAllOnEmpty]="true"
[editProfileEnabled]="false">
</tb-asset-profile-autocomplete>
<div class="flex min-w-0 flex-row items-center justify-start">
<tb-filter-button emptyLabel="asset.asset-filter-title"
[valueLabel]="assetProfileLabel"
[ngModel]="entitiesTableConfig.componentsData.assetProfileId"
(ngModelChange)="assetProfileChanged($event)">
<ng-template let-control>
<div class="tb-form-row column-xs">
<div class="fixed-title-width" translate>asset-profile.asset-profile</div>
<tb-asset-profile-autocomplete
class="min-w-0 flex-1"
[formControl]="control"
[inlineField]="true"
[displayAllOnEmpty]="true"
[editProfileEnabled]="false"
[addNewProfile]="false">
</tb-asset-profile-autocomplete>
</div>
</ng-template>
</tb-filter-button>
<mat-slide-toggle
style="margin-left: 32px;"
[ngModel]="entitiesTableConfig.componentsData.includeCustomers"

6
ui-ngx/src/app/modules/home/pages/asset/asset-table-header.component.scss

@ -1,6 +0,0 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
:host ::ng-deep .mat-mdc-slide-toggle .mdc-label {
white-space: normal;
}

11
ui-ngx/src/app/modules/home/pages/asset/asset-table-header.component.ts

@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
import { Component, OnInit } from '@angular/core';
import { Component, inject, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityTableHeaderComponent } from '../../components/entity/entity-table-header.component';
@ -10,11 +10,12 @@ import { Asset, AssetInfo } from '@shared/models/asset.models';
import { AssetProfileId } from '@shared/models/id/asset-profile-id';
import { getCurrentAuthUser } from '@core/auth/auth.selectors';
import { Authority } from '@shared/models/authority.enum';
import { AssetProfileService } from '@core/http/asset-profile.service';
import { map } from 'rxjs/operators';
@Component({
selector: 'tb-asset-table-header',
templateUrl: './asset-table-header.component.html',
styleUrls: ['asset-table-header.component.scss'],
standalone: false
})
export class AssetTableHeaderComponent extends EntityTableHeaderComponent<AssetInfo | Asset> implements OnInit {
@ -23,6 +24,12 @@ export class AssetTableHeaderComponent extends EntityTableHeaderComponent<AssetI
includeCustomersLabel: string;
private assetProfileService = inject(AssetProfileService);
readonly assetProfileLabel = (assetProfileId: AssetProfileId) =>
this.assetProfileService.getAssetProfileInfo(assetProfileId.id, {ignoreLoading: true, ignoreErrors: true})
.pipe(map(assetProfileInfo => assetProfileInfo.name));
constructor(protected store: Store<AppState>) {
super(store);
}

5
ui-ngx/src/app/modules/home/pages/dashboard/dashboard-group-config.factory.ts

@ -254,7 +254,10 @@ export class DashboardGroupConfigFactory implements EntityGroupStateConfigFactor
}
importDashboardFile($event: Event, dashboard: DashboardInfo, config: GroupEntityTableConfig<DashboardInfo>) {
this.homeDialogs.importDashboardFile($event, dashboard).subscribe(
if ($event) {
$event.stopPropagation();
}
this.importExport.importDashboardVersion(dashboard, this.editMissingAliases.bind(this)).subscribe(
(res) => {
if (res) {
config.updateData();

4
ui-ngx/src/app/modules/home/pages/dashboard/dashboard.module.ts

@ -12,14 +12,12 @@ import { DASHBOARD_GROUP_CONFIG_FACTORY } from '@home/models/group/group-entitie
import { DashboardGroupConfigFactory } from '@home/pages/dashboard/dashboard-group-config.factory';
import { DashboardRoutingModule } from '@home/pages/dashboard/dashboard-routing.module';
import { DashboardTableHeaderComponent } from '@home/pages/dashboard/dashboard-table-header.component';
import { ImportDashboardFileDialogComponent } from "@home/pages/dashboard/import-dashboard-file-dialog.component";
@NgModule({
declarations: [
DashboardFormComponent,
DashboardTableHeaderComponent,
PublicDashboardLinkDialogComponent,
ImportDashboardFileDialogComponent
PublicDashboardLinkDialogComponent
],
imports: [
CommonModule,

5
ui-ngx/src/app/modules/home/pages/dashboard/dashboards-table-config.resolver.ts

@ -286,7 +286,10 @@ export class DashboardsTableConfigResolver {
}
importDashboardFile($event: Event, dashboard: DashboardInfo, config: EntityTableConfig<DashboardInfo>) {
this.homeDialogs.importDashboardFile($event, dashboard).subscribe(
if ($event) {
$event.stopPropagation();
}
this.importExport.importDashboardVersion(dashboard, this.editMissingAliases.bind(this)).subscribe(
(res) => {
if (res) {
config.updateData();

50
ui-ngx/src/app/modules/home/pages/dashboard/import-dashboard-file-dialog.component.html

@ -1,50 +0,0 @@
<!--
SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
-->
<form [formGroup]="uploadFileFormGroup" (ngSubmit)="save()" style="width: 800px;">
<mat-toolbar color="tb-primary" class="tb-bottom-border">
<h2>{{ 'dashboard.update-new-version' | translate }}</h2>
<span class="flex-1"></span>
<button mat-icon-button
(click)="cancel()"
type="button">
<mat-icon class="material-icons">close</mat-icon>
</button>
</mat-toolbar>
@if (isLoading$ | async) {
<mat-progress-bar color="warn" mode="indeterminate">
</mat-progress-bar>
} @else {
<div style="height: 4px;"></div>
}
<div mat-dialog-content>
<tb-file-input [contentConvertFunction]="loadDataFromJsonContent"
[existingFileName]="currentFileName"
(fileNameChanged)="currentFileName = $event"
label="{{'dashboard.upload-file-to-update' | translate}}"
formControlName="file"
dropLabel="{{ 'import.drop-json-file-or' | translate }}"
accept=".json,application/json"
allowedExtensions="json">
</tb-file-input>
</div>
<div mat-dialog-actions class="flex flex-row items-center justify-end">
<button mat-button color="primary"
type="button"
[disabled]="(isLoading$ | async)"
(click)="cancel()" cdkFocusInitial>
{{ 'action.cancel' | translate }}
</button>
<button mat-raised-button color="primary"
type="submit"
[disabled]="(isLoading$ | async) || uploadFileFormGroup.invalid
|| !uploadFileFormGroup.dirty">
{{ 'action.save' | translate }}
</button>
</div>
</form>

77
ui-ngx/src/app/modules/home/pages/dashboard/import-dashboard-file-dialog.component.ts

@ -1,77 +0,0 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { FormBuilder, FormGroup } from '@angular/forms';
import { DashboardService } from '@core/http/dashboard.service';
import { DashboardInfo } from '@app/shared/models/dashboard.models';
import { ActionNotificationShow } from '@core/notification/notification.actions';
import { DialogComponent } from '@shared/components/dialog.component';
import { Router } from '@angular/router';
export interface DashboardInfoDialogData {
dashboard: DashboardInfo;
}
@Component({
selector: 'tb-import-dashboard-file-dialog',
templateUrl: './import-dashboard-file-dialog.component.html',
styleUrls: [],
standalone: false
})
export class ImportDashboardFileDialogComponent extends DialogComponent<ImportDashboardFileDialogComponent> implements OnInit {
private dashboard: DashboardInfo;
currentFileName: string = '';
uploadFileFormGroup: FormGroup;
constructor(protected store: Store<AppState>,
protected router: Router,
@Inject(MAT_DIALOG_DATA) public data: DashboardInfoDialogData,
private dashboardService: DashboardService,
protected dialogRef: MatDialogRef<ImportDashboardFileDialogComponent>,
private fb: FormBuilder) {
super(store, router, dialogRef);
this.dashboard = data.dashboard;
}
ngOnInit(): void {
this.uploadFileFormGroup = this.fb.group({
file: [null]
});
}
cancel(): void {
this.dialogRef.close();
}
save() {
const fileControl = this.uploadFileFormGroup.get('file');
if (!fileControl || !fileControl.value) {
return;
}
const dashboardContent = {
...fileControl.value,
description: this.dashboard.configuration.description
};
this.dashboard.configuration = dashboardContent;
this.dashboardService.saveDashboard(this.dashboard).subscribe(() => {
this.dialogRef.close(true);
})
}
loadDataFromJsonContent(content: string): any {
try {
const importData = JSON.parse(content);
return importData ? importData['configuration'] : importData;
} catch (err) {
this.store.dispatch(new ActionNotificationShow({message: err.message, type: 'error'}));
return null;
}
}
}

13
ui-ngx/src/app/modules/home/pages/device/device-table-header.component.html

@ -5,10 +5,15 @@
SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
-->
<div class="flex flex-row items-center justify-start">
<tb-device-info-filter [ngModel]="entitiesTableConfig.componentsData.deviceInfoFilter"
(ngModelChange)="deviceInfoFilterChanged($event)">
</tb-device-info-filter>
<div class="flex min-w-0 flex-row items-center justify-start">
<tb-filter-button emptyLabel="device.device-filter-title"
[valueLabel]="deviceInfoFilterLabel"
[ngModel]="entitiesTableConfig.componentsData.deviceInfoFilter"
(ngModelChange)="deviceInfoFilterChanged($event)">
<ng-template let-control>
<tb-device-info-filter [formControl]="control"></tb-device-info-filter>
</ng-template>
</tb-filter-button>
<mat-slide-toggle
style="margin-left: 32px;"
[ngModel]="entitiesTableConfig.componentsData.includeCustomers"

26
ui-ngx/src/app/modules/home/pages/device/device-table-header.component.ts

@ -1,20 +1,23 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
import { Component, OnInit } from '@angular/core';
import { Component, inject, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityTableHeaderComponent } from '../../components/entity/entity-table-header.component';
import { Device, DeviceInfo, DeviceInfoFilter } from '@app/shared/models/device.models';
import { DeviceInfo, DeviceInfoFilter } from '@app/shared/models/device.models';
import { EntityType } from '@shared/models/entity-type.models';
import { DeviceProfileId } from '@shared/models/id/device-profile-id';
import { getCurrentAuthUser } from '@core/auth/auth.selectors';
import { Authority } from '@shared/models/authority.enum';
import { DeviceProfileService } from '@core/http/device-profile.service';
import { TranslateService } from '@ngx-translate/core';
import { isDefinedAndNotNull } from '@core/utils';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
@Component({
selector: 'tb-device-table-header',
templateUrl: './device-table-header.component.html',
styleUrls: [],
standalone: false
})
export class DeviceTableHeaderComponent extends EntityTableHeaderComponent<DeviceInfo> implements OnInit {
@ -23,6 +26,19 @@ export class DeviceTableHeaderComponent extends EntityTableHeaderComponent<Devic
includeCustomersLabel: string;
private deviceProfileService = inject(DeviceProfileService);
private translate = inject(TranslateService);
readonly deviceInfoFilterLabel = (deviceInfoFilter: DeviceInfoFilter): Observable<string> => {
const stateText = isDefinedAndNotNull(deviceInfoFilter.active)
? this.translate.instant(deviceInfoFilter.active ? 'device.active' : 'device.inactive') : null;
const profileName$ = isDefinedAndNotNull(deviceInfoFilter.deviceProfileId)
? this.deviceProfileService.getDeviceProfileInfo(deviceInfoFilter.deviceProfileId.id, {ignoreLoading: true, ignoreErrors: true})
.pipe(map(deviceProfileInfo => deviceProfileInfo.name))
: of(null);
return profileName$.pipe(map(profileName => [profileName, stateText].filter(Boolean).join(', ')));
};
constructor(protected store: Store<AppState>) {
super(store);
}
@ -34,7 +50,7 @@ export class DeviceTableHeaderComponent extends EntityTableHeaderComponent<Devic
}
deviceInfoFilterChanged(deviceInfoFilter: DeviceInfoFilter) {
this.entitiesTableConfig.componentsData.deviceInfoFilter = deviceInfoFilter;
this.entitiesTableConfig.componentsData.deviceInfoFilter = deviceInfoFilter ?? {};
this.entitiesTableConfig.getTable().resetSortAndFilter(true);
}

25
ui-ngx/src/app/modules/home/pages/edge/edge-table-header.component.html

@ -5,14 +5,23 @@
SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
-->
<div class="flex flex-row items-center justify-start">
<tb-entity-subtype-select
subscriptSizing="dynamic"
[showLabel]="true"
[entityType]="entityType.EDGE"
[ngModel]="entitiesTableConfig.componentsData.edgeType"
(ngModelChange)="edgeTypeChanged($event)">
</tb-entity-subtype-select>
<div class="flex min-w-0 flex-row items-center justify-start">
<tb-filter-button emptyLabel="edge.edge-filter-title"
emptyValue=""
[ngModel]="entitiesTableConfig.componentsData.edgeType"
(ngModelChange)="edgeTypeChanged($event)">
<ng-template let-control>
<div class="tb-form-row column-xs">
<div class="fixed-title-width" translate>edge.edge-type</div>
<tb-entity-subtype-select
class="min-w-0 flex-1"
[formControl]="control"
[inlineField]="true"
[entityType]="entityType.EDGE">
</tb-entity-subtype-select>
</div>
</ng-template>
</tb-filter-button>
<mat-slide-toggle
style="margin-left: 32px;"
[ngModel]="entitiesTableConfig.componentsData.includeCustomers"

1
ui-ngx/src/app/modules/home/pages/edge/edge-table-header.component.ts

@ -13,7 +13,6 @@ import { Authority } from '@shared/models/authority.enum';
@Component({
selector: 'tb-edge-table-header',
templateUrl: './edge-table-header.component.html',
styleUrls: [],
standalone: false
})
export class EdgeTableHeaderComponent extends EntityTableHeaderComponent<EdgeInfo | Edge> implements OnInit {

26
ui-ngx/src/app/modules/home/pages/entity-view/entity-view-table-header.component.html

@ -5,15 +5,23 @@
SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
-->
<div class="flex flex-row items-center justify-start">
<tb-entity-subtype-select
class="min-w-0 flex-1"
subscriptSizing="dynamic"
[showLabel]="true"
[entityType]="entityType.ENTITY_VIEW"
[ngModel]="entitiesTableConfig.componentsData.entityViewType"
(ngModelChange)="entityViewTypeChanged($event)">
</tb-entity-subtype-select>
<div class="flex min-w-0 flex-row items-center justify-start">
<tb-filter-button emptyLabel="entity-view.entity-view-filter-title"
emptyValue=""
[ngModel]="entitiesTableConfig.componentsData.entityViewType"
(ngModelChange)="entityViewTypeChanged($event)">
<ng-template let-control>
<div class="tb-form-row column-xs">
<div class="fixed-title-width" translate>entity-view.entity-view-type</div>
<tb-entity-subtype-select
class="min-w-0 flex-1"
[formControl]="control"
[inlineField]="true"
[entityType]="entityType.ENTITY_VIEW">
</tb-entity-subtype-select>
</div>
</ng-template>
</tb-filter-button>
<mat-slide-toggle
style="margin-left: 32px;"
[ngModel]="entitiesTableConfig.componentsData.includeCustomers"

6
ui-ngx/src/app/modules/home/pages/entity-view/entity-view-table-header.component.scss

@ -1,6 +0,0 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
:host ::ng-deep .mat-mdc-slide-toggle .mdc-label {
white-space: normal;
}

1
ui-ngx/src/app/modules/home/pages/entity-view/entity-view-table-header.component.ts

@ -13,7 +13,6 @@ import { Authority } from '@shared/models/authority.enum';
@Component({
selector: 'tb-entity-view-table-header',
templateUrl: './entity-view-table-header.component.html',
styleUrls: ['./entity-view-table-header.component.scss'],
standalone: false
})
export class EntityViewTableHeaderComponent extends EntityTableHeaderComponent<EntityViewInfo | EntityView> implements OnInit {

41
ui-ngx/src/app/shared/components/button/filter-button.component.html

@ -0,0 +1,41 @@
<!--
SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
SPDX-License-Identifier: BUSL-1.1
-->
<button color="primary"
matTooltip="{{ buttonDisplayValue() }}"
matTooltipPosition="above"
mat-stroked-button
[disabled]="disabled()"
(click)="openPanel($event)">
<mat-icon>filter_list</mat-icon>{{ buttonDisplayValue() }}
</button>
<ng-template #filterPanel>
<form class="mat-content mat-padding flex flex-col" cdkTrapFocus cdkTrapFocusAutoCapture (ngSubmit)="update()">
<div class="tb-filter-button-panel-content tb-form-panel no-padding no-border outline-none" tabindex="-1" cdkFocusInitial>
<ng-container *ngTemplateOutlet="panelContent(); context: {$implicit: filterControl}"></ng-container>
</div>
<div class="tb-panel-actions flex flex-row items-center justify-end">
<button type="button"
mat-button
color="primary"
(click)="reset()">
{{ 'action.reset' | translate }}
</button>
<span class="flex-1"></span>
<button type="button"
mat-button
(click)="cancel()">
{{ 'action.cancel' | translate }}
</button>
<button type="submit"
mat-raised-button
color="primary"
[disabled]="filterControl.invalid || !isChanged()">
{{ 'action.update' | translate }}
</button>
</div>
</form>
</ng-template>

204
ui-ngx/src/app/shared/components/button/filter-button.component.ts

@ -0,0 +1,204 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
import {
ChangeDetectionStrategy,
Component,
computed,
contentChild,
DestroyRef,
ElementRef,
forwardRef,
inject,
input,
signal,
TemplateRef,
viewChild,
ViewContainerRef
} from '@angular/core';
import { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay';
import { TemplatePortal } from '@angular/cdk/portal';
import { FocusMonitor, InputModalityDetector } from '@angular/cdk/a11y';
import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
import { MatButton } from '@angular/material/button';
import { toObservable, toSignal } from '@angular/core/rxjs-interop';
import { TranslateService } from '@ngx-translate/core';
import { fromEvent, isObservable, Observable, of, Subscription } from 'rxjs';
import { catchError, filter, switchMap } from 'rxjs/operators';
import { POSITION_MAP } from '@shared/models/overlay.models';
import { isDefinedAndNotNull, isEqual, isObject } from '@core/utils';
export type FilterButtonValueLabelFn<T> = (value: T) => string | Observable<string>;
export interface FilterButtonPanelContext<T> {
$implicit: FormControl<T>;
}
/**
* Filter button for entity table headers. Shows the current filter value on the button and
* opens an overlay panel with Reset/Cancel/Update actions. The panel control is supplied
* by the host as an <ng-template let-control> bound to the provided FormControl.
*/
@Component({
selector: 'tb-filter-button',
templateUrl: './filter-button.component.html',
styleUrls: ['../../../../scss/filter-button.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => FilterButtonComponent),
multi: true
}
],
standalone: false
})
export class FilterButtonComponent<T = any> implements ControlValueAccessor {
private translate = inject(TranslateService);
private overlay = inject(Overlay);
private elementRef = inject(ElementRef);
private viewContainerRef = inject(ViewContainerRef);
private destroyRef = inject(DestroyRef);
private focusMonitor = inject(FocusMonitor);
private inputModality = inject(InputModalityDetector);
emptyLabel = input.required<string>();
valueLabel = input<FilterButtonValueLabelFn<T>>(value => String(value));
emptyValue = input<T>(null);
panelContent = contentChild.required<TemplateRef<FilterButtonPanelContext<T>>>(TemplateRef);
private panelTemplate = viewChild.required<TemplateRef<any>>('filterPanel');
private filterButton = viewChild.required(MatButton, {read: ElementRef});
disabled = signal(false);
filterControl = new FormControl<T>(null);
private value = signal<T>(null);
private valueText = toSignal(
toObservable(computed(() => ({value: this.value(), labelFn: this.valueLabel()}))).pipe(
switchMap(({value, labelFn}) => {
if (this.isEmpty(value)) {
return of(null);
}
const label = labelFn(value);
return (isObservable(label) ? label : of(label)).pipe(catchError(() => of(null)));
})
),
{initialValue: null}
);
buttonDisplayValue = computed(() => {
if (this.isEmpty(this.value())) {
return this.translate.instant(this.emptyLabel());
}
const filterTitle = this.translate.instant('filter.filter');
const valueText = this.valueText();
return valueText ? `${filterTitle}: ${valueText}` : filterTitle;
});
private overlayRef: OverlayRef;
private resizeWindows: Subscription;
private propagateChange = (_: any) => {};
constructor() {
this.destroyRef.onDestroy(() => this.closePanel(false));
}
registerOnChange(fn: any): void {
this.propagateChange = fn;
}
registerOnTouched(_fn: any): void {
}
setDisabledState(isDisabled: boolean): void {
this.disabled.set(isDisabled);
if (isDisabled) {
this.filterControl.disable({emitEvent: false});
} else {
this.filterControl.enable({emitEvent: false});
}
}
writeValue(value?: T): void {
this.value.set(this.normalize(value));
this.filterControl.setValue(this.value(), {emitEvent: false});
}
openPanel($event: Event) {
$event?.stopPropagation();
const config = new OverlayConfig({
panelClass: 'tb-filter-panel',
backdropClass: 'cdk-overlay-transparent-backdrop',
hasBackdrop: true,
maxHeight: '80vh',
height: 'min-content',
minWidth: ''
});
config.positionStrategy = this.overlay.position()
.flexibleConnectedTo(this.elementRef)
.withPositions([POSITION_MAP.bottomLeft]);
this.overlayRef = this.overlay.create(config);
this.overlayRef.backdropClick().subscribe(() => this.cancel());
this.overlayRef.keydownEvents()
.pipe(filter(event => event.keyCode === ESCAPE && !hasModifierKey(event)))
.subscribe(event => {
event.preventDefault();
this.cancel();
});
this.overlayRef.attach(new TemplatePortal(this.panelTemplate(), this.viewContainerRef));
this.resizeWindows = fromEvent(window, 'resize').subscribe(() => this.overlayRef.updatePosition());
}
cancel() {
this.filterControl.setValue(this.value(), {emitEvent: false});
this.filterControl.markAsPristine();
this.closePanel();
}
update() {
this.value.set(this.normalize(this.filterControl.value));
this.propagateChange(this.value());
this.filterControl.markAsPristine();
this.closePanel();
}
reset() {
if (!this.isEmpty(this.filterControl.value)) {
this.filterControl.setValue(this.emptyValue(), {emitEvent: false});
this.filterControl.markAsDirty();
}
}
isChanged(): boolean {
return this.filterControl.dirty && !isEqual(this.normalize(this.filterControl.value), this.value());
}
private closePanel(restoreFocus = true) {
this.resizeWindows?.unsubscribe();
this.resizeWindows = null;
if (this.overlayRef) {
this.overlayRef.dispose();
this.overlayRef = null;
if (restoreFocus) {
this.focusMonitor.focusVia(this.filterButton(), this.inputModality.mostRecentModality ?? 'program');
}
}
}
private normalize(value: T): T {
return this.isEmpty(value) ? this.emptyValue() : value;
}
private isEmpty(value: T): boolean {
if (!isDefinedAndNotNull(value) || value === '') {
return true;
}
return isObject(value) && Object.values(value).every(v => !isDefinedAndNotNull(v) || v === '');
}
}

13
ui-ngx/src/app/shared/components/entity/entity-subtype-select.component.html

@ -1,14 +1,21 @@
<!--
SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
-->
<mat-form-field [formGroup]="subTypeFormGroup" class="mat-block" subscriptSizing="{{ subscriptSizing }}">
<mat-form-field [formGroup]="subTypeFormGroup"
[class.tb-inline-field]="inlineField"
[class.flex]="inlineField"
class="mat-block"
[appearance]="inlineField ? 'outline' : 'fill'"
[subscriptSizing]="inlineField ? 'dynamic' : subscriptSizing">
@if (showLabel) {
<mat-label>{{ entitySubtypeTitle | translate }}</mat-label>
}
<mat-select [class.!hidden]="!subTypesLoaded" class="tb-entity-subtype-select" formControlName="subType">
<mat-select [class.!hidden]="!subTypesLoaded" class="tb-entity-subtype-select" formControlName="subType"
[aria-label]="showLabel ? '' : (entitySubtypeTitle | translate)">
@for (subType of subTypesOptions | async; track subType) {
<mat-option [value]="subType">
{{ displaySubTypeFn(subType) }}

9
ui-ngx/src/app/shared/components/entity/entity-subtype-select.component.ts

@ -12,6 +12,7 @@ import { EntityType } from '@app/shared/models/entity-type.models';
import { BroadcastService } from '@app/core/services/broadcast.service';
import { SubscriptSizing } from '@angular/material/form-field';
import { isNotEmptyStr } from '@core/utils';
import { coerceBoolean } from '@shared/decorators/coercion';
import { EntityService } from '@core/http/entity.service';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@ -50,6 +51,10 @@ export class EntitySubTypeSelectComponent implements ControlValueAccessor, OnIni
@Input()
typeTranslatePrefix: string;
@Input()
@coerceBoolean()
inlineField: boolean;
entitySubtypeTitle: string;
entitySubtypeRequiredText: string;
@ -152,9 +157,9 @@ export class EntitySubTypeSelectComponent implements ControlValueAccessor, OnIni
setDisabledState(isDisabled: boolean): void {
this.disabled = isDisabled;
if (this.disabled) {
this.subTypeFormGroup.disable();
this.subTypeFormGroup.disable({emitEvent: false});
} else {
this.subTypeFormGroup.enable();
this.subTypeFormGroup.enable({emitEvent: false});
}
}

2
ui-ngx/src/app/shared/components/role/group-permissions.component.html

@ -4,7 +4,7 @@
SPDX-License-Identifier: BUSL-1.1
-->
<div class="mat-padding tb-entity-table" [class.tb-absolute-fill]="groupPermissionsMode === 'group'">
<div class="tb-entity-table" [class.mat-padding]="groupPermissionsMode === 'group'" [class.tb-absolute-fill]="groupPermissionsMode === 'group'">
<div class="tb-entity-table-content tb-outlined-border flex flex-col">
<mat-toolbar class="mat-mdc-table-toolbar" [class.!hidden]="textSearchMode || !dataSource.selection.isEmpty()">
<div class="mat-toolbar-tools">

7
ui-ngx/src/app/shared/components/time/timezone-select.component.ts

@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
import { AfterViewInit, Component, forwardRef, Input, NgZone, OnInit, ViewChild } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { MatFormFieldAppearance, SubscriptSizing } from '@angular/material/form-field';
@ -10,8 +11,7 @@ import { AppState } from '@app/core/core.state';
import { TranslateService } from '@ngx-translate/core';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { MatAutocompleteTrigger } from '@angular/material/autocomplete';
import { getDefaultTimezoneInfo, getTimezoneInfo, getTimezones, TimezoneInfo } from '@shared/models/time/time.models';
import { deepClone } from '@core/utils';
import { getTimezoneInfo, getTimezones, TimezoneInfo } from '@shared/models/time/time.models';
import { coerceBoolean } from '@shared/decorators/coercion';
import { TimeService } from '@core/services/time.service';
@ -222,6 +222,7 @@ export class TimezoneSelectComponent implements ControlValueAccessor, OnInit, Af
this.selectTimezoneFormGroup.get('timezone').patchValue('', {emitEvent: true});
setTimeout(() => {
this.timezoneInputTrigger.openPanel();
this.ignoreClosePanel = false;
}, 0);
}

102
ui-ngx/src/app/shared/import-export/import-export.service.ts

@ -7,9 +7,9 @@ import { TranslateService } from '@ngx-translate/core';
import { select, Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { ActionNotificationShow } from '@core/notification/notification.actions';
import { BreakpointId, Dashboard, DashboardLayoutId } from '@shared/models/dashboard.models';
import { BreakpointId, Dashboard, DashboardInfo, DashboardLayoutId } from '@shared/models/dashboard.models';
import { DatePipe } from '@angular/common';
import { deepClone, guid, isDate, isDefined, isNotEmptyStr, isNumber, isObject, isString, isUndefined, unwrapModule } from '@core/utils';
import { deepClone, guid, isDate, isDefined, isNotEmptyStr, isObject, isString, isUndefined, unwrapModule } from '@core/utils';
import {
AliasesInfo,
@ -22,7 +22,8 @@ import {
import { MatDialog } from '@angular/material/dialog';
import { ImportDialogComponent, ImportDialogData } from '@shared/import-export/import-dialog.component';
import { forkJoin, Observable, of, Subject } from 'rxjs';
import { catchError, map, mergeMap, switchMap, take, tap } from 'rxjs/operators';
import { catchError, defaultIfEmpty, map, mergeMap, switchMap, take, tap } from 'rxjs/operators';
import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http';
import { DashboardUtilsService } from '@core/services/dashboard-utils.service';
import { EntityService } from '@core/http/entity.service';
import { ExportRow, Widget, WidgetActionsMap, WidgetActionType, WidgetSize, WidgetTypeDetails } from '@shared/models/widget.models';
@ -266,48 +267,33 @@ export class ImportExportService {
onEditMissingAliases: editMissingAliasesFunction, entityGroupId?: string): Observable<Dashboard> {
return this.openImportDialog('dashboard.import', 'dashboard.dashboard-file').pipe(
mergeMap((dashboard: Dashboard) => {
if (!this.validateImportedDashboard(dashboard)) {
this.store.dispatch(new ActionNotificationShow(
{message: this.translate.instant('dashboard.invalid-dashboard-file-error'),
type: 'error'}));
throw new Error('Invalid dashboard file');
} else {
dashboard = this.prepareImport(dashboard);
dashboard = this.dashboardUtils.validateAndUpdateDashboard(dashboard);
dashboard.customerId = customerId;
let aliasIds = null;
const entityAliases = dashboard.configuration.entityAliases;
if (entityAliases) {
aliasIds = Object.keys(entityAliases);
}
if (aliasIds && aliasIds.length > 0) {
return this.processEntityAliases(entityAliases, aliasIds).pipe(
mergeMap((missingEntityAliases) => {
if (Object.keys(missingEntityAliases).length > 0) {
return onEditMissingAliases(this.dashboardUtils.getWidgetsArray(dashboard),
false, 'dashboard.dashboard-import-missing-aliases-title',
missingEntityAliases).pipe(
mergeMap((updatedEntityAliases) => {
for (const aliasId of Object.keys(updatedEntityAliases)) {
entityAliases[aliasId] = updatedEntityAliases[aliasId];
}
return this.saveImportedDashboard(dashboard, entityGroupId);
})
);
} else {
return this.saveImportedDashboard(dashboard, entityGroupId);
}
}
));
} else {
return this.saveImportedDashboard(dashboard, entityGroupId);
}
}
dashboard = this.prepareImportedDashboard(dashboard);
dashboard.customerId = customerId;
return this.resolveMissingAliases(dashboard, onEditMissingAliases);
}),
mergeMap((dashboard) => this.saveImportedDashboard(dashboard, entityGroupId)),
catchError(() => of(null))
);
}
public importDashboardVersion(dashboard: DashboardInfo,
onEditMissingAliases: editMissingAliasesFunction): Observable<boolean> {
return this.openImportDialog('dashboard.update-new-version', 'dashboard.upload-file-to-update').pipe(
mergeMap((imported: Dashboard) =>
this.resolveMissingAliases(this.prepareImportedDashboard(imported), onEditMissingAliases)),
mergeMap((imported) => this.dashboardService.saveDashboard({
...dashboard,
configuration: {...imported.configuration, description: dashboard.configuration?.description},
resources: imported.resources
}).pipe(
map(() => true),
defaultIfEmpty(true),
catchError((err) => of(err instanceof HttpErrorResponse && err.status === HttpStatusCode.Conflict))
)),
catchError(() => of(false))
);
}
public exportWidget(dashboard: Dashboard, sourceState: string, sourceLayout: DashboardLayoutId, widget: Widget,
widgetTitle: string, breakpoint: BreakpointId) {
const widgetItem = this.itembuffer.prepareWidgetItem(dashboard, sourceState, sourceLayout, widget, breakpoint);
@ -1315,10 +1301,40 @@ export class ImportExportService {
}
private validateImportedDashboard(dashboard: Dashboard): boolean {
if (isUndefined(dashboard.title) || isUndefined(dashboard.configuration)) {
return false;
return isObject(dashboard) && !Array.isArray(dashboard) && isDefined(dashboard.title)
&& isObject(dashboard.configuration) && !Array.isArray(dashboard.configuration);
}
private prepareImportedDashboard(dashboard: Dashboard): Dashboard {
if (!this.validateImportedDashboard(dashboard)) {
this.store.dispatch(new ActionNotificationShow(
{message: this.translate.instant('dashboard.invalid-dashboard-file-error'),
type: 'error'}));
throw new Error('Invalid dashboard file');
}
return true;
return this.dashboardUtils.validateAndUpdateDashboard(this.prepareImport(dashboard));
}
private resolveMissingAliases(dashboard: Dashboard, onEditMissingAliases: editMissingAliasesFunction): Observable<Dashboard> {
const entityAliases = dashboard.configuration.entityAliases;
const aliasIds = entityAliases ? Object.keys(entityAliases) : [];
if (!aliasIds.length) {
return of(dashboard);
}
return this.processEntityAliases(entityAliases, aliasIds).pipe(
mergeMap((missingEntityAliases) => {
if (!Object.keys(missingEntityAliases).length) {
return of(dashboard);
}
return onEditMissingAliases(this.dashboardUtils.getWidgetsArray(dashboard),
false, 'dashboard.dashboard-import-missing-aliases-title', missingEntityAliases).pipe(
map((updatedEntityAliases) => {
Object.assign(entityAliases, updatedEntityAliases);
return dashboard;
})
);
})
);
}
private validateImportedWidget(widgetItem: WidgetItem): boolean {

6
ui-ngx/src/app/shared/shared.module.ts

@ -67,6 +67,7 @@ import { TbAnchorComponent } from '@shared/components/tb-anchor.component';
import { MillisecondsToTimeStringPipe } from '@shared/pipe/milliseconds-to-time-string.pipe';
import { TimewindowComponent } from '@shared/components/time/timewindow.component';
import { OverlayModule } from '@angular/cdk/overlay';
import { A11yModule } from '@angular/cdk/a11y';
import { TimewindowPanelComponent } from '@shared/components/time/timewindow-panel.component';
import { TimeintervalComponent } from '@shared/components/time/timeinterval.component';
import { DatetimePeriodComponent } from '@shared/components/time/datetime-period.component';
@ -160,6 +161,7 @@ import { EdgeEntityGroupListComponent } from '@shared/components/group/edge-enti
import { OtaPackageAutocompleteComponent } from '@shared/components/ota-package/ota-package-autocomplete.component';
import { MAT_DATE_LOCALE } from '@angular/material/core';
import { CopyButtonComponent } from '@shared/components/button/copy-button.component';
import { FilterButtonComponent } from '@shared/components/button/filter-button.component';
import { TogglePasswordComponent } from '@shared/components/button/toggle-password.component';
import { WidgetButtonToggleComponent } from '@shared/components/button/widget-button-toggle.component';
import { HelpPopupComponent } from '@shared/components/help-popup.component';
@ -491,6 +493,7 @@ export function MarkedOptionsFactory(markedOptionsService: MarkedOptionsService)
ShareEntityGroupComponent,
OtaPackageAutocompleteComponent,
CopyButtonComponent,
FilterButtonComponent,
TogglePasswordComponent,
WidgetButtonToggleComponent,
ProtobufContentComponent,
@ -594,6 +597,7 @@ export function MarkedOptionsFactory(markedOptionsService: MarkedOptionsService)
FormsModule,
ReactiveFormsModule,
OverlayModule,
A11yModule,
ShareButtonDirective,
HotkeyModule,
ColorPickerModule,
@ -729,6 +733,7 @@ export function MarkedOptionsFactory(markedOptionsService: MarkedOptionsService)
FormsModule,
ReactiveFormsModule,
OverlayModule,
A11yModule,
HotkeyModule,
ColorPickerModule,
NgxHmCarouselComponent,
@ -805,6 +810,7 @@ export function MarkedOptionsFactory(markedOptionsService: MarkedOptionsService)
ShareEntityGroupComponent,
OtaPackageAutocompleteComponent,
CopyButtonComponent,
FilterButtonComponent,
TogglePasswordComponent,
WidgetButtonToggleComponent,
ProtobufContentComponent,

3
ui-ngx/src/assets/locale/locale.constant-ar_AE.json

@ -2863,7 +2863,6 @@
"is-gateway": "Gateway",
"overwrite-activity-time": "استبدال وقت النشاط للجهاز المتصل",
"device-filter-title": "فلتر الجهاز",
"filter-title": "الفلتر",
"device-state": "حالة الجهاز",
"state": "الحالة",
"any": "أي",
@ -5781,7 +5780,7 @@
"opc-ua-type": "النوع",
"opc-ua-keystore-type": "النوع",
"opc-ua-keystore-type-required": "النوع مطلوب",
"opc-ua-keystore-location": "الموقع *",
"opc-ua-keystore-location": "الموقع",
"opc-ua-keystore-password": "كلمة المرور",
"opc-ua-keystore-password-required": "كلمة المرور مطلوبة",
"opc-ua-keystore-alias": "الاسم المستعار",

2
ui-ngx/src/assets/locale/locale.constant-ca_ES.json

@ -5776,7 +5776,7 @@
"opc-ua-type": "Tipus",
"opc-ua-keystore-type": "Tipus",
"opc-ua-keystore-type-required": "El tipus és obligatori",
"opc-ua-keystore-location": "Ubicació *",
"opc-ua-keystore-location": "Ubicació",
"opc-ua-keystore-password": "Contrasenya",
"opc-ua-keystore-password-required": "La contrasenya és obligatòria",
"opc-ua-keystore-alias": "Àlies",

4
ui-ngx/src/assets/locale/locale.constant-da_DK.json

@ -2837,7 +2837,6 @@
"is-gateway": "Er gateway",
"overwrite-activity-time": "Overskriv aktivitetstid for tilsluttet enhed",
"device-filter-title": "Enhedsfilter",
"filter-title": "Filter",
"device-state": "Enhedstilstand",
"state": "Tilstand",
"any": "Enhver",
@ -5745,7 +5744,7 @@
"opc-ua-type": "Type",
"opc-ua-keystore-type": "Type",
"opc-ua-keystore-type-required": "Type er påkrævet",
"opc-ua-keystore-location": "Placering *",
"opc-ua-keystore-location": "Placering",
"opc-ua-keystore-password": "Adgangskode",
"opc-ua-keystore-password-required": "Adgangskode er påkrævet",
"opc-ua-keystore-alias": "Alias",
@ -7543,7 +7542,6 @@
"drop-file": "Slip en JavaScript-fil eller klik for at vælge en fil, der skal uploades.",
"drop-resource-file-or": "Træk og slip en JavaScript-fil eller",
"javascript-library": "JavaScript-bibliotek",
"javascript-type": "JavaScript-type",
"scripts": "Scripts",
"script-type": "Scripttype",
"javascript-resource-details": "JavaScript-ressourcedetaljer",

4
ui-ngx/src/assets/locale/locale.constant-de_DE.json

@ -2835,7 +2835,6 @@
"is-gateway": "Ist Gateway",
"overwrite-activity-time": "Aktivitätszeit für verbundenes Gerät überschreiben",
"device-filter-title": "Gerätefilter",
"filter-title": "Filter",
"device-state": "Gerätestatus",
"state": "Status",
"any": "Beliebig",
@ -5743,7 +5742,7 @@
"opc-ua-type": "Typ",
"opc-ua-keystore-type": "Typ",
"opc-ua-keystore-type-required": "Typ ist erforderlich",
"opc-ua-keystore-location": "Speicherort *",
"opc-ua-keystore-location": "Speicherort",
"opc-ua-keystore-password": "Passwort",
"opc-ua-keystore-password-required": "Passwort ist erforderlich",
"opc-ua-keystore-alias": "Alias",
@ -7541,7 +7540,6 @@
"drop-file": "Legen Sie eine JavaScript-Datei ab oder klicken Sie, um eine Datei auszuwählen.",
"drop-resource-file-or": "JavaScript-Datei hierher ziehen oder",
"javascript-library": "JavaScript-Bibliothek",
"javascript-type": "JavaScript-Typ",
"scripts": "Skripte",
"script-type": "Skripttyp",
"javascript-resource-details": "Details der JavaScript-Ressource",

4
ui-ngx/src/assets/locale/locale.constant-el_GR.json

@ -2837,7 +2837,6 @@
"is-gateway": "Είναι Gateway",
"overwrite-activity-time": "Αντικατάσταση χρόνου δραστηριότητας για συνδεδεμένη συσκευή",
"device-filter-title": "Φίλτρο συσκευής",
"filter-title": "Φίλτρο",
"device-state": "Κατάσταση συσκευής",
"state": "Κατάσταση",
"any": "Οποιαδήποτε",
@ -5754,7 +5753,7 @@
"opc-ua-type": "Τύπος",
"opc-ua-keystore-type": "Τύπος",
"opc-ua-keystore-type-required": "Απαιτείται τύπος",
"opc-ua-keystore-location": "Τοποθεσία *",
"opc-ua-keystore-location": "Τοποθεσία",
"opc-ua-keystore-password": "Κωδικός πρόσβασης",
"opc-ua-keystore-password-required": "Απαιτείται κωδικός πρόσβασης",
"opc-ua-keystore-alias": "Ψευδώνυμο",
@ -7555,7 +7554,6 @@
"drop-file": "Σύρετε ένα αρχείο JavaScript ή κάντε κλικ για να επιλέξετε ένα αρχείο για μεταφόρτωση.",
"drop-resource-file-or": "Σύρετε ένα αρχείο JavaScript ή",
"javascript-library": "Βιβλιοθήκη JavaScript",
"javascript-type": "Τύπος JavaScript",
"scripts": "Σενάρια",
"script-type": "Τύπος σεναρίου",
"javascript-resource-details": "Λεπτομέρειες πόρου JavaScript",

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

@ -994,6 +994,7 @@
"delete": "Delete asset",
"asset-public": "Asset is public",
"asset-type": "Asset type",
"asset-filter-title": "Asset filter",
"asset-type-required": "Asset type is required.",
"select-asset-type": "Select asset type",
"enter-asset-type": "Enter asset profile",
@ -2863,7 +2864,6 @@
"is-gateway": "Is gateway",
"overwrite-activity-time": "Overwrite activity time for connected device",
"device-filter-title": "Device filter",
"filter-title": "Filter",
"device-state": "Device state",
"state": "State",
"any": "Any",
@ -3534,6 +3534,7 @@
"sync": "Sync Edge",
"edge-required": "Edge required",
"edge-type": "Edge type",
"edge-filter-title": "Edge filter",
"edge-type-required": "Edge type is required.",
"event-action": "Event action",
"entity-id": "Entity ID",
@ -4872,6 +4873,7 @@
"unassign-entity-views-title": "Are you sure you want to unassign { count, plural, =1 {1 entity view} other {# entity views} }?",
"unassign-entity-views-text": "After the confirmation all selected entity views will be unassigned and won't be accessible by the customer.",
"entity-view-type": "Entity view type",
"entity-view-filter-title": "Entity view filter",
"entity-view-type-required": "Entity view type is required.",
"select-entity-view-type": "Select entity view type",
"enter-entity-view-type": "Enter entity view type",
@ -5624,6 +5626,7 @@
"kpn-no-security-warning": "Requests to this endpoint are not authenticated. Add the security header generated in KPN Things.",
"customer-id": "Customer id",
"api-id": "API ID",
"api-id-required": "API ID is required.",
"azure-ca-cert": "CA certificate file",
"ca-cert": "CA certificate file",
"private-key": "Private key file",
@ -5782,7 +5785,7 @@
"opc-ua-type": "Type",
"opc-ua-keystore-type": "Type",
"opc-ua-keystore-type-required": "Type is required",
"opc-ua-keystore-location": "Location *",
"opc-ua-keystore-location": "Location",
"opc-ua-keystore-password": "Password",
"opc-ua-keystore-password-required": "Password is required",
"opc-ua-keystore-alias": "Alias",
@ -7592,6 +7595,7 @@
"resource-files": "Resource files",
"resource-library-details": "Resource details",
"resource-type": "Resource type",
"resource-filter-title": "Resource filter",
"resources-library": "Resources library",
"files": "Files",
"search": "Search resources",
@ -7635,9 +7639,9 @@
"drop-file": "Drop a JavaScript file or click to select a file to upload.",
"drop-resource-file-or": "Drag and drop a JavaScript file or",
"javascript-library": "JavaScript library",
"javascript-type": "JavaScript type",
"scripts": "Scripts",
"script-type": "Script type",
"script-filter-title": "Script filter",
"javascript-resource-details": "JavaScript resource details",
"javascript-resource-is-in-use": "JavaScript resource is used by other entities",
"javascript-resources-are-in-use": "JavaScript resources are used by other entities",

4
ui-ngx/src/assets/locale/locale.constant-es_ES.json

@ -2835,7 +2835,6 @@
"is-gateway": "Es un Gateway",
"overwrite-activity-time": "Sobrescribir tiempo de actividad del dispositivo conectado",
"device-filter-title": "Filtro de dispositivo",
"filter-title": "Filtro",
"device-state": "Estado del dispositivo",
"state": "Estado",
"any": "Cualquiera",
@ -5743,7 +5742,7 @@
"opc-ua-type": "Tipo",
"opc-ua-keystore-type": "Tipo",
"opc-ua-keystore-type-required": "Se requiere el tipo",
"opc-ua-keystore-location": "Ubicación *",
"opc-ua-keystore-location": "Ubicación",
"opc-ua-keystore-password": "Contraseña",
"opc-ua-keystore-password-required": "Se requiere la contraseña",
"opc-ua-keystore-alias": "Alias",
@ -7541,7 +7540,6 @@
"drop-file": "Suelta un archivo JavaScript o haz clic para seleccionar uno para subir.",
"drop-resource-file-or": "Arrastra y suelta un archivo JavaScript o",
"javascript-library": "Biblioteca JavaScript",
"javascript-type": "Tipo de JavaScript",
"scripts": "Scripts",
"script-type": "Tipo de script",
"javascript-resource-details": "Detalles del recurso JavaScript",

4
ui-ngx/src/assets/locale/locale.constant-fr_FR.json

@ -2835,7 +2835,6 @@
"is-gateway": "Est une Gateway",
"overwrite-activity-time": "Écraser l’heure d’activité de l’appareil connecté",
"device-filter-title": "Filtre d’appareil",
"filter-title": "Filtre",
"device-state": "État de l’appareil",
"state": "État",
"any": "N’importe quel",
@ -5743,7 +5742,7 @@
"opc-ua-type": "Type",
"opc-ua-keystore-type": "Type",
"opc-ua-keystore-type-required": "Le type est requis",
"opc-ua-keystore-location": "Emplacement *",
"opc-ua-keystore-location": "Emplacement",
"opc-ua-keystore-password": "Mot de passe",
"opc-ua-keystore-password-required": "Le mot de passe est requis",
"opc-ua-keystore-alias": "Alias",
@ -7541,7 +7540,6 @@
"drop-file": "Déposez un fichier JavaScript ou cliquez pour en sélectionner un à téléverser.",
"drop-resource-file-or": "Glissez-déposez un fichier JavaScript ou",
"javascript-library": "Bibliothèque JavaScript",
"javascript-type": "Type JavaScript",
"scripts": "Scripts",
"script-type": "Type de script",
"javascript-resource-details": "Détails de la ressource JavaScript",

4
ui-ngx/src/assets/locale/locale.constant-hi_IN.json

@ -2863,7 +2863,6 @@
"is-gateway": "Gateway है",
"overwrite-activity-time": "कनेक्टेड डिवाइस के गतिविधि समय को ओवरराइट करें",
"device-filter-title": "डिवाइस फ़िल्टर",
"filter-title": "फ़िल्टर",
"device-state": "डिवाइस स्थिति",
"state": "स्थिति",
"any": "कोई भी",
@ -5780,7 +5779,7 @@
"opc-ua-type": "प्रकार",
"opc-ua-keystore-type": "प्रकार",
"opc-ua-keystore-type-required": "प्रकार आवश्यक है",
"opc-ua-keystore-location": "स्थान *",
"opc-ua-keystore-location": "स्थान",
"opc-ua-keystore-password": "पासवर्ड",
"opc-ua-keystore-password-required": "पासवर्ड आवश्यक है",
"opc-ua-keystore-alias": "उपनाम",
@ -7581,7 +7580,6 @@
"drop-file": "JavaScript फ़ाइल ड्रॉप करें या अपलोड करने के लिए क्लिक करके फ़ाइल चुनें।",
"drop-resource-file-or": "JavaScript फ़ाइल को ड्रैग और ड्रॉप करें या",
"javascript-library": "JavaScript लाइब्रेरी",
"javascript-type": "JavaScript प्रकार",
"scripts": "स्क्रिप्ट",
"script-type": "स्क्रिप्ट प्रकार",
"javascript-resource-details": "JavaScript संसाधन विवरण",

4
ui-ngx/src/assets/locale/locale.constant-it_IT.json

@ -2835,7 +2835,6 @@
"is-gateway": "È un gateway",
"overwrite-activity-time": "Sovrascrivi tempo di attività per il dispositivo connesso",
"device-filter-title": "Filtro dispositivo",
"filter-title": "Filtro",
"device-state": "Stato dispositivo",
"state": "Stato",
"any": "Qualsiasi",
@ -5743,7 +5742,7 @@
"opc-ua-type": "Tipo",
"opc-ua-keystore-type": "Tipo",
"opc-ua-keystore-type-required": "Il tipo è obbligatorio",
"opc-ua-keystore-location": "Posizione *",
"opc-ua-keystore-location": "Posizione",
"opc-ua-keystore-password": "Password",
"opc-ua-keystore-password-required": "La password è obbligatoria",
"opc-ua-keystore-alias": "Alias",
@ -7541,7 +7540,6 @@
"drop-file": "Trascina un file JavaScript o clicca per selezionarlo da caricare.",
"drop-resource-file-or": "Trascina un file JavaScript o",
"javascript-library": "Libreria JavaScript",
"javascript-type": "Tipo JavaScript",
"scripts": "Script",
"script-type": "Tipo di script",
"javascript-resource-details": "Dettagli risorsa JavaScript",

4
ui-ngx/src/assets/locale/locale.constant-ja_JP.json

@ -2835,7 +2835,6 @@
"is-gateway": "Gateway",
"overwrite-activity-time": "接続されたデバイスのアクティビティ時刻を上書き",
"device-filter-title": "デバイスフィルター",
"filter-title": "フィルター",
"device-state": "デバイス状態",
"state": "状態",
"any": "任意",
@ -5743,7 +5742,7 @@
"opc-ua-type": "タイプ",
"opc-ua-keystore-type": "タイプ",
"opc-ua-keystore-type-required": "タイプは必須です。",
"opc-ua-keystore-location": "場所 *",
"opc-ua-keystore-location": "場所",
"opc-ua-keystore-password": "パスワード",
"opc-ua-keystore-password-required": "パスワードは必須です。",
"opc-ua-keystore-alias": "エイリアス",
@ -7541,7 +7540,6 @@
"drop-file": "JavaScriptファイルをドラッグ&ドロップするか、クリックして選択してください。",
"drop-resource-file-or": "JavaScriptファイルをドラッグ&ドロップするか",
"javascript-library": "JavaScriptライブラリ",
"javascript-type": "JavaScriptタイプ",
"scripts": "スクリプト",
"script-type": "スクリプトタイプ",
"javascript-resource-details": "JavaScriptリソースの詳細",

2
ui-ngx/src/assets/locale/locale.constant-ka_GE.json

@ -1743,7 +1743,7 @@
"opc-ua-type": "ტიპი",
"opc-ua-keystore-type": "ტიპი",
"opc-ua-keystore-type-required": "ტიპი სავალდებულოა",
"opc-ua-keystore-location": "ლოკაცია *",
"opc-ua-keystore-location": "ლოკაცია",
"opc-ua-keystore-password": "პაროლი",
"opc-ua-keystore-password-required": "პაროლი სავალდებულოა",
"opc-ua-keystore-alias": "ზედმესახელი",

4
ui-ngx/src/assets/locale/locale.constant-ko_KR.json

@ -2855,7 +2855,6 @@
"is-gateway": "Gateway 여부",
"overwrite-activity-time": "연결된 장치의 활동 시간 덮어쓰기",
"device-filter-title": "장치 필터",
"filter-title": "필터",
"device-state": "장치 상태",
"state": "상태",
"any": "전체",
@ -5772,7 +5771,7 @@
"opc-ua-type": "유형",
"opc-ua-keystore-type": "유형",
"opc-ua-keystore-type-required": "유형은 필수 항목입니다.",
"opc-ua-keystore-location": "위치 *",
"opc-ua-keystore-location": "위치",
"opc-ua-keystore-password": "비밀번호",
"opc-ua-keystore-password-required": "비밀번호는 필수 항목입니다.",
"opc-ua-keystore-alias": "별명",
@ -7655,7 +7654,6 @@
"drop-file": "JavaScript 파일을 끌어다 놓거나 클릭하여 업로드할 파일을 선택하세요.",
"drop-resource-file-or": "JavaScript 파일을 끌어다 놓거나",
"javascript-library": "JavaScript 라이브러리",
"javascript-type": "JavaScript 유형",
"scripts": "스크립트",
"script-type": "스크립트 유형",
"javascript-resource-details": "JavaScript 리소스 세부 정보",

4
ui-ngx/src/assets/locale/locale.constant-lt_LT.json

@ -2863,7 +2863,6 @@
"is-gateway": "Gateway",
"overwrite-activity-time": "Perrašyti aktyvumo laiką prijungtam įrenginiui",
"device-filter-title": "Įrenginių filtras",
"filter-title": "Filtras",
"device-state": "Įrenginio būsena",
"state": "Būsena",
"any": "Visos",
@ -5780,7 +5779,7 @@
"opc-ua-type": "Tipas",
"opc-ua-keystore-type": "Tipas",
"opc-ua-keystore-type-required": "Tipas yra privalomas",
"opc-ua-keystore-location": "Vieta *",
"opc-ua-keystore-location": "Vieta",
"opc-ua-keystore-password": "Slaptažodis",
"opc-ua-keystore-password-required": "Slaptažodis yra privalomas",
"opc-ua-keystore-alias": "Pseudonimas",
@ -7581,7 +7580,6 @@
"drop-file": "Nuvilkite JavaScript failą arba spustelėkite, kad pasirinktumėte failą, kurį norite įkelti.",
"drop-resource-file-or": "Nuvilkite JavaScript failą arba",
"javascript-library": "JavaScript biblioteka",
"javascript-type": "JavaScript tipas",
"scripts": "Skriptai",
"script-type": "Skripto tipas",
"javascript-resource-details": "JavaScript ištekliaus informacija",

2
ui-ngx/src/assets/locale/locale.constant-lv_LV.json

@ -1648,7 +1648,7 @@
"opc-ua-type": "Tips",
"opc-ua-keystore-type": "Tips",
"opc-ua-keystore-type-required": "Tips ir nepieciešams",
"opc-ua-keystore-location": "Vieta *",
"opc-ua-keystore-location": "Vieta",
"opc-ua-keystore-password": "Parole",
"opc-ua-keystore-password-required": "Parole ir nepieciešama",
"opc-ua-keystore-alias": "Segvārds",

4
ui-ngx/src/assets/locale/locale.constant-nl_BE.json

@ -2863,7 +2863,6 @@
"is-gateway": "Is gateway",
"overwrite-activity-time": "Activiteitstijd voor verbonden apparaat overschrijven",
"device-filter-title": "Apparaatfilter",
"filter-title": "Filter",
"device-state": "Apparaatstatus",
"state": "Status",
"any": "Alles",
@ -5780,7 +5779,7 @@
"opc-ua-type": "Type",
"opc-ua-keystore-type": "Type",
"opc-ua-keystore-type-required": "Type is verplicht",
"opc-ua-keystore-location": "Locatie *",
"opc-ua-keystore-location": "Locatie",
"opc-ua-keystore-password": "Wachtwoord",
"opc-ua-keystore-password-required": "Wachtwoord is verplicht",
"opc-ua-keystore-alias": "Alias",
@ -7587,7 +7586,6 @@
"drop-file": "Sleep een JavaScript-bestand hierheen of klik om een bestand te selecteren om te uploaden.",
"drop-resource-file-or": "Sleep een JavaScript-bestand hierheen of",
"javascript-library": "JavaScript-bibliotheek",
"javascript-type": "JavaScript-type",
"scripts": "Scripts",
"script-type": "Scripttype",
"javascript-resource-details": "Details van JavaScript-resource",

4
ui-ngx/src/assets/locale/locale.constant-nl_NL.json

@ -2835,7 +2835,6 @@
"is-gateway": "Is gateway",
"overwrite-activity-time": "Activiteitstijd voor verbonden apparaat overschrijven",
"device-filter-title": "Apparaatfilter",
"filter-title": "Filter",
"device-state": "Apparaatstatus",
"state": "Status",
"any": "Alles",
@ -5743,7 +5742,7 @@
"opc-ua-type": "Type",
"opc-ua-keystore-type": "Type",
"opc-ua-keystore-type-required": "Type is verplicht",
"opc-ua-keystore-location": "Locatie *",
"opc-ua-keystore-location": "Locatie",
"opc-ua-keystore-password": "Wachtwoord",
"opc-ua-keystore-password-required": "Wachtwoord is verplicht",
"opc-ua-keystore-alias": "Alias",
@ -7541,7 +7540,6 @@
"drop-file": "Sleep een JavaScript-bestand of klik om een bestand te selecteren om te uploaden.",
"drop-resource-file-or": "Sleep een JavaScript-bestand of",
"javascript-library": "JavaScript-bibliotheek",
"javascript-type": "JavaScript-type",
"scripts": "Scripts",
"script-type": "Scripttype",
"javascript-resource-details": "Details van JavaScript-bron",

4
ui-ngx/src/assets/locale/locale.constant-no_NO.json

@ -2837,7 +2837,6 @@
"is-gateway": "Er gateway",
"overwrite-activity-time": "Overstyr aktivitetstid for tilkoblet enhet",
"device-filter-title": "Enhetsfilter",
"filter-title": "Filter",
"device-state": "Enhetstilstand",
"state": "Tilstand",
"any": "Alle",
@ -5754,7 +5753,7 @@
"opc-ua-type": "Type",
"opc-ua-keystore-type": "Type",
"opc-ua-keystore-type-required": "Type er påkrevd",
"opc-ua-keystore-location": "Plassering *",
"opc-ua-keystore-location": "Plassering",
"opc-ua-keystore-password": "Passord",
"opc-ua-keystore-password-required": "Passord er påkrevd",
"opc-ua-keystore-alias": "Alias",
@ -7555,7 +7554,6 @@
"drop-file": "Slipp en JavaScript-fil eller klikk for å velge en fil for opplasting.",
"drop-resource-file-or": "Dra og slipp en JavaScript-fil eller",
"javascript-library": "JavaScript-bibliotek",
"javascript-type": "JavaScript-type",
"scripts": "Skript",
"script-type": "Skripttype",
"javascript-resource-details": "JavaScript-ressursdetaljer",

4
ui-ngx/src/assets/locale/locale.constant-pl_PL.json

@ -2863,7 +2863,6 @@
"is-gateway": "Gateway",
"overwrite-activity-time": "Zastąp czas aktywności podłączonego urządzenia",
"device-filter-title": "Filtr urządzeń",
"filter-title": "Filtr",
"device-state": "Stan urządzenia",
"state": "Stan",
"any": "Dowolny",
@ -5780,7 +5779,7 @@
"opc-ua-type": "Typ",
"opc-ua-keystore-type": "Typ",
"opc-ua-keystore-type-required": "Typ jest wymagany",
"opc-ua-keystore-location": "Lokalizacja *",
"opc-ua-keystore-location": "Lokalizacja",
"opc-ua-keystore-password": "Hasło",
"opc-ua-keystore-password-required": "Hasło jest wymagane",
"opc-ua-keystore-alias": "Alias",
@ -7581,7 +7580,6 @@
"drop-file": "Upuść plik JavaScript lub kliknij, aby wybrać plik do przesłania.",
"drop-resource-file-or": "Przeciągnij i upuść plik JavaScript lub",
"javascript-library": "Biblioteka JavaScript",
"javascript-type": "Typ JavaScript",
"scripts": "Skrypty",
"script-type": "Typ skryptu",
"javascript-resource-details": "Szczegóły skryptu JavaScript",

4
ui-ngx/src/assets/locale/locale.constant-pt_BR.json

@ -2835,7 +2835,6 @@
"is-gateway": "É gateway",
"overwrite-activity-time": "Sobrescrever tempo de atividade do dispositivo conectado",
"device-filter-title": "Filtro de dispositivo",
"filter-title": "Filtro",
"device-state": "Estado do dispositivo",
"state": "Estado",
"any": "Qualquer",
@ -5743,7 +5742,7 @@
"opc-ua-type": "Tipo",
"opc-ua-keystore-type": "Tipo",
"opc-ua-keystore-type-required": "O tipo é obrigatório",
"opc-ua-keystore-location": "Localização *",
"opc-ua-keystore-location": "Localização",
"opc-ua-keystore-password": "Senha",
"opc-ua-keystore-password-required": "A senha é obrigatória",
"opc-ua-keystore-alias": "Alias",
@ -7541,7 +7540,6 @@
"drop-file": "Solte um arquivo JavaScript ou clique para selecionar um arquivo para enviar.",
"drop-resource-file-or": "Arraste e solte um arquivo JavaScript ou",
"javascript-library": "Biblioteca JavaScript",
"javascript-type": "Tipo JavaScript",
"scripts": "Scripts",
"script-type": "Tipo de script",
"javascript-resource-details": "Detalhes do recurso JavaScript",

4
ui-ngx/src/assets/locale/locale.constant-sl_SI.json

@ -2853,7 +2853,6 @@
"is-gateway": "Je Gateway",
"overwrite-activity-time": "Prepiši čas aktivnosti za povezano napravo",
"device-filter-title": "Filter naprav",
"filter-title": "Filter",
"device-state": "Stanje naprave",
"state": "Stanje",
"any": "Vse",
@ -5770,7 +5769,7 @@
"opc-ua-type": "Vrsta",
"opc-ua-keystore-type": "Vrsta",
"opc-ua-keystore-type-required": "Vrsta je obvezna",
"opc-ua-keystore-location": "Lokacija *",
"opc-ua-keystore-location": "Lokacija",
"opc-ua-keystore-password": "Geslo",
"opc-ua-keystore-password-required": "Geslo je obvezno",
"opc-ua-keystore-alias": "Vzdevek",
@ -7653,7 +7652,6 @@
"drop-file": "Spustite datoteko JavaScript ali kliknite in izberite datoteko za nalaganje.",
"drop-resource-file-or": "Povlecite in spustite datoteko JavaScript ali",
"javascript-library": "Knjižnica JavaScript",
"javascript-type": "Vrsta skripta JavaScript",
"scripts": "Skripti",
"script-type": "Vrsta skripta",
"javascript-resource-details": "Podrobnosti vira JavaScript",

4
ui-ngx/src/assets/locale/locale.constant-tr_TR.json

@ -2837,7 +2837,6 @@
"is-gateway": "Gateway mi",
"overwrite-activity-time": "Bağlı cihaz için etkinlik zamanını üzerine yaz",
"device-filter-title": "Cihaz Filtresi",
"filter-title": "Filtre",
"device-state": "Cihaz durumu",
"state": "Durum",
"any": "Herhangi biri",
@ -5745,7 +5744,7 @@
"opc-ua-type": "Tür",
"opc-ua-keystore-type": "Tür",
"opc-ua-keystore-type-required": "Tür gereklidir",
"opc-ua-keystore-location": "Konum *",
"opc-ua-keystore-location": "Konum",
"opc-ua-keystore-password": "Parola",
"opc-ua-keystore-password-required": "Parola gereklidir",
"opc-ua-keystore-alias": "Takma ad",
@ -7543,7 +7542,6 @@
"drop-file": "Bir JavaScript dosyasını bırakın veya yüklemek için tıklayın.",
"drop-resource-file-or": "Bir JavaScript dosyasını sürükleyip bırakın ya da",
"javascript-library": "JavaScript kütüphanesi",
"javascript-type": "JavaScript türü",
"scripts": "Betikler",
"script-type": "Betik türü",
"javascript-resource-details": "JavaScript kaynağı ayrıntıları",

4
ui-ngx/src/assets/locale/locale.constant-uk_UA.json

@ -2835,7 +2835,6 @@
"is-gateway": "Це Gateway",
"overwrite-activity-time": "Перезаписати час активності для підключеного пристрою",
"device-filter-title": "Фільтр пристроїв",
"filter-title": "Фільтр",
"device-state": "Стан пристрою",
"state": "Стан",
"any": "Будь-який",
@ -5743,7 +5742,7 @@
"opc-ua-type": "Тип",
"opc-ua-keystore-type": "Тип",
"opc-ua-keystore-type-required": "Потрібно вказати тип",
"opc-ua-keystore-location": "Розташування *",
"opc-ua-keystore-location": "Розташування",
"opc-ua-keystore-password": "Пароль",
"opc-ua-keystore-password-required": "Потрібно вказати пароль",
"opc-ua-keystore-alias": "Псевдонім",
@ -7541,7 +7540,6 @@
"drop-file": "Перетягніть JavaScript файл або натисніть, щоб вибрати файл для завантаження.",
"drop-resource-file-or": "Перетягніть JavaScript файл або",
"javascript-library": "Бібліотека JavaScript",
"javascript-type": "Тип JavaScript",
"scripts": "Скрипти",
"script-type": "Тип скрипту",
"javascript-resource-details": "Деталі JavaScript ресурсу",

4
ui-ngx/src/assets/locale/locale.constant-zh_CN.json

@ -2837,7 +2837,6 @@
"is-gateway": "Gateway",
"overwrite-activity-time": "覆盖已连接设备的活动时间",
"device-filter-title": "设备过滤器",
"filter-title": "过滤器",
"device-state": "设备状态",
"state": "状态",
"any": "任意",
@ -5745,7 +5744,7 @@
"opc-ua-type": "类型",
"opc-ua-keystore-type": "类型",
"opc-ua-keystore-type-required": "类型为必填项",
"opc-ua-keystore-location": "位置 *",
"opc-ua-keystore-location": "位置",
"opc-ua-keystore-password": "密码",
"opc-ua-keystore-password-required": "密码为必填项",
"opc-ua-keystore-alias": "别名",
@ -7543,7 +7542,6 @@
"drop-file": "拖放 JavaScript 文件或点击选择要上传的文件。",
"drop-resource-file-or": "拖放 JavaScript 文件或",
"javascript-library": "JavaScript 库",
"javascript-type": "JavaScript 类型",
"scripts": "脚本",
"script-type": "脚本类型",
"javascript-resource-details": "JavaScript 资源详情",

4
ui-ngx/src/assets/locale/locale.constant-zh_TW.json

@ -1656,7 +1656,6 @@
"generate-access-token": "產生存取權杖",
"device-profile-type-list-empty": "至少應選擇一個裝置設定檔。",
"device-filter-title": "裝置篩選器",
"filter-title": "篩選器",
"device-state": "裝置狀態",
"state": "狀態",
"any": "任意",
@ -9921,7 +9920,6 @@
"drop-file": "拖放 JavaScript 檔案,或點選以選取要上傳的檔案。",
"drop-resource-file-or": "拖放 JavaScript 檔案或",
"javascript-library": "JavaScript 程式庫",
"javascript-type": "JavaScript 類型",
"scripts": "指令碼",
"script-type": "指令碼類型",
"javascript-resource-details": "JavaScript 資源詳細資料",
@ -11897,7 +11895,7 @@
"opc-ua-type": "類型",
"opc-ua-keystore-type": "類型",
"opc-ua-keystore-type-required": "類型為必填項。",
"opc-ua-keystore-location": "位置 *",
"opc-ua-keystore-location": "位置",
"opc-ua-keystore-password": "密碼",
"opc-ua-keystore-password-required": "密碼為必填項。",
"opc-ua-keystore-alias": "別名",

9
ui-ngx/src/app/modules/home/components/device/device-info-filter.component.scss → ui-ngx/src/scss/filter-button.scss

@ -1,5 +1,7 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
:host {
display: block;
overflow: hidden;
@ -21,12 +23,11 @@
}
}
::ng-deep {
.tb-device-filter-config-component {
.tb-filter-button-panel-content {
max-width: 100%;
width: 500px;
min-width: 100%;
flex: 1;
}
}
}
Loading…
Cancel
Save