Skip to content

Commit 9097f05

Browse files
authored
Fix response vars (#675)
* fixed design response vars in tx details
1 parent fd91085 commit 9097f05

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

public/views/modals/tx-details.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,13 @@ <h4 class="title m0" translate>This transaction was sent to an autonomous agent<
257257
</li>
258258
</ul>
259259

260-
<h4 ng-show="btx.formattedResponseVars" class="title m0" translate>Response variables</h4>
261-
<div ng-show="btx.formattedResponseVars" class="size-14 m0 tx-details">
262-
<div style="display: grid;grid-template-columns: auto 1fr;">
263-
<div ng-repeat="(_key,value) in btx.formattedResponseVars" class="line-b p10 tx-grid">{{ value }}</div>
264-
</div>
265-
</div>
260+
<h4 ng-show="btx.formattedResponseVars" class="title m0" translate>Response variables</h4>
261+
<ul ng-show="btx.formattedResponseVars" class="no-bullet size-14 m0 tx-details">
262+
<li ng-repeat="(key,value) in btx.formattedResponseVars" class="line-b p10 row collapse" style="display:flex;flex-wrap:wrap;flex-direction:row;justify-content:flex-end;">
263+
<div class="text-gray enable_text_select" style="word-wrap: break-word; flex: 1; width: 100%"><span>{{key}}</span></div>
264+
<div class="enable_text_select" ng-class="[value.isJson ? 'tx-grid_json' : 'right text-right']" style="word-wrap: break-word">{{value.v}}</div>
265+
</li>
266+
</ul>
266267
</div>
267268

268269
</div>

src/css/main.css

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,12 +2305,7 @@ not screen and (min-resolution: 192dpi) {
23052305
display: block;
23062306
}
23072307

2308-
.tx-grid {
2309-
word-wrap: break-word;
2308+
.tx-grid_json {
23102309
white-space: pre-wrap;
2311-
}
2312-
2313-
.tx-grid:nth-child(odd) {
2314-
max-width: 144px;
23152310
width: 100%;
23162311
}

src/js/controllers/walletHome.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3115,26 +3115,25 @@ angular.module('copayApp.controllers')
31153115
}
31163116

31173117
function formatResponseVars(vars) {
3118-
const _vars = [];
3118+
const _vars = {};
31193119

31203120
for (let key in vars) {
31213121
let _key = key;
3122-
let value = vars[key];
3122+
let value = { isJson: false, v: vars[key] };
31233123
if (key.length > 14) {
31243124
// _key = key.split('_').join('\n_');
31253125
}
31263126

31273127
try {
31283128
const v = JSON.parse(vars[key]);
31293129
if (v && typeof v === 'object') {
3130-
value = JSON.stringify(v, null, 2);
3130+
value = { isJson: true, v: JSON.stringify(v, null, 2) };
31313131
}
31323132
} catch (e) {
31333133
// nothing
31343134
}
31353135

3136-
_vars.push(_key);
3137-
_vars.push(value);
3136+
_vars[_key] = value;
31383137
}
31393138

31403139
return _vars;

0 commit comments

Comments
 (0)