From 7f0ad0f86a3bbe7726c852b841c4a20658f00f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Vi=C3=A9not?= Date: Wed, 7 Jun 2023 16:17:14 +0200 Subject: [PATCH 1/2] A transaction should be considered a parent only when it has children. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Simon Viénot --- .../transaction/TransactionGroupAnalyzer.ts | 2 +- .../transaction/TransactionDetails.spec.ts | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/components/transaction/TransactionGroupAnalyzer.ts b/src/components/transaction/TransactionGroupAnalyzer.ts index 3c559ae9a..49a43e68f 100644 --- a/src/components/transaction/TransactionGroupAnalyzer.ts +++ b/src/components/transaction/TransactionGroupAnalyzer.ts @@ -41,7 +41,7 @@ export class TransactionGroupAnalyzer { break } } - return result + return this.childTransactions.value.length ? result : null }) public readonly childTransactions = computed(() => { diff --git a/tests/unit/transaction/TransactionDetails.spec.ts b/tests/unit/transaction/TransactionDetails.spec.ts index 6a5c46bd2..7c0de3672 100644 --- a/tests/unit/transaction/TransactionDetails.spec.ts +++ b/tests/unit/transaction/TransactionDetails.spec.ts @@ -42,6 +42,7 @@ import { SAMPLE_NETWORK_EXCHANGERATE, SAMPLE_NETWORK_NODES, SAMPLE_PARENT_CHILD_TRANSACTIONS, + SAMPLE_SAME_ID_NOT_PARENT_TRANSACTIONS, SAMPLE_SCHEDULING_SCHEDULED_TRANSACTIONS, SAMPLE_SYSTEM_CONTRACT_CALL_TRANSACTIONS, SAMPLE_TOKEN, @@ -657,6 +658,42 @@ describe("TransactionDetails.vue", () => { await flushPromises() }); + it("Should NOT display a link to the parent transaction", async () => { + + await router.push("/") // To avoid "missing required param 'network'" error + + const NONCE_1 = SAMPLE_SAME_ID_NOT_PARENT_TRANSACTIONS.transactions[1] + const matcher1 = "/api/v1/transactions" + mock.onGet(matcher1).reply((config: AxiosRequestConfig) => { + if (config.params.timestamp == NONCE_1.consensus_timestamp) { + return [200, {transactions: [NONCE_1]}] + } else { + return [404] + } + }); + const matcher11 = "/api/v1/transactions/" + NONCE_1.transaction_id + mock.onGet(matcher11).reply(200, SAMPLE_SAME_ID_NOT_PARENT_TRANSACTIONS); + + const wrapper = mount(TransactionDetails, { + global: { + plugins: [router, Oruga] + }, + props: { + transactionLoc: NONCE_1.consensus_timestamp, + }, + }); + + await flushPromises() + // console.log(wrapper.html()) + // console.log(wrapper.text()) + + expect(wrapper.text()).toMatch(RegExp("^Transaction " + normalizeTransactionId(NONCE_1.transaction_id, true))) + expect(wrapper.find("#parentTransaction").exists()).toBe(false) + + wrapper.unmount() + await flushPromises() + }); + it("Should display transaction details with account/token association", async () => { await router.push("/") // To avoid "missing required param 'network'" error From 21d2fe5d3c84a6c20692aabe99eb538df04e996c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Vi=C3=A9not?= Date: Wed, 7 Jun 2023 16:28:50 +0200 Subject: [PATCH 2/2] Display "Show all with same ID" link in 'control' slot like other similar links. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Simon Viénot --- src/pages/TransactionDetails.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pages/TransactionDetails.vue b/src/pages/TransactionDetails.vue index ccb80204b..d97202322 100644 --- a/src/pages/TransactionDetails.vue +++ b/src/pages/TransactionDetails.vue @@ -37,11 +37,6 @@
FAILURE
- - - Show all transactions with the same ID - - @@ -50,6 +45,12 @@ + +