From f5238cb91191bf2b6a8c7461624ab602fb52d4d2 Mon Sep 17 00:00:00 2001 From: Torresmorah Date: Wed, 5 Jul 2023 15:55:53 -0600 Subject: [PATCH 01/18] fix(hapi): wait a second to query the account created and use /v1/chain/get_accounts_by_authorizers --- .../src/routes/create-faucet-account.route.js | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/hapi/src/routes/create-faucet-account.route.js b/hapi/src/routes/create-faucet-account.route.js index ef672b01..7e2c00b4 100644 --- a/hapi/src/routes/create-faucet-account.route.js +++ b/hapi/src/routes/create-faucet-account.route.js @@ -6,7 +6,8 @@ const { eosUtil, axiosUtil, googleRecaptchaEnterpriseUtil, - getCreateAccountDataUtil + getCreateAccountDataUtil, + sleepFor } = require('../utils') module.exports = { @@ -43,25 +44,29 @@ module.exports = { eosConfig.faucet.password ) + await sleepFor(1) + const { - data: { account_name: account, permissions } + data: { accounts } } = await axiosUtil.instance.post( - `${eosConfig.apiEndpoint}/v1/chain/get_account`, + `${eosConfig.apiEndpoint}/v1/chain/get_accounts_by_authorizers`, { - account_name: input.name + keys: [input.public_key] } ) - const keys = permissions[0]?.required_auth?.keys || [] - const key = keys[0]?.key + const response = accounts.find(account => account.account_name === input.name) - if (account === input.name && key === input.public_key) { - return { account } - } + if (!response) throw new Error('Account creation failed') - return Boom.badData('Wrong key format') + return { account: input.name } } catch (err) { - throw Boom.badRequest(err.message) + const errorDetail = + err?.response?.data?.error?.details[0]?.message?.substring(0, 11) + + return 'unknown key' === errorDetail + ? Boom.badRequest('Account creation failed') + : Boom.badRequest(err.message) } }, options: { From f7bf0ce10fadb45f4ac809662ed51936d14dec01 Mon Sep 17 00:00:00 2001 From: Torresmorah Date: Wed, 5 Jul 2023 15:57:52 -0600 Subject: [PATCH 02/18] fix(webapp): input.name is not allowed to be empty --- webapp/src/gql/faucet.gql.js | 10 +++++--- webapp/src/routes/Faucet/index.js | 42 ++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/webapp/src/gql/faucet.gql.js b/webapp/src/gql/faucet.gql.js index ad1670dc..8ea73834 100644 --- a/webapp/src/gql/faucet.gql.js +++ b/webapp/src/gql/faucet.gql.js @@ -1,8 +1,12 @@ import gql from 'graphql-tag' -export const CREATE_ACCOUNT_MUTATION = gql` - mutation ($token: String!, $public_key: String!, $name: String) { - createAccount(token: $token, public_key: $public_key, name: $name) { +export const CREATE_ACCOUNT_MUTATION = (includeName = true) => gql` + mutation ($token: String!, $public_key: String! ${ + includeName ? ', $name: String' : '' + }) { + createAccount(token: $token, public_key: $public_key ${ + includeName ? ', name: $name' : '' + }) { account } } diff --git a/webapp/src/routes/Faucet/index.js b/webapp/src/routes/Faucet/index.js index 5e46d716..cf82b624 100644 --- a/webapp/src/routes/Faucet/index.js +++ b/webapp/src/routes/Faucet/index.js @@ -30,7 +30,7 @@ const Faucet = () => { const [createAccountValues, setCreateAccountValues] = useState({}) const [transferTokensTransaction, setTransferTokensTransaction] = useState('') const [createFaucetAccount, { loading: loadingCreateAccount }] = useMutation( - CREATE_ACCOUNT_MUTATION, + CREATE_ACCOUNT_MUTATION( eosConfig.networkName !== 'ultra-testnet' ), ) const [transferFaucetTokens, { loading: loadingTransferFaucetTokens }] = useMutation(TRANFER_FAUCET_TOKENS_MUTATION) @@ -39,14 +39,17 @@ const Faucet = () => { const createAccount = async () => { const reCaptchaToken = await executeRecaptcha?.('submit') - if (eosConfig.networkName === 'libre-testnet') { - if ( - !reCaptchaToken || - (!createAccountValues.publicKey && !createAccountValues.accountName) - ) - return - } else { - if (!reCaptchaToken || !createAccountValues.publicKey) return + if ( + !reCaptchaToken || + !createAccountValues.publicKey || + (eosConfig.networkName !== 'ultra-testnet' && + !createAccountValues.accountName) + ) { + showMessage({ + type: 'error', + content: 'Fill out the fields to create an account', + }) + return } try { @@ -58,7 +61,7 @@ const Faucet = () => { variables: { token: reCaptchaToken, public_key: createAccountValues.publicKey, - name: createAccountValues.accountName || '', + name: createAccountValues.accountName }, }) @@ -71,8 +74,8 @@ const Faucet = () => { ), }) } catch (err) { - const errorMessage = err.message.replace( - 'GraphQL error: assertion failure with message: ', + const errorMessage = err.message.replace('GraphQL error:','').replace( + 'assertion failure with message: ', '', ) @@ -128,6 +131,12 @@ const Faucet = () => { setAccount('') } + const isValidName = name => { + const regex = /^[.12345abcdefghijklmnopqrstuvwxyz]+$/i + + return name?.length < 13 && regex.test(name) + } + return (
@@ -147,9 +156,11 @@ const Faucet = () => { ...{ publicKey: e.target.value }, }) } + error={!createAccountValues.publicKey} + required />
- {eosConfig.networkName === 'libre-testnet' && ( + {eosConfig.networkName !== 'ultra-testnet' && (
{ ...{ accountName: e.target.value }, }) } + error={!isValidName(createAccountValues.accountName)} + required />
)} @@ -195,10 +208,11 @@ const Faucet = () => {
setAccount(e.target.value)} + error={!isValidName(account)} />
From 0264a264eadef7a735ad429502630d280375c383 Mon Sep 17 00:00:00 2001 From: Torresmorah Date: Wed, 5 Jul 2023 16:56:56 -0600 Subject: [PATCH 03/18] fix(hapi): get account name from the transaction --- hapi/src/routes/create-faucet-account.route.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hapi/src/routes/create-faucet-account.route.js b/hapi/src/routes/create-faucet-account.route.js index 7e2c00b4..e77c95c1 100644 --- a/hapi/src/routes/create-faucet-account.route.js +++ b/hapi/src/routes/create-faucet-account.route.js @@ -55,6 +55,10 @@ module.exports = { } ) + if (!input.name) { + input.name = transaction?.processed?.action_traces[0]?.act?.data?.name + } + const response = accounts.find(account => account.account_name === input.name) if (!response) throw new Error('Account creation failed') From f1ceadbd6d28928b9848a27a84efc060811f4d61 Mon Sep 17 00:00:00 2001 From: Torresmorah Date: Thu, 6 Jul 2023 09:24:11 -0600 Subject: [PATCH 04/18] chore(hapi): use the first account of the array when there is no account name --- hapi/src/routes/create-faucet-account.route.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hapi/src/routes/create-faucet-account.route.js b/hapi/src/routes/create-faucet-account.route.js index e77c95c1..0cb734d8 100644 --- a/hapi/src/routes/create-faucet-account.route.js +++ b/hapi/src/routes/create-faucet-account.route.js @@ -59,7 +59,9 @@ module.exports = { input.name = transaction?.processed?.action_traces[0]?.act?.data?.name } - const response = accounts.find(account => account.account_name === input.name) + const response = accounts.find( + account => account.account_name === input.name || !input.name + ) if (!response) throw new Error('Account creation failed') From 1ddecc8b58834d71b2233cc1a1a3e9d3e8892a97 Mon Sep 17 00:00:00 2001 From: Torresmorah Date: Thu, 6 Jul 2023 09:25:00 -0600 Subject: [PATCH 05/18] chore(webapp): show a error message when the account is invalid --- webapp/src/routes/Faucet/index.js | 34 +++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/webapp/src/routes/Faucet/index.js b/webapp/src/routes/Faucet/index.js index cf82b624..ce4c5236 100644 --- a/webapp/src/routes/Faucet/index.js +++ b/webapp/src/routes/Faucet/index.js @@ -30,7 +30,7 @@ const Faucet = () => { const [createAccountValues, setCreateAccountValues] = useState({}) const [transferTokensTransaction, setTransferTokensTransaction] = useState('') const [createFaucetAccount, { loading: loadingCreateAccount }] = useMutation( - CREATE_ACCOUNT_MUTATION( eosConfig.networkName !== 'ultra-testnet' ), + CREATE_ACCOUNT_MUTATION(eosConfig.networkName !== 'ultra-testnet'), ) const [transferFaucetTokens, { loading: loadingTransferFaucetTokens }] = useMutation(TRANFER_FAUCET_TOKENS_MUTATION) @@ -52,6 +52,14 @@ const Faucet = () => { return } + if (!isValidAccountName(createAccountValues.accountName)) { + showMessage({ + type: 'error', + content: 'Please enter a valid account name', + }) + return + } + try { const { data: { @@ -61,7 +69,7 @@ const Faucet = () => { variables: { token: reCaptchaToken, public_key: createAccountValues.publicKey, - name: createAccountValues.accountName + name: createAccountValues.accountName, }, }) @@ -74,10 +82,9 @@ const Faucet = () => { ), }) } catch (err) { - const errorMessage = err.message.replace('GraphQL error:','').replace( - 'assertion failure with message: ', - '', - ) + const errorMessage = err.message + .replace('GraphQL error:', '') + .replace('assertion failure with message: ', '') showMessage({ type: 'error', @@ -94,6 +101,14 @@ const Faucet = () => { if (!reCaptchaToken || !account) return + if (!isValidAccountName(account)) { + showMessage({ + type: 'error', + content: 'Please enter a valid account name', + }) + return + } + try { const result = await transferFaucetTokens({ variables: { @@ -131,7 +146,7 @@ const Faucet = () => { setAccount('') } - const isValidName = name => { + const isValidAccountName = name => { const regex = /^[.12345abcdefghijklmnopqrstuvwxyz]+$/i return name?.length < 13 && regex.test(name) @@ -173,7 +188,7 @@ const Faucet = () => { ...{ accountName: e.target.value }, }) } - error={!isValidName(createAccountValues.accountName)} + error={!isValidAccountName(createAccountValues.accountName)} required />
@@ -212,7 +227,8 @@ const Faucet = () => { variant="outlined" value={account} onChange={(e) => setAccount(e.target.value)} - error={!isValidName(account)} + error={!isValidAccountName(account)} + required />
From 531ba0a8335b0a027dccb7b8a43f910ed936fe07 Mon Sep 17 00:00:00 2001 From: Torresmorah Date: Thu, 6 Jul 2023 09:28:55 -0600 Subject: [PATCH 06/18] fix(hapi): use the name of the account created --- hapi/src/routes/create-faucet-account.route.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hapi/src/routes/create-faucet-account.route.js b/hapi/src/routes/create-faucet-account.route.js index 0cb734d8..8362a6be 100644 --- a/hapi/src/routes/create-faucet-account.route.js +++ b/hapi/src/routes/create-faucet-account.route.js @@ -59,13 +59,13 @@ module.exports = { input.name = transaction?.processed?.action_traces[0]?.act?.data?.name } - const response = accounts.find( + const newAccount = accounts.find( account => account.account_name === input.name || !input.name ) - if (!response) throw new Error('Account creation failed') + if (!newAccount) throw new Error('Account creation failed') - return { account: input.name } + return { account: newAccount.account_name } } catch (err) { const errorDetail = err?.response?.data?.error?.details[0]?.message?.substring(0, 11) From 4c7353a78fce40f95bdba3e02b055ef8a90ec6b9 Mon Sep 17 00:00:00 2001 From: Torresmorah Date: Thu, 6 Jul 2023 09:40:39 -0600 Subject: [PATCH 07/18] fix(hapi): missing variable definition --- hapi/src/routes/create-faucet-account.route.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hapi/src/routes/create-faucet-account.route.js b/hapi/src/routes/create-faucet-account.route.js index 8362a6be..0972fe06 100644 --- a/hapi/src/routes/create-faucet-account.route.js +++ b/hapi/src/routes/create-faucet-account.route.js @@ -22,7 +22,7 @@ module.exports = { throw Boom.badRequest('Are you a human?') } - await eosUtil.transact( + const transaction = await eosUtil.transact( [ { authorization: [ From 4319699b394a83f44aa35c353b7ea926da265b65 Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Thu, 6 Jul 2023 15:47:40 +0000 Subject: [PATCH 08/18] [CodeFactor] Apply fixes --- hapi/src/routes/create-faucet-account.route.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hapi/src/routes/create-faucet-account.route.js b/hapi/src/routes/create-faucet-account.route.js index 0972fe06..958b687b 100644 --- a/hapi/src/routes/create-faucet-account.route.js +++ b/hapi/src/routes/create-faucet-account.route.js @@ -60,7 +60,7 @@ module.exports = { } const newAccount = accounts.find( - account => account.account_name === input.name || !input.name + (account) => account.account_name === input.name || !input.name ) if (!newAccount) throw new Error('Account creation failed') @@ -70,7 +70,7 @@ module.exports = { const errorDetail = err?.response?.data?.error?.details[0]?.message?.substring(0, 11) - return 'unknown key' === errorDetail + return errorDetail === 'unknown key' ? Boom.badRequest('Account creation failed') : Boom.badRequest(err.message) } From 71ff92add2ea2a64e5897916b7cc6d48d33b1dcf Mon Sep 17 00:00:00 2001 From: Torresmorah Date: Thu, 13 Jul 2023 09:59:08 -0600 Subject: [PATCH 09/18] feat(webapp): add index position, key type and reverse options to query table rows - fix lowerbound and upperbound type - adapt UI to add new fields - avoid to translate datatypes in the action form --- .../components/ContractActionForm/index.js | 2 +- webapp/src/components/ContractTables/index.js | 162 ++++++++++++------ .../src/components/ContractTables/styles.js | 42 ++++- webapp/src/language/en.json | 2 + webapp/src/language/es.json | 4 +- webapp/src/routes/Accounts/useAccountState.js | 4 +- 6 files changed, 154 insertions(+), 62 deletions(-) diff --git a/webapp/src/components/ContractActionForm/index.js b/webapp/src/components/ContractActionForm/index.js index 229f566e..92bc50ad 100644 --- a/webapp/src/components/ContractActionForm/index.js +++ b/webapp/src/components/ContractActionForm/index.js @@ -227,7 +227,7 @@ const ContractActionForm = ({ accountName, action, abi, onSubmitAction }) => { InputProps={{ endAdornment: ( - + ), }} diff --git a/webapp/src/components/ContractTables/index.js b/webapp/src/components/ContractTables/index.js index 5ee5d728..d0c948f4 100644 --- a/webapp/src/components/ContractTables/index.js +++ b/webapp/src/components/ContractTables/index.js @@ -2,11 +2,10 @@ import React, { useState, useEffect, useCallback } from 'react' import PropTypes from 'prop-types' import { useTranslation } from 'react-i18next' import { makeStyles } from '@mui/styles' -import MenuItem from '@mui/material/MenuItem' -import Select from '@mui/material/Select' -import FormControl from '@mui/material/FormControl' +import Autocomplete from '@mui/material/Autocomplete' +import Checkbox from '@mui/material/Checkbox' +import FormControlLabel from '@mui/material/FormControlLabel' import TextField from '@mui/material/TextField' -import InputLabel from '@mui/material/InputLabel' import Button from '@mui/material/Button' import RefreshIcon from '@mui/icons-material/Refresh' @@ -24,26 +23,42 @@ const ContractTables = ({ onGetTableRows, tableName, }) => { + const keys = [ + 'i64', + 'i128', + 'i256', + 'float64', + 'float128', + 'sha256', + 'ripemd160', + 'name', + ] const initData = { table: '', scope: '', + index: '', + keyType: 'i64', lowerBound: null, upperBound: null, limit: 10, + reverse: false } const formFields = [ { name: 'scope', type: 'text' }, - { name: 'lowerBound', type: 'number' }, - { name: 'upperBound', type: 'number' }, + { name: 'index', type: 'text' }, + { name: 'keyType', type: 'text', component: 'select', options: keys }, + { name: 'lowerBound', type: 'text' }, + { name: 'upperBound', type: 'text' }, { name: 'limit', type: 'number' }, ] - const DELAY = 300 + const DELAY = 500 const { t } = useTranslation('contractTablesComponent') const classes = useStyles() const [tables, setTables] = useState([]) const [fields, setFields] = useState([]) const [filters, setFilters] = useState(initData) + const [selectedTable,setSelectedTable]= useState(tableName) const debouncedFilter = useDebounceState(filters, DELAY) const getValidValue = (value, type) => { @@ -78,6 +93,9 @@ const ContractTables = ({ table: filters.table, code: accountName, json: true, + key_type: filters.keyType, + index_position: filters.index, + reverse: filters.reverse, lower_bound: nextKey || filters.lowerBound, upper_bound: filters.upperBound, loadMore: !!nextKey, @@ -86,6 +104,19 @@ const ContractTables = ({ [accountName, onGetTableRows, filters], ) + const handleTableSelect = (_event, value) => { + setSelectedTable(value || '') + if (tables.includes(value)) { + handleTableChange(value) + } + } + + const handleFilterSelect = (newValue, name, type) => { + handleOnChange({ + target: { name, type, value: newValue || '' }, + }) + } + useEffect(() => { if (!abi) { setTables([]) @@ -127,52 +158,79 @@ const ContractTables = ({ }, [debouncedFilter]) return ( -
+ <>
- - {t('table')} - - - - {formFields.map(({ name, type }, index) => ( - handleOnChange(event)} +
+ ( + + )} + noOptionsText={t('noOptions')} + /> + + {formFields.map(({ name, type, component, options }, index) => + component === 'select' ? ( + {handleFilterSelect(value,name,type)}} + onInputChange={(_e,value) => {handleFilterSelect(value,name,type)}} + renderInput={(params) => ( + + )} + noOptionsText={t('noOptions')} + /> + ) : ( + handleOnChange(event)} + /> + ), + )} + + { + setFilters((prev) => ({ ...prev, reverse: event.target.checked })) + }} + /> + } + label={t('reverse')} + labelPlacement="top" /> - ))} - - {filters.table && ( - - )} +
+ +
+ {filters.table && ( + + )} +
-
+ ) } diff --git a/webapp/src/components/ContractTables/styles.js b/webapp/src/components/ContractTables/styles.js index 4b6fdc3a..a327d8b3 100644 --- a/webapp/src/components/ContractTables/styles.js +++ b/webapp/src/components/ContractTables/styles.js @@ -4,15 +4,22 @@ export default (theme) => ({ display: 'flex', alignItems: 'center', flexWrap: 'wrap', + gap: theme.spacing(1), + [theme.breakpoints.down('md')]: { + flexDirection: 'column' + } }, formControl: { display: 'block', - width: '100%', - minWidth: '180px', - [theme.breakpoints.up('md')]: { - width: '15%', - marginRight: theme.spacing(2), + width: '12%', + marginRight: theme.spacing(2), + [theme.breakpoints.down('lg')]: { + width: '10%', }, + [theme.breakpoints.down('md')]: { + width: '100%', + minWidth: '180px', + } }, refreshButton: { [theme.breakpoints.up('md')]: { @@ -28,9 +35,30 @@ export default (theme) => ({ padding: theme.spacing(4), }, tableEmpty: { - [theme.breakpoints.up('md')]: { - width: '150px !important', + [theme.breakpoints.down('lg')]: { + width: '100px !important', }, + [theme.breakpoints.down('md')]: { + width: '100% !important', + }, + width: '120px !important', display: 'inline-block', }, + fieldsContainer: { + display: 'flex', + flexWrap: 'wrap', + width: '80%', + gap: '8px', + }, + textField: { + width: '200px', + [theme.breakpoints.down('md')]: { + width: '100%' + } + }, + checkBox: { + '& .MuiCheckbox-root':{ + padding: `${theme.spacing(1)} !important`, + } + } }) diff --git a/webapp/src/language/en.json b/webapp/src/language/en.json index ad171e7e..d6fefbce 100644 --- a/webapp/src/language/en.json +++ b/webapp/src/language/en.json @@ -328,6 +328,8 @@ "upperBound": "Upper Bound", "limit": "Limit", "refreshData": "Refresh Data", + "index": "Index Position", + "keyType": "Index Type", "loadMore": "Load More", "emptyTable": "Empty Table" }, diff --git a/webapp/src/language/es.json b/webapp/src/language/es.json index c834bdd4..bbbeb82f 100644 --- a/webapp/src/language/es.json +++ b/webapp/src/language/es.json @@ -331,9 +331,11 @@ }, "contractTablesComponent": { "table": "Tabla", - "scope": "Alcance", + "scope": "Ámbito", "lowerBound": "Límite inferior", "upperBound": "Límite superior", + "index": "Posición del Índice", + "keyType": "Tipo del Índice", "limit": "Límite", "refreshData": "Actualizar Datos", "loadMore": "Carga Más", diff --git a/webapp/src/routes/Accounts/useAccountState.js b/webapp/src/routes/Accounts/useAccountState.js index c55fd0bb..bab77ba5 100644 --- a/webapp/src/routes/Accounts/useAccountState.js +++ b/webapp/src/routes/Accounts/useAccountState.js @@ -61,7 +61,9 @@ const useAccountState = () => { try { const actionError = JSON.parse(error?.message).error.details[0].message - return actionError ? `${resultRequested} ${t('notFound')}` : '' + return actionError?.substring(0, 11) === 'unknown key' + ? `${resultRequested} ${t('notFound')}` + : actionError } catch (error) { return t('unknownError') } From cbfda5dc531e919695cb7610cc6f5ed3b03fd92a Mon Sep 17 00:00:00 2001 From: Torresmorah Date: Thu, 13 Jul 2023 10:04:56 -0600 Subject: [PATCH 10/18] feat(webapp): add link to the second block in the ATH card --- .../components/TransactionsHistory/index.js | 20 +++++++------------ webapp/src/language/en.json | 4 ++-- webapp/src/language/es.json | 4 ++-- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/webapp/src/components/TransactionsHistory/index.js b/webapp/src/components/TransactionsHistory/index.js index fc124f95..fba5e5e4 100644 --- a/webapp/src/components/TransactionsHistory/index.js +++ b/webapp/src/components/TransactionsHistory/index.js @@ -17,17 +17,17 @@ import styles from './styles' const useStyles = makeStyles(styles) -const BodyGraphValue = ({ loading, value, classes, href }) => { +const BodyGraphValue = ({ loading, value, classes, links }) => { if (loading) return return ( {value} - {href && ( - + {links && links.map((href, index) => ( + - )} + ))} ) } @@ -60,9 +60,7 @@ const TransactionsHistory = ({ t, nodesChildren }) => { value={data?.stats[0]?.tps_all_time_high?.transactions_count} loading={loading} classes={classes} - href={getBlockNumUrl( - data?.stats?.[0]?.tps_all_time_high?.blocks[0], - )} + links={data?.stats?.[0]?.tps_all_time_high?.blocks.map(block => getBlockNumUrl(block))} /> @@ -70,9 +68,7 @@ const TransactionsHistory = ({ t, nodesChildren }) => { getBlockNumUrl(block))} loading={loading} /> @@ -81,9 +77,7 @@ const TransactionsHistory = ({ t, nodesChildren }) => { getBlockNumUrl(block))} loading={loading} /> diff --git a/webapp/src/language/en.json b/webapp/src/language/en.json index d6fefbce..220a3c84 100644 --- a/webapp/src/language/en.json +++ b/webapp/src/language/en.json @@ -139,8 +139,8 @@ "tpsAllTimeHigh": "TPS All Time High", "cpuUtilization": "CPU Usage", "netUtilization": "NET Usage", - "cpuUtilizationAllTimeHigh": "CPU Usage All Time High", - "networkUtilizationAllTimeHigh": "NET Usage All Time High", + "cpuUtilizationAllTimeHigh": "CPU Usage in TPS All Time High", + "networkUtilizationAllTimeHigh": "NET Usage in TPS All Time High", "transactionsPerSecond": "Transactions per Second", "transactionsPerBlock": "Transactions per Block", "nodes": "Nodes", diff --git a/webapp/src/language/es.json b/webapp/src/language/es.json index bbbeb82f..2ca8080e 100644 --- a/webapp/src/language/es.json +++ b/webapp/src/language/es.json @@ -143,8 +143,8 @@ "secondsAgo": "Hace Segundos", "cpuUtilization": "Uso de CPU", "netUtilization": "Uso de NET", - "cpuUtilizationAllTimeHigh": "Máxima uso de CPU", - "networkUtilizationAllTimeHigh": "Máxima uso de NET", + "cpuUtilizationAllTimeHigh": "Uso de CPU en TPS máximo histórico", + "networkUtilizationAllTimeHigh": "Uso de NET en TPS máximo histórico", "tpsAllTimeHigh": "TPS máximo histórico", "transactionsPerSecond": "Transacciones por segundo", "transactionsPerBlock": "Transacciones por bloque", From e9882218e5d9c0249f286c0a12cf498c52811b50 Mon Sep 17 00:00:00 2001 From: Torresmorah Date: Thu, 13 Jul 2023 10:11:48 -0600 Subject: [PATCH 11/18] fix(webapp): fix getBlockNumUrl and fix text overlapping in the endpoints table --- webapp/src/components/EndpointsTable/styles.js | 8 ++++++++ webapp/src/utils/get-blocknum-url.js | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/webapp/src/components/EndpointsTable/styles.js b/webapp/src/components/EndpointsTable/styles.js index c5e8ebf5..defe6a82 100644 --- a/webapp/src/components/EndpointsTable/styles.js +++ b/webapp/src/components/EndpointsTable/styles.js @@ -3,6 +3,14 @@ export default (theme) => ({ display: 'flex', justifyContent: 'space-between', maxWidth: '250px', + wordBreak: 'break-all', + [theme.breakpoints.down('lg')]: { + maxWidth: '300px', + wordBreak: 'normal', + }, + [theme.breakpoints.up('xl')]:{ + maxWidth: '350px', + } }, titleCell: { display: 'flex', diff --git a/webapp/src/utils/get-blocknum-url.js b/webapp/src/utils/get-blocknum-url.js index dbe9c1d6..3c7f8062 100644 --- a/webapp/src/utils/get-blocknum-url.js +++ b/webapp/src/utils/get-blocknum-url.js @@ -7,9 +7,10 @@ export const getBlockNumUrl = (blockNum) => { return ( eosConfig.blockExplorerUrl + .replace('(transaction)', blockNum) + .replace('tx', 'block') .replace('transaction', 'block') // eslint-disable-next-line - .replace('(transaction)', blockNum) ) } From 4ceb89bb0be0662b6242048a882993b081099e0a Mon Sep 17 00:00:00 2001 From: Torresmorah Date: Thu, 13 Jul 2023 10:35:51 -0600 Subject: [PATCH 12/18] fix(webapp): change selected table when the account is changed and format code --- webapp/src/components/ContractTables/index.js | 53 +++++++++++-------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/webapp/src/components/ContractTables/index.js b/webapp/src/components/ContractTables/index.js index d0c948f4..f65c57ad 100644 --- a/webapp/src/components/ContractTables/index.js +++ b/webapp/src/components/ContractTables/index.js @@ -23,7 +23,7 @@ const ContractTables = ({ onGetTableRows, tableName, }) => { - const keys = [ + const keysTypes = [ 'i64', 'i128', 'i256', @@ -37,16 +37,16 @@ const ContractTables = ({ table: '', scope: '', index: '', - keyType: 'i64', + keyType: keysTypes[0], lowerBound: null, upperBound: null, limit: 10, - reverse: false + reverse: false, } const formFields = [ { name: 'scope', type: 'text' }, { name: 'index', type: 'text' }, - { name: 'keyType', type: 'text', component: 'select', options: keys }, + { name: 'keyType', type: 'text', component: 'select', options: keysTypes }, { name: 'lowerBound', type: 'text' }, { name: 'upperBound', type: 'text' }, { name: 'limit', type: 'number' }, @@ -58,7 +58,7 @@ const ContractTables = ({ const [tables, setTables] = useState([]) const [fields, setFields] = useState([]) const [filters, setFilters] = useState(initData) - const [selectedTable,setSelectedTable]= useState(tableName) + const [selectedTable, setSelectedTable] = useState(tableName) const debouncedFilter = useDebounceState(filters, DELAY) const getValidValue = (value, type) => { @@ -134,10 +134,12 @@ const ContractTables = ({ return } + setSelectedTable(filters.table) + const tableType = abi.tables.find( - (item) => item.name === filters.table, + item => item.name === filters.table, )?.type - const struct = abi.structs.find((struct) => struct.name === tableType) + const struct = abi.structs.find(struct => struct.name === tableType) setFields(struct?.fields || []) }, [filters.table, abi]) @@ -160,14 +162,14 @@ const ContractTables = ({ return ( <>
-
+
( )} @@ -177,47 +179,54 @@ const ContractTables = ({ {formFields.map(({ name, type, component, options }, index) => component === 'select' ? ( {handleFilterSelect(value,name,type)}} - onInputChange={(_e,value) => {handleFilterSelect(value,name,type)}} - renderInput={(params) => ( + onChange={(_e, value) => { + handleFilterSelect(value, name, type) + }} + onInputChange={(_e, value) => { + handleFilterSelect(value, name, type) + }} + renderInput={params => ( )} noOptionsText={t('noOptions')} /> ) : ( handleOnChange(event)} + onChange={event => handleOnChange(event)} /> ), - )} + )} { - setFilters((prev) => ({ ...prev, reverse: event.target.checked })) - }} - /> + checked={filters.reverse} + onChange={event => { + setFilters(prev => ({ + ...prev, + reverse: event.target.checked, + })) + }} + /> } label={t('reverse')} labelPlacement="top" />
- +
{filters.table && (