Commit d2965be1a79608604aa8f38ba6a9939668296674

Authored by Vladyslav
Committed by Igor Kulikov
1 parent 6a54e2ff

Fix not correct detect index to chip drag-and-drop, style for autocomplete to th…

…e long attributes and display long attributes (#1914)
@@ -192,9 +192,9 @@ function DatasourceEntity($compile, $templateCache, $q, $mdDialog, $window, $doc @@ -192,9 +192,9 @@ function DatasourceEntity($compile, $templateCache, $q, $mdDialog, $window, $doc
192 dataKey.color = color; 192 dataKey.color = color;
193 ngModelCtrl.$setDirty(); 193 ngModelCtrl.$setDirty();
194 }); 194 });
195 - } 195 + };
196 196
197 - scope.editDataKey = function (event, dataKey, index) { 197 + scope.editDataKey = function (event, dataKey) {
198 198
199 $mdDialog.show({ 199 $mdDialog.show({
200 controller: 'DatakeyConfigDialogController', 200 controller: 'DatakeyConfigDialogController',
@@ -214,11 +214,12 @@ function DatasourceEntity($compile, $templateCache, $q, $mdDialog, $window, $doc @@ -214,11 +214,12 @@ function DatasourceEntity($compile, $templateCache, $q, $mdDialog, $window, $doc
214 var w = angular.element($window); 214 var w = angular.element($window);
215 w.triggerHandler('resize'); 215 w.triggerHandler('resize');
216 } 216 }
217 - }).then(function (dataKey) {  
218 - if ((dataKey.type === types.dataKeyType.timeseries) || (dataKey.type === types.dataKeyType.attribute)) {  
219 - scope.dataKeys[index] = dataKey;  
220 - } else if (dataKey.type === types.dataKeyType.alarm) {  
221 - scope.alarmDataKeys[index] = dataKey; 217 + }).then(function (newDataKey) {
  218 + let index = scope.dataKeys.indexOf(dataKey);
  219 + if ((newDataKey.type === types.dataKeyType.timeseries) || (newDataKey.type === types.dataKeyType.attribute)) {
  220 + scope.dataKeys[index] = newDataKey;
  221 + } else if (newDataKey.type === types.dataKeyType.alarm) {
  222 + scope.alarmDataKeys[index] = newDataKey;
222 } 223 }
223 ngModelCtrl.$setDirty(); 224 ngModelCtrl.$setDirty();
224 }, function () { 225 }, function () {
@@ -24,6 +24,7 @@ @@ -24,6 +24,7 @@
24 display: block; 24 display: block;
25 height: 48px; 25 height: 48px;
26 line-height: 1.5; 26 line-height: 1.5;
  27 + white-space: normal !important;
27 28
28 .tb-no-entries { 29 .tb-no-entries {
29 line-height: 48px; 30 line-height: 48px;
@@ -32,7 +33,6 @@ @@ -32,7 +33,6 @@
32 33
33 li { 34 li {
34 height: auto !important; 35 height: auto !important;
35 - white-space: normal !important;  
36 } 36 }
37 } 37 }
38 38
@@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
76 <div class="tb-color-preview" ng-click="showColorPicker($event, $chip, $index)" style="margin-right: 5px;"> 76 <div class="tb-color-preview" ng-click="showColorPicker($event, $chip, $index)" style="margin-right: 5px;">
77 <div class="tb-color-result" ng-style="{background: $chip.color}"></div> 77 <div class="tb-color-result" ng-style="{background: $chip.color}"></div>
78 </div> 78 </div>
79 - <div layout="row"> 79 + <div layout="row" flex>
80 <div class="tb-chip-label"> 80 <div class="tb-chip-label">
81 <span ng-show="$chip.type==types.dataKeyType.attribute"> 81 <span ng-show="$chip.type==types.dataKeyType.attribute">
82 <md-tooltip>{{'datakey.attributes' | translate }}</md-tooltip> 82 <md-tooltip>{{'datakey.attributes' | translate }}</md-tooltip>
@@ -94,7 +94,7 @@ @@ -94,7 +94,7 @@
94 <strong ng-if="$chip.postFuncBody">f({{$chip.name}})</strong> 94 <strong ng-if="$chip.postFuncBody">f({{$chip.name}})</strong>
95 </div> 95 </div>
96 </div> 96 </div>
97 - <md-button ng-click="editDataKey($event, $chip, $index)" class="md-icon-button tb-md-32"> 97 + <md-button ng-click="editDataKey($event, $chip)" class="md-icon-button tb-md-32">
98 <md-icon aria-label="edit" class="material-icons tb-md-20">edit</md-icon> 98 <md-icon aria-label="edit" class="material-icons tb-md-20">edit</md-icon>
99 </md-button> 99 </md-button>
100 </div> 100 </div>
@@ -139,7 +139,7 @@ @@ -139,7 +139,7 @@
139 <div class="tb-color-preview" ng-click="showColorPicker($event, $chip, $index)" style="margin-right: 5px;"> 139 <div class="tb-color-preview" ng-click="showColorPicker($event, $chip, $index)" style="margin-right: 5px;">
140 <div class="tb-color-result" ng-style="{background: $chip.color}"></div> 140 <div class="tb-color-result" ng-style="{background: $chip.color}"></div>
141 </div> 141 </div>
142 - <div layout="row"> 142 + <div layout="row" flex>
143 <div class="tb-chip-label"> 143 <div class="tb-chip-label">
144 {{$chip.label}} 144 {{$chip.label}}
145 </div> 145 </div>
@@ -149,7 +149,7 @@ @@ -149,7 +149,7 @@
149 <strong ng-if="$chip.postFuncBody">f({{$chip.name}})</strong> 149 <strong ng-if="$chip.postFuncBody">f({{$chip.name}})</strong>
150 </div> 150 </div>
151 </div> 151 </div>
152 - <md-button ng-click="editDataKey($event, $chip, $index)" class="md-icon-button tb-md-32"> 152 + <md-button ng-click="editDataKey($event, $chip)" class="md-icon-button tb-md-32">
153 <md-icon aria-label="edit" class="material-icons tb-md-20">edit</md-icon> 153 <md-icon aria-label="edit" class="material-icons tb-md-20">edit</md-icon>
154 </md-button> 154 </md-button>
155 </div> 155 </div>
@@ -162,7 +162,7 @@ function DatasourceFunc($compile, $templateCache, $mdDialog, $window, $document, @@ -162,7 +162,7 @@ function DatasourceFunc($compile, $templateCache, $mdDialog, $window, $document,
162 }); 162 });
163 } 163 }
164 164
165 - scope.editDataKey = function (event, dataKey, index) { 165 + scope.editDataKey = function (event, dataKey) {
166 166
167 $mdDialog.show({ 167 $mdDialog.show({
168 controller: 'DatakeyConfigDialogController', 168 controller: 'DatakeyConfigDialogController',
@@ -182,11 +182,12 @@ function DatasourceFunc($compile, $templateCache, $mdDialog, $window, $document, @@ -182,11 +182,12 @@ function DatasourceFunc($compile, $templateCache, $mdDialog, $window, $document,
182 var w = angular.element($window); 182 var w = angular.element($window);
183 w.triggerHandler('resize'); 183 w.triggerHandler('resize');
184 } 184 }
185 - }).then(function (dataKey) {  
186 - if (dataKey.type === types.dataKeyType.function) {  
187 - scope.funcDataKeys[index] = dataKey;  
188 - } else if (dataKey.type === types.dataKeyType.alarm) {  
189 - scope.alarmDataKeys[index] = dataKey; 185 + }).then(function (newDataKey) {
  186 + let index = scope.funcDataKeys.indexOf(dataKey);
  187 + if (newDataKey.type === types.dataKeyType.function) {
  188 + scope.funcDataKeys[index] = newDataKey;
  189 + } else if (newDataKey.type === types.dataKeyType.alarm) {
  190 + scope.alarmDataKeys[index] = newDataKey;
190 } 191 }
191 ngModelCtrl.$setDirty(); 192 ngModelCtrl.$setDirty();
192 }, function () { 193 }, function () {
@@ -64,7 +64,7 @@ @@ -64,7 +64,7 @@
64 <div class="tb-color-preview" ng-click="showColorPicker($event, $chip, $index)" style="margin-right: 5px;"> 64 <div class="tb-color-preview" ng-click="showColorPicker($event, $chip, $index)" style="margin-right: 5px;">
65 <div class="tb-color-result" ng-style="{background: $chip.color}"></div> 65 <div class="tb-color-result" ng-style="{background: $chip.color}"></div>
66 </div> 66 </div>
67 - <div layout="row"> 67 + <div layout="row" flex>
68 <div class="tb-chip-label"> 68 <div class="tb-chip-label">
69 {{$chip.label}} 69 {{$chip.label}}
70 </div> 70 </div>
@@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
73 <strong>{{$chip.name}}</strong> 73 <strong>{{$chip.name}}</strong>
74 </div> 74 </div>
75 </div> 75 </div>
76 - <md-button ng-click="editDataKey($event, $chip, $index)" class="md-icon-button tb-md-32"> 76 + <md-button ng-click="editDataKey($event, $chip)" class="md-icon-button tb-md-32">
77 <md-icon aria-label="edit" class="material-icons tb-md-20">edit</md-icon> 77 <md-icon aria-label="edit" class="material-icons tb-md-20">edit</md-icon>
78 </md-button> 78 </md-button>
79 </div> 79 </div>
@@ -118,7 +118,7 @@ @@ -118,7 +118,7 @@
118 <div class="tb-color-preview" ng-click="showColorPicker($event, $chip, $index)" style="margin-right: 5px;"> 118 <div class="tb-color-preview" ng-click="showColorPicker($event, $chip, $index)" style="margin-right: 5px;">
119 <div class="tb-color-result" ng-style="{background: $chip.color}"></div> 119 <div class="tb-color-result" ng-style="{background: $chip.color}"></div>
120 </div> 120 </div>
121 - <div layout="row"> 121 + <div layout="row" flex>
122 <div class="tb-chip-label"> 122 <div class="tb-chip-label">
123 {{$chip.label}} 123 {{$chip.label}}
124 </div> 124 </div>
@@ -128,7 +128,7 @@ @@ -128,7 +128,7 @@
128 <strong ng-if="$chip.postFuncBody">f({{$chip.name}})</strong> 128 <strong ng-if="$chip.postFuncBody">f({{$chip.name}})</strong>
129 </div> 129 </div>
130 </div> 130 </div>
131 - <md-button ng-click="editDataKey($event, $chip, $index)" class="md-icon-button tb-md-32"> 131 + <md-button ng-click="editDataKey($event, $chip)" class="md-icon-button tb-md-32">
132 <md-icon aria-label="edit" class="material-icons tb-md-20">edit</md-icon> 132 <md-icon aria-label="edit" class="material-icons tb-md-20">edit</md-icon>
133 </md-button> 133 </md-button>
134 </div> 134 </div>