diff --git a/.github/scripts/set_commit_status.sh b/.github/scripts/set_commit_status.sh
index 01a822304..73b460812 100644
--- a/.github/scripts/set_commit_status.sh
+++ b/.github/scripts/set_commit_status.sh
@@ -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
@@ -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!"
diff --git a/.github/workflows/test_backend.yml b/.github/workflows/test_backend.yml
index 59488d061..28c7b1599 100644
--- a/.github/workflows/test_backend.yml
+++ b/.github/workflows/test_backend.yml
@@ -46,6 +46,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
+ with:
+ ref: ${{ env.COMMIT_SHA }}
- name: Set pending commit status
id: set-pending-status
@@ -53,7 +55,7 @@ jobs:
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 }}\"}"
@@ -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 }}
diff --git a/.github/workflows/test_integration_playwright.yml b/.github/workflows/test_integration_playwright.yml
index b3c1591db..cf5e0ed63 100644
--- a/.github/workflows/test_integration_playwright.yml
+++ b/.github/workflows/test_integration_playwright.yml
@@ -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
@@ -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 }}
diff --git a/.github/workflows/update-intersect-package.yml b/.github/workflows/update-intersect-package.yml
index e2fb1d680..f93759b13 100644
--- a/.github/workflows/update-intersect-package.yml
+++ b/.github/workflows/update-intersect-package.yml
@@ -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 }}`.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f802f639f..8be337c51 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/govtool/backend/sql/list-proposals.sql b/govtool/backend/sql/list-proposals.sql
index cedc4e86d..2c0de7f10 100644
--- a/govtool/backend/sql/list-proposals.sql
+++ b/govtool/backend/sql/list-proposals.sql
@@ -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
),
@@ -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
diff --git a/govtool/frontend/src/components/organisms/DashboardGovernanceActions.tsx b/govtool/frontend/src/components/organisms/DashboardGovernanceActions.tsx
index 3bcf8bb90..2efc90aa6 100644
--- a/govtool/frontend/src/components/organisms/DashboardGovernanceActions.tsx
+++ b/govtool/frontend/src/components/organisms/DashboardGovernanceActions.tsx
@@ -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,
@@ -18,6 +20,7 @@ import {
GovernanceActionsToVote,
DashboardGovernanceActionsVotedOn,
} from "@organisms";
+import { Button } from "@atoms";
type TabPanelProps = {
children?: React.ReactNode;
@@ -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;
@@ -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);
}, []);
@@ -126,36 +139,49 @@ export const DashboardGovernanceActions = () => {
) : (
<>
{(voter?.isRegisteredAsDRep || voter?.isRegisteredAsSoleVoter) && (
-
-
+
-
+
+
+
+
-
+ >
+ {t("govActions.propose")}
+
+
)}
+
{
filtersTitle={t("govActions.filterTitle")}
sortOptions={GOVERNANCE_ACTIONS_SORTING}
/>
-
{!proposals || isProposalsLoading ? (