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
4 changes: 2 additions & 2 deletions .github/scripts/set_commit_status.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Ensure required environment variables are set
if [ -z "$GITHUB_REPOSITORY" ] || [ -z "$GITHUB_SHA" ] || [ -z "$GITHUB_TOKEN" ] || [ -z "$GITHUB_RUN_ID" ]; then
if [ -z "$GITHUB_REPOSITORY" ] || [ -z "$COMMIT_SHA" ] || [ -z "$GITHUB_TOKEN" ] || [ -z "$GITHUB_RUN_ID" ]; then
echo "Missing required environment variables!"
exit 1
fi
Expand Down Expand Up @@ -69,7 +69,7 @@ fi
# Send commit status update to GitHub
curl -X POST -H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA} \
https://api.github.com/repos/${GITHUB_REPOSITORY}/statuses/${COMMIT_SHA} \
-d "{\"state\": \"${TEST_STATUS}\", \"context\": \"${CONTEXT}\", \"description\": \"${DESCRIPTION}\", \"target_url\": \"${TARGET_URL}\"}"

echo "Commit status updated successfully!"
5 changes: 4 additions & 1 deletion .github/workflows/test_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ env.COMMIT_SHA }}

- name: Set pending commit status
id: set-pending-status
run: |
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
curl -X POST -H "Authorization: Bearer ${{ github.token }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.COMMIT_SHA }} \
-d "{\"state\": \"pending\", \"context\": \"Backend Tests : ${{env.BASE_URL}}\", \"target_url\": \"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"


Expand Down Expand Up @@ -184,3 +186,4 @@ env:
BASE_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io/api' }}
REPORT_NAME: govtool-backend
GH_PAGES: ${{vars.GH_PAGES}}
COMMIT_SHA: ${{ github.event.workflow_run.head_sha || github.sha }}
5 changes: 4 additions & 1 deletion .github/workflows/test_integration_playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ jobs:
working-directory: tests/govtool-frontend/playwright
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.COMMIT_SHA }}
- name: Set pending commit status
id: set-pending-status
run: |
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
curl -X POST -H "Authorization: Bearer ${{ github.token }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.COMMIT_SHA }} \
-d "{\"state\": \"pending\", \"context\": \"Playwright Tests : ${{env.HOST_URL}}\", \"target_url\": \"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"

- uses: actions/setup-node@v4
Expand Down Expand Up @@ -223,3 +225,4 @@ env:
HOST_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io' }}
REPORT_NAME: govtool-frontend
GH_PAGES: ${{vars.GH_PAGES}}
COMMIT_SHA: ${{ github.event.workflow_run.head_sha || github.sha }}
1 change: 1 addition & 0 deletions .github/workflows/update-intersect-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
branch: "chore/${{ github.event.inputs.package_name }}-${{ github.event.inputs.new_version }}"
title: "Update ${{ github.event.inputs.package_name }} to ${{ github.event.inputs.new_version }}"
commit-message: "chore: update ${{ github.event.inputs.package_name }} to ${{ github.event.inputs.new_version }}"
body: |
This PR updates `${{ github.event.inputs.package_name }}` to version `${{ github.event.inputs.new_version }}`.

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ changes.
- Add CC votes percentages, not voted and Ratification threshold
- Add support for submitting all 7 governance action types [Issue 2258](https://github.com/IntersectMBO/govtool/issues/2258)
- Add workflow to automatically update any of the @intersect.mbo package [Issue 2968](https://github.com/IntersectMBO/govtool/issues/2968)
- Add Propose Governance Action button in governance actions dashboard [Issue 1188](https://github.com/IntersectMBO/govtool/issues/1188)

### Fixed

Expand Down
19 changes: 14 additions & 5 deletions govtool/backend/sql/list-proposals.sql
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ EnrichedCurrentMembers AS (
) AS enriched_members
FROM
ProcessedCurrentMembers pcm
LEFT JOIN
json_array_elements(pcm.current_members) AS member ON true
LEFT JOIN
CommitteeData cm ON cm.hash = encode(decode(member->>'hash', 'hex'), 'hex')
LEFT JOIN json_array_elements(pcm.current_members) AS member ON true
LEFT JOIN CommitteeData cm
ON (CASE
WHEN (member->>'hash') ~ '^[0-9a-fA-F]+$'
THEN encode(decode(member->>'hash', 'hex'), 'hex')
ELSE NULL
END) = cm.hash
GROUP BY
pcm.id
),
Expand Down Expand Up @@ -199,7 +202,13 @@ SELECT
'tag', pd.tag,
'members', em.enriched_members,
'membersToBeRemoved', mtr.members_to_be_removed,
'threshold', pd.threshold::float
'threshold',
CASE
WHEN (pd.threshold->>'numerator') IS NOT NULL
AND (pd.threshold->>'denominator') IS NOT NULL
THEN (pd.threshold->>'numerator')::float / (pd.threshold->>'denominator')::float
ELSE NULL
END
)
FROM
ParsedDescription pd
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { useState, useEffect } from "react";
import { useState, useEffect, useCallback } from "react";
import { Box, CircularProgress, Tab, Tabs, styled } from "@mui/material";
import { useLocation } from "react-router-dom";
import { useLocation, useNavigate } from "react-router-dom";

import {
GOVERNANCE_ACTIONS_FILTERS,
GOVERNANCE_ACTIONS_SORTING,
PATHS,
PDF_PATHS,
} from "@consts";
import { useCardano, useDataActionsBar } from "@context";
import { useCardano, useDataActionsBar, useFeatureFlag } from "@context";
import {
useGetProposalsQuery,
useGetVoterInfo,
Expand All @@ -18,6 +20,7 @@ import {
GovernanceActionsToVote,
DashboardGovernanceActionsVotedOn,
} from "@organisms";
import { Button } from "@atoms";

type TabPanelProps = {
children?: React.ReactNode;
Expand Down Expand Up @@ -74,6 +77,8 @@ export const DashboardGovernanceActions = () => {
const { isMobile } = useScreenDimension();
const { t } = useTranslation();
const { isEnableLoading } = useCardano();
const { isProposalDiscussionForumEnabled } = useFeatureFlag();
const navigate = useNavigate();

const queryFilters =
chosenFilters.length > 0 ? chosenFilters : defaultCategories;
Expand All @@ -94,6 +99,14 @@ export const DashboardGovernanceActions = () => {
setContent(newValue);
};

const onClickPropose = useCallback(() => {
navigate(
isProposalDiscussionForumEnabled
? PDF_PATHS.proposalDiscussionPropose
: PATHS.createGovernanceAction,
);
}, [isProposalDiscussionForumEnabled]);

useEffect(() => {
window.history.replaceState({}, document.title);
}, []);
Expand Down Expand Up @@ -126,36 +139,49 @@ export const DashboardGovernanceActions = () => {
) : (
<>
{(voter?.isRegisteredAsDRep || voter?.isRegisteredAsSoleVoter) && (
<Tabs
sx={{
marginTop: 3,
display: "flex",
fontSize: 16,
fontWeight: 500,
}}
value={content}
indicatorColor="secondary"
onChange={handleChange}
aria-label="Governance Actions tabs"
>
<StyledTab
data-testid="to-vote-tab"
label={t("govActions.toVote")}
<Box display="flex" flexDirection="row" alignItems="center">
<Tabs
sx={{
textTransform: "none",
width: !isMobile ? "auto" : "50%",
marginTop: 3,
display: "flex",
fontSize: 16,
fontWeight: 500,
}}
/>
<StyledTab
data-testid="voted-tab"
label={t("govActions.votedOnByMe")}
value={content}
indicatorColor="secondary"
onChange={handleChange}
aria-label="Governance Actions tabs"
>
<StyledTab
data-testid="to-vote-tab"
label={t("govActions.toVote")}
sx={{
textTransform: "none",
width: !isMobile ? "auto" : "50%",
}}
/>
<StyledTab
data-testid="voted-tab"
label={t("govActions.votedOnByMe")}
sx={{
textTransform: "none",
width: !isMobile ? "auto" : "50%",
}}
/>
</Tabs>
<Button
data-testid="proposal-discussion-link"
onClick={onClickPropose}
sx={{
textTransform: "none",
width: !isMobile ? "auto" : "50%",
display: isMobile ? "none" : "block",
ml: "auto",
}}
/>
</Tabs>
>
{t("govActions.propose")}
</Button>
</Box>
)}

<Box height={isMobile ? 24 : 60} />
<CustomTabPanel value={content} index={0}>
<GovernanceActionsToVote
Expand Down
1 change: 1 addition & 0 deletions govtool/frontend/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@
"noResultsForTheSearch": "No results for the search.",
"onChainTransactionDetails": "On-chain Transaction Details",
"optional": "(optional)",
"propose": "Propose Governance Action",
"provideContext": "Provide context",
"provideContextAboutYourVote": "Provide context about your vote",
"additionalInformationAboutYourVote": "Additional information about your vote",
Expand Down
1 change: 0 additions & 1 deletion govtool/frontend/src/pages/GovernanceActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export const GovernanceActions = () => {
filtersTitle={t("govActions.filterTitle")}
sortOptions={GOVERNANCE_ACTIONS_SORTING}
/>

{!proposals || isProposalsLoading ? (
<Box
sx={{
Expand Down