Merge branch 'master' of https://github.com/thingsboard/thingsboard into map/3.0

This commit is contained in:
Artem Halushko 2020-05-20 13:27:33 +03:00
commit 889e55104a
7 changed files with 73 additions and 69 deletions

View File

@ -135,7 +135,7 @@ public class CassandraEntitiesToSqlMigrateService implements EntitiesMigrateServ
stringColumn("entity_type"), stringColumn("entity_type"),
stringColumn("attribute_type"), stringColumn("attribute_type"),
stringColumn("attribute_key"), stringColumn("attribute_key"),
booleanColumn("bool_v"), booleanColumn("bool_v", true),
stringColumn("str_v"), stringColumn("str_v"),
bigintColumn("long_v"), bigintColumn("long_v"),
doubleColumn("dbl_v"), doubleColumn("dbl_v"),

View File

@ -38,6 +38,7 @@ public class CassandraToSqlColumn {
private int sqlType; private int sqlType;
private int size; private int size;
private Class<? extends Enum> enumClass; private Class<? extends Enum> enumClass;
private boolean allowNullBoolean = false;
public static CassandraToSqlColumn idColumn(String name) { public static CassandraToSqlColumn idColumn(String name) {
return new CassandraToSqlColumn(name, CassandraToSqlColumnType.ID); return new CassandraToSqlColumn(name, CassandraToSqlColumnType.ID);
@ -60,7 +61,11 @@ public class CassandraToSqlColumn {
} }
public static CassandraToSqlColumn booleanColumn(String name) { public static CassandraToSqlColumn booleanColumn(String name) {
return new CassandraToSqlColumn(name, CassandraToSqlColumnType.BOOLEAN); return booleanColumn(name, false);
}
public static CassandraToSqlColumn booleanColumn(String name, boolean allowNullBoolean) {
return new CassandraToSqlColumn(name, name, CassandraToSqlColumnType.BOOLEAN, null, allowNullBoolean);
} }
public static CassandraToSqlColumn jsonColumn(String name) { public static CassandraToSqlColumn jsonColumn(String name) {
@ -72,32 +77,33 @@ public class CassandraToSqlColumn {
} }
public CassandraToSqlColumn(String columnName) { public CassandraToSqlColumn(String columnName) {
this(columnName, columnName, CassandraToSqlColumnType.STRING, null); this(columnName, columnName, CassandraToSqlColumnType.STRING, null, false);
} }
public CassandraToSqlColumn(String columnName, CassandraToSqlColumnType type) { public CassandraToSqlColumn(String columnName, CassandraToSqlColumnType type) {
this(columnName, columnName, type, null); this(columnName, columnName, type, null, false);
} }
public CassandraToSqlColumn(String columnName, CassandraToSqlColumnType type, Class<? extends Enum> enumClass) { public CassandraToSqlColumn(String columnName, CassandraToSqlColumnType type, Class<? extends Enum> enumClass) {
this(columnName, columnName, type, enumClass); this(columnName, columnName, type, enumClass, false);
} }
public CassandraToSqlColumn(String cassandraColumnName, String sqlColumnName) { public CassandraToSqlColumn(String cassandraColumnName, String sqlColumnName) {
this(cassandraColumnName, sqlColumnName, CassandraToSqlColumnType.STRING, null); this(cassandraColumnName, sqlColumnName, CassandraToSqlColumnType.STRING, null, false);
} }
public CassandraToSqlColumn(String cassandraColumnName, String sqlColumnName, CassandraToSqlColumnType type, public CassandraToSqlColumn(String cassandraColumnName, String sqlColumnName, CassandraToSqlColumnType type,
Class<? extends Enum> enumClass) { Class<? extends Enum> enumClass, boolean allowNullBoolean) {
this.cassandraColumnName = cassandraColumnName; this.cassandraColumnName = cassandraColumnName;
this.sqlColumnName = sqlColumnName; this.sqlColumnName = sqlColumnName;
this.type = type; this.type = type;
this.enumClass = enumClass; this.enumClass = enumClass;
this.allowNullBoolean = allowNullBoolean;
} }
public String getColumnValue(Row row) { public String getColumnValue(Row row) {
if (row.isNull(index)) { if (row.isNull(index)) {
if (this.type == CassandraToSqlColumnType.BOOLEAN) { if (this.type == CassandraToSqlColumnType.BOOLEAN && !this.allowNullBoolean) {
return Boolean.toString(false); return Boolean.toString(false);
} else { } else {
return null; return null;

View File

@ -24,7 +24,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.EPOCH_DIFF;
public class CassandraToSqlEventTsColumn extends CassandraToSqlColumn { public class CassandraToSqlEventTsColumn extends CassandraToSqlColumn {
CassandraToSqlEventTsColumn() { CassandraToSqlEventTsColumn() {
super("id", "ts", CassandraToSqlColumnType.BIGINT, null); super("id", "ts", CassandraToSqlColumnType.BIGINT, null, false);
} }
@Override @Override

View File

@ -85,51 +85,53 @@
formControlName="entityId"> formControlName="entityId">
</tb-entity-select> </tb-entity-select>
</section> </section>
<div formGroupName="keys"> <div class="mat-accordion-container" formGroupName="keys">
<mat-expansion-panel formGroupName="attributes" [expanded]="true"> <mat-accordion [multi]="true">
<mat-expansion-panel-header> <mat-expansion-panel formGroupName="attributes" [expanded]="true">
<mat-panel-title> <mat-expansion-panel-header>
<div class="tb-panel-title" translate>entity-view.attributes-propagation</div> <mat-panel-title>
</mat-panel-title> <div class="tb-panel-title" translate>entity-view.attributes-propagation</div>
</mat-expansion-panel-header> </mat-panel-title>
<div translate class="tb-hint">entity-view.attributes-propagation-hint</div> </mat-expansion-panel-header>
<label translate class="tb-title no-padding">entity-view.client-attributes</label> <div translate class="tb-hint">entity-view.attributes-propagation-hint</div>
<tb-entity-keys-list <label translate class="tb-title no-padding">entity-view.client-attributes</label>
[entityId]="selectedEntityId | async" <tb-entity-keys-list
formControlName="cs" [entityId]="selectedEntityId | async"
keysText="entity-view.client-attributes-placeholder" formControlName="cs"
[dataKeyType]="dataKeyType.attribute"> keysText="entity-view.client-attributes-placeholder"
</tb-entity-keys-list> [dataKeyType]="dataKeyType.attribute">
<label translate class="tb-title no-padding">entity-view.shared-attributes</label> </tb-entity-keys-list>
<tb-entity-keys-list <label translate class="tb-title no-padding">entity-view.shared-attributes</label>
[entityId]="selectedEntityId | async" <tb-entity-keys-list
formControlName="sh" [entityId]="selectedEntityId | async"
keysText="entity-view.shared-attributes-placeholder" formControlName="sh"
[dataKeyType]="dataKeyType.attribute"> keysText="entity-view.shared-attributes-placeholder"
</tb-entity-keys-list> [dataKeyType]="dataKeyType.attribute">
<label translate class="tb-title no-padding">entity-view.server-attributes</label> </tb-entity-keys-list>
<tb-entity-keys-list <label translate class="tb-title no-padding">entity-view.server-attributes</label>
[entityId]="selectedEntityId | async" <tb-entity-keys-list
formControlName="ss" [entityId]="selectedEntityId | async"
keysText="entity-view.server-attributes-placeholder" formControlName="ss"
[dataKeyType]="dataKeyType.attribute"> keysText="entity-view.server-attributes-placeholder"
</tb-entity-keys-list> [dataKeyType]="dataKeyType.attribute">
</mat-expansion-panel> </tb-entity-keys-list>
<mat-expansion-panel [expanded]="true"> </mat-expansion-panel>
<mat-expansion-panel-header> <mat-expansion-panel [expanded]="true">
<mat-panel-title> <mat-expansion-panel-header>
<div class="tb-panel-title" translate>entity-view.timeseries-data</div> <mat-panel-title>
</mat-panel-title> <div class="tb-panel-title" translate>entity-view.timeseries-data</div>
</mat-expansion-panel-header> </mat-panel-title>
<div translate class="tb-hint">entity-view.timeseries-data-hint</div> </mat-expansion-panel-header>
<label translate class="tb-title no-padding">entity-view.timeseries</label> <div translate class="tb-hint">entity-view.timeseries-data-hint</div>
<tb-entity-keys-list <label translate class="tb-title no-padding">entity-view.timeseries</label>
[entityId]="selectedEntityId | async" <tb-entity-keys-list
formControlName="timeseries" [entityId]="selectedEntityId | async"
keysText="entity-view.timeseries-placeholder" formControlName="timeseries"
[dataKeyType]="dataKeyType.timeseries"> keysText="entity-view.timeseries-placeholder"
</tb-entity-keys-list> [dataKeyType]="dataKeyType.timeseries">
</mat-expansion-panel> </tb-entity-keys-list>
</mat-expansion-panel>
</mat-accordion>
</div> </div>
<tb-datetime <tb-datetime
dateText="entity-view.start-date" dateText="entity-view.start-date"

View File

@ -14,16 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
:host { :host {
mat-expansion-panel { .mat-accordion-container {
margin-bottom: 16px; margin-bottom: 16px;
} }
} }
.tb-dialog {
:host {
mat-expansion-panel {
margin-left: 6px;
margin-right: 6px;
}
}
}

View File

@ -14,9 +14,15 @@
* limitations under the License. * limitations under the License.
*/ */
:host ::ng-deep { :host ::ng-deep {
.mat-checkbox.hinted-checkbox { .mat-checkbox{
.mat-checkbox-inner-container { &.hinted-checkbox {
margin-top: 4px; .mat-checkbox-inner-container {
margin-top: 4px;
}
}
.mat-checkbox-layout{
white-space: normal;
} }
} }
} }

View File

@ -812,7 +812,6 @@ mat-label {
min-width: 100%; min-width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: auto;
} }
.mat-dialog-content { .mat-dialog-content {
margin: 0; margin: 0;
@ -862,7 +861,7 @@ mat-label {
.mat-dialog-container { .mat-dialog-container {
> *:first-child, form { > *:first-child, form {
min-width: 100% !important; min-width: 100% !important;
height: 100vh; height: 100%;
} }
.mat-dialog-content { .mat-dialog-content {
max-height: 100%; max-height: 100%;