Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync pretest with test with the recent workflow changes introduced on develop #1024

Merged
merged 32 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9508e77
change navto items
Sworzen1 May 9, 2024
5d1c8a7
fix lint
Sworzen1 May 9, 2024
b32b138
[#926] DRep panel needs to be clickable
JanJaroszczak May 10, 2024
4c53331
Merge pull request #977 from IntersectMBO/fix/929-drep-links-are-appe…
Sworzen1 May 10, 2024
d57c6d2
Configure sonar-scanner
mesudip May 2, 2024
6ca4719
Merge remote-tracking branch 'origin/develop' into feat/sonar-scanner
mesudip May 13, 2024
2cf09aa
Merge pull request #998 from IntersectMBO/feat/sonar-scanner
mesudip May 13, 2024
6ba37d8
Use docker image to run sonar-scanner
mesudip May 13, 2024
6353ee4
Run tests before sonar scan
mesudip May 13, 2024
3f583da
Use sonar scanner action with coverage reports.
mesudip May 13, 2024
0cef8a7
fix: fix frontend makefile
MSzalowski May 13, 2024
864bd79
Merge pull request #1004 from IntersectMBO/fix/fix-frontend-deployment
MSzalowski May 13, 2024
e129f0a
Allow backend to receive POST mehod
placek May 13, 2024
9059dc4
Merge pull request #1006 from IntersectMBO/fix/allow-backend-to-recei…
MSzalowski May 13, 2024
1eb3d99
fix backend config
jankun4 May 13, 2024
5959680
fix backend config
jankun4 May 13, 2024
8b91031
[#927] Your DRep needs showing on detail page
JanJaroszczak May 10, 2024
e33383b
[#927] Fixes after CR
JanJaroszczak May 13, 2024
c9788e5
[#932] Automated voting options voting power fix
JanJaroszczak May 13, 2024
5248e87
[#925] In Progress DRep cards display fixes
JanJaroszczak May 13, 2024
23ddf9e
Remove sonar host configuration
mesudip May 13, 2024
16a578b
Merge pull request #1016 from IntersectMBO/feat/sonar-scanner
NabinKawan May 14, 2024
3a948e2
[#1003] Apply basic auth on staging environment
placek May 14, 2024
06675fc
[#1003] Apply environment variables for basic authentication in GitHu…
placek May 14, 2024
2e095a7
Merge pull request #983 from IntersectMBO/926-drep-panel-needs-to-be-…
JanJaroszczak May 14, 2024
7c6003b
Merge pull request #985 from IntersectMBO/927-your-drep-needs-showing…
JanJaroszczak May 14, 2024
a6d6060
Merge pull request #1012 from IntersectMBO/932-voting-power-not-corre…
JanJaroszczak May 14, 2024
ecd232a
Merge pull request #1013 from IntersectMBO/925-drep-delegation-incorr…
JanJaroszczak May 14, 2024
8dfaf81
Update backend config with metadata-validation service address
placek May 14, 2024
624fd10
Merge pull request #1020 from IntersectMBO/chore/1003-set-up-basic-au…
placek May 14, 2024
84cd7bb
Merge pull request #1023 from IntersectMBO/hotfix/change-metadata-val…
placek May 14, 2024
77cc6e6
sync pretest with develop
MSzalowski May 14, 2024
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
2 changes: 0 additions & 2 deletions .github/workflows/build-and-deploy-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
DBSYNC_POSTGRES_USER: "postgres"
GA_CLIENT_EMAIL: ${{ secrets.GA_CLIENT_EMAIL }}
GA_PRIVATE_KEY: ${{ secrets.GA_PRIVATE_KEY }}
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
GRAFANA_ADMIN_PASSWORD: ${{ secrets.GRAFANA_ADMIN_PASSWORD }}
GRAFANA_SLACK_OAUTH_TOKEN: ${{ secrets.GRAFANA_SLACK_OAUTH_TOKEN }}
GRAFANA_SLACK_RECIPIENT: ${{ secrets.GRAFANA_SLACK_RECIPIENT }}
Expand All @@ -32,7 +31,6 @@ jobs:
IP_ADDRESS_BYPASSING_BASIC_AUTH2: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH2 }}
NEXT_PUBLIC_API_URL: "https://participation.sanchogov.tools"
NEXT_PUBLIC_GA4_PROPERTY_ID: ${{ secrets.NEXT_PUBLIC_GA4_PROPERTY_ID }}
NGINX_BASIC_AUTH: ${{ secrets.NGINX_BASIC_AUTH }}
PIPELINE_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN_FRONTEND }}
SENTRY_DSN_BACKEND: ${{ secrets.SENTRY_DSN_BACKEND }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/build-and-deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
DBSYNC_POSTGRES_USER: "postgres"
GA_CLIENT_EMAIL: ${{ secrets.GA_CLIENT_EMAIL }}
GA_PRIVATE_KEY: ${{ secrets.GA_PRIVATE_KEY }}
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
GRAFANA_ADMIN_PASSWORD: ${{ secrets.GRAFANA_ADMIN_PASSWORD }}
GRAFANA_SLACK_OAUTH_TOKEN: ${{ secrets.GRAFANA_SLACK_OAUTH_TOKEN }}
GRAFANA_SLACK_RECIPIENT: ${{ secrets.GRAFANA_SLACK_RECIPIENT }}
Expand All @@ -31,7 +30,7 @@ jobs:
IP_ADDRESS_BYPASSING_BASIC_AUTH2: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH2 }}
NEXT_PUBLIC_API_URL: "https://participation.sanchogov.tools"
NEXT_PUBLIC_GA4_PROPERTY_ID: ${{ secrets.NEXT_PUBLIC_GA4_PROPERTY_ID }}
NGINX_BASIC_AUTH: ${{ secrets.NGINX_BASIC_AUTH }}
DEV_NGINX_BASIC_AUTH: ${{ secrets.DEV_NGINX_BASIC_AUTH }}
PIPELINE_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN_FRONTEND }}
SENTRY_DSN_BACKEND: ${{ secrets.SENTRY_DSN_BACKEND }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/build-and-deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
DBSYNC_POSTGRES_USER: "postgres"
GA_CLIENT_EMAIL: ${{ secrets.GA_CLIENT_EMAIL }}
GA_PRIVATE_KEY: ${{ secrets.GA_PRIVATE_KEY }}
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
GRAFANA_ADMIN_PASSWORD: ${{ secrets.GRAFANA_ADMIN_PASSWORD }}
GRAFANA_SLACK_OAUTH_TOKEN: ${{ secrets.GRAFANA_SLACK_OAUTH_TOKEN }}
GRAFANA_SLACK_RECIPIENT: ${{ secrets.GRAFANA_SLACK_RECIPIENT }}
Expand All @@ -33,7 +32,7 @@ jobs:
IP_ADDRESS_BYPASSING_BASIC_AUTH2: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH2 }}
NEXT_PUBLIC_API_URL: "https://participation.sanchogov.tools"
NEXT_PUBLIC_GA4_PROPERTY_ID: ${{ secrets.NEXT_PUBLIC_GA4_PROPERTY_ID }}
NGINX_BASIC_AUTH: ${{ secrets.NGINX_BASIC_AUTH }}
STAGING_NGINX_BASIC_AUTH: ${{ secrets.STAGING_NGINX_BASIC_AUTH }}
PIPELINE_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN_FRONTEND }}
SENTRY_DSN_BACKEND: ${{ secrets.SENTRY_DSN_BACKEND }}
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/build-and-deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,22 @@ jobs:
name: Deploy app
runs-on: ubuntu-latest
env:
DBSYNC_POSTGRES_DB: "cexplorer"
DBSYNC_POSTGRES_PASSWORD: "pSa8JCpQOACMUdGb"
DBSYNC_POSTGRES_USER: "postgres"
GA_CLIENT_EMAIL: ${{ secrets.GA_CLIENT_EMAIL }}
GA_PRIVATE_KEY: ${{ secrets.GA_PRIVATE_KEY }}
GRAFANA_ADMIN_PASSWORD: ${{ secrets.GRAFANA_ADMIN_PASSWORD }}
GRAFANA_SLACK_RECIPIENT: ${{ secrets.GRAFANA_SLACK_RECIPIENT }}
GRAFANA_SLACK_OAUTH_TOKEN: ${{ secrets.GRAFANA_SLACK_OAUTH_TOKEN }}
SENTRY_DSN_BACKEND: ${{ secrets.SENTRY_DSN_BACKEND }}
GTM_ID: ${{ secrets.GTM_ID }}
IP_ADDRESS_BYPASSING_BASIC_AUTH1: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH1 }}
IP_ADDRESS_BYPASSING_BASIC_AUTH2: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH2 }}
NEXT_PUBLIC_API_URL: "https://participation.sanchogov.tools"
NEXT_PUBLIC_GA4_PROPERTY_ID: ${{ secrets.NEXT_PUBLIC_GA4_PROPERTY_ID }}
TEST_NGINX_BASIC_AUTH: ${{ secrets.TEST_NGINX_BASIC_AUTH }}
PIPELINE_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN_FRONTEND }}
PIPELINE_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
USERSNAP_SPACE_API_KEY: ${{ secrets.USERSNAP_SPACE_API_KEY }}
Expand Down
39 changes: 32 additions & 7 deletions .github/workflows/frontend_sonar_scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,40 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Cache dependencies
uses: actions/cache@v2
with:
path: govtool/frontend/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('govtool/frontend/package-lock.json') }}

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: "govtool/frontend/.nvmrc"

- name: 🧪 Test
working-directory: govtool/frontend
env:
NODE_OPTIONS: "--max_old_space_size=4096"
run: |
npm install
npm run test:coverage

# Running with docker
#
# - name: Run SonarQube Scanner
# run: |
# docker run --rm \
# -e SONAR_HOST_URL="https://sonarcloud.io" \
# -e SONAR_TOKEN="ec4183646e59dd70c8077acfabe52062ccbea7a9" \
# -v "$(pwd):/usr/src" \
# --workdir=/usr/src/govtool/frontend \
# sonarsource/sonar-scanner-cli:5.0.1

- uses: sonarsource/sonarqube-scan-action@master
with:
projectBaseDir: govtool/frontend
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

# Fail the build if it doesn't meet quality gate
# - uses: sonarsource/sonarqube-quality-gate-action@master
# timeout-minutes: 5
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,5 @@ scripts/govtool/dev-postgres_password

node_modules


# sonar scanner
.scannerwork/
4 changes: 4 additions & 0 deletions govtool/frontend/public/icons/Edit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion govtool/frontend/sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
sonar.projectKey=voltaire-era_AYra4oOPzihwqYo-BApS
sonar.projectKey=intersect-govtool
sonar.sources=./src
sonar.host.url=https://sonarcloud.io
sonar.organization=intersect
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
sonar.junit.reportsPath=./junit-report.xml
sonar.exclusions=node_modules
3 changes: 3 additions & 0 deletions govtool/frontend/src/components/molecules/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type CardProps = PropsWithChildren & {
label?: string;
sx?: SxProps<Theme>;
variant?: "default" | "error" | "primary" | "success" | "warning";
onCardClick?: () => void;
};

const COLORS = {
Expand Down Expand Up @@ -42,6 +43,7 @@ export const Card = ({
elevation = 3,
label,
sx,
onCardClick,
}: CardProps) => {
const colors = COLORS[variant];

Expand All @@ -57,6 +59,7 @@ export const Card = ({
position: "relative",
...sx,
}}
onClick={onCardClick}
>
{label && (
<Chip
Expand Down
10 changes: 4 additions & 6 deletions govtool/frontend/src/components/molecules/DelegationAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { DirectVoterActionProps } from "./types";

export const DelegationAction = ({
dRepId,
onClickArrow,
onCardClick,
sx,
}: DirectVoterActionProps) => {
const { t } = useTranslation();
Expand All @@ -27,8 +27,10 @@ export const DelegationAction = ({
justifyContent: "space-between",
px: 1.5,
py: 1,
cursor: "pointer",
...sx,
}}
onCardClick={onCardClick}
>
<Box sx={{ width: "90%" }}>
<Typography fontWeight={600} variant="body2">
Expand All @@ -45,11 +47,7 @@ export const DelegationAction = ({
{dRepId}
</Typography>
</Box>
<ArrowForwardIosIcon
color="primary"
onClick={onClickArrow}
sx={{ cursor: "pointer", height: 16, width: 24 }}
/>
<ArrowForwardIosIcon color="primary" sx={{ height: 16, width: 24 }} />
</Card>
);
};
2 changes: 1 addition & 1 deletion govtool/frontend/src/components/molecules/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type StepProps = {

export type DirectVoterActionProps = {
dRepId: string;
onClickArrow: () => void;
onCardClick: () => void;
sx?: SxProps;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
import { Typography } from "@atoms";
import { ICONS } from "@consts";
import { PendingTransaction } from "@context";
import { useTranslation } from "@hooks";
import { useGetNetworkMetrics, useTranslation } from "@hooks";
import { AutomatedVotingCard } from "@molecules";
import { openInNewTab } from "@/utils";
import { correctAdaFormat, openInNewTab } from "@/utils";
import {
AutomatedVotingOptionCurrentDelegation,
AutomatedVotingOptionDelegationId,
Expand Down Expand Up @@ -42,6 +42,8 @@ export const AutomatedVotingOptions = ({

const [isOpen, setIsOpen] = useState<boolean>(false);

const { networkMetrics } = useGetNetworkMetrics();

// TODO: Change to certain automated voted option if available
const onClickInfo = () => openInNewTab("https://docs.sanchogov.tools/");

Expand All @@ -63,10 +65,13 @@ export const AutomatedVotingOptions = ({
isDelegationToAbstainInProgress ||
isDelegationToNoConfidenceInProgress;

if (shouldBeSetOpen) {
setIsOpen(true);
}
}, [currentDelegation, delegationInProgress]);
setIsOpen(shouldBeSetOpen);
}, [
isDelegatedToAbstain,
isDelegatedToNoConfidence,
isDelegationToAbstainInProgress,
isDelegationToNoConfidenceInProgress,
]);

return (
<Accordion
Expand Down Expand Up @@ -117,7 +122,11 @@ export const AutomatedVotingOptions = ({
})
: t("dRepDirectory.abstainCardDefaultTitle")
}
votingPower={votingPower}
votingPower={
networkMetrics
? correctAdaFormat(networkMetrics?.alwaysAbstainVotingPower)
: ""
}
transactionId={
pendingTransaction?.delegate?.resourceId ===
AutomatedVotingOptionDelegationId.abstain
Expand Down Expand Up @@ -148,7 +157,13 @@ export const AutomatedVotingOptions = ({
})
: t("dRepDirectory.noConfidenceDefaultTitle")
}
votingPower={votingPower}
votingPower={
networkMetrics
? correctAdaFormat(
networkMetrics?.alwaysNoConfidenceVotingPower,
)
: ""
}
transactionId={
pendingTransaction?.delegate?.resourceId ===
AutomatedVotingOptionDelegationId.no_confidence
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const DelegateDashboardCard = ({
{displayedDelegationId && (
<DelegationAction
dRepId={displayedDelegationId}
onClickArrow={navigateToDRepDetails}
onCardClick={navigateToDRepDetails}
sx={{ mt: 1.5 }}
/>
)}
Expand Down
1 change: 1 addition & 0 deletions govtool/frontend/src/consts/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const ICONS = {
drawerIcon: "/icons/DrawerIcon.svg",
dRepDirectoryActiveIcon: "/icons/DRepDirectoryActive.svg",
dRepDirectoryIcon: "/icons/DRepDirectory.svg",
editIcon: "/icons/Edit.svg",
externalLinkIcon: "/icons/ExternalLink.svg",
faqsActiveIcon: "/icons/FaqsActive.svg",
faqsIcon: "/icons/Faqs.svg",
Expand Down
1 change: 1 addition & 0 deletions govtool/frontend/src/consts/queryKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const QUERY_KEYS = {
useGetDRepListInfiniteKey: "useGetDRepListInfiniteKey",
useGetDRepVotesKey: "useGetDRepVotesKey",
useGetDRepVotingPowerKey: "useGetDRepVotingPowerKey",
useGetNetworkMetricsKey: "useGetNetworkMetricsKey",
useGetProposalKey: "useGetProposalKey",
useGetProposalsKey: "useGetProposalsKey",
useGetProposalsInfiniteKey: "useGetProposalsInfiniteKey",
Expand Down
1 change: 1 addition & 0 deletions govtool/frontend/src/hooks/queries/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from "./useGetVoterInfoQuery";
export * from "./useGetDRepListQuery";
export * from "./useGetDRepVotesQuery";
export * from "./useGetDRepVotingPowerQuery";
export * from "./useGetNetworkMetrics";
export * from "./useGetProposalQuery";
export * from "./useGetProposalsQuery";
export * from "./useGetProposalsInfiniteQuery";
Expand Down
17 changes: 17 additions & 0 deletions govtool/frontend/src/hooks/queries/useGetNetworkMetrics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { useQuery } from "react-query";

import { getNetworkMetrics } from "@services";
import { QUERY_KEYS } from "@consts";
import { useCardano } from "@/context";

export const useGetNetworkMetrics = () => {
const { isEnabled } = useCardano();

const { data } = useQuery({
queryKey: QUERY_KEYS.useGetNetworkMetricsKey,
queryFn: () => getNetworkMetrics(),
enabled: isEnabled,
});

return { networkMetrics: data };
};
4 changes: 2 additions & 2 deletions govtool/frontend/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,11 @@ export const en = {
directVoter: "Direct Voter",
filterTitle: "DRep Status",
goToDRepDirectory: "Go to DRep Directory",
meAsDRep: "This DRep ID is connected to your wallet",
meAsDRep: "This DRep ID is connected to your wallet",
myDelegation: "You have delegated <strong>₳ {{ada}}</strong> to:",
myDelegationToYourself:
"You have delegated <strong>₳ {{ada}}</strong> to yourself:",
myDRep: "This is your DRep",
myDRep: "This is your DRep profile",
listTitle: "Find a DRep",
noConfidenceDefaultDescription:
"Select this to signal no confidence in the current constitutional committee by voting NO on every proposal and voting YES to no confidence proposals",
Expand Down
Loading
Loading