Browse Source

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

pull/9325/head
Igor Kulikov 3 years ago
parent
commit
7310f438eb
  1. 3
      application/src/main/data/upgrade/3.5.1/schema_update.sql
  2. 2
      common/data/src/main/java/org/thingsboard/server/common/data/widget/BaseWidgetType.java
  3. 2
      common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetType.java
  4. 6
      common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetTypeDetails.java
  5. 2
      common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetsBundle.java
  6. 4
      dao/src/main/resources/sql/schema-entities.sql
  7. 4
      ui-ngx/src/app/modules/home/pages/widget/widget-type.component.html
  8. 2
      ui-ngx/src/app/modules/home/pages/widget/widget-type.component.ts
  9. 4
      ui-ngx/src/app/modules/home/pages/widget/widgets-bundle.component.html
  10. 2
      ui-ngx/src/app/modules/home/pages/widget/widgets-bundle.component.ts

3
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

2
common/data/src/main/java/org/thingsboard/server/common/data/widget/BaseWidgetType.java

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

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

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

2
common/data/src/main/java/org/thingsboard/server/common/data/widget/WidgetsBundle.java

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

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

4
ui-ngx/src/app/modules/home/pages/widget/widget-type.component.html

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

2
ui-ngx/src/app/modules/home/pages/widget/widget-type.component.ts

@ -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]
}
);

4
ui-ngx/src/app/modules/home/pages/widget/widgets-bundle.component.html

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

2
ui-ngx/src/app/modules/home/pages/widget/widgets-bundle.component.ts

@ -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)]
}
);
}

Loading…
Cancel
Save