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("attribute_type"),
stringColumn("attribute_key"),
booleanColumn("bool_v"),
booleanColumn("bool_v", true),
stringColumn("str_v"),
bigintColumn("long_v"),
doubleColumn("dbl_v"),

View File

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

View File

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

View File

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

View File

@ -14,16 +14,7 @@
* limitations under the License.
*/
:host {
mat-expansion-panel {
.mat-accordion-container {
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.
*/
:host ::ng-deep {
.mat-checkbox.hinted-checkbox {
.mat-checkbox-inner-container {
margin-top: 4px;
.mat-checkbox{
&.hinted-checkbox {
.mat-checkbox-inner-container {
margin-top: 4px;
}
}
.mat-checkbox-layout{
white-space: normal;
}
}
}

View File

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