feat(wallet) filter activity by status
Parse the status information from the API response Added debugging status as to the debug view Closes: #10746
This commit is contained in:
parent
f0b42ad672
commit
16304ab26b
|
@ -138,6 +138,7 @@ QtObject:
|
|||
var backendEntities = newSeq[backend_activity.ActivityEntry](response.result.len)
|
||||
for i in 0 ..< response.result.len:
|
||||
backendEntities[i] = fromJson(response.result[i], backend_activity.ActivityEntry)
|
||||
|
||||
let entries = self.backendToPresentation(backendEntities)
|
||||
self.model.setEntries(entries)
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ QtObject:
|
|||
result.multi_transaction = mt
|
||||
result.transaction = nil
|
||||
result.isPending = false
|
||||
result.metadata = metadata
|
||||
result.setup()
|
||||
|
||||
proc newTransactionActivityEntry*(tr: ref Item, metadata: backend.ActivityEntry): ActivityEntry =
|
||||
|
@ -41,6 +42,7 @@ QtObject:
|
|||
result.multi_transaction = nil
|
||||
result.transaction = tr
|
||||
result.isPending = metadata.payloadType == backend.PayloadType.PendingTransaction
|
||||
result.metadata = metadata
|
||||
result.setup()
|
||||
|
||||
proc isMultiTransaction*(self: ActivityEntry): bool {.slot.} =
|
||||
|
@ -134,6 +136,12 @@ QtObject:
|
|||
QtProperty[int] timestamp:
|
||||
read = getTimestamp
|
||||
|
||||
proc getStatus*(self: ActivityEntry): int {.slot.} =
|
||||
return self.metadata.activityStatus.int
|
||||
|
||||
QtProperty[int] status:
|
||||
read = getStatus
|
||||
|
||||
# TODO: properties - type, fromChains, toChains, fromAsset, toAsset, assetName
|
||||
|
||||
# proc getType*(self: ActivityEntry): int {.slot.} =
|
||||
|
|
|
@ -68,6 +68,9 @@ proc `%`*(at: ActivityType): JsonNode {.inline.} =
|
|||
proc `%`*(aSt: ActivityStatus): JsonNode {.inline.} =
|
||||
return newJInt(ord(aSt))
|
||||
|
||||
proc fromJson*(x: JsonNode, T: typedesc[ActivityStatus]): ActivityStatus {.inline.} =
|
||||
return cast[ActivityStatus](x.getInt())
|
||||
|
||||
proc `$`*(tc: TokenCode): string = $(string(tc))
|
||||
proc `$`*(ta: TokenAddress): string = $(string(ta))
|
||||
|
||||
|
@ -154,6 +157,7 @@ proc fromJson*(e: JsonNode, T: typedesc[ActivityEntry]): ActivityEntry {.inline.
|
|||
transaction: if e.hasKey("transaction"): fromJson(e["transaction"], Option[TransactionIdentity])
|
||||
else: none(TransactionIdentity),
|
||||
id: e["id"].getInt(),
|
||||
activityStatus: fromJson(e["activityStatus"], ActivityStatus),
|
||||
timestamp: e["timestamp"].getInt()
|
||||
)
|
||||
|
||||
|
|
|
@ -153,6 +153,7 @@ Item {
|
|||
|
||||
assetsLoading: RootStore.assetsLoading
|
||||
address: RootStore.overview.mixedcaseAddress
|
||||
|
||||
networkConnectionStore: root.networkConnectionStore
|
||||
}
|
||||
|
||||
|
|
|
@ -365,6 +365,20 @@ Control {
|
|||
Label { text: entry.recipient; Layout.maximumWidth: 200; elide: Text.ElideMiddle }
|
||||
Label { text: "got"; Layout.leftMargin: 5; Layout.rightMargin: 5; visible: entry.isMultiTransaction }
|
||||
Label { text: entry.toAmount; Layout.leftMargin: 5; Layout.rightMargin: 5; visible: entry.isMultiTransaction }
|
||||
Label {
|
||||
text: `{${
|
||||
function() {
|
||||
switch (entry.status) {
|
||||
case ActivityView.ActivityStatus.Failed: return "F";
|
||||
case ActivityView.ActivityStatus.Pending: return "P";
|
||||
case ActivityView.ActivityStatus.Complete: return "C";
|
||||
case ActivityView.ActivityStatus.Finalized: return "FZ";
|
||||
}
|
||||
return "-"
|
||||
}()}}`
|
||||
Layout.leftMargin: 5;
|
||||
}
|
||||
Label { text: entry.toAmount; Layout.leftMargin: 5; Layout.rightMargin: 5; visible: entry.isMultiTransaction }
|
||||
RowLayout {} // Spacer
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e53c2c0a6d36d8956a4ba8cb476c977548cc3c11
|
||||
Subproject commit 87ce6cfbcd8c6dd9ce3f7dee8b2a3f7b43738e81
|
Loading…
Reference in New Issue