From f34e74548eba9c506783fca0f1f80bc56c343683 Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 9 Aug 2023 13:19:32 +0200 Subject: [PATCH] Update GRCP status entries (#175) --- frontend/src/components/status/GrcpStatus.tsx | 18 ++-------- .../src/components/status/GrcpStatusBadge.tsx | 34 ++---------------- frontend/src/utils/flow-utils.ts | 36 ++----------------- shared/proto/entities/transactions.proto | 19 ++-------- yarn.lock | 2 ++ 5 files changed, 12 insertions(+), 97 deletions(-) diff --git a/frontend/src/components/status/GrcpStatus.tsx b/frontend/src/components/status/GrcpStatus.tsx index cb00a156..5c1cc0d6 100644 --- a/frontend/src/components/status/GrcpStatus.tsx +++ b/frontend/src/components/status/GrcpStatus.tsx @@ -25,23 +25,9 @@ function GrcpStatusIcon(props: { statusCode: GrcpStatusCode | undefined }) { switch (props.statusCode) { case GrcpStatusCode.GRCP_STATUS_OK: return ; - case GrcpStatusCode.GRCP_STATUS_CANCELLED: - case GrcpStatusCode.GRCP_STATUS_INVALID_ARGUMENT: - case GrcpStatusCode.GRCP_STATUS_DEADLINE_EXCEEDED: - case GrcpStatusCode.GRCP_STATUS_NOT_FOUND: - case GrcpStatusCode.GRCP_STATUS_ALREADY_EXISTS: - case GrcpStatusCode.GRCP_STATUS_PERMISSION_DENIED: - case GrcpStatusCode.GRCP_STATUS_RESOURCE_EXHAUSTED: - case GrcpStatusCode.GRCP_STATUS_FAILED_PRECONDITION: - case GrcpStatusCode.GRCP_STATUS_ABORTED: - case GrcpStatusCode.GRCP_STATUS_OUT_OF_RANGE: - case GrcpStatusCode.GRCP_STATUS_UNIMPLEMENTED: - case GrcpStatusCode.GRCP_STATUS_INTERNAL: - case GrcpStatusCode.GRCP_STATUS_UNAVAILABLE: - case GrcpStatusCode.GRCP_STATUS_DATA_LOSS: - case GrcpStatusCode.GRCP_STATUS_UNAUTHENTICATED: + case GrcpStatusCode.GRCP_STATUS_FAILED: return ; - case GrcpStatusCode.GRCP_STATUS_UNKNOWN: + case GrcpStatusCode.UNRECOGNIZED: default: return ; } diff --git a/frontend/src/components/status/GrcpStatusBadge.tsx b/frontend/src/components/status/GrcpStatusBadge.tsx index c9f1bba8..33d9790b 100644 --- a/frontend/src/components/status/GrcpStatusBadge.tsx +++ b/frontend/src/components/status/GrcpStatusBadge.tsx @@ -29,24 +29,10 @@ export const GrcpStatusBadge: FunctionComponent = ({ function getBackground(statusCode: GrcpStatusCode | undefined) { switch (statusCode) { - case GrcpStatusCode.GRCP_STATUS_ABORTED: - case GrcpStatusCode.GRCP_STATUS_CANCELLED: - case GrcpStatusCode.GRCP_STATUS_UNAVAILABLE: - case GrcpStatusCode.GRCP_STATUS_UNAUTHENTICATED: - case GrcpStatusCode.GRCP_STATUS_DEADLINE_EXCEEDED: - case GrcpStatusCode.GRCP_STATUS_ALREADY_EXISTS: - case GrcpStatusCode.GRCP_STATUS_FAILED_PRECONDITION: - case GrcpStatusCode.GRCP_STATUS_INVALID_ARGUMENT: - case GrcpStatusCode.GRCP_STATUS_OUT_OF_RANGE: - case GrcpStatusCode.GRCP_STATUS_INTERNAL: - case GrcpStatusCode.GRCP_STATUS_UNIMPLEMENTED: - case GrcpStatusCode.GRCP_STATUS_DATA_LOSS: - case GrcpStatusCode.GRCP_STATUS_PERMISSION_DENIED: - case GrcpStatusCode.GRCP_STATUS_RESOURCE_EXHAUSTED: + case GrcpStatusCode.GRCP_STATUS_FAILED: return "#dd868b"; case GrcpStatusCode.GRCP_STATUS_OK: return "#A2CE8D"; - case GrcpStatusCode.GRCP_STATUS_UNKNOWN: default: return "#D0D2D6"; } @@ -54,24 +40,10 @@ function getBackground(statusCode: GrcpStatusCode | undefined) { function getTextColor(statusCode: GrcpStatusCode | undefined) { switch (statusCode) { - case GrcpStatusCode.GRCP_STATUS_ABORTED: - case GrcpStatusCode.GRCP_STATUS_CANCELLED: - case GrcpStatusCode.GRCP_STATUS_UNAVAILABLE: - case GrcpStatusCode.GRCP_STATUS_UNAUTHENTICATED: - case GrcpStatusCode.GRCP_STATUS_DEADLINE_EXCEEDED: - case GrcpStatusCode.GRCP_STATUS_ALREADY_EXISTS: - case GrcpStatusCode.GRCP_STATUS_FAILED_PRECONDITION: - case GrcpStatusCode.GRCP_STATUS_INVALID_ARGUMENT: - case GrcpStatusCode.GRCP_STATUS_OUT_OF_RANGE: - case GrcpStatusCode.GRCP_STATUS_INTERNAL: - case GrcpStatusCode.GRCP_STATUS_UNIMPLEMENTED: - case GrcpStatusCode.GRCP_STATUS_DATA_LOSS: - case GrcpStatusCode.GRCP_STATUS_PERMISSION_DENIED: - case GrcpStatusCode.GRCP_STATUS_RESOURCE_EXHAUSTED: - return "#FFFFF"; case GrcpStatusCode.GRCP_STATUS_OK: return "#218300"; - case GrcpStatusCode.GRCP_STATUS_UNKNOWN: + case GrcpStatusCode.GRCP_STATUS_FAILED: + return "#FFFFF"; default: return "#D0D2D6"; } diff --git a/frontend/src/utils/flow-utils.ts b/frontend/src/utils/flow-utils.ts index 79e70391..6047ecd9 100644 --- a/frontend/src/utils/flow-utils.ts +++ b/frontend/src/utils/flow-utils.ts @@ -42,40 +42,10 @@ export class FlowUtils { switch (statusCode) { case GrcpStatusCode.GRCP_STATUS_OK: return "Ok"; - case GrcpStatusCode.GRCP_STATUS_CANCELLED: - return "Cancelled"; - case GrcpStatusCode.GRCP_STATUS_UNKNOWN: - return "Unknown"; - case GrcpStatusCode.GRCP_STATUS_INVALID_ARGUMENT: - return "Invalid argument"; - case GrcpStatusCode.GRCP_STATUS_DEADLINE_EXCEEDED: - return "Deadline exceeded"; - case GrcpStatusCode.GRCP_STATUS_NOT_FOUND: - return "Not found"; - case GrcpStatusCode.GRCP_STATUS_ALREADY_EXISTS: - return "Already exists"; - case GrcpStatusCode.GRCP_STATUS_PERMISSION_DENIED: - return "Permission denied"; - case GrcpStatusCode.GRCP_STATUS_RESOURCE_EXHAUSTED: - return "Resource exhausted"; - case GrcpStatusCode.GRCP_STATUS_FAILED_PRECONDITION: - return "Failed precondition"; - case GrcpStatusCode.GRCP_STATUS_ABORTED: - return "Aborted"; - case GrcpStatusCode.GRCP_STATUS_OUT_OF_RANGE: - return "Out of range"; - case GrcpStatusCode.GRCP_STATUS_UNIMPLEMENTED: - return "Unimplemented"; - case GrcpStatusCode.GRCP_STATUS_INTERNAL: - return "Internal"; - case GrcpStatusCode.GRCP_STATUS_UNAVAILABLE: - return "Unavailable"; - case GrcpStatusCode.GRCP_STATUS_DATA_LOSS: - return "Data loss"; - case GrcpStatusCode.GRCP_STATUS_UNAUTHENTICATED: - return "Unauthenticated"; + case GrcpStatusCode.GRCP_STATUS_FAILED: + return "Failed"; default: - return "-"; + return "?"; } } diff --git a/shared/proto/entities/transactions.proto b/shared/proto/entities/transactions.proto index 696dfded..558c033e 100644 --- a/shared/proto/entities/transactions.proto +++ b/shared/proto/entities/transactions.proto @@ -28,25 +28,10 @@ enum ExecutionStatusCode { EXECUTION_STATUS_EXPIRED = 5; } -// https://grpc.github.io/grpc/core/md_doc_statuscodes.html +// https://github.com/onflow/flow-go/issues/4494#issuecomment-1601995168 enum GrcpStatusCode { GRCP_STATUS_OK = 0; - GRCP_STATUS_CANCELLED = 1; - GRCP_STATUS_UNKNOWN = 2; - GRCP_STATUS_INVALID_ARGUMENT = 3; - GRCP_STATUS_DEADLINE_EXCEEDED = 4; - GRCP_STATUS_NOT_FOUND = 5; - GRCP_STATUS_ALREADY_EXISTS = 6; - GRCP_STATUS_PERMISSION_DENIED = 7; - GRCP_STATUS_RESOURCE_EXHAUSTED = 8; - GRCP_STATUS_FAILED_PRECONDITION = 9; - GRCP_STATUS_ABORTED = 10; - GRCP_STATUS_OUT_OF_RANGE = 11; - GRCP_STATUS_UNIMPLEMENTED = 12; - GRCP_STATUS_INTERNAL = 13; - GRCP_STATUS_UNAVAILABLE = 14; - GRCP_STATUS_DATA_LOSS = 15; - GRCP_STATUS_UNAUTHENTICATED = 16; + GRCP_STATUS_FAILED = 1; } message Transaction { diff --git a/yarn.lock b/yarn.lock index 84ed39e8..85460d3c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1382,6 +1382,7 @@ "@fingerprintjs/fingerprintjs" "^3.3.6" "@flowser/backend" "0.0.1" "@flowser/shared" "0.0.1" + "@onflow/cadence-parser" "^0.26.0" "@onflow/fcl" "^1.2.0" "@onflow/types" "^1.0.3" "@sentry/electron" "^4.0.2" @@ -1429,6 +1430,7 @@ "react-timeago" "^6.2.1" "sqlite3" "^5.0.11" "typescript" "^4.4.3" + "usehooks-ts" "^2.9.1" "wait-on" "^6.0.1" "web-vitals" "^1.1.2" "yup" "^0.32.11"