Skip to content

Commit e539e37

Browse files
authored
fix: NodeUpdate and NodeDelete views now disable creation when node id is invalid (#2437)
* NodeUpdate now disable creation when node is invalid. Signed-off-by: Eric Le Ponner <eric.leponner@icloud.com> * NodeDelete now disables creation when node is invalid. Signed-off-by: Eric Le Ponner <eric.leponner@icloud.com> --------- Signed-off-by: Eric Le Ponner <eric.leponner@icloud.com>
1 parent 120be3c commit e539e37

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

front-end/src/renderer/components/Transaction/Create/NodeDelete/NodeDelete.vue

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ const createTransaction = computed<CreateTransactionFunc>(() => {
3636
});
3737
});
3838
39+
const createDisabled = computed(() => {
40+
return !nodeData.nodeInfo?.value;
41+
});
42+
3943
/* Handlers */
4044
const handleDraftLoaded = (transaction: Transaction) => {
4145
if (transaction instanceof NodeDeleteTransaction) {
@@ -55,18 +59,12 @@ const handleExecutedSuccess = async () => {
5559
toast.success(`Node ${data.nodeId} Deleted`, successToastOptions);
5660
};
5761
58-
/* Functions */
59-
const preCreateAssert = () => {
60-
if (!data.nodeId) {
61-
throw new Error('Node ID Required');
62-
}
63-
};
6462
</script>
6563
<template>
6664
<BaseTransaction
6765
ref="baseTransactionRef"
6866
:create-transaction="createTransaction"
69-
:pre-create-assert="preCreateAssert"
67+
:create-disabled="createDisabled"
7068
@executed:success="handleExecutedSuccess"
7169
@draft-loaded="handleDraftLoaded"
7270
>

front-end/src/renderer/components/Transaction/Create/NodeUpdate/NodeUpdate.vue

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ const createTransaction = computed<CreateTransactionFunc>(() => {
5252
);
5353
});
5454
55+
const createDisabled = computed(() => {
56+
return !nodeData.nodeInfo?.value;
57+
});
58+
5559
/* Handlers */
5660
const handleDraftLoaded = (transaction: Transaction) => {
5761
if (transaction instanceof NodeUpdateTransaction) {
@@ -75,13 +79,6 @@ const handleExecutedSuccess = async () => {
7579
toast.success(`Node ${data.nodeAccountId} Updated`, successToastOptions);
7680
};
7781
78-
/* Functions */
79-
const preCreateAssert = () => {
80-
if (!data.nodeId) {
81-
throw new Error('Node ID Required');
82-
}
83-
};
84-
8582
/* Watchers */
8683
watch(nodeData.nodeInfo, nodeInfo => {
8784
if (!nodeInfo) {
@@ -119,7 +116,7 @@ watch(
119116
<BaseTransaction
120117
ref="baseTransactionRef"
121118
:create-transaction="createTransaction"
122-
:pre-create-assert="preCreateAssert"
119+
:create-disabled="createDisabled"
123120
@executed:success="handleExecutedSuccess"
124121
@draft-loaded="handleDraftLoaded"
125122
>

0 commit comments

Comments
 (0)