Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion govtool/backend/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ startApp vvaConfig sentryService = do
$ setOnException (exceptionHandler vvaConfig sentryService) defaultSettings
cacheEnv <- do
let newCache = Cache.newCache (Just $ TimeSpec (fromIntegral (cacheDurationSeconds vvaConfig)) 0)
let newDRepListCache = Cache.newCache (Just $ TimeSpec (fromIntegral (dRepListCacheDurationSeconds vvaConfig)) 0)
proposalListCache <- newCache
getProposalCache <- newCache
currentEpochCache <- newCache
Expand All @@ -123,7 +124,7 @@ startApp vvaConfig sentryService = do
dRepGetVotesCache <- newCache
dRepInfoCache <- newCache
dRepVotingPowerCache <- newCache
dRepListCache <- newCache
dRepListCache <- newDRepListCache
networkMetricsCache <- newCache
networkInfoCache <- newCache
networkTotalStakeCache <- newCache
Expand Down
1 change: 1 addition & 0 deletions govtool/backend/example-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"port" : 9999,
"host" : "localhost",
"cachedurationseconds": 20,
"dreplistcachedurationseconds": 600,
"sentrydsn": "https://username:password@senty.host/id",
"sentryenv": "dev"
}
34 changes: 20 additions & 14 deletions govtool/backend/src/VVA/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,21 @@ instance DefaultConfig DBConfig where
data VVAConfigInternal
= VVAConfigInternal
{ -- | db-sync database access.
vVAConfigInternalDbsyncconfig :: DBConfig
vVAConfigInternalDbsyncconfig :: DBConfig
-- | Server port.
, vVAConfigInternalPort :: Int
, vVAConfigInternalPort :: Int
-- | Server host.
, vVAConfigInternalHost :: Text
, vVAConfigInternalHost :: Text
-- | Request cache duration
, vVaConfigInternalCacheDurationSeconds :: Int
, vVaConfigInternalCacheDurationSeconds :: Int
-- | DRep List request cache duration
, vVaConfigInternalDRepListCacheDurationSeconds :: Int
-- | Sentry DSN
, vVAConfigInternalSentrydsn :: String
, vVAConfigInternalSentrydsn :: String
-- | Sentry environment
, vVAConfigInternalSentryEnv :: String
, vVAConfigInternalSentryEnv :: String
-- | Pinata API JWT
, vVAConfigInternalPinataApiJwt :: Maybe Text
, vVAConfigInternalPinataApiJwt :: Maybe Text
}
deriving (FromConfig, Generic, Show)

Expand All @@ -92,6 +94,7 @@ instance DefaultConfig VVAConfigInternal where
vVAConfigInternalPort = 3000,
vVAConfigInternalHost = "localhost",
vVaConfigInternalCacheDurationSeconds = 20,
vVaConfigInternalDRepListCacheDurationSeconds = 600,
vVAConfigInternalSentrydsn = "https://username:password@senty.host/id",
vVAConfigInternalSentryEnv = "development",
vVAConfigInternalPinataApiJwt = Nothing
Expand All @@ -101,19 +104,21 @@ instance DefaultConfig VVAConfigInternal where
data VVAConfig
= VVAConfig
{ -- | db-sync database credentials.
dbSyncConnectionString :: Text
dbSyncConnectionString :: Text
-- | Server port.
, serverPort :: Int
, serverPort :: Int
-- | Server host.
, serverHost :: Text
, serverHost :: Text
-- | Request cache duration
, cacheDurationSeconds :: Int
, cacheDurationSeconds :: Int
-- | DRep List request cache duration
, dRepListCacheDurationSeconds :: Int
-- | Sentry DSN
, sentryDSN :: String
, sentryDSN :: String
-- | Sentry environment
, sentryEnv :: String
, sentryEnv :: String
-- | Pinata API JWT
, pinataApiJwt :: Maybe Text
, pinataApiJwt :: Maybe Text
}
deriving (Generic, Show, ToJSON)

Expand Down Expand Up @@ -153,6 +158,7 @@ convertConfig VVAConfigInternal {..} =
serverPort = vVAConfigInternalPort,
serverHost = vVAConfigInternalHost,
cacheDurationSeconds = vVaConfigInternalCacheDurationSeconds,
dRepListCacheDurationSeconds = vVaConfigInternalDRepListCacheDurationSeconds,
sentryDSN = vVAConfigInternalSentrydsn,
sentryEnv = vVAConfigInternalSentryEnv,
pinataApiJwt = vVAConfigInternalPinataApiJwt
Expand Down
23 changes: 22 additions & 1 deletion govtool/frontend/src/components/molecules/PaginationFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
} from "@mui/material";
import KeyboardArrowLeft from "@mui/icons-material/KeyboardArrowLeft";
import KeyboardArrowRight from "@mui/icons-material/KeyboardArrowRight";
import { FC } from "react";
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
import { FC, useState } from "react";

type Props = {
page: number;
Expand Down Expand Up @@ -46,6 +47,19 @@ export const PaginationFooter: FC<Props> = ({
}
};

const [open, setOpen] = useState(false);

const ArrowIcon: React.FC<React.ComponentProps<typeof ArrowDropDownIcon>> = (props,) => (
<ArrowDropDownIcon
{...props}
onMouseDown={(e: React.MouseEvent<SVGSVGElement, MouseEvent>) => {
e.preventDefault();
e.stopPropagation();
setOpen(true);
}}
/>
);

return (
<Box
sx={{
Expand All @@ -68,15 +82,22 @@ export const PaginationFooter: FC<Props> = ({
onChange={handlePageSizeChange}
variant="standard"
disableUnderline
open={open}
onOpen={() => setOpen(true)}
onClose={() => setOpen(false)}
IconComponent={ArrowIcon}
sx={{
verticalAlign: "baseline",
"& .MuiSelect-select": {
py: 0,
pr: "8px !important",
lineHeight: 1.5,
display: "inline-flex",
alignItems: "center",
},
"& .MuiSelect-icon": {
pointerEvents: "auto",
cursor: "pointer",
top: "calc(50% - 12px)",
},
}}
Expand Down
Loading