Increase widget type and widgets bundle description field size to 1024.

This commit is contained in:
Igor Kulikov 2023-09-20 16:11:42 +03:00
parent 79dbf41b9f
commit 7310f438eb
10 changed files with 17 additions and 14 deletions

View File

@ -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

View File

@ -38,7 +38,7 @@ public class BaseWidgetType extends BaseData<WidgetTypeId> 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")

View File

@ -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() {

View File

@ -32,11 +32,11 @@ import org.thingsboard.server.common.data.validation.NoXss;
public class WidgetTypeDetails extends WidgetType implements HasName, HasTenantId, ExportableEntity<WidgetTypeId> {
@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

View File

@ -64,7 +64,7 @@ public class WidgetsBundle extends BaseData<WidgetsBundleId> 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)

View File

@ -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)

View File

@ -55,8 +55,8 @@
</tb-image-input>
<mat-form-field class="mat-block">
<mat-label translate>widget.description</mat-label>
<textarea matInput formControlName="description" rows="2" maxlength="255" #descriptionInput></textarea>
<mat-hint align="end">{{descriptionInput.value?.length || 0}}/255</mat-hint>
<textarea matInput formControlName="description" rows="2" maxlength="1024" #descriptionInput></textarea>
<mat-hint align="end">{{descriptionInput.value?.length || 0}}/1024</mat-hint>
</mat-form-field>
<mat-slide-toggle formControlName="deprecated">
{{ 'widget.deprecated' | translate }}

View File

@ -51,7 +51,7 @@ export class WidgetTypeComponent extends EntityComponent<WidgetTypeDetails> {
{
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]
}
);

View File

@ -55,8 +55,8 @@
</tb-image-input>
<mat-form-field class="mat-block">
<mat-label translate>widgets-bundle.description</mat-label>
<textarea matInput formControlName="description" rows="2" maxlength="255" #descriptionInput></textarea>
<mat-hint align="end">{{descriptionInput.value?.length || 0}}/255</mat-hint>
<textarea matInput formControlName="description" rows="2" maxlength="1024" #descriptionInput></textarea>
<mat-hint align="end">{{descriptionInput.value?.length || 0}}/1024</mat-hint>
</mat-form-field>
</fieldset>
</form>

View File

@ -50,7 +50,7 @@ export class WidgetsBundleComponent extends EntityComponent<WidgetsBundle> {
{
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)]
}
);
}