diff --git a/src/api/bcd.js b/src/api/bcd.js
index 515d3ad5..5b6dd1cf 100644
--- a/src/api/bcd.js
+++ b/src/api/bcd.js
@@ -518,6 +518,16 @@ export class BetterCallApi {
})
}
+ getOperationDiff(network, id) {
+ return getCancellable(this.api, `/operation/${network}/${id}/diff`, {})
+ .then((res) => {
+ if (res.status != 200) {
+ throw new RequestFailedError(res);
+ }
+ return res.data
+ })
+ }
+
getStats() {
return getCancellable(this.api, `/stats`, {})
.then((res) => {
diff --git a/src/components/InternalOperation.vue b/src/components/InternalOperation.vue
index 2392ab6c..0e0051db 100644
--- a/src/components/InternalOperation.vue
+++ b/src/components/InternalOperation.vue
@@ -67,21 +67,16 @@
mdi-file-tree
- Hide details
-
-
- mdi-file-tree
- Show details
+ {{ showParams ? 'Hide' : 'Show' }} details
@@ -141,7 +136,7 @@
@@ -161,7 +156,10 @@
-
+
+ Loading storage diff...
+
+
Storage
@@ -182,7 +180,7 @@
class="text--secondary caption"
v-if="data"
>{{ data.storage_size | bytes}}
-
+
@@ -225,6 +223,8 @@ export default {
showRaw: false,
showParams: false,
expanded: false,
+ loadingDiffs: false,
+ diffs: null
}),
created() {
this.showParams =
@@ -325,8 +325,8 @@ export default {
return (
this.data != null &&
this.data !== undefined &&
- this.data.storage_diff != null &&
- this.data.storage_diff !== undefined
+ this.diffs != null &&
+ this.diffs !== undefined
);
},
statusColor() {
@@ -354,7 +354,30 @@ export default {
},
},
methods: {
- ...mapActions(["showClipboardOK"]),
+ ...mapActions(["showClipboardOK", "showError"]),
+ getDiff() {
+ if (this.diffs !== null) return;
+
+ this.loadingDiffs = true;
+ this.api.getOperationDiff(this.data.network, this.data.id).
+ then((res) => {
+ this.diffs = res;
+ }).
+ catch(err => {
+ console.log(err);
+ this.showError(err);
+ }).
+ finally(() => {
+ this.loadingDiffs = false;
+ })
+ }
},
+ watch: {
+ showParams(newValue) {
+ if (newValue && this.diffs === null) {
+ this.getDiff();
+ }
+ }
+ }
};
diff --git a/src/views/contract/ContentItem.vue b/src/views/contract/ContentItem.vue
index c76affd2..4cb691f7 100644
--- a/src/views/contract/ContentItem.vue
+++ b/src/views/contract/ContentItem.vue
@@ -2,7 +2,6 @@
{
- const diffs = Object.fromEntries(opg.map(op => [op.id, op.storage_diff]));
- Vue.set(this.value, 'storage_diff', diffs[this.value.id]);
- for (var i = 0; i < this.value.internal_operations.length; i++) {
- Vue.set(this.value.internal_operations[i], 'storage_diff', diffs[this.value.internal_operations[i].id]);
- }
- })
- }
- }
},
};