Skip to content

Commit bc7fb42

Browse files
authored
Merge pull request #3974 from IntersectMBO/staging
v2.0.32.1
2 parents 6f0b1dc + 4030ac1 commit bc7fb42

File tree

8 files changed

+70
-144
lines changed

8 files changed

+70
-144
lines changed

.github/workflows/build-from-main.yml

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
- staging
87
workflow_dispatch:
98

109
permissions:
@@ -83,90 +82,6 @@ jobs:
8382
dockerfile: ./govtool/metadata-validation/Dockerfile
8483
image: ghcr.io/${{ github.repository }}-metadata-validation
8584
qovery_container_name: govtool-metadata-validation
86-
- branch: staging
87-
network: preview-govtool
88-
workdir: ./govtool/backend
89-
name: govtool-backend
90-
dockerfile: ./govtool/backend/Dockerfile.qovery
91-
image: ghcr.io/${{ github.repository }}-backend
92-
qovery_container_name: govtool-backend
93-
- branch: staging
94-
network: preview-govtool
95-
workdir: ./govtool/frontend
96-
name: govtool-frontend
97-
dockerfile: ./govtool/frontend/Dockerfile.qovery
98-
image: ghcr.io/${{ github.repository }}-frontend
99-
qovery_container_name: govtool-frontend
100-
- branch: staging
101-
network: preview-govtool
102-
workdir: ./govtool/metadata-validation
103-
name: govtool-metadata-validation
104-
dockerfile: ./govtool/metadata-validation/Dockerfile
105-
image: ghcr.io/${{ github.repository }}-metadata-validation
106-
qovery_container_name: govtool-metadata-validation
107-
- branch: staging
108-
network: pre-prod-govtool
109-
workdir: ./govtool/backend
110-
name: govtool-backend
111-
dockerfile: ./govtool/backend/Dockerfile.qovery
112-
image: ghcr.io/${{ github.repository }}-backend
113-
qovery_container_name: govtool-backend
114-
- branch: staging
115-
network: pre-prod-govtool
116-
workdir: ./govtool/frontend
117-
name: govtool-frontend
118-
dockerfile: ./govtool/frontend/Dockerfile.qovery
119-
image: ghcr.io/${{ github.repository }}-frontend
120-
qovery_container_name: govtool-frontend
121-
- branch: staging
122-
network: pre-prod-govtool
123-
workdir: ./govtool/metadata-validation
124-
name: govtool-metadata-validation
125-
dockerfile: ./govtool/metadata-validation/Dockerfile
126-
image: ghcr.io/${{ github.repository }}-metadata-validation
127-
qovery_container_name: govtool-metadata-validation
128-
- branch: staging
129-
network: prod-govtool
130-
workdir: ./govtool/backend
131-
name: govtool-backend
132-
dockerfile: ./govtool/backend/Dockerfile.qovery
133-
image: ghcr.io/${{ github.repository }}-backend
134-
qovery_container_name: govtool-backend
135-
- branch: staging
136-
network: prod-govtool
137-
workdir: ./govtool/frontend
138-
name: govtool-frontend
139-
dockerfile: ./govtool/frontend/Dockerfile.qovery
140-
image: ghcr.io/${{ github.repository }}-frontend
141-
qovery_container_name: govtool-frontend
142-
- branch: staging
143-
network: prod-govtool
144-
workdir: ./govtool/metadata-validation
145-
name: govtool-metadata-validation
146-
dockerfile: ./govtool/metadata-validation/Dockerfile
147-
image: ghcr.io/${{ github.repository }}-metadata-validation
148-
qovery_container_name: govtool-metadata-validation
149-
- branch: develop
150-
network: dev-govtool
151-
workdir: ./govtool/backend
152-
name: govtool-backend
153-
dockerfile: ./govtool/backend/Dockerfile.qovery
154-
image: ghcr.io/${{ github.repository }}-backend
155-
qovery_container_name: govtool-backend
156-
- branch: develop
157-
network: dev-govtool
158-
workdir: ./govtool/frontend
159-
name: govtool-frontend
160-
dockerfile: ./govtool/frontend/Dockerfile.qovery
161-
image: ghcr.io/${{ github.repository }}-frontend
162-
qovery_container_name: govtool-frontend
163-
- branch: develop
164-
network: dev-govtool
165-
workdir: ./govtool/metadata-validation
166-
name: govtool-metadata-validation
167-
dockerfile: ./govtool/metadata-validation/Dockerfile
168-
image: ghcr.io/${{ github.repository }}-metadata-validation
169-
qovery_container_name: govtool-metadata-validation
17085

17186
runs-on: ubuntu-latest
17287
steps:

.github/workflows/merge.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
name: Check,Build,Deploy
22

33
on:
4-
workflow_dispatch
4+
push:
5+
branches:
6+
- develop
7+
workflow_dispatch:
58

69
permissions:
710
contents: write

govtool/backend/src/VVA/API.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,22 +296,22 @@ getVotes (unHexText -> dRepId) selectedTypes sortMode mSearch = do
296296
CacheEnv {dRepGetVotesCache} <- asks vvaCache
297297
(votes, proposals) <- cacheRequest dRepGetVotesCache dRepId $ DRep.getVotes dRepId []
298298

299-
let voteMapByTxHash = Map.fromList $
300-
map (\vote -> (pack $ Prelude.takeWhile (/= '#') (unpack $ Types.voteGovActionId vote), vote)) votes
299+
let voteMapById = Map.fromList $
300+
map (\vote -> (Types.voteGovActionId vote, vote)) votes
301301

302302
processedProposals <- filter (isProposalSearchedFor mSearch) <$>
303303
mapSortAndFilterProposals selectedTypes sortMode proposals
304304

305-
return $
305+
return
306306
[ VoteResponse
307307
{ voteResponseVote = voteToResponse vote
308308
, voteResponseProposal = proposalResponse
309309
}
310310
| proposalResponse <- processedProposals
311-
, let txHash = unHexText (proposalResponseTxHash proposalResponse)
312-
, Just vote <- [Map.lookup txHash voteMapByTxHash]
311+
, let govActionId = unHexText (proposalResponseTxHash proposalResponse) <> "#" <> pack (show $ proposalResponseIndex proposalResponse)
312+
, Just vote <- [Map.lookup govActionId voteMapById]
313313
]
314-
314+
315315
drepInfo :: App m => HexText -> m DRepInfoResponse
316316
drepInfo (unHexText -> dRepId) = do
317317
CacheEnv {dRepInfoCache} <- asks vvaCache

govtool/frontend/src/components/organisms/DashboardGovernanceActionDetails.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ export const DashboardGovernanceActionDetails = () => {
6060
);
6161

6262
useEffect(() => {
63-
if (data?.proposal && typeof isMetadataValid !== "boolean") {
63+
const extendedProposalIndex = extendedProposal ? extendedProposal.index : -1;
64+
if (data?.proposal && data?.proposal.index !== extendedProposalIndex) {
6465
setExtendedProposal(data.proposal);
6566
}
6667
}, [data?.proposal, isMetadataValid]);

govtool/frontend/src/components/organisms/DashboardGovernanceActions.tsx

Lines changed: 28 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
DashboardGovernanceActionsVotedOn,
2323
} from "@organisms";
2424
import { Button } from "@atoms";
25-
import usePrevious from "@/hooks/usePrevious";
2625

2726
type TabPanelProps = {
2827
children?: React.ReactNode;
@@ -85,21 +84,11 @@ export const DashboardGovernanceActions = () => {
8584
const queryFilters =
8685
chosenFilters.length > 0 ? chosenFilters : defaultCategories;
8786

88-
const prevFilters = usePrevious(queryFilters);
89-
const prevSorting = usePrevious(chosenSorting);
90-
91-
const stableFilters = isAdjusting
92-
? prevFilters ?? queryFilters
93-
: queryFilters;
94-
const stableSorting = isAdjusting
95-
? prevSorting ?? chosenSorting
96-
: chosenSorting;
97-
9887
const { proposals, isProposalsLoading } = useGetProposalsQuery({
99-
filters: stableFilters,
100-
sorting: stableSorting,
88+
filters: queryFilters,
89+
sorting: chosenSorting,
10190
searchPhrase: debouncedSearchText,
102-
enabled: true,
91+
enabled: !isAdjusting,
10392
});
10493
const { data: votes, areDRepVotesLoading } = useGetDRepVotesQuery(
10594
queryFilters,
@@ -109,31 +98,31 @@ export const DashboardGovernanceActions = () => {
10998

11099
// White Magic :)
111100
const shouldFilter =
112-
voter?.isRegisteredAsDRep || voter?.isRegisteredAsSoleVoter;
113-
114-
const filteredProposals = useMemo(() => {
115-
if (!shouldFilter || !proposals || !votes) return proposals;
116-
117-
return proposals
118-
.map((proposalCategory) => {
119-
const filteredActions = proposalCategory.actions.filter((action) => {
120-
const hasVote = votes.some((voteCategory) =>
121-
voteCategory.actions.some(
122-
(voteAction) =>
123-
voteAction.proposal.txHash === action.txHash &&
124-
voteAction.proposal.index === action.index,
125-
),
126-
);
127-
return !hasVote;
128-
});
129-
130-
return {
131-
...proposalCategory,
132-
actions: filteredActions,
133-
};
134-
})
135-
.filter((category) => category.actions.length > 0);
136-
}, [proposals, votes, shouldFilter]);
101+
voter?.isRegisteredAsDRep || voter?.isRegisteredAsSoleVoter;
102+
103+
const filteredProposals = useMemo(() => {
104+
if (!shouldFilter || !proposals || !votes) return proposals;
105+
106+
return proposals
107+
.map((proposalCategory) => {
108+
const filteredActions = proposalCategory.actions.filter((action) => {
109+
const hasVote = votes.some((voteCategory) =>
110+
voteCategory.actions.some(
111+
(voteAction) =>
112+
voteAction.proposal.txHash === action.txHash &&
113+
voteAction.proposal.index === action.index,
114+
),
115+
);
116+
return !hasVote;
117+
});
118+
119+
return {
120+
...proposalCategory,
121+
actions: filteredActions,
122+
};
123+
})
124+
.filter((category) => category.actions.length > 0);
125+
}, [proposals, votes, shouldFilter]);
137126

138127
const { state } = useLocation();
139128
const [content, setContent] = useState<number>(

govtool/frontend/src/components/organisms/GovernanceActionsToVote.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const GovernanceActionsToVote = ({
4848
data={item.actions.slice(0, 6).map((action) => (
4949
<div
5050
className="keen-slider__slide"
51-
key={action.id}
51+
key={`${action.txHash}${action.index}`}
5252
style={{
5353
overflow: "visible",
5454
width: "auto",

govtool/frontend/src/hooks/queries/useGetProposalsQuery.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,23 @@ export const useGetProposalsQuery = ({
3333
return allProposals.flatMap((proposal) => proposal.elements);
3434
};
3535

36-
const { data, isLoading } = useQuery(
37-
[QUERY_KEYS.useGetProposalsKey, filters, searchPhrase, sorting, dRepID],
38-
fetchProposals,
39-
{
40-
enabled,
41-
refetchOnWindowFocus: true,
42-
keepPreviousData: true,
43-
staleTime: 2000,
44-
},
45-
);
36+
const { data, isLoading } = useQuery(
37+
[
38+
QUERY_KEYS.useGetProposalsKey,
39+
filters,
40+
searchPhrase,
41+
sorting,
42+
dRepID,
43+
voter?.isRegisteredAsDRep,
44+
voter?.isRegisteredAsSoleVoter,
45+
],
46+
fetchProposals,
47+
{
48+
enabled,
49+
refetchOnWindowFocus: true,
50+
keepPreviousData: true,
51+
},
52+
);
4653

4754
const proposals = Object.values(groupByType(data) ?? []);
4855

govtool/frontend/src/pages/DRepDirectoryContent.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,24 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
5050
}) => {
5151
const { dRepID: myDRepId, pendingTransaction, stakeKey } = useCardano();
5252
const { t } = useTranslation();
53-
const { debouncedSearchText, ...dataActionsBarProps } = useDataActionsBar();
53+
54+
const {
55+
searchText,
56+
debouncedSearchText,
57+
setSearchText,
58+
...dataActionsBarProps
59+
} = useDataActionsBar();
60+
5461
const { chosenFilters, chosenSorting, setChosenFilters, setChosenSorting } =
5562
dataActionsBarProps;
5663

5764
const [inProgressDelegationDRepData, setInProgressDelegationDRepData] =
5865
useState<DRepData | undefined>(undefined);
5966

67+
// Set initial filters and sort
6068
useEffect(() => {
6169
setChosenFilters([DRepStatus.Active]);
70+
setSearchText(""); // <--- Clear the search field on mount
6271
}, []);
6372

6473
useEffect(() => {
@@ -198,6 +207,8 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
198207
</Typography>
199208
<DataActionsBar
200209
{...dataActionsBarProps}
210+
searchText={searchText}
211+
setSearchText={setSearchText}
201212
filterOptions={DREP_DIRECTORY_FILTERS}
202213
filtersTitle={t("dRepDirectory.filterTitle")}
203214
sortOptions={DREP_DIRECTORY_SORTING}

0 commit comments

Comments
 (0)