Commit 889e55104af22adb60ffcda14accb386c6cff830

Authored by Artem Halushko
2 parents 69f41be5 13e6b10b

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

... ... @@ -135,7 +135,7 @@ public class CassandraEntitiesToSqlMigrateService implements EntitiesMigrateServ
135 135 stringColumn("entity_type"),
136 136 stringColumn("attribute_type"),
137 137 stringColumn("attribute_key"),
138   - booleanColumn("bool_v"),
  138 + booleanColumn("bool_v", true),
139 139 stringColumn("str_v"),
140 140 bigintColumn("long_v"),
141 141 doubleColumn("dbl_v"),
... ...
... ... @@ -38,6 +38,7 @@ public class CassandraToSqlColumn {
38 38 private int sqlType;
39 39 private int size;
40 40 private Class<? extends Enum> enumClass;
  41 + private boolean allowNullBoolean = false;
41 42
42 43 public static CassandraToSqlColumn idColumn(String name) {
43 44 return new CassandraToSqlColumn(name, CassandraToSqlColumnType.ID);
... ... @@ -60,7 +61,11 @@ public class CassandraToSqlColumn {
60 61 }
61 62
62 63 public static CassandraToSqlColumn booleanColumn(String name) {
63   - return new CassandraToSqlColumn(name, CassandraToSqlColumnType.BOOLEAN);
  64 + return booleanColumn(name, false);
  65 + }
  66 +
  67 + public static CassandraToSqlColumn booleanColumn(String name, boolean allowNullBoolean) {
  68 + return new CassandraToSqlColumn(name, name, CassandraToSqlColumnType.BOOLEAN, null, allowNullBoolean);
64 69 }
65 70
66 71 public static CassandraToSqlColumn jsonColumn(String name) {
... ... @@ -72,32 +77,33 @@ public class CassandraToSqlColumn {
72 77 }
73 78
74 79 public CassandraToSqlColumn(String columnName) {
75   - this(columnName, columnName, CassandraToSqlColumnType.STRING, null);
  80 + this(columnName, columnName, CassandraToSqlColumnType.STRING, null, false);
76 81 }
77 82
78 83 public CassandraToSqlColumn(String columnName, CassandraToSqlColumnType type) {
79   - this(columnName, columnName, type, null);
  84 + this(columnName, columnName, type, null, false);
80 85 }
81 86
82 87 public CassandraToSqlColumn(String columnName, CassandraToSqlColumnType type, Class<? extends Enum> enumClass) {
83   - this(columnName, columnName, type, enumClass);
  88 + this(columnName, columnName, type, enumClass, false);
84 89 }
85 90
86 91 public CassandraToSqlColumn(String cassandraColumnName, String sqlColumnName) {
87   - this(cassandraColumnName, sqlColumnName, CassandraToSqlColumnType.STRING, null);
  92 + this(cassandraColumnName, sqlColumnName, CassandraToSqlColumnType.STRING, null, false);
88 93 }
89 94
90 95 public CassandraToSqlColumn(String cassandraColumnName, String sqlColumnName, CassandraToSqlColumnType type,
91   - Class<? extends Enum> enumClass) {
  96 + Class<? extends Enum> enumClass, boolean allowNullBoolean) {
92 97 this.cassandraColumnName = cassandraColumnName;
93 98 this.sqlColumnName = sqlColumnName;
94 99 this.type = type;
95 100 this.enumClass = enumClass;
  101 + this.allowNullBoolean = allowNullBoolean;
96 102 }
97 103
98 104 public String getColumnValue(Row row) {
99 105 if (row.isNull(index)) {
100   - if (this.type == CassandraToSqlColumnType.BOOLEAN) {
  106 + if (this.type == CassandraToSqlColumnType.BOOLEAN && !this.allowNullBoolean) {
101 107 return Boolean.toString(false);
102 108 } else {
103 109 return null;
... ...
... ... @@ -24,7 +24,7 @@ import static org.thingsboard.server.dao.model.ModelConstants.EPOCH_DIFF;
24 24 public class CassandraToSqlEventTsColumn extends CassandraToSqlColumn {
25 25
26 26 CassandraToSqlEventTsColumn() {
27   - super("id", "ts", CassandraToSqlColumnType.BIGINT, null);
  27 + super("id", "ts", CassandraToSqlColumnType.BIGINT, null, false);
28 28 }
29 29
30 30 @Override
... ...
... ... @@ -85,51 +85,53 @@
85 85 formControlName="entityId">
86 86 </tb-entity-select>
87 87 </section>
88   - <div formGroupName="keys">
89   - <mat-expansion-panel formGroupName="attributes" [expanded]="true">
90   - <mat-expansion-panel-header>
91   - <mat-panel-title>
92   - <div class="tb-panel-title" translate>entity-view.attributes-propagation</div>
93   - </mat-panel-title>
94   - </mat-expansion-panel-header>
95   - <div translate class="tb-hint">entity-view.attributes-propagation-hint</div>
96   - <label translate class="tb-title no-padding">entity-view.client-attributes</label>
97   - <tb-entity-keys-list
98   - [entityId]="selectedEntityId | async"
99   - formControlName="cs"
100   - keysText="entity-view.client-attributes-placeholder"
101   - [dataKeyType]="dataKeyType.attribute">
102   - </tb-entity-keys-list>
103   - <label translate class="tb-title no-padding">entity-view.shared-attributes</label>
104   - <tb-entity-keys-list
105   - [entityId]="selectedEntityId | async"
106   - formControlName="sh"
107   - keysText="entity-view.shared-attributes-placeholder"
108   - [dataKeyType]="dataKeyType.attribute">
109   - </tb-entity-keys-list>
110   - <label translate class="tb-title no-padding">entity-view.server-attributes</label>
111   - <tb-entity-keys-list
112   - [entityId]="selectedEntityId | async"
113   - formControlName="ss"
114   - keysText="entity-view.server-attributes-placeholder"
115   - [dataKeyType]="dataKeyType.attribute">
116   - </tb-entity-keys-list>
117   - </mat-expansion-panel>
118   - <mat-expansion-panel [expanded]="true">
119   - <mat-expansion-panel-header>
120   - <mat-panel-title>
121   - <div class="tb-panel-title" translate>entity-view.timeseries-data</div>
122   - </mat-panel-title>
123   - </mat-expansion-panel-header>
124   - <div translate class="tb-hint">entity-view.timeseries-data-hint</div>
125   - <label translate class="tb-title no-padding">entity-view.timeseries</label>
126   - <tb-entity-keys-list
127   - [entityId]="selectedEntityId | async"
128   - formControlName="timeseries"
129   - keysText="entity-view.timeseries-placeholder"
130   - [dataKeyType]="dataKeyType.timeseries">
131   - </tb-entity-keys-list>
132   - </mat-expansion-panel>
  88 + <div class="mat-accordion-container" formGroupName="keys">
  89 + <mat-accordion [multi]="true">
  90 + <mat-expansion-panel formGroupName="attributes" [expanded]="true">
  91 + <mat-expansion-panel-header>
  92 + <mat-panel-title>
  93 + <div class="tb-panel-title" translate>entity-view.attributes-propagation</div>
  94 + </mat-panel-title>
  95 + </mat-expansion-panel-header>
  96 + <div translate class="tb-hint">entity-view.attributes-propagation-hint</div>
  97 + <label translate class="tb-title no-padding">entity-view.client-attributes</label>
  98 + <tb-entity-keys-list
  99 + [entityId]="selectedEntityId | async"
  100 + formControlName="cs"
  101 + keysText="entity-view.client-attributes-placeholder"
  102 + [dataKeyType]="dataKeyType.attribute">
  103 + </tb-entity-keys-list>
  104 + <label translate class="tb-title no-padding">entity-view.shared-attributes</label>
  105 + <tb-entity-keys-list
  106 + [entityId]="selectedEntityId | async"
  107 + formControlName="sh"
  108 + keysText="entity-view.shared-attributes-placeholder"
  109 + [dataKeyType]="dataKeyType.attribute">
  110 + </tb-entity-keys-list>
  111 + <label translate class="tb-title no-padding">entity-view.server-attributes</label>
  112 + <tb-entity-keys-list
  113 + [entityId]="selectedEntityId | async"
  114 + formControlName="ss"
  115 + keysText="entity-view.server-attributes-placeholder"
  116 + [dataKeyType]="dataKeyType.attribute">
  117 + </tb-entity-keys-list>
  118 + </mat-expansion-panel>
  119 + <mat-expansion-panel [expanded]="true">
  120 + <mat-expansion-panel-header>
  121 + <mat-panel-title>
  122 + <div class="tb-panel-title" translate>entity-view.timeseries-data</div>
  123 + </mat-panel-title>
  124 + </mat-expansion-panel-header>
  125 + <div translate class="tb-hint">entity-view.timeseries-data-hint</div>
  126 + <label translate class="tb-title no-padding">entity-view.timeseries</label>
  127 + <tb-entity-keys-list
  128 + [entityId]="selectedEntityId | async"
  129 + formControlName="timeseries"
  130 + keysText="entity-view.timeseries-placeholder"
  131 + [dataKeyType]="dataKeyType.timeseries">
  132 + </tb-entity-keys-list>
  133 + </mat-expansion-panel>
  134 + </mat-accordion>
133 135 </div>
134 136 <tb-datetime
135 137 dateText="entity-view.start-date"
... ...
... ... @@ -14,16 +14,7 @@
14 14 * limitations under the License.
15 15 */
16 16 :host {
17   - mat-expansion-panel {
  17 + .mat-accordion-container {
18 18 margin-bottom: 16px;
19 19 }
20 20 }
21   -
22   -.tb-dialog {
23   - :host {
24   - mat-expansion-panel {
25   - margin-left: 6px;
26   - margin-right: 6px;
27   - }
28   - }
29   -}
... ...
... ... @@ -14,9 +14,15 @@
14 14 * limitations under the License.
15 15 */
16 16 :host ::ng-deep {
17   - .mat-checkbox.hinted-checkbox {
18   - .mat-checkbox-inner-container {
19   - margin-top: 4px;
  17 + .mat-checkbox{
  18 + &.hinted-checkbox {
  19 + .mat-checkbox-inner-container {
  20 + margin-top: 4px;
  21 + }
  22 + }
  23 +
  24 + .mat-checkbox-layout{
  25 + white-space: normal;
20 26 }
21 27 }
22 28 }
... ...
... ... @@ -812,7 +812,6 @@ mat-label {
812 812 min-width: 100%;
813 813 display: flex;
814 814 flex-direction: column;
815   - overflow: auto;
816 815 }
817 816 .mat-dialog-content {
818 817 margin: 0;
... ... @@ -862,7 +861,7 @@ mat-label {
862 861 .mat-dialog-container {
863 862 > *:first-child, form {
864 863 min-width: 100% !important;
865   - height: 100vh;
  864 + height: 100%;
866 865 }
867 866 .mat-dialog-content {
868 867 max-height: 100%;
... ...