152 changed files with 4553 additions and 2511 deletions
File diff suppressed because it is too large
@ -0,0 +1,231 @@ |
|||
Here is the list of commands, that can be used to quickly install ThingsBoard Edge on RHEL/CentOS 7/8 and connect to the cloud. |
|||
|
|||
#### Prerequisites |
|||
Before continue to installation execute the following commands in order to install necessary tools: |
|||
|
|||
```bash |
|||
sudo yum install -y nano wget |
|||
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm |
|||
``` |
|||
|
|||
#### Install Java 11 (OpenJDK) |
|||
ThingsBoard service is running on Java 11. Follow these instructions to install OpenJDK 11: |
|||
|
|||
```bash |
|||
sudo yum install java-11-openjdk |
|||
{:copy-code} |
|||
``` |
|||
|
|||
Please don't forget to configure your operating system to use OpenJDK 11 by default. |
|||
You can configure which version is the default using the following command: |
|||
|
|||
```bash |
|||
sudo update-alternatives --config java |
|||
{:copy-code} |
|||
``` |
|||
|
|||
You can check the installation using the following command: |
|||
|
|||
```bash |
|||
java -version |
|||
{:copy-code} |
|||
``` |
|||
|
|||
Expected command output is: |
|||
|
|||
```text |
|||
openjdk version "11.0.xx" |
|||
OpenJDK Runtime Environment (...) |
|||
OpenJDK 64-Bit Server VM (build ...) |
|||
``` |
|||
|
|||
#### Configure PostgreSQL |
|||
ThingsBoard Edge uses PostgreSQL database as a local storage. |
|||
Instructions listed below will help you to install PostgreSQL. |
|||
|
|||
```bash |
|||
# Update your system |
|||
sudo yum update |
|||
{:copy-code} |
|||
``` |
|||
|
|||
**For CentOS 7:** |
|||
|
|||
```bash |
|||
# Install the repository RPM (for CentOS 7): |
|||
sudo yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm |
|||
# Install packages |
|||
sudo yum -y install epel-release yum-utils |
|||
sudo yum-config-manager --enable pgdg12 |
|||
sudo yum install postgresql12-server postgresql12 |
|||
# Initialize your PostgreSQL DB |
|||
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb |
|||
sudo systemctl start postgresql-12 |
|||
# Optional: Configure PostgreSQL to start on boot |
|||
sudo systemctl enable --now postgresql-12 |
|||
|
|||
{:copy-code} |
|||
``` |
|||
|
|||
**For CentOS 8:** |
|||
|
|||
```bash |
|||
# Install the repository RPM (for CentOS 8): |
|||
sudo yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm |
|||
# Install packages |
|||
sudo dnf -qy module disable postgresql |
|||
sudo dnf -y install postgresql12 postgresql12-server |
|||
# Initialize your PostgreSQL DB |
|||
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb |
|||
sudo systemctl start postgresql-12 |
|||
# Optional: Configure PostgreSQL to start on boot |
|||
sudo systemctl enable --now postgresql-12 |
|||
|
|||
{:copy-code} |
|||
``` |
|||
|
|||
Once PostgreSQL is installed you may want to create a new user or set the password for the main user. |
|||
The instructions below will help to set the password for main PostgreSQL user: |
|||
|
|||
```text |
|||
sudo su - postgres |
|||
psql |
|||
\password |
|||
\q |
|||
``` |
|||
|
|||
Then, press "Ctrl+D" to return to main user console. |
|||
|
|||
After configuring the password, edit the pg_hba.conf to use MD5 authentication with the postgres user. |
|||
|
|||
Edit pg_hba.conf file: |
|||
|
|||
```bash |
|||
sudo nano /var/lib/pgsql/12/data/pg_hba.conf |
|||
{:copy-code} |
|||
``` |
|||
|
|||
Locate the following lines: |
|||
|
|||
```text |
|||
# IPv4 local connections: |
|||
host all all 127.0.0.1/32 ident |
|||
``` |
|||
|
|||
Replace `ident` with `md5`: |
|||
|
|||
```text |
|||
host all all 127.0.0.1/32 md5 |
|||
``` |
|||
|
|||
Finally, you should restart the PostgreSQL service to initialize the new configuration: |
|||
|
|||
```bash |
|||
sudo systemctl restart postgresql-12.service |
|||
{:copy-code} |
|||
``` |
|||
|
|||
Connect to the database to create ThingsBoard Edge DB: |
|||
|
|||
```bash |
|||
psql -U postgres -d postgres -h 127.0.0.1 -W |
|||
{:copy-code} |
|||
``` |
|||
|
|||
Execute create database statement: |
|||
|
|||
```bash |
|||
CREATE DATABASE tb_edge; |
|||
\q |
|||
{:copy-code} |
|||
``` |
|||
|
|||
#### ThingsBoard Edge service installation |
|||
Download installation package: |
|||
|
|||
```bash |
|||
wget https://github.com/thingsboard/thingsboard-edge/releases/download/v${TB_EDGE_VERSION}/tb-edge-${TB_EDGE_VERSION}.rpm |
|||
{:copy-code} |
|||
``` |
|||
|
|||
Go to the download repository and install ThingsBoard Edge service: |
|||
|
|||
```bash |
|||
sudo rpm -Uvh tb-edge-${TB_EDGE_VERSION}.rpm |
|||
{:copy-code} |
|||
``` |
|||
|
|||
#### Configure ThingsBoard Edge |
|||
To configure ThingsBoard Edge, you can use the following command to automatically update the configuration file with specific values: |
|||
|
|||
```bash |
|||
sudo sh -c 'cat <<EOL >> /etc/tb-edge/conf/tb-edge.conf |
|||
export CLOUD_ROUTING_KEY=${CLOUD_ROUTING_KEY} |
|||
export CLOUD_ROUTING_SECRET=${CLOUD_ROUTING_SECRET} |
|||
export CLOUD_RPC_HOST=${BASE_URL} |
|||
export CLOUD_RPC_PORT=${CLOUD_RPC_PORT} |
|||
export CLOUD_RPC_SSL_ENABLED=${CLOUD_RPC_SSL_ENABLED} |
|||
EOL' |
|||
{:copy-code} |
|||
``` |
|||
|
|||
##### [Optional] Database Configuration |
|||
In case you changed default PostgreSQL datasource settings (**postgres**/**postgres**) please update the configuration file (**/etc/tb-edge/conf/tb-edge.conf**) with your actual values: |
|||
|
|||
```bash |
|||
sudo nano /etc/tb-edge/conf/tb-edge.conf |
|||
{:copy-code} |
|||
``` |
|||
|
|||
Please update the following lines in your configuration file. Make sure **to replace**: |
|||
- Replace 'postgres' with your actual PostgreSQL username; |
|||
- Replace 'PUT_YOUR_POSTGRESQL_PASSWORD_HERE' with your actual PostgreSQL password. |
|||
|
|||
```bash |
|||
export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/tb_edge |
|||
export SPRING_DATASOURCE_USERNAME=postgres |
|||
export SPRING_DATASOURCE_PASSWORD=PUT_YOUR_POSTGRESQL_PASSWORD_HERE |
|||
{:copy-code} |
|||
``` |
|||
|
|||
##### [Optional] Update bind ports |
|||
If ThingsBoard Edge is going to be running on the same machine where ThingsBoard server (cloud) is running, you'll need to update configuration parameters to avoid port collision between ThingsBoard server and ThingsBoard Edge. |
|||
|
|||
Please execute the following command to update ThingsBoard Edge configuration file (**/etc/tb-edge/conf/tb-edge.conf**): |
|||
|
|||
```bash |
|||
sudo sh -c 'cat <<EOL >> /etc/tb-edge/conf/tb-edge.conf |
|||
export HTTP_BIND_PORT=18080 |
|||
export MQTT_BIND_PORT=11883 |
|||
export COAP_BIND_PORT=15683 |
|||
export LWM2M_ENABLED=false |
|||
export SNMP_ENABLED=false |
|||
EOL' |
|||
{:copy-code} |
|||
``` |
|||
|
|||
Make sure that ports above (18080, 11883, 15683) are not used by any other application. |
|||
|
|||
#### Run installation script |
|||
Once ThingsBoard Edge is installed and configured please execute the following install script: |
|||
|
|||
```bash |
|||
sudo /usr/share/tb-edge/bin/install/install.sh |
|||
{:copy-code} |
|||
``` |
|||
|
|||
#### Restart ThingsBoard Edge service |
|||
|
|||
```bash |
|||
sudo service tb-edge restart |
|||
{:copy-code} |
|||
``` |
|||
|
|||
#### Open ThingsBoard Edge UI |
|||
|
|||
Once started, you will be able to open **ThingsBoard Edge UI** using the following link http://localhost:8080. |
|||
|
|||
###### NOTE: Edge HTTP bind port update |
|||
|
|||
Use next **ThingsBoard Edge UI** link **http://localhost:18080** if you updated HTTP 8080 bind port to **18080**. |
|||
|
|||
@ -0,0 +1,164 @@ |
|||
Here is the list of commands, that can be used to quickly install ThingsBoard Edge on Ubuntu Server and connect to the cloud. |
|||
|
|||
#### Install Java 11 (OpenJDK) |
|||
ThingsBoard service is running on Java 11. Follow these instructions to install OpenJDK 11: |
|||
|
|||
```bash |
|||
sudo apt update |
|||
sudo apt install openjdk-11-jdk |
|||
{:copy-code} |
|||
``` |
|||
|
|||
Please don't forget to configure your operating system to use OpenJDK 11 by default. |
|||
You can configure which version is the default using the following command: |
|||
|
|||
```bash |
|||
sudo update-alternatives --config java |
|||
{:copy-code} |
|||
``` |
|||
|
|||
You can check the installation using the following command: |
|||
|
|||
```bash |
|||
java -version |
|||
{:copy-code} |
|||
``` |
|||
|
|||
Expected command output is: |
|||
|
|||
```text |
|||
openjdk version "11.0.xx" |
|||
OpenJDK Runtime Environment (...) |
|||
OpenJDK 64-Bit Server VM (build ...) |
|||
``` |
|||
|
|||
#### Configure PostgreSQL |
|||
ThingsBoard Edge uses PostgreSQL database as a local storage. |
|||
Instructions listed below will help you to install PostgreSQL. |
|||
|
|||
```bash |
|||
# install **wget** if not already installed: |
|||
sudo apt install -y wget |
|||
|
|||
# import the repository signing key: |
|||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - |
|||
|
|||
# add repository contents to your system: |
|||
RELEASE=$(lsb_release -cs) |
|||
echo "deb http://apt.postgresql.org/pub/repos/apt/ ${RELEASE}"-pgdg main | sudo tee /etc/apt/sources.list.d/pgdg.list |
|||
|
|||
# install and launch the postgresql service: |
|||
sudo apt update |
|||
sudo apt -y install postgresql-12 |
|||
sudo service postgresql start |
|||
{:copy-code} |
|||
``` |
|||
|
|||
Once PostgreSQL is installed you may want to create a new user or set the password for the main user. |
|||
The instructions below will help to set the password for main PostgreSQL user: |
|||
|
|||
```text |
|||
sudo su - postgres |
|||
psql |
|||
\password |
|||
\q |
|||
``` |
|||
|
|||
Then, press “Ctrl+D” to return to main user console and connect to the database to create ThingsBoard Edge DB: |
|||
|
|||
```text |
|||
psql -U postgres -d postgres -h 127.0.0.1 -W |
|||
CREATE DATABASE tb_edge; |
|||
\q |
|||
``` |
|||
|
|||
#### Thingsboard Edge service installation |
|||
Download installation package: |
|||
|
|||
```bash |
|||
wget https://github.com/thingsboard/thingsboard-edge/releases/download/v${TB_EDGE_VERSION}/tb-edge-${TB_EDGE_VERSION}.deb |
|||
{:copy-code} |
|||
``` |
|||
|
|||
Go to the download repository and install ThingsBoard Edge service: |
|||
|
|||
```bash |
|||
sudo dpkg -i tb-edge-${TB_EDGE_VERSION}.deb |
|||
{:copy-code} |
|||
``` |
|||
|
|||
#### Configure ThingsBoard Edge |
|||
To configure ThingsBoard Edge, you can use the following command to automatically update the configuration file with specific values: |
|||
|
|||
```bash |
|||
sudo sh -c 'cat <<EOL >> /etc/tb-edge/conf/tb-edge.conf |
|||
export CLOUD_ROUTING_KEY=${CLOUD_ROUTING_KEY} |
|||
export CLOUD_ROUTING_SECRET=${CLOUD_ROUTING_SECRET} |
|||
export CLOUD_RPC_HOST=${BASE_URL} |
|||
export CLOUD_RPC_PORT=${CLOUD_RPC_PORT} |
|||
export CLOUD_RPC_SSL_ENABLED=${CLOUD_RPC_SSL_ENABLED} |
|||
EOL' |
|||
{:copy-code} |
|||
``` |
|||
|
|||
##### [Optional] Database Configuration |
|||
In case you changed default PostgreSQL datasource settings (**postgres**/**postgres**) please update the configuration file (**/etc/tb-edge/conf/tb-edge.conf**) with your actual values: |
|||
|
|||
```bash |
|||
sudo nano /etc/tb-edge/conf/tb-edge.conf |
|||
{:copy-code} |
|||
``` |
|||
|
|||
Please update the following lines in your configuration file. Make sure **to replace**: |
|||
- Replace 'postgres' with your actual PostgreSQL username; |
|||
- Replace 'PUT_YOUR_POSTGRESQL_PASSWORD_HERE' with your actual PostgreSQL password. |
|||
|
|||
```bash |
|||
export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/tb_edge |
|||
export SPRING_DATASOURCE_USERNAME=postgres |
|||
export SPRING_DATASOURCE_PASSWORD=PUT_YOUR_POSTGRESQL_PASSWORD_HERE |
|||
{:copy-code} |
|||
``` |
|||
|
|||
##### [Optional] Update bind ports |
|||
If ThingsBoard Edge is going to be running on the same machine where ThingsBoard server (cloud) is running, you'll need to update configuration parameters to avoid port collision between ThingsBoard server and ThingsBoard Edge. |
|||
|
|||
Please execute the following command to update ThingsBoard Edge configuration file (**/etc/tb-edge/conf/tb-edge.conf**): |
|||
|
|||
```bash |
|||
sudo sh -c 'cat <<EOL >> /etc/tb-edge/conf/tb-edge.conf |
|||
export HTTP_BIND_PORT=18080 |
|||
export MQTT_BIND_PORT=11883 |
|||
export COAP_BIND_PORT=15683 |
|||
export LWM2M_ENABLED=false |
|||
export SNMP_ENABLED=false |
|||
EOL' |
|||
{:copy-code} |
|||
``` |
|||
|
|||
Make sure that ports above (18080, 11883, 15683) are not used by any other application. |
|||
|
|||
#### Run installation script |
|||
|
|||
Once ThingsBoard Edge is installed and configured please execute the following install script: |
|||
|
|||
```bash |
|||
sudo /usr/share/tb-edge/bin/install/install.sh |
|||
{:copy-code} |
|||
``` |
|||
|
|||
#### Restart ThingsBoard Edge service |
|||
|
|||
```bash |
|||
sudo service tb-edge restart |
|||
{:copy-code} |
|||
``` |
|||
|
|||
#### Open ThingsBoard Edge UI |
|||
|
|||
Once started, you will be able to open **ThingsBoard Edge UI** using the following link http://localhost:8080. |
|||
|
|||
###### NOTE: Edge HTTP bind port update |
|||
|
|||
Use next **ThingsBoard Edge UI** link **http://localhost:18080** if you updated HTTP 8080 bind port to **18080**. |
|||
|
|||
@ -0,0 +1,14 @@ |
|||
{ |
|||
"widgetsBundle": { |
|||
"alias": "count_widgets", |
|||
"title": "Count widgets", |
|||
"image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACgCAMAAAB+IdObAAABaFBMVEXj4+Pj4+Pt7e0AAADi4uLi4uLt7e3m5ubi4uL////39/f6+vrh4eHxjRf5+fnRJzD+/f38/Pz19fX7+/vzxcj74cHdYWf1q1UhISHylSb62bKbm5vz8/PGxsb+9/CZmZn4ypP2s2MkJCTx8fHa2tqrq6vn5+dcXFzBwcG5ubmKiorv7+/r6+vQ0NDNzc2/v7+fn59FRUU/Pz/T09Ozs7Onp6czMzP55ebX19fIyMi8vLzZSlEvLy/k5OS2trakpKSHh4eBgYFgYGBQUFDVNT05OTkrKysoKCji4uL43N31z9HKysqoqKiSkpLidnx5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YOKrw+QihTR2JyBxNf6KmeEtO0lMg0qydECOES+e9D+RWrODgkxHcHqZ2GyJaGyJaGyJaGyJaGyJaGyJaGyJaGyFYFotzuomZ1IYAQdXYXtasLIoBQRXYXNasLKoK4DMPNlnt4YRtuLsULMS1Tsb1ChWIJZhempdpcweYSwexCOYcr0bMLqRLPLmwVZxe27b8fuX5O0HXI1qH7kVe7rYJ2L0OyKCW278XQi63CLh68qSbZx7BfGgF06FqhtU6oqSeG3hEYhTy5FUUPf5HhbgPZkQTqJyuEtqF/vHt16HY0iTake1qStC2XTKFpiSG0YYhRxFSyP00mYwm08ReQyySLvWhajNL/ASGFGDpM1om+IuGMtSwbtoskasKnICAXX13+3QcP5NbkWoygpT+ZQuo2MIFsMjmO/NodGz41BcIOQp6TL+f2+1aFSBbzu/FsH3Lpa2tNUkLMv4Ncaq12/3p7e/vnEECu4PXr5wgFhP+GGZIt3I6CZ8S6bbjZvTn4JSekf9FxFgrAjZLjDPQAsKYXnD74JSXkRnwmlxgoAzsDQ4/L9whwNT6VMOBXIJBL1661u125gvb2Tx5IXzlWOXYadaaBojOEYacDhxQI5Cb2uvIBvHbRl52W7yHlZIARJ43peNvOThp+BQJ5cHGvB63uuwiScbpB5ks22XQm0OWUpkrOMHwKAOJNAEk66wDuxAfmB5xVzI5FkYpfhV9yQkbim6g0VBzJLEbRNQ+gvAOf5ISsLl6lqLY0sAVk4kvILm7Bp6ZDdsWOXdQ0PhafzmQyeWByZqHUCeTGSh2z8V741HTIfTHkPmoa6nJLA9NdHVH3PzPlmWH41mzIzfcXBL2/Ccky9exCskIOCdPsAooV7v1I1B0rSH1d+mDVuUK0zn7EtExDiSzL9NmPUKbK6uKXg+jZhaxpiGxpiGxpiGxpiGxpiGxpiGxpiGxpiGxpiGxpiGyFCBKaBwSH5JHNJyJHQ/EQ7dOnIseOhuCx5idOHfsJzoAQyrcRdLoAAAAASUVORK5CYII=", |
|||
"description": "Cards to display the number of alarms or entities based on selected filter.", |
|||
"externalId": null, |
|||
"name": "Count widgets" |
|||
}, |
|||
"widgetTypeFqns": [ |
|||
"alarm_count", |
|||
"entity_count" |
|||
] |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
{ |
|||
"fqn": "alarm_count", |
|||
"name": "Alarm count", |
|||
"deprecated": false, |
|||
"image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACgCAMAAAB+IdObAAAAolBMVEXg4ODf39/g4OAAAADg4ODf39/////g4OD8/Pz+/v7RJzD29vb6+vr7+/v09PTt7e3z8/P4+Pjx8fHv7+/ok5fXQkqXl5chISHk5OTIyMi6urqpqamgoKDDw8P55OXurrI8PDzc3NyxsbF0dHRYWFjlhYrUND3V1dXroKT88fLR0dHzycvwu76QkJDieH7eY2pKSkovLy/219jieH1mZmbTND12Tj45AAAABnRSTlPvIL8Ar7DvmsykAAAEx0lEQVR42u2aiXLaMBBATdMuUmU5yEBJgEDanL3v//+1rpDI2khA087U63RfjGRJa4k3a5sMpjgZPCuGfef54KQYFGMFPUfVqPG8hifAGE+r3ufDo4piCE+CoYgwQ0S4ISLcEBFuiAg3RIQbIsINEeGGiHBDRLghItwQEW6ICDdEhBsiwg0R4YaIcENEuCEi3BARbogIN0SEGyLCDRHhhohwQ0S48X+IaDiKBibsiGit/hit/i06J0IatkRsaWPZxoZR3OIgheKYjUHbkoLj/jawOWOjsDQ3rUfTUXcIQ5c9IqhROlPlMf5lwm6saYx2KC4dJSg6BhsKzMZTBK3hSqV0XsQ6p9ic9EexximtMyJaOdMfDURjTnIiyrqe/d5fOauyIgb6ha4wJRmRsoKekRXRyvVPxKUiGkVGEFnfvswwXQMzRiiik4xYEpm+zHILDS4Wy8UFeE7jtfUK/i15Ea2seRB5uQeI0Bs/ew1mcWGw7kKkNjYrUj9aZP7m4o1Zzg1W512IOKVSEZUVufm+XyRu89dwOl/OmWQEdFbkHuD+gMgSNy+yNK+7EcllxLpUZEqXflbk3QIv+HdLc7FYvOlCxFkNuiWitc5dIx8AeU8iKSa8DHRBnd61NOREPoXm5wcRZmBGVJIRlRFZAawxKatbriK/efud+AtkisWkRyKZUwsVosjbKVMR91sZWQMyuW9c77vz1NAVlBGAY3etT9Dgcypy/mU2uz6DzsiLQCqyAs/NDXhWicjZ7Mt88fUaOoJOrWMZmQDEa2TDZFfk7uoO4GoGHUGf7PpIRlbQ4m32Yr+8hI4gETgi8g1arFKR8+uvl3fQFXT7PfKBOJ00uZlmRK5+zD5CJ1BGNBw+tfLALlezGjrgkZ8jKe18nAF8nGHRDfTf79+KzK7Pz7u+2J2Fg9fIbd5jCk2Wlyw+EA/etdbTnMfPNbQ56/5fFLVHpGf4jMDTEMl+r+VGvXqqsO8LOq1c1bPHCuWe736t6VdKdGXKVkbo3KpGJfQFbUeVs9mMqBJNxuPT8SnRbKS940MhcaOOXCgu9whoYTyw3nikIt7EOlONPNWorkeBUFe176lDGxuhDANYhMjQsymo8qMRf1gaQathSZ3bmCqO163p8LlufKybnlooosrSObMX95iBdOR4jHtEqEOPRIRyosLjfB/msLKhahYIFiECxzF486IOfPliU1Fo+ENiUSI0l2/EJeKiYeUQZ2NJK/mmRQ0EMiJqg03xevinwm4Thd1xI9R2YBtfKhqIsc3jFM2llI8uYwD2UMAGmlQhwSMRQVSfCBqpCOgNyuuEDaEq9oYOKg9BR+5O125ovTtCA1TRHKEH0EOnIqTixx8ARaXC2pcB5RsQ+o6zEwR4dLuNTZoqzrpdAFqRcS6gfJAIETUASIl2qBGrGA5JCNAOJKPUBiROQiHxXcBma8ydLpKIJMSc6WYrzkz7YY94eAeNYJonjEWzzHK0FwV20Nsh/T//FLBPiAg3RIQbIsINEeGGiHBDRLghItwQEW6ICDdEhBsiwg0R4YaIcENEuCEi3BARbogIN0SEGyLCDRHhhohwQ0S4ISLcGBZFz37Zn0cNi2djeALUL4pBUfc+J2qMGieD58O+UzwbnPwC9rQ9R9RHLAMAAAAASUVORK5CYII=", |
|||
"description": "Displays the number of alarms based on selected filter.", |
|||
"descriptor": { |
|||
"type": "latest", |
|||
"sizeX": 3.5, |
|||
"sizeY": 1.5, |
|||
"resources": [], |
|||
"templateHtml": "<tb-count-widget \n [ctx]=\"ctx\"\n [widgetTitlePanel]=\"widgetTitlePanel\"\n alarmElseEntity=\"true\">\n</tb-count-widget>", |
|||
"templateCss": "", |
|||
"controllerScript": "self.onInit = function() {\n self.ctx.$scope.countWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.countWidget.onDataUpdated();\n};\n\nself.typeParameters = function() {\n return {\n maxDatasources: 1,\n maxDataKeys: 1,\n singleEntity: true,\n previewWidth: '220px',\n previewHeight: '100px',\n embedTitlePanel: true,\n hideDataSettings: true\n };\n};\n\nself.actionSources = function() {\n return {\n 'cardClick': {\n name: 'widget-action.card-click',\n multiple: false\n }\n };\n}\n\nself.onDestroy = function() {\n};\n", |
|||
"settingsSchema": "", |
|||
"dataKeySettingsSchema": "", |
|||
"settingsDirective": "tb-alarm-count-widget-settings", |
|||
"hasBasicMode": true, |
|||
"basicModeDirective": "tb-alarm-count-basic-config", |
|||
"defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"count\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.2392660816082064,\"funcBody\":\"var value = Number((prevValue + Math.random() * 4 - 2).toFixed(0));\\nif (value < 0) {\\n\\tvalue = 0;\\n} else if (value > 25) {\\n\\tvalue = 25;\\n}\\nreturn value;\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"],\"assignedToCurrentUser\":false,\"assigneeId\":null}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":false,\"backgroundColor\":\"rgb(255, 255, 255)\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"0px\",\"settings\":{\"showLabel\":true,\"label\":\"Total\",\"labelFont\":{\"family\":\"Roboto\",\"size\":12,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"400\",\"lineHeight\":\"16px\"},\"labelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.54)\",\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"showIcon\":true,\"iconSize\":20,\"iconSizeUnit\":\"px\",\"icon\":\"warning\",\"iconColor\":{\"type\":\"constant\",\"color\":\"rgba(255, 255, 255, 1)\",\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"showIconBackground\":true,\"iconBackgroundSize\":36,\"iconBackgroundSizeUnit\":\"px\",\"iconBackgroundColor\":{\"type\":\"range\",\"color\":\"rgba(0, 105, 92, 1)\",\"rangeList\":[{\"from\":0,\"to\":0,\"color\":\"rgba(0, 105, 92, 1)\"},{\"from\":1,\"to\":null,\"color\":\"rgba(209, 39, 48, 1)\"}],\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":20,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"24px\"},\"valueColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"showChevron\":false,\"chevronSize\":24,\"chevronSizeUnit\":\"px\",\"chevronColor\":\"rgba(0, 0, 0, 0.38)\",\"layout\":\"column\"},\"title\":\"Alarm count\",\"dropShadow\":true,\"enableFullscreen\":false,\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400},\"units\":\"\",\"decimals\":null,\"useDashboardTimewindow\":true,\"showLegend\":false,\"widgetStyle\":{},\"actions\":{},\"configMode\":\"basic\",\"displayTimewindow\":true,\"margin\":\"0px\",\"borderRadius\":\"0px\",\"widgetCss\":\"\",\"pageSize\":1024,\"noDataDisplayMessage\":\"\",\"showTitleIcon\":false,\"titleTooltip\":\"\",\"titleFont\":{\"size\":12,\"sizeUnit\":\"px\",\"family\":null,\"weight\":null,\"style\":null,\"lineHeight\":\"1\"},\"titleIcon\":\"\",\"iconColor\":\"rgba(0, 0, 0, 0.87)\",\"iconSize\":\"14px\",\"timewindowStyle\":{\"showIcon\":true,\"iconSize\":\"14px\",\"icon\":\"query_builder\",\"iconPosition\":\"left\",\"font\":{\"size\":12,\"sizeUnit\":\"px\",\"family\":null,\"weight\":null,\"style\":null,\"lineHeight\":\"1\"},\"color\":null},\"titleColor\":\"rgba(0, 0, 0, 0.54)\"}" |
|||
}, |
|||
"externalId": null |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
{ |
|||
"fqn": "entity_count", |
|||
"name": "Entity count", |
|||
"deprecated": false, |
|||
"image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACgCAMAAAB+IdObAAAAnFBMVEXg4ODf39/g4ODg4OAAAAD////9/f3g4ODxjRf7+/v6+vr19fX39/ft7e3z8/P5+fnx8fH2uG4hISH09PTk5OTv7+/51KhYWFisrKzLy8svLy+fn5/61Kg8PDyxsbGpqam6urqXl5fzmzSQkJCCgoJ0dHTc3NzV1dXDw8PHx8fylCX4xIhKSkrU1NT74MD1rFb98eKPj49mZmb+9/EJyyRgAAAABXRSTlPvIL+vAC9A4IoAAATwSURBVHja7ZyJctowEEBNkxX1ATbGYG4IIUBzND3+/9+6QkrWVHacpB13ne6TWVu33kgM08DUu+x88rpt56Jz6XW8kYKWoxLUu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S6JDF5zJhoKjCYlqYEQ/Gmay26m9uCZtPRFlKXoa1PzobTXzFHgfZwjxacvmSP0QWTvohTWXi6m5vO2Ra2goKBss/9Timk0amTzTtDUFPieeIYPVwRRCE+EiBxHAcxRvOgA2ZNQKhCl9kXlfux7W6DzVFn268wVmBvNJQJuoCiKbF3H1EIuCKgTaoIMJVX2MutcB9trrJfUJjKhqByUGU1XJEnCk39KjN19qScyqpe6reuZzNQTpmMUpWTqhMVP+Fo129qtIa7I0WX1wn9VW14ey3ghVSI6FrTQp2S9dKpgBW20eZ1oEQPT42dZBeizKVoMpuzg9CMxRWRhitC0AqKOSeeD0UrKKyvMI6xsZLudAaSd5b07PE//xSwTYgIN0SEGyLCDRHhhohwQ0S4ISLcEBFuiAg3RIQbIsINEeGGiHBDRLghItwQEW6ICDdEhBsiwg0R4YaIcENEuCEi3Oh6Xqt+D1+F6nqfRvABSC68jpe0fk/UCDUuOxfdtuN96lz+Agb8xlnnx/XqAAAAAElFTkSuQmCC", |
|||
"description": "Displays the number of entities based on selected filter.", |
|||
"descriptor": { |
|||
"type": "latest", |
|||
"sizeX": 3.5, |
|||
"sizeY": 1.5, |
|||
"resources": [], |
|||
"templateHtml": "<tb-count-widget \n [ctx]=\"ctx\"\n [widgetTitlePanel]=\"widgetTitlePanel\"\n alarmElseEntity=\"false\">\n</tb-count-widget>", |
|||
"templateCss": "", |
|||
"controllerScript": "self.onInit = function() {\n self.ctx.$scope.countWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.countWidget.onDataUpdated();\n};\n\nself.typeParameters = function() {\n return {\n maxDatasources: 1,\n maxDataKeys: 1,\n singleEntity: true,\n previewWidth: '220px',\n previewHeight: '100px',\n embedTitlePanel: true,\n hideDataSettings: true\n };\n};\n\nself.actionSources = function() {\n return {\n 'cardClick': {\n name: 'widget-action.card-click',\n multiple: false\n }\n };\n}\n\nself.onDestroy = function() {\n};\n", |
|||
"settingsSchema": "", |
|||
"dataKeySettingsSchema": "", |
|||
"settingsDirective": "tb-entity-count-widget-settings", |
|||
"hasBasicMode": true, |
|||
"basicModeDirective": "tb-entity-count-basic-config", |
|||
"defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"count\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.2392660816082064,\"funcBody\":\"return 150;\",\"aggregationType\":null,\"units\":null,\"decimals\":null,\"usePostProcessing\":null,\"postFuncBody\":null}],\"alarmFilterConfig\":{\"statusList\":[\"ACTIVE\"],\"assignedToCurrentUser\":false,\"assigneeId\":null}}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":false,\"backgroundColor\":\"rgb(255, 255, 255)\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"0px\",\"settings\":{\"showLabel\":true,\"label\":\"Devices\",\"labelFont\":{\"family\":\"Roboto\",\"size\":12,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"400\",\"lineHeight\":\"16px\"},\"labelColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.54)\",\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"showIcon\":true,\"iconSize\":20,\"iconSizeUnit\":\"px\",\"icon\":\"devices\",\"iconColor\":{\"type\":\"constant\",\"color\":\"rgba(255, 255, 255, 1)\",\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"showIconBackground\":true,\"iconBackgroundSize\":36,\"iconBackgroundSizeUnit\":\"px\",\"iconBackgroundColor\":{\"type\":\"constant\",\"color\":\"rgb(241, 141, 23)\",\"rangeList\":[],\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"valueFont\":{\"family\":\"Roboto\",\"size\":20,\"sizeUnit\":\"px\",\"style\":\"normal\",\"weight\":\"500\",\"lineHeight\":\"24px\"},\"valueColor\":{\"type\":\"constant\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"colorFunction\":\"var temperature = value;\\nif (typeof temperature !== undefined) {\\n var percent = (temperature + 60)/120 * 100;\\n return tinycolor.mix('blue', 'red', percent).toHexString();\\n}\\nreturn 'blue';\"},\"showChevron\":false,\"chevronSize\":24,\"chevronSizeUnit\":\"px\",\"chevronColor\":\"rgba(0, 0, 0, 0.38)\",\"layout\":\"column\"},\"title\":\"Entity count\",\"dropShadow\":true,\"enableFullscreen\":false,\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400},\"units\":\"\",\"decimals\":null,\"useDashboardTimewindow\":true,\"showLegend\":false,\"widgetStyle\":{},\"actions\":{},\"configMode\":\"basic\",\"displayTimewindow\":true,\"margin\":\"0px\",\"borderRadius\":\"0px\",\"widgetCss\":\"\",\"pageSize\":1024,\"noDataDisplayMessage\":\"\",\"showTitleIcon\":false,\"titleTooltip\":\"\",\"titleFont\":{\"size\":12,\"sizeUnit\":\"px\",\"family\":null,\"weight\":null,\"style\":null,\"lineHeight\":\"1\"},\"titleIcon\":\"\",\"iconColor\":\"rgba(0, 0, 0, 0.87)\",\"iconSize\":\"14px\",\"timewindowStyle\":{\"showIcon\":true,\"iconSize\":\"14px\",\"icon\":\"query_builder\",\"iconPosition\":\"left\",\"font\":{\"size\":12,\"sizeUnit\":\"px\",\"family\":null,\"weight\":null,\"style\":null,\"lineHeight\":\"1\"},\"color\":null},\"titleColor\":\"rgba(0, 0, 0, 0.54)\"}" |
|||
}, |
|||
"externalId": null |
|||
} |
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,19 @@ |
|||
{ |
|||
"fqn": "gateway_widgets.gateway_connectors", |
|||
"name": "Gateway connectors", |
|||
"deprecated": false, |
|||
"image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACgCAMAAAB+IdObAAAA7VBMVEXg4ODf39/g4ODg4OAAAAD////88vPg4OD39/fo6Ojv7+9hYWHt7e2GhobLy8upqan99fb9+Pn++/zDw8OXl5fb29vnjJHspao9PT1VVVXPz8/l5eX65efd3d1tbW2enp7hc3nz8/O2tra6urrU1NT32dvcWmHxv8KPj4+YmJixsbGgoKBzc3P+/f332Nuqqqp6enrXQEj0zM7Z2dlJSUnZTVR9fX3pmZ2wsLDusraSkpLr6+tpaWmRkZGNjY3eZ23k5OTkf4Xjf4XkgIWBgYHeZm3aTVXvsrbfZ23UMTnFxcXusrWzs7PkgIbeZmxYj4YaAAAABXRSTlPvIMCwAL23wXkAAAxzSURBVHja7NbBquMgGIbhdM75KLbILILw/b+g6L4YqKvCuf/bmtjNTLMJswm2+BIU1M2DWTh9n35N53fv6/Q9nabLDW/e7bIyvi74gC7rb/X299G6TdMZH9F5QDprQHprQHprQHprC1FrM96xDSQyLAzYTWVGX71CDC1QqEi5GEDVlRnITqMBoFHbWLJJkdYhlXZo1nl+LuKw9iEzFSvCG6mBBbZWYQblKjXB1sCIzKuIu1KyabsKqbSZQeQ4yT4k0qD1oIetaf1QLbhAmWdmxJpkgWdWZgRJCAEiq1GQrOKo9iGFd7SCAJl3K4BY0MIwR4YgdIxYaxCxTQwJgIosGYe1D1FmwAVdBCgbSGFWVfABmLSBwM+WPd0IRFSv1WcWI4IXiPLhtCCIK5wdHylWp2KfkBCMYcZh7UP8lZQ78NOmVwiKsP6GF/IHEMa0kME3yHMxJBzWPgRI/u+0zad/xnYobbb+v/FEGZDeG5DeGpDeGpDeGpDeGpDeGpDeGpDe+lDIH/LqoMVtGAjD8OmDDO4kBzUgjWAGDXtY6EEC+STw//9btZO27CYBey+l0PdgsBnLPAgsEpHy58YBeMe9mvEhugJS8KL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mWPWWJKjr2aQxTIHpBGik3a4x4EdUPRBr1Xin9V/XswgPKCyN3Rce+aac+9JURgka48ruMpv2qES9CG8Lbo+h4bA2cBU6tLFA17QOrAoQa3WHArsn71dPII1ES3ZFGL+a+r/OE6EyksYd9SrUjQhRpLE6xA2I7OZYch4ElJeJGaa0GeVPSWDLTL6QQ1MlU3TYBfKEY8ChKsWnjs2wSKERhW+pQFcAWafGuCPWkMbccZ6BIYy4t+S7TsqakUeXGxyYcXpWppb7eUUXHoawlja1domwOSeaihZI0jj9J+cbJg6MhjZtOLFc6mpVh0qxmfdbkN2vTR5sXjehkl46jEAZgtOdNkEZQMXLSjR8IPj152I2fbH7UnR/Rfvzg0emx6+Thg8ffAbOE0ZCNlb+aAAAAAElFTkSuQmCC", |
|||
"description": "Allow to create and manage gateway connectors.", |
|||
"descriptor": { |
|||
"type": "latest", |
|||
"sizeX": 11, |
|||
"sizeY": 8, |
|||
"resources": [], |
|||
"templateHtml": "<tb-gateway-connector [device]=\"entityId\" *ngIf=\"entityId\" [ctx]=\"ctx\"></tb-gateway-connector>", |
|||
"templateCss": "", |
|||
"controllerScript": "self.onInit = function() {\n if (self.ctx.datasources && self.ctx.datasources.length) {\n self.ctx.$scope.entityId = self.ctx.datasources[0].entity.id;\n }\n};\n\nself.typeParameters = function() {\n return {\n dataKeysOptional: true,\n singleEntity: true\n };\n}", |
|||
"settingsSchema": "{}", |
|||
"dataKeySettingsSchema": "{}\n", |
|||
"defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"var value = prevValue + Math.random() * 100 - 50;\\nvar multiplier = Math.pow(10, 2 || 0);\\nvar value = Math.round(value * multiplier) / multiplier;\\nif (value < -1000) {\\n\\tvalue = -1000;\\n} else if (value > 1000) {\\n\\tvalue = 1000;\\n}\\nreturn value;\"}]}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":false,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{},\"title\":\"Gateway connectors\",\"showTitleIcon\":false,\"titleTooltip\":\"\",\"dropShadow\":true,\"enableFullscreen\":false,\"enableDataExport\":false,\"widgetStyle\":{},\"widgetCss\":\"\",\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":500},\"pageSize\":1024,\"noDataDisplayMessage\":\"\",\"showLegend\":false}" |
|||
} |
|||
} |
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,5 +1,2 @@ |
|||
--PostgreSQL specific truncate to fit constraints |
|||
TRUNCATE TABLE device_credentials, device, device_profile, asset, asset_profile, ota_package, rule_node_state, rule_node, rule_chain, alarm_comment, alarm, entity_alarm; |
|||
|
|||
-- Decrease seq_id column to make sure to cover cases of new sequential cycle during the tests |
|||
ALTER SEQUENCE edge_event_seq_id_seq MAXVALUE 256; |
|||
TRUNCATE TABLE device_credentials, device, device_profile, asset, asset_profile, ota_package, rule_node_state, rule_node, rule_chain, alarm_comment, alarm, entity_alarm; |
|||
@ -0,0 +1,61 @@ |
|||
<!-- |
|||
|
|||
Copyright © 2016-2023 The Thingsboard Authors |
|||
|
|||
Licensed under the Apache License, Version 2.0 (the "License"); |
|||
you may not use this file except in compliance with the License. |
|||
You may obtain a copy of the License at |
|||
|
|||
http://www.apache.org/licenses/LICENSE-2.0 |
|||
|
|||
Unless required by applicable law or agreed to in writing, software |
|||
distributed under the License is distributed on an "AS IS" BASIS, |
|||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
See the License for the specific language governing permissions and |
|||
limitations under the License. |
|||
|
|||
--> |
|||
<ng-container [formGroup]="alarmCountWidgetConfigForm"> |
|||
<div class="tb-form-panel"> |
|||
<div fxLayout="row" fxLayoutAlign="space-between center"> |
|||
<div class="tb-form-panel-title" translate>alarm.filter</div> |
|||
<button mat-button color="primary" |
|||
(click)="alarmFilterConfig.reset()"> |
|||
{{ 'action.reset' | translate }} |
|||
</button> |
|||
</div> |
|||
<tb-alarm-filter-config #alarmFilterConfig buttonMode="false" |
|||
propagatedFilter="false" |
|||
formControlName="alarmFilterConfig" |
|||
[initialAlarmFilterConfig]="{ statusList: [alarmSearchStatus.ACTIVE] }"></tb-alarm-filter-config> |
|||
</div> |
|||
<div class="tb-form-panel"> |
|||
<div class="tb-form-panel-title" translate>widget-config.appearance</div> |
|||
<tb-count-widget-settings alarmElseEntity="true" formControlName="settings"></tb-count-widget-settings> |
|||
</div> |
|||
<div class="tb-form-panel"> |
|||
<div class="tb-form-panel-title" translate>widget-config.card-appearance</div> |
|||
<div class="tb-form-row space-between"> |
|||
<div>{{ 'widgets.background.background' | translate }}</div> |
|||
<tb-color-input asBoxInput |
|||
colorClearButton |
|||
formControlName="backgroundColor"> |
|||
</tb-color-input> |
|||
</div> |
|||
<div class="tb-form-row space-between column-lt-md"> |
|||
<div translate>widget-config.show-card-buttons</div> |
|||
<mat-chip-listbox multiple formControlName="cardButtons"> |
|||
<mat-chip-option value="fullscreen">{{ 'fullscreen.fullscreen' | translate }}</mat-chip-option> |
|||
</mat-chip-listbox> |
|||
</div> |
|||
<div class="tb-form-row space-between"> |
|||
<div>{{ 'widget-config.card-border-radius' | translate }}</div> |
|||
<mat-form-field appearance="outline" subscriptSizing="dynamic"> |
|||
<input matInput formControlName="borderRadius" placeholder="{{ 'widget-config.set' | translate }}"> |
|||
</mat-form-field> |
|||
</div> |
|||
</div> |
|||
<tb-widget-actions-panel |
|||
formControlName="actions"> |
|||
</tb-widget-actions-panel> |
|||
</ng-container> |
|||
@ -0,0 +1,107 @@ |
|||
///
|
|||
/// Copyright © 2016-2023 The Thingsboard Authors
|
|||
///
|
|||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|||
/// you may not use this file except in compliance with the License.
|
|||
/// You may obtain a copy of the License at
|
|||
///
|
|||
/// http://www.apache.org/licenses/LICENSE-2.0
|
|||
///
|
|||
/// Unless required by applicable law or agreed to in writing, software
|
|||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
/// See the License for the specific language governing permissions and
|
|||
/// limitations under the License.
|
|||
///
|
|||
|
|||
import { Component } from '@angular/core'; |
|||
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; |
|||
import { Store } from '@ngrx/store'; |
|||
import { AppState } from '@core/core.state'; |
|||
import { BasicWidgetConfigComponent } from '@home/components/widget/config/widget-config.component.models'; |
|||
import { WidgetConfigComponentData } from '@home/models/widget-component.models'; |
|||
import { DatasourceType, WidgetConfig, widgetType, } from '@shared/models/widget.models'; |
|||
import { WidgetConfigComponent } from '@home/components/widget/widget-config.component'; |
|||
import { DataKeyType } from '@shared/models/telemetry/telemetry.models'; |
|||
import { isUndefined } from '@core/utils'; |
|||
import { getAlarmFilterConfig, setAlarmFilterConfig } from '@shared/models/widget-settings.models'; |
|||
import { UtilsService } from '@core/services/utils.service'; |
|||
import { AlarmSearchStatus } from '@shared/models/alarm.models'; |
|||
import { |
|||
countDefaultSettings, |
|||
CountWidgetSettings |
|||
} from '@home/components/widget/lib/count/count-widget.models'; |
|||
|
|||
@Component({ |
|||
selector: 'tb-alarm-count-basic-config', |
|||
templateUrl: './alarm-count-basic-config.component.html', |
|||
styleUrls: ['../basic-config.scss'] |
|||
}) |
|||
export class AlarmCountBasicConfigComponent extends BasicWidgetConfigComponent { |
|||
|
|||
alarmSearchStatus = AlarmSearchStatus; |
|||
|
|||
alarmCountWidgetConfigForm: UntypedFormGroup; |
|||
|
|||
constructor(protected store: Store<AppState>, |
|||
protected widgetConfigComponent: WidgetConfigComponent, |
|||
private utils: UtilsService, |
|||
private fb: UntypedFormBuilder) { |
|||
super(store, widgetConfigComponent); |
|||
} |
|||
|
|||
protected configForm(): UntypedFormGroup { |
|||
return this.alarmCountWidgetConfigForm; |
|||
} |
|||
|
|||
protected setupDefaults(configData: WidgetConfigComponentData) { |
|||
let datasources = configData.config.datasources; |
|||
if (!datasources || !datasources.length) { |
|||
datasources = [{}]; |
|||
configData.config.datasources = datasources; |
|||
} |
|||
datasources[0].type = DatasourceType.alarmCount; |
|||
datasources[0].alarmFilterConfig = {statusList: [AlarmSearchStatus.ACTIVE]}; |
|||
datasources[0].dataKeys = [this.utils.createKey({name: 'count'}, DataKeyType.count)]; |
|||
} |
|||
|
|||
protected onConfigSet(configData: WidgetConfigComponentData) { |
|||
const settings: CountWidgetSettings = {...countDefaultSettings(true), ...(configData.config.settings || {})}; |
|||
this.alarmCountWidgetConfigForm = this.fb.group({ |
|||
alarmFilterConfig: [getAlarmFilterConfig(configData.config.datasources), []], |
|||
|
|||
settings: [settings, []], |
|||
|
|||
backgroundColor: [configData.config.backgroundColor, []], |
|||
cardButtons: [this.getCardButtons(configData.config), []], |
|||
borderRadius: [configData.config.borderRadius, []], |
|||
|
|||
actions: [configData.config.actions || {}, []] |
|||
}); |
|||
} |
|||
|
|||
protected prepareOutputConfig(config: any): WidgetConfigComponentData { |
|||
setAlarmFilterConfig(config.alarmFilterConfig, this.widgetConfig.config.datasources); |
|||
|
|||
this.widgetConfig.config.settings = {...(this.widgetConfig.config.settings || {}), ...config.settings}; |
|||
|
|||
this.widgetConfig.config.backgroundColor = config.backgroundColor; |
|||
this.setCardButtons(config.cardButtons, this.widgetConfig.config); |
|||
this.widgetConfig.config.borderRadius = config.borderRadius; |
|||
|
|||
this.widgetConfig.config.actions = config.actions; |
|||
return this.widgetConfig; |
|||
} |
|||
|
|||
private getCardButtons(config: WidgetConfig): string[] { |
|||
const buttons: string[] = []; |
|||
if (isUndefined(config.enableFullscreen) || config.enableFullscreen) { |
|||
buttons.push('fullscreen'); |
|||
} |
|||
return buttons; |
|||
} |
|||
|
|||
private setCardButtons(buttons: string[], config: WidgetConfig) { |
|||
config.enableFullscreen = buttons.includes('fullscreen'); |
|||
} |
|||
} |
|||
@ -0,0 +1,56 @@ |
|||
<!-- |
|||
|
|||
Copyright © 2016-2023 The Thingsboard Authors |
|||
|
|||
Licensed under the Apache License, Version 2.0 (the "License"); |
|||
you may not use this file except in compliance with the License. |
|||
You may obtain a copy of the License at |
|||
|
|||
http://www.apache.org/licenses/LICENSE-2.0 |
|||
|
|||
Unless required by applicable law or agreed to in writing, software |
|||
distributed under the License is distributed on an "AS IS" BASIS, |
|||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
See the License for the specific language governing permissions and |
|||
limitations under the License. |
|||
|
|||
--> |
|||
<ng-container [formGroup]="entityCountWidgetConfigForm"> |
|||
<tb-datasources |
|||
[configMode]="basicMode" |
|||
hideDatasourcesMode |
|||
hideDatasourceLabel |
|||
hideDataKeys |
|||
displayDatasourceFilterForBasicMode |
|||
formControlName="datasources"> |
|||
</tb-datasources> |
|||
<div class="tb-form-panel"> |
|||
<div class="tb-form-panel-title" translate>widget-config.appearance</div> |
|||
<tb-count-widget-settings alarmElseEntity="false" formControlName="settings"></tb-count-widget-settings> |
|||
</div> |
|||
<div class="tb-form-panel"> |
|||
<div class="tb-form-panel-title" translate>widget-config.card-appearance</div> |
|||
<div class="tb-form-row space-between"> |
|||
<div>{{ 'widgets.background.background' | translate }}</div> |
|||
<tb-color-input asBoxInput |
|||
colorClearButton |
|||
formControlName="backgroundColor"> |
|||
</tb-color-input> |
|||
</div> |
|||
<div class="tb-form-row space-between column-lt-md"> |
|||
<div translate>widget-config.show-card-buttons</div> |
|||
<mat-chip-listbox multiple formControlName="cardButtons"> |
|||
<mat-chip-option value="fullscreen">{{ 'fullscreen.fullscreen' | translate }}</mat-chip-option> |
|||
</mat-chip-listbox> |
|||
</div> |
|||
<div class="tb-form-row space-between"> |
|||
<div>{{ 'widget-config.card-border-radius' | translate }}</div> |
|||
<mat-form-field appearance="outline" subscriptSizing="dynamic"> |
|||
<input matInput formControlName="borderRadius" placeholder="{{ 'widget-config.set' | translate }}"> |
|||
</mat-form-field> |
|||
</div> |
|||
</div> |
|||
<tb-widget-actions-panel |
|||
formControlName="actions"> |
|||
</tb-widget-actions-panel> |
|||
</ng-container> |
|||
@ -0,0 +1,98 @@ |
|||
///
|
|||
/// Copyright © 2016-2023 The Thingsboard Authors
|
|||
///
|
|||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|||
/// you may not use this file except in compliance with the License.
|
|||
/// You may obtain a copy of the License at
|
|||
///
|
|||
/// http://www.apache.org/licenses/LICENSE-2.0
|
|||
///
|
|||
/// Unless required by applicable law or agreed to in writing, software
|
|||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
/// See the License for the specific language governing permissions and
|
|||
/// limitations under the License.
|
|||
///
|
|||
|
|||
import { Component } from '@angular/core'; |
|||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; |
|||
import { Store } from '@ngrx/store'; |
|||
import { AppState } from '@core/core.state'; |
|||
import { BasicWidgetConfigComponent } from '@home/components/widget/config/widget-config.component.models'; |
|||
import { WidgetConfigComponentData } from '@home/models/widget-component.models'; |
|||
import { DatasourceType, WidgetConfig, } from '@shared/models/widget.models'; |
|||
import { WidgetConfigComponent } from '@home/components/widget/widget-config.component'; |
|||
import { DataKeyType } from '@shared/models/telemetry/telemetry.models'; |
|||
import { isUndefined } from '@core/utils'; |
|||
import { UtilsService } from '@core/services/utils.service'; |
|||
import { countDefaultSettings, CountWidgetSettings } from '@home/components/widget/lib/count/count-widget.models'; |
|||
|
|||
@Component({ |
|||
selector: 'tb-entity-count-basic-config', |
|||
templateUrl: './entity-count-basic-config.component.html', |
|||
styleUrls: ['../basic-config.scss'] |
|||
}) |
|||
export class EntityCountBasicConfigComponent extends BasicWidgetConfigComponent { |
|||
|
|||
entityCountWidgetConfigForm: UntypedFormGroup; |
|||
|
|||
constructor(protected store: Store<AppState>, |
|||
protected widgetConfigComponent: WidgetConfigComponent, |
|||
private utils: UtilsService, |
|||
private fb: UntypedFormBuilder) { |
|||
super(store, widgetConfigComponent); |
|||
} |
|||
|
|||
protected configForm(): UntypedFormGroup { |
|||
return this.entityCountWidgetConfigForm; |
|||
} |
|||
|
|||
protected setupDefaults(configData: WidgetConfigComponentData) { |
|||
let datasources = configData.config.datasources; |
|||
if (!datasources || !datasources.length) { |
|||
datasources = [{}]; |
|||
configData.config.datasources = datasources; |
|||
} |
|||
datasources[0].type = DatasourceType.entityCount; |
|||
datasources[0].dataKeys = [this.utils.createKey({name: 'count'}, DataKeyType.count)]; |
|||
} |
|||
|
|||
protected onConfigSet(configData: WidgetConfigComponentData) { |
|||
const settings: CountWidgetSettings = {...countDefaultSettings(false), ...(configData.config.settings || {})}; |
|||
this.entityCountWidgetConfigForm = this.fb.group({ |
|||
datasources: [configData.config.datasources, []], |
|||
settings: [settings, []], |
|||
|
|||
backgroundColor: [configData.config.backgroundColor, []], |
|||
cardButtons: [this.getCardButtons(configData.config), []], |
|||
borderRadius: [configData.config.borderRadius, []], |
|||
|
|||
actions: [configData.config.actions || {}, []] |
|||
}); |
|||
} |
|||
|
|||
protected prepareOutputConfig(config: any): WidgetConfigComponentData { |
|||
this.widgetConfig.config.datasources = config.datasources; |
|||
|
|||
this.widgetConfig.config.settings = {...(this.widgetConfig.config.settings || {}), ...config.settings}; |
|||
|
|||
this.widgetConfig.config.backgroundColor = config.backgroundColor; |
|||
this.setCardButtons(config.cardButtons, this.widgetConfig.config); |
|||
this.widgetConfig.config.borderRadius = config.borderRadius; |
|||
|
|||
this.widgetConfig.config.actions = config.actions; |
|||
return this.widgetConfig; |
|||
} |
|||
|
|||
private getCardButtons(config: WidgetConfig): string[] { |
|||
const buttons: string[] = []; |
|||
if (isUndefined(config.enableFullscreen) || config.enableFullscreen) { |
|||
buttons.push('fullscreen'); |
|||
} |
|||
return buttons; |
|||
} |
|||
|
|||
private setCardButtons(buttons: string[], config: WidgetConfig) { |
|||
config.enableFullscreen = buttons.includes('fullscreen'); |
|||
} |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
<!-- |
|||
|
|||
Copyright © 2016-2023 The Thingsboard Authors |
|||
|
|||
Licensed under the Apache License, Version 2.0 (the "License"); |
|||
you may not use this file except in compliance with the License. |
|||
You may obtain a copy of the License at |
|||
|
|||
http://www.apache.org/licenses/LICENSE-2.0 |
|||
|
|||
Unless required by applicable law or agreed to in writing, software |
|||
distributed under the License is distributed on an "AS IS" BASIS, |
|||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
See the License for the specific language governing permissions and |
|||
limitations under the License. |
|||
|
|||
--> |
|||
<div class="tb-count-panel" [class.tb-count-pointer]="showChevron" (click)="cardClick($event)"> |
|||
<div class="tb-count-panel-column"> |
|||
<ng-container *ngTemplateOutlet="widgetTitlePanel"></ng-container> |
|||
<div class="tb-count-panel-row"> |
|||
<div class="tb-count-icon-panel" *ngIf="showIconBackground || showIcon" |
|||
[style]="{minWidth: iconBackgroundSize, minHeight: iconBackgroundSize}"> |
|||
<div *ngIf="showIconBackground" class="tb-count-icon-background-panel"> |
|||
<div [style]="iconBackgroundStyle" [style.background-color]="iconBackgroundColor.color"></div> |
|||
</div> |
|||
<tb-icon *ngIf="showIcon" [style]="iconStyle" [style.color]="iconColor.color">{{ icon }}</tb-icon> |
|||
</div> |
|||
<div class="tb-count-label-value-panel" [class.tb-count-layout-row]="layout === countCardLayout.row"> |
|||
<div *ngIf="showLabel" [style]="labelStyle" [style.color]="labelColor.color">{{ label }}</div> |
|||
<div *ngIf="layout === countCardLayout.row" style="flex: 1;"></div> |
|||
<div [style]="valueStyle" [style.color]="valueColor.color">{{ valueText }}</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<tb-icon *ngIf="showChevron" [style]="chevronStyle">chevron_right</tb-icon> |
|||
</div> |
|||
@ -0,0 +1,80 @@ |
|||
/** |
|||
* Copyright © 2016-2023 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0 |
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
:host { |
|||
.tb-count-panel { |
|||
width: 100%; |
|||
height: 100%; |
|||
display: flex; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
gap: 12px; |
|||
padding: 12px; |
|||
&.tb-count-pointer { |
|||
cursor: pointer; |
|||
} |
|||
.tb-count-panel-column { |
|||
flex: 1; |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 12px; |
|||
} |
|||
.tb-count-panel-row { |
|||
flex: 1; |
|||
display: flex; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
gap: 12px; |
|||
} |
|||
.tb-count-icon-panel { |
|||
position: relative; |
|||
display: flex; |
|||
flex-direction: column; |
|||
align-items: center; |
|||
justify-content: center; |
|||
.mat-icon { |
|||
z-index: 1; |
|||
} |
|||
} |
|||
.tb-count-icon-background-panel { |
|||
position: absolute; |
|||
inset: 0; |
|||
display: flex; |
|||
flex-direction: column; |
|||
align-items: center; |
|||
justify-content: center; |
|||
} |
|||
.tb-count-label-value-panel { |
|||
flex: 1; |
|||
display: flex; |
|||
flex-direction: column; |
|||
place-content: flex-start space-around; |
|||
align-items: flex-start; |
|||
gap: 0; |
|||
&.tb-count-layout-row { |
|||
flex-direction: row; |
|||
align-items: center; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
:host ::ng-deep { |
|||
.tb-count-panel { |
|||
.tb-widget-title { |
|||
padding: 0; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,148 @@ |
|||
///
|
|||
/// Copyright © 2016-2023 The Thingsboard Authors
|
|||
///
|
|||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|||
/// you may not use this file except in compliance with the License.
|
|||
/// You may obtain a copy of the License at
|
|||
///
|
|||
/// http://www.apache.org/licenses/LICENSE-2.0
|
|||
///
|
|||
/// Unless required by applicable law or agreed to in writing, software
|
|||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
/// See the License for the specific language governing permissions and
|
|||
/// limitations under the License.
|
|||
///
|
|||
|
|||
import { ChangeDetectorRef, Component, Input, OnInit, TemplateRef } from '@angular/core'; |
|||
import { WidgetContext } from '@home/models/widget-component.models'; |
|||
import { formatValue } from '@core/utils'; |
|||
import { |
|||
ColorProcessor, |
|||
ComponentStyle, |
|||
getSingleTsValue, |
|||
iconStyle, |
|||
textStyle |
|||
} from '@shared/models/widget-settings.models'; |
|||
import { WidgetComponent } from '@home/components/widget/widget.component'; |
|||
import { |
|||
CountCardLayout, |
|||
countDefaultSettings, |
|||
CountWidgetSettings |
|||
} from '@home/components/widget/lib/count/count-widget.models'; |
|||
import { coerceBoolean } from '@shared/decorators/coercion'; |
|||
|
|||
@Component({ |
|||
selector: 'tb-count-widget', |
|||
templateUrl: './count-widget.component.html', |
|||
styleUrls: ['./count-widget.component.scss'] |
|||
}) |
|||
export class CountWidgetComponent implements OnInit { |
|||
|
|||
settings: CountWidgetSettings; |
|||
|
|||
countCardLayout = CountCardLayout; |
|||
|
|||
@Input() |
|||
ctx: WidgetContext; |
|||
|
|||
@Input() |
|||
widgetTitlePanel: TemplateRef<any>; |
|||
|
|||
@coerceBoolean() |
|||
@Input() |
|||
alarmElseEntity: boolean; |
|||
|
|||
layout: CountCardLayout; |
|||
|
|||
showLabel = true; |
|||
label: string; |
|||
labelStyle: ComponentStyle = {}; |
|||
labelColor: ColorProcessor; |
|||
|
|||
showIcon = true; |
|||
icon = ''; |
|||
iconStyle: ComponentStyle = {}; |
|||
iconColor: ColorProcessor; |
|||
|
|||
showIconBackground = true; |
|||
iconBackgroundSize: string; |
|||
iconBackgroundStyle: ComponentStyle = {}; |
|||
iconBackgroundColor: ColorProcessor; |
|||
|
|||
valueText = 'N/A'; |
|||
valueStyle: ComponentStyle = {}; |
|||
valueColor: ColorProcessor; |
|||
|
|||
showChevron = false; |
|||
chevronStyle: ComponentStyle = {}; |
|||
|
|||
constructor(private widgetComponent: WidgetComponent, |
|||
private cd: ChangeDetectorRef) { |
|||
} |
|||
|
|||
ngOnInit(): void { |
|||
this.ctx.$scope.countWidget = this; |
|||
this.settings = {...countDefaultSettings(this.alarmElseEntity), ...this.ctx.settings}; |
|||
|
|||
this.layout = this.settings.layout; |
|||
|
|||
this.showLabel = this.settings.showLabel; |
|||
this.label = this.settings.label; |
|||
this.labelStyle = textStyle(this.settings.labelFont, '0.4px'); |
|||
this.labelColor = ColorProcessor.fromSettings(this.settings.labelColor); |
|||
|
|||
this.showIcon = this.settings.showIcon; |
|||
this.icon = this.settings.icon; |
|||
this.iconStyle = iconStyle(this.settings.iconSize, this.settings.iconSizeUnit); |
|||
this.iconColor = ColorProcessor.fromSettings(this.settings.iconColor); |
|||
|
|||
this.showIconBackground = this.settings.showIconBackground; |
|||
if (this.showIconBackground) { |
|||
this.iconBackgroundSize = this.settings.iconBackgroundSize + this.settings.iconBackgroundSizeUnit; |
|||
} else { |
|||
this.iconBackgroundSize = this.settings.iconSize + this.settings.iconSizeUnit; |
|||
} |
|||
this.iconBackgroundStyle = { |
|||
width: this.iconBackgroundSize, |
|||
height: this.iconBackgroundSize, |
|||
borderRadius: '4px' |
|||
}; |
|||
this.iconBackgroundColor = ColorProcessor.fromSettings(this.settings.iconBackgroundColor); |
|||
|
|||
this.valueStyle = textStyle(this.settings.valueFont, '0.1px'); |
|||
this.valueColor = ColorProcessor.fromSettings(this.settings.valueColor); |
|||
|
|||
this.showChevron = this.settings.showChevron; |
|||
this.chevronStyle = iconStyle(this.settings.chevronSize, this.settings.chevronSizeUnit); |
|||
this.chevronStyle.color = this.settings.chevronColor; |
|||
} |
|||
|
|||
public onInit() { |
|||
} |
|||
|
|||
public onDataUpdated() { |
|||
const tsValue = getSingleTsValue(this.ctx.data); |
|||
let value: any; |
|||
if (tsValue) { |
|||
value = tsValue[1]; |
|||
this.valueText = formatValue(value, 0); |
|||
} else { |
|||
this.valueText = 'N/A'; |
|||
} |
|||
this.labelColor.update(value); |
|||
this.iconColor.update(value); |
|||
this.iconBackgroundColor.update(value); |
|||
this.valueColor.update(value); |
|||
this.cd.detectChanges(); |
|||
} |
|||
|
|||
public cardClick($event: Event) { |
|||
const descriptors = this.ctx.actionsApi.getActionDescriptors('cardClick'); |
|||
if (descriptors.length) { |
|||
$event.stopPropagation(); |
|||
const descriptor = descriptors[0]; |
|||
this.ctx.actionsApi.handleWidgetAction($event, descriptor); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,122 @@ |
|||
///
|
|||
/// Copyright © 2016-2023 The Thingsboard Authors
|
|||
///
|
|||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|||
/// you may not use this file except in compliance with the License.
|
|||
/// You may obtain a copy of the License at
|
|||
///
|
|||
/// http://www.apache.org/licenses/LICENSE-2.0
|
|||
///
|
|||
/// Unless required by applicable law or agreed to in writing, software
|
|||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
/// See the License for the specific language governing permissions and
|
|||
/// limitations under the License.
|
|||
///
|
|||
|
|||
import { |
|||
ColorSettings, |
|||
ColorType, |
|||
constantColor, |
|||
cssUnit, |
|||
defaultColorFunction, |
|||
Font |
|||
} from '@shared/models/widget-settings.models'; |
|||
|
|||
export enum CountCardLayout { |
|||
column = 'column', |
|||
row = 'row' |
|||
} |
|||
|
|||
export const countCardLayouts = Object.keys(CountCardLayout) as CountCardLayout[]; |
|||
|
|||
export const countCardLayoutTranslations = new Map<CountCardLayout, string>( |
|||
[ |
|||
[CountCardLayout.column, 'widgets.count.layout-column'], |
|||
[CountCardLayout.row, 'widgets.count.layout-row'] |
|||
] |
|||
); |
|||
|
|||
export const alarmCountCardLayoutImages = new Map<CountCardLayout, string>( |
|||
[ |
|||
[CountCardLayout.column, 'assets/widget/alarm-count/column-layout.svg'], |
|||
[CountCardLayout.row, 'assets/widget/alarm-count/row-layout.svg'] |
|||
] |
|||
); |
|||
|
|||
export const entityCountCardLayoutImages = new Map<CountCardLayout, string>( |
|||
[ |
|||
[CountCardLayout.column, 'assets/widget/entity-count/column-layout.svg'], |
|||
[CountCardLayout.row, 'assets/widget/entity-count/row-layout.svg'] |
|||
] |
|||
); |
|||
|
|||
export interface CountWidgetSettings { |
|||
layout: CountCardLayout; |
|||
showLabel: boolean; |
|||
label: string; |
|||
labelFont: Font; |
|||
labelColor: ColorSettings; |
|||
showIcon: boolean; |
|||
icon: string; |
|||
iconSize: number; |
|||
iconSizeUnit: cssUnit; |
|||
iconColor: ColorSettings; |
|||
showIconBackground: boolean; |
|||
iconBackgroundSize: number; |
|||
iconBackgroundSizeUnit: cssUnit; |
|||
iconBackgroundColor: ColorSettings; |
|||
valueFont: Font; |
|||
valueColor: ColorSettings; |
|||
showChevron: boolean; |
|||
chevronSize: number; |
|||
chevronSizeUnit: cssUnit; |
|||
chevronColor: string; |
|||
} |
|||
|
|||
export const countDefaultSettings = (alarmElseEntity: boolean): CountWidgetSettings => ({ |
|||
layout: CountCardLayout.column, |
|||
showLabel: true, |
|||
label: alarmElseEntity ? 'Total' : 'Devices', |
|||
labelFont: { |
|||
family: 'Roboto', |
|||
size: 12, |
|||
sizeUnit: 'px', |
|||
style: 'normal', |
|||
weight: '400', |
|||
lineHeight: '16px' |
|||
}, |
|||
labelColor: constantColor('rgba(0, 0, 0, 0.54)'), |
|||
showIcon: true, |
|||
icon: alarmElseEntity ? 'warning' : 'devices', |
|||
iconSize: 20, |
|||
iconSizeUnit: 'px', |
|||
iconColor: constantColor('rgba(255, 255, 255, 1)'), |
|||
showIconBackground: true, |
|||
iconBackgroundSize: 36, |
|||
iconBackgroundSizeUnit: 'px', |
|||
iconBackgroundColor: alarmElseEntity |
|||
? { |
|||
color: 'rgba(0, 105, 92, 1)', |
|||
type: ColorType.range, |
|||
rangeList: [ |
|||
{from: 0, to: 0, color: 'rgba(0, 105, 92, 1)'}, |
|||
{from: 1, color: 'rgba(209, 39, 48, 1)'} |
|||
], |
|||
colorFunction: defaultColorFunction |
|||
} |
|||
: constantColor('rgba(241, 141, 23, 1)'), |
|||
valueFont: { |
|||
family: 'Roboto', |
|||
size: 20, |
|||
sizeUnit: 'px', |
|||
style: 'normal', |
|||
weight: '500', |
|||
lineHeight: '24px' |
|||
}, |
|||
valueColor: constantColor('rgba(0, 0, 0, 0.87)'), |
|||
showChevron: false, |
|||
chevronSize: 24, |
|||
chevronSizeUnit: 'px', |
|||
chevronColor: 'rgba(0, 0, 0, 0.38)' |
|||
}); |
|||
File diff suppressed because it is too large
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue