From 7310f438eb8f3a13ef4d37edde46d8860307501b Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Wed, 20 Sep 2023 16:11:42 +0300 Subject: [PATCH] Increase widget type and widgets bundle description field size to 1024. --- application/src/main/data/upgrade/3.5.1/schema_update.sql | 3 +++ .../server/common/data/widget/BaseWidgetType.java | 2 +- .../thingsboard/server/common/data/widget/WidgetType.java | 2 +- .../server/common/data/widget/WidgetTypeDetails.java | 6 +++--- .../server/common/data/widget/WidgetsBundle.java | 2 +- dao/src/main/resources/sql/schema-entities.sql | 4 ++-- .../modules/home/pages/widget/widget-type.component.html | 4 ++-- .../app/modules/home/pages/widget/widget-type.component.ts | 2 +- .../modules/home/pages/widget/widgets-bundle.component.html | 4 ++-- .../modules/home/pages/widget/widgets-bundle.component.ts | 2 +- 10 files changed, 17 insertions(+), 14 deletions(-) diff --git a/application/src/main/data/upgrade/3.5.1/schema_update.sql b/application/src/main/data/upgrade/3.5.1/schema_update.sql index 5aab5d740b..f41e370ab5 100644 --- a/application/src/main/data/upgrade/3.5.1/schema_update.sql +++ b/application/src/main/data/upgrade/3.5.1/schema_update.sql @@ -138,6 +138,9 @@ CREATE TABLE IF NOT EXISTS alarm_types ( INSERT INTO alarm_types (tenant_id, type) SELECT DISTINCT tenant_id, type FROM alarm ON CONFLICT (tenant_id, type) DO NOTHING; +ALTER TABLE widgets_bundle ALTER COLUMN description SET DATA TYPE varchar(1024); +ALTER TABLE widget_type ALTER COLUMN description SET DATA TYPE varchar(1024); + ALTER TABLE widget_type ADD COLUMN IF NOT EXISTS fqn varchar(512); ALTER TABLE widget_type diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/widget/BaseWidgetType.java b/common/data/src/main/java/org/thingsboard/server/common/data/widget/BaseWidgetType.java index 8fd0e58006..e26f0ca6e5 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/widget/BaseWidgetType.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/widget/BaseWidgetType.java @@ -38,7 +38,7 @@ public class BaseWidgetType extends BaseData implements HasName, H private String fqn; @NoXss @Length(fieldName = "name") - @ApiModelProperty(position = 6, value = "Widget name used in search and UI", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @ApiModelProperty(position = 6, value = "Widget name used in search and UI") private String name; @ApiModelProperty(position = 7, value = "Whether widget type is deprecated.", example = "true") diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetType.java b/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetType.java index 63c270851c..ddf1b6b03f 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetType.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetType.java @@ -23,7 +23,7 @@ import org.thingsboard.server.common.data.id.WidgetTypeId; @Data public class WidgetType extends BaseWidgetType { - @ApiModelProperty(position = 8, value = "Complex JSON object that describes the widget type", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @ApiModelProperty(position = 8, value = "Complex JSON object that describes the widget type") private transient JsonNode descriptor; public WidgetType() { diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeDetails.java b/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeDetails.java index 9ebc0b6639..cd6f13c6d0 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeDetails.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeDetails.java @@ -32,11 +32,11 @@ import org.thingsboard.server.common.data.validation.NoXss; public class WidgetTypeDetails extends WidgetType implements HasName, HasTenantId, ExportableEntity { @Length(fieldName = "image", max = 1000000) - @ApiModelProperty(position = 9, value = "Base64 encoded thumbnail", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @ApiModelProperty(position = 9, value = "Base64 encoded thumbnail") private String image; @NoXss - @Length(fieldName = "description") - @ApiModelProperty(position = 10, value = "Description of the widget", accessMode = ApiModelProperty.AccessMode.READ_ONLY) + @Length(fieldName = "description", max = 1024) + @ApiModelProperty(position = 10, value = "Description of the widget") private String description; @Getter diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetsBundle.java b/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetsBundle.java index 0ceef991ad..3655eace53 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetsBundle.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetsBundle.java @@ -64,7 +64,7 @@ public class WidgetsBundle extends BaseData implements HasName, private String image; @NoXss - @Length(fieldName = "description") + @Length(fieldName = "description", max = 1024) @Getter @Setter @ApiModelProperty(position = 7, value = "Description", accessMode = ApiModelProperty.AccessMode.READ_ONLY) diff --git a/dao/src/main/resources/sql/schema-entities.sql b/dao/src/main/resources/sql/schema-entities.sql index 72469e3bdd..4df73de9d6 100644 --- a/dao/src/main/resources/sql/schema-entities.sql +++ b/dao/src/main/resources/sql/schema-entities.sql @@ -488,7 +488,7 @@ CREATE TABLE IF NOT EXISTS widget_type ( tenant_id uuid, image varchar(1000000), deprecated boolean NOT NULL DEFAULT false, - description varchar(255), + description varchar(1024), external_id uuid, CONSTRAINT uq_widget_type_fqn UNIQUE (tenant_id, fqn), CONSTRAINT widget_type_external_id_unq_key UNIQUE (tenant_id, external_id) @@ -501,7 +501,7 @@ CREATE TABLE IF NOT EXISTS widgets_bundle ( tenant_id uuid, title varchar(255), image varchar(1000000), - description varchar(255), + description varchar(1024), external_id uuid, CONSTRAINT uq_widgets_bundle_alias UNIQUE (tenant_id, alias), CONSTRAINT widgets_bundle_external_id_unq_key UNIQUE (tenant_id, external_id) diff --git a/ui-ngx/src/app/modules/home/pages/widget/widget-type.component.html b/ui-ngx/src/app/modules/home/pages/widget/widget-type.component.html index cacd187b5b..b7c23c415d 100644 --- a/ui-ngx/src/app/modules/home/pages/widget/widget-type.component.html +++ b/ui-ngx/src/app/modules/home/pages/widget/widget-type.component.html @@ -55,8 +55,8 @@ widget.description - - {{descriptionInput.value?.length || 0}}/255 + + {{descriptionInput.value?.length || 0}}/1024 {{ 'widget.deprecated' | translate }} diff --git a/ui-ngx/src/app/modules/home/pages/widget/widget-type.component.ts b/ui-ngx/src/app/modules/home/pages/widget/widget-type.component.ts index bdbfebbd8f..5418557631 100644 --- a/ui-ngx/src/app/modules/home/pages/widget/widget-type.component.ts +++ b/ui-ngx/src/app/modules/home/pages/widget/widget-type.component.ts @@ -51,7 +51,7 @@ export class WidgetTypeComponent extends EntityComponent { { name: [entity ? entity.name : '', [Validators.required, Validators.maxLength(255)]], image: [entity ? entity.image : ''], - description: [entity ? entity.description : '', Validators.maxLength(255)], + description: [entity ? entity.description : '', Validators.maxLength(1024)], deprecated: [entity ? entity.deprecated : false] } ); diff --git a/ui-ngx/src/app/modules/home/pages/widget/widgets-bundle.component.html b/ui-ngx/src/app/modules/home/pages/widget/widgets-bundle.component.html index 05847aa6b6..bfc61fb98c 100644 --- a/ui-ngx/src/app/modules/home/pages/widget/widgets-bundle.component.html +++ b/ui-ngx/src/app/modules/home/pages/widget/widgets-bundle.component.html @@ -55,8 +55,8 @@ widgets-bundle.description - - {{descriptionInput.value?.length || 0}}/255 + + {{descriptionInput.value?.length || 0}}/1024 diff --git a/ui-ngx/src/app/modules/home/pages/widget/widgets-bundle.component.ts b/ui-ngx/src/app/modules/home/pages/widget/widgets-bundle.component.ts index 6c4d1ffdc0..f7634e5c53 100644 --- a/ui-ngx/src/app/modules/home/pages/widget/widgets-bundle.component.ts +++ b/ui-ngx/src/app/modules/home/pages/widget/widgets-bundle.component.ts @@ -50,7 +50,7 @@ export class WidgetsBundleComponent extends EntityComponent { { title: [entity ? entity.title : '', [Validators.required, Validators.maxLength(255)]], image: [entity ? entity.image : ''], - description: [entity ? entity.description : '', Validators.maxLength(255)] + description: [entity ? entity.description : '', Validators.maxLength(1024)] } ); }