From 1b5994970d04f37fbebb864a1b1e28391b365d52 Mon Sep 17 00:00:00 2001 From: anonymoussprocket <42718855+anonymoussprocket@users.noreply.github.com> Date: Sun, 19 Dec 2021 14:25:14 -0500 Subject: [PATCH 1/3] - column name update --- public/locales/en/translation.json | 36 ++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 39d6b0dc..47786d9a 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -122,11 +122,14 @@ "governance": "Governance", "registered_tokens": "Registered Tokens", "originated_account_maps": "Map Owners", - "big_maps": "Map Definitons", + "big_maps": "Map Definitions", "big_map_contents": "Map Content", + "big_map_contents_history": "Map History", "known_addresses": "Known Addresses", "baker_registry": "TCF Baker Registry", "bakers_history": "Baker History", + "metadata": "Metadata", + "nfts": "NFTs", "transactions": "Transactions", "contracts": "Contracts", "logs": "Logs", @@ -344,7 +347,9 @@ "utc_year": "Year (UTC)", "utc_month": "Month (UTC)", "utc_day": "Day (UTC)", - "utc_time": "Time (UTC)" + "utc_time": "Time (UTC)", + "operation_order": "Operation Index" + }, "baking_rights": { "block_hash": "Block Hash", @@ -579,6 +584,33 @@ "tx_in_witness": "", "txid": "Transaction Id", "v_out": "" + }, + "big_map_contents_history": { + "big_map_id": "Map Index", + "key": "Key", + "key_hash": "Hashed Key", + "value": "Value", + "operation_group_id": "Op Group Hash", + "block_level": "Block Level", + "cycle": "Cycle", + "period": "Period", + "timestamp": "Timestamp" + }, + "metadata": { + "address": "Address", + "description": "Description", + "last_updated": "Last Updated", + "name": "Name", + "raw_metadata": "Raw Data" + }, + "nfts": { + "asset_location": "Asset URL", + "asset_type": "Asset Type", + "block_level": "Block Level", + "contract_address": "Contract", + "op_group_hash": "Op Group Hash", + "raw_metadata": "Raw Data", + "timestamp": "Timestamp" } }, "operators": { From 29a6b2a870c9cdfa4ec0e10b0fcfd4ef114e48ba Mon Sep 17 00:00:00 2001 From: anonymoussprocket Date: Fri, 28 Jan 2022 17:53:27 -0500 Subject: [PATCH 2/3] - hangzounet - error handling - whitespace --- src/components/AggregationPanel/index.tsx | 2 +- src/components/FilterSelect/index.tsx | 2 +- src/containers/Modal/templates/index.tsx | 12 +++++----- src/reducers/app/thunks.ts | 28 +++++++++++++++-------- src/reducers/modal/thunk.ts | 2 +- 5 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/components/AggregationPanel/index.tsx b/src/components/AggregationPanel/index.tsx index 392e728b..bfd58bfa 100644 --- a/src/components/AggregationPanel/index.tsx +++ b/src/components/AggregationPanel/index.tsx @@ -103,7 +103,7 @@ class AggregationPanel extends React.Component { function: func.name }; localAggs[index] = aggregation; - this.setState({localAggs}); + this.setState({ localAggs }); }; onResetAggregations = () => { diff --git a/src/components/FilterSelect/index.tsx b/src/components/FilterSelect/index.tsx index 568ee39c..c68bb8ce 100755 --- a/src/components/FilterSelect/index.tsx +++ b/src/components/FilterSelect/index.tsx @@ -54,7 +54,7 @@ class FilterSelect extends React.Component backgroundcolor={backgroundColor} borderradius={borderRadius} isactive={value} - iscapital={placeholder !== t('components.filterPanel.select_operator')? 1 : 0} + iscapital={placeholder !== t('components.filterPanel.select_operator') ? 1 : 0} onClick={this.handleClick} > {menuTitle} diff --git a/src/containers/Modal/templates/index.tsx b/src/containers/Modal/templates/index.tsx index fe5a76db..87a9e6c5 100644 --- a/src/containers/Modal/templates/index.tsx +++ b/src/containers/Modal/templates/index.tsx @@ -15,12 +15,12 @@ const templates: any = { "tezos/mainnet/operations": operation, "tezos/mainnet/default": defaultTemplate, - "tezos/granadanet/blocks": block, - "tezos/granadanet/accounts": account, - "tezos/granadanet/bakers": baker, - "tezos/granadanet/contracts": contract, - "tezos/granadanet/operations": operation, - "tezos/granadanet/default": defaultTemplate + "tezos/hangzhounet/blocks": block, + "tezos/hangzhounet/accounts": account, + "tezos/hangzhounet/bakers": baker, + "tezos/hangzhounet/contracts": contract, + "tezos/hangzhounet/operations": operation, + "tezos/hangzhounet/default": defaultTemplate }; export default templates; diff --git a/src/reducers/app/thunks.ts b/src/reducers/app/thunks.ts index f53f6b75..61120370 100644 --- a/src/reducers/app/thunks.ts +++ b/src/reducers/app/thunks.ts @@ -51,7 +51,6 @@ import { defaultPath } from '../../router/routes'; import { Config, Sort, Filter, Aggregation, InitLoad } from '../../types'; -const { executeEntityQuery } = ConseilDataClient; const { blankQuery, addOrdering, addFields, setLimit, addPredicate, addAggregationFunction } = ConseilQueryBuilder; const CACHE_TIME = 432000000; // 5*24*3600*1000 @@ -265,7 +264,7 @@ export const fetchInitEntityAction = ( query = addOrdering(query, sorts[0].orderBy, sorts[0].order); } - const items = await executeEntityQuery(serverInfo, platform, network, entity, query).catch(() => { + const items = await ConseilDataClient.executeEntityQuery(serverInfo, platform, network, entity, query).catch(() => { const name = entities.find((e: EntityDefinition) => e.name === entity)?.displayName.toLowerCase(); dispatch(createMessageAction(`Unable to retrieve data for ${name} request.`, true)); return []; @@ -419,14 +418,14 @@ const loadAttributes = (query: string) => async (dispatch: any, state: any) => { const metadata = await fetch(state().app.selectedConfig.metadataOverrideUrl) .then(response => response.text()) .catch(e => "" ); - console.log(`loaded metadata override of length ${metadata.length}`) + console.debug(`loaded metadata override of length ${metadata.length}`) await hocon().then((instance) => { const cfg = new instance.Config(metadata); injectedMetadata = JSON.parse(cfg.toJSON()); cfg.delete(); - }).catch(e => { console.log(`hocon parse error ${JSON.stringify(e)}`)}); + }).catch(e => { console.warn(`hocon parse error ${JSON.stringify(e)}`)}); } catch (err) { - console.log(`hocon error ${JSON.stringify(err)}`) + console.warn(`hocon error ${JSON.stringify(err)}`) } } @@ -444,13 +443,24 @@ const loadAttributes = (query: string) => async (dispatch: any, state: any) => { try { attrObjsList.forEach((entity: any) => { entity.attributes.forEach((attribute: any) => { + if (!injectedMetadata['entities'][entity.entity]) { + console.log(`no overrides for ${entity.entity}`); + return; + } + + if (!injectedMetadata['entities'][entity.entity]['attributes'][attribute.name]) { + console.log(`no overrides for ${entity.entity}/${attribute.name}`); + return; + } + if (injectedMetadata['entities'][entity.entity]['attributes'][attribute.name]['value-map']) { + console.log(`updated value map for ${entity.entity}/${attribute.name}`) attribute.valueMap = {...injectedMetadata['entities'][entity.entity]['attributes'][attribute.name]['value-map']}; } }); }); } catch (err) { - // meh + console.warn(`metadata override error`, err); } const attrMap = [...attrObjsList].reduce((curr: any, next: any) => { @@ -632,7 +642,7 @@ export const exportCsvData = () => async (dispatch: any, state: any) => { query = ConseilQueryBuilder.setOutputType(query, ConseilOutput.csv); query = ConseilQueryBuilder.setLimit(query, 80000); - const result: any = await executeEntityQuery(serverInfo, platform, network, selectedEntity, query); + const result: any = await ConseilDataClient.executeEntityQuery(serverInfo, platform, network, selectedEntity, query); if (!result || result.length === 0) { dispatch(createMessageAction('Export failed, no results were returned.', true)); @@ -663,7 +673,7 @@ export const submitQuery = () => async (dispatch: any, state: any) => { let query = getMainQuery(attributeNames, selectedFilters[selectedEntity], sort[selectedEntity], aggregations[selectedEntity]); query = setLimit(query, 5000); try { - const items = await executeEntityQuery(serverInfo, platform, network, selectedEntity, query); + const items = await ConseilDataClient.executeEntityQuery(serverInfo, platform, network, selectedEntity, query); await dispatch(setSubmitAction(selectedEntity, items, selectedFilters[selectedEntity].length)); await dispatch(setQueryFilters(selectedEntity, query)); dispatch(setLoadingAction(false)); @@ -703,7 +713,7 @@ export const searchByIdThunk = (id: string | number) => async (dispatch: any, st try { const { entity, query } = TezosConseilClient.getEntityQueryForId(id); - const items = await executeEntityQuery(serverInfo, platform, network, entity, query); + const items = await ConseilDataClient.executeEntityQuery(serverInfo, platform, network, entity, query); if (items.length > 0) { await dispatch(changeTab(entity)); } else { diff --git a/src/reducers/modal/thunk.ts b/src/reducers/modal/thunk.ts index e2457d10..d8f56a3e 100644 --- a/src/reducers/modal/thunk.ts +++ b/src/reducers/modal/thunk.ts @@ -375,7 +375,7 @@ export const loadModal = (platform: string, network: string, id: string) => asyn try { const { entity, query } = TezosConseilClient.getEntityQueryForId(id); // TODO: eth - let items: any = await executeEntityQuery({ url, apiKey, network }, platform, network, entity, query); + let items: any[] = await executeEntityQuery({ url, apiKey, network }, platform, network, entity, query); if (!items.length && platform === 'tezos' && entity === 'operations') { items = await getMempoolOperation(nodeUrl, id); } if (!items.length) { From be529f3f16a9c8c011933ce8c3d288020c858318 Mon Sep 17 00:00:00 2001 From: anonymoussprocket Date: Sat, 3 Dec 2022 20:31:10 -0500 Subject: [PATCH 3/3] - countDistinct --- public/locales/en/translation.json | 3 ++- src/reducers/app/reducers.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 47786d9a..eaf66cd1 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -636,6 +636,7 @@ "avg": "Average", "min": "Min", "max": "Max", - "count": "Count" + "count": "Count", + "countDistinct": "Distinct" } } diff --git a/src/reducers/app/reducers.ts b/src/reducers/app/reducers.ts index 7f3c2e56..5fb47c98 100644 --- a/src/reducers/app/reducers.ts +++ b/src/reducers/app/reducers.ts @@ -137,7 +137,10 @@ let initialState: AppState = { { name: 'max', displayName: 'Max' }, { name: 'count', displayName: 'Count' }, ], - string: [{ name: 'count', displayName: 'Count' }], + string: [ + { name: 'count', displayName: 'Count' }, + { name: 'countDistinct', displayName: 'Distinct' } + ], dateTime: [ { name: 'min', displayName: 'Min' }, { name: 'max', displayName: 'Max' },