Skip to content

Commit 012046b

Browse files
authored
Merge pull request #4046 from IntersectMBO/issue-4030
Even more DRep search improvements #4030
2 parents 2455c3d + 3fddbc6 commit 012046b

File tree

4 files changed

+45
-16
lines changed

4 files changed

+45
-16
lines changed

govtool/backend/app/Main.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ startApp vvaConfig sentryService = do
115115
$ setOnException (exceptionHandler vvaConfig sentryService) defaultSettings
116116
cacheEnv <- do
117117
let newCache = Cache.newCache (Just $ TimeSpec (fromIntegral (cacheDurationSeconds vvaConfig)) 0)
118+
let newDRepListCache = Cache.newCache (Just $ TimeSpec (fromIntegral (dRepListCacheDurationSeconds vvaConfig)) 0)
118119
proposalListCache <- newCache
119120
getProposalCache <- newCache
120121
currentEpochCache <- newCache
@@ -123,7 +124,7 @@ startApp vvaConfig sentryService = do
123124
dRepGetVotesCache <- newCache
124125
dRepInfoCache <- newCache
125126
dRepVotingPowerCache <- newCache
126-
dRepListCache <- newCache
127+
dRepListCache <- newDRepListCache
127128
networkMetricsCache <- newCache
128129
networkInfoCache <- newCache
129130
networkTotalStakeCache <- newCache

govtool/backend/example-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"port" : 9999,
1111
"host" : "localhost",
1212
"cachedurationseconds": 20,
13+
"dreplistcachedurationseconds": 600,
1314
"sentrydsn": "https://username:[email protected]/id",
1415
"sentryenv": "dev"
1516
}

govtool/backend/src/VVA/Config.hs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,21 @@ instance DefaultConfig DBConfig where
6868
data VVAConfigInternal
6969
= VVAConfigInternal
7070
{ -- | db-sync database access.
71-
vVAConfigInternalDbsyncconfig :: DBConfig
71+
vVAConfigInternalDbsyncconfig :: DBConfig
7272
-- | Server port.
73-
, vVAConfigInternalPort :: Int
73+
, vVAConfigInternalPort :: Int
7474
-- | Server host.
75-
, vVAConfigInternalHost :: Text
75+
, vVAConfigInternalHost :: Text
7676
-- | Request cache duration
77-
, vVaConfigInternalCacheDurationSeconds :: Int
77+
, vVaConfigInternalCacheDurationSeconds :: Int
78+
-- | DRep List request cache duration
79+
, vVaConfigInternalDRepListCacheDurationSeconds :: Int
7880
-- | Sentry DSN
79-
, vVAConfigInternalSentrydsn :: String
81+
, vVAConfigInternalSentrydsn :: String
8082
-- | Sentry environment
81-
, vVAConfigInternalSentryEnv :: String
83+
, vVAConfigInternalSentryEnv :: String
8284
-- | Pinata API JWT
83-
, vVAConfigInternalPinataApiJwt :: Maybe Text
85+
, vVAConfigInternalPinataApiJwt :: Maybe Text
8486
}
8587
deriving (FromConfig, Generic, Show)
8688

@@ -92,6 +94,7 @@ instance DefaultConfig VVAConfigInternal where
9294
vVAConfigInternalPort = 3000,
9395
vVAConfigInternalHost = "localhost",
9496
vVaConfigInternalCacheDurationSeconds = 20,
97+
vVaConfigInternalDRepListCacheDurationSeconds = 600,
9598
vVAConfigInternalSentrydsn = "https://username:[email protected]/id",
9699
vVAConfigInternalSentryEnv = "development",
97100
vVAConfigInternalPinataApiJwt = Nothing
@@ -101,19 +104,21 @@ instance DefaultConfig VVAConfigInternal where
101104
data VVAConfig
102105
= VVAConfig
103106
{ -- | db-sync database credentials.
104-
dbSyncConnectionString :: Text
107+
dbSyncConnectionString :: Text
105108
-- | Server port.
106-
, serverPort :: Int
109+
, serverPort :: Int
107110
-- | Server host.
108-
, serverHost :: Text
111+
, serverHost :: Text
109112
-- | Request cache duration
110-
, cacheDurationSeconds :: Int
113+
, cacheDurationSeconds :: Int
114+
-- | DRep List request cache duration
115+
, dRepListCacheDurationSeconds :: Int
111116
-- | Sentry DSN
112-
, sentryDSN :: String
117+
, sentryDSN :: String
113118
-- | Sentry environment
114-
, sentryEnv :: String
119+
, sentryEnv :: String
115120
-- | Pinata API JWT
116-
, pinataApiJwt :: Maybe Text
121+
, pinataApiJwt :: Maybe Text
117122
}
118123
deriving (Generic, Show, ToJSON)
119124

@@ -153,6 +158,7 @@ convertConfig VVAConfigInternal {..} =
153158
serverPort = vVAConfigInternalPort,
154159
serverHost = vVAConfigInternalHost,
155160
cacheDurationSeconds = vVaConfigInternalCacheDurationSeconds,
161+
dRepListCacheDurationSeconds = vVaConfigInternalDRepListCacheDurationSeconds,
156162
sentryDSN = vVAConfigInternalSentrydsn,
157163
sentryEnv = vVAConfigInternalSentryEnv,
158164
pinataApiJwt = vVAConfigInternalPinataApiJwt

govtool/frontend/src/components/molecules/PaginationFooter.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import {
88
} from "@mui/material";
99
import KeyboardArrowLeft from "@mui/icons-material/KeyboardArrowLeft";
1010
import KeyboardArrowRight from "@mui/icons-material/KeyboardArrowRight";
11-
import { FC } from "react";
11+
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
12+
import { FC, useState } from "react";
1213

1314
type Props = {
1415
page: number;
@@ -46,6 +47,19 @@ export const PaginationFooter: FC<Props> = ({
4647
}
4748
};
4849

50+
const [open, setOpen] = useState(false);
51+
52+
const ArrowIcon: React.FC<React.ComponentProps<typeof ArrowDropDownIcon>> = (props,) => (
53+
<ArrowDropDownIcon
54+
{...props}
55+
onMouseDown={(e: React.MouseEvent<SVGSVGElement, MouseEvent>) => {
56+
e.preventDefault();
57+
e.stopPropagation();
58+
setOpen(true);
59+
}}
60+
/>
61+
);
62+
4963
return (
5064
<Box
5165
sx={{
@@ -68,15 +82,22 @@ export const PaginationFooter: FC<Props> = ({
6882
onChange={handlePageSizeChange}
6983
variant="standard"
7084
disableUnderline
85+
open={open}
86+
onOpen={() => setOpen(true)}
87+
onClose={() => setOpen(false)}
88+
IconComponent={ArrowIcon}
7189
sx={{
7290
verticalAlign: "baseline",
7391
"& .MuiSelect-select": {
7492
py: 0,
93+
pr: "8px !important",
7594
lineHeight: 1.5,
7695
display: "inline-flex",
7796
alignItems: "center",
7897
},
7998
"& .MuiSelect-icon": {
99+
pointerEvents: "auto",
100+
cursor: "pointer",
80101
top: "calc(50% - 12px)",
81102
},
82103
}}

0 commit comments

Comments
 (0)