From 02e686a9df3c75d59d968afac83dcab473c6f472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Tue, 22 Oct 2024 16:07:33 +0200 Subject: [PATCH] fix(#2191): protocol parameter change ga is not displayed correctly --- CHANGELOG.md | 1 + .../backend/sql/get-current-epoch-params.sql | 19 +++++++++++++++- govtool/backend/sql/list-proposals.sql | 12 +++++++++- .../molecules/DataMissingHeader.tsx | 2 -- govtool/frontend/src/main.tsx | 2 ++ govtool/frontend/src/theme.ts | 22 ++++++++++++++----- 6 files changed, 49 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2abdc9e52..a7a4e19f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ changes. - Fix duplicate testIds for reference errors and hints in DRep metadata form [Issue 1965](https://github.com/IntersectMBO/govtool/issues/1965) - Eliminate duplicate DReps in the DRep Directory [Issue 2171](https://github.com/IntersectMBO/govtool/issues/2171) - Handle script based DReps [Issue 1951](https://github.com/IntersectMBO/govtool/issues/1951) +- Fix displaying protocol parameter cost models [Issue 2191](https://github.com/IntersectMBO/govtool/issues/2191) ### Changed diff --git a/govtool/backend/sql/get-current-epoch-params.sql b/govtool/backend/sql/get-current-epoch-params.sql index 9fd642903..2b591a0b4 100644 --- a/govtool/backend/sql/get-current-epoch-params.sql +++ b/govtool/backend/sql/get-current-epoch-params.sql @@ -1 +1,18 @@ -select ROW_TO_JSON(epoch_param) from epoch_param order by epoch_no desc limit 1; +SELECT + jsonb_set( + ROW_TO_JSON(epoch_param)::jsonb, + '{cost_model}', + CASE + WHEN cost_model.id IS NOT NULL THEN + ROW_TO_JSON(cost_model)::jsonb + ELSE + 'null'::jsonb + END + ) AS epoch_param +FROM + epoch_param +LEFT JOIN + cost_model ON epoch_param.cost_model_id = cost_model.id +ORDER BY + epoch_no DESC +LIMIT 1; diff --git a/govtool/backend/sql/list-proposals.sql b/govtool/backend/sql/list-proposals.sql index b3b836540..c8767062c 100644 --- a/govtool/backend/sql/list-proposals.sql +++ b/govtool/backend/sql/list-proposals.sql @@ -64,7 +64,16 @@ SELECT creator_block.epoch_no, voting_anchor.url, encode(voting_anchor.data_hash, 'hex'), - ROW_TO_JSON(proposal_params), + jsonb_set( + ROW_TO_JSON(proposal_params)::jsonb, + '{cost_model}', + CASE + WHEN cost_model.id IS NOT NULL THEN + ROW_TO_JSON(cost_model)::jsonb + ELSE + 'null'::jsonb + END + ) AS proposal_params, off_chain_vote_gov_action_data.title, off_chain_vote_gov_action_data.abstract, off_chain_vote_gov_action_data.motivation, @@ -104,6 +113,7 @@ FROM JOIN block AS creator_block ON creator_block.id = creator_tx.block_id LEFT JOIN voting_anchor ON voting_anchor.id = gov_action_proposal.voting_anchor_id LEFT JOIN param_proposal as proposal_params ON gov_action_proposal.param_proposal = proposal_params.id + LEFT JOIN cost_model AS cost_model ON proposal_params.cost_model_id = cost_model.id LEFT JOIN off_chain_vote_data ON off_chain_vote_data.voting_anchor_id = voting_anchor.id LEFT JOIN off_chain_vote_gov_action_data ON off_chain_vote_gov_action_data.off_chain_vote_data_id = off_chain_vote_data.id LEFT JOIN voting_procedure ON voting_procedure.gov_action_proposal_id = gov_action_proposal.id diff --git a/govtool/frontend/src/components/molecules/DataMissingHeader.tsx b/govtool/frontend/src/components/molecules/DataMissingHeader.tsx index 7e19844e9..a07f7277d 100644 --- a/govtool/frontend/src/components/molecules/DataMissingHeader.tsx +++ b/govtool/frontend/src/components/molecules/DataMissingHeader.tsx @@ -36,9 +36,7 @@ export const DataMissingHeader = ({ > + diff --git a/govtool/frontend/src/theme.ts b/govtool/frontend/src/theme.ts index 910447fab..2d0831b23 100644 --- a/govtool/frontend/src/theme.ts +++ b/govtool/frontend/src/theme.ts @@ -1,6 +1,11 @@ import { createTheme } from "@mui/material/styles"; import { - cyan, errorRed, orange, primaryBlue, progressYellow, successGreen, + cyan, + errorRed, + orange, + primaryBlue, + progressYellow, + successGreen, } from "./consts"; export type Theme = typeof theme; @@ -17,12 +22,19 @@ export const theme = createTheme({ }, }, components: { + MuiCssBaseline: { + styleOverrides: { + ":root": { + fonfFamily: "Poppins, Arial", + }, + }, + }, MuiAccordion: { styleOverrides: { root: { borderRadius: `12px !important`, - } - } + }, + }, }, MuiInputBase: { styleOverrides: { @@ -52,7 +64,7 @@ export const theme = createTheme({ { props: { color: "default", variant: "filled" }, style: { - backgroundColor: primaryBlue.c50 + backgroundColor: primaryBlue.c50, }, }, { @@ -110,7 +122,7 @@ export const theme = createTheme({ MuiPopover: { defaultProps: { elevation: 2, - } + }, }, }, typography: {