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 192 dataKey.color = color;
193 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 199 $mdDialog.show({
200 200 controller: 'DatakeyConfigDialogController',
... ... @@ -214,11 +214,12 @@ function DatasourceEntity($compile, $templateCache, $q, $mdDialog, $window, $doc
214 214 var w = angular.element($window);
215 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 224 ngModelCtrl.$setDirty();
224 225 }, function () {
... ...
... ... @@ -24,6 +24,7 @@
24 24 display: block;
25 25 height: 48px;
26 26 line-height: 1.5;
  27 + white-space: normal !important;
27 28
28 29 .tb-no-entries {
29 30 line-height: 48px;
... ... @@ -32,7 +33,6 @@
32 33
33 34 li {
34 35 height: auto !important;
35   - white-space: normal !important;
36 36 }
37 37 }
38 38
... ...
... ... @@ -76,7 +76,7 @@
76 76 <div class="tb-color-preview" ng-click="showColorPicker($event, $chip, $index)" style="margin-right: 5px;">
77 77 <div class="tb-color-result" ng-style="{background: $chip.color}"></div>
78 78 </div>
79   - <div layout="row">
  79 + <div layout="row" flex>
80 80 <div class="tb-chip-label">
81 81 <span ng-show="$chip.type==types.dataKeyType.attribute">
82 82 <md-tooltip>{{'datakey.attributes' | translate }}</md-tooltip>
... ... @@ -94,7 +94,7 @@
94 94 <strong ng-if="$chip.postFuncBody">f({{$chip.name}})</strong>
95 95 </div>
96 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 98 <md-icon aria-label="edit" class="material-icons tb-md-20">edit</md-icon>
99 99 </md-button>
100 100 </div>
... ... @@ -139,7 +139,7 @@
139 139 <div class="tb-color-preview" ng-click="showColorPicker($event, $chip, $index)" style="margin-right: 5px;">
140 140 <div class="tb-color-result" ng-style="{background: $chip.color}"></div>
141 141 </div>
142   - <div layout="row">
  142 + <div layout="row" flex>
143 143 <div class="tb-chip-label">
144 144 {{$chip.label}}
145 145 </div>
... ... @@ -149,7 +149,7 @@
149 149 <strong ng-if="$chip.postFuncBody">f({{$chip.name}})</strong>
150 150 </div>
151 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 153 <md-icon aria-label="edit" class="material-icons tb-md-20">edit</md-icon>
154 154 </md-button>
155 155 </div>
... ...
... ... @@ -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 167 $mdDialog.show({
168 168 controller: 'DatakeyConfigDialogController',
... ... @@ -182,11 +182,12 @@ function DatasourceFunc($compile, $templateCache, $mdDialog, $window, $document,
182 182 var w = angular.element($window);
183 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 192 ngModelCtrl.$setDirty();
192 193 }, function () {
... ...
... ... @@ -64,7 +64,7 @@
64 64 <div class="tb-color-preview" ng-click="showColorPicker($event, $chip, $index)" style="margin-right: 5px;">
65 65 <div class="tb-color-result" ng-style="{background: $chip.color}"></div>
66 66 </div>
67   - <div layout="row">
  67 + <div layout="row" flex>
68 68 <div class="tb-chip-label">
69 69 {{$chip.label}}
70 70 </div>
... ... @@ -73,7 +73,7 @@
73 73 <strong>{{$chip.name}}</strong>
74 74 </div>
75 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 77 <md-icon aria-label="edit" class="material-icons tb-md-20">edit</md-icon>
78 78 </md-button>
79 79 </div>
... ... @@ -118,7 +118,7 @@
118 118 <div class="tb-color-preview" ng-click="showColorPicker($event, $chip, $index)" style="margin-right: 5px;">
119 119 <div class="tb-color-result" ng-style="{background: $chip.color}"></div>
120 120 </div>
121   - <div layout="row">
  121 + <div layout="row" flex>
122 122 <div class="tb-chip-label">
123 123 {{$chip.label}}
124 124 </div>
... ... @@ -128,7 +128,7 @@
128 128 <strong ng-if="$chip.postFuncBody">f({{$chip.name}})</strong>
129 129 </div>
130 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 132 <md-icon aria-label="edit" class="material-icons tb-md-20">edit</md-icon>
133 133 </md-button>
134 134 </div>
... ...