diff --git a/packages/backend/package.json b/packages/backend/package.json index f629dab..8a47a4b 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "main": "index.js", "dependencies": { - "@cerc-io/laconic-sdk": "^0.1.14", + "@cerc-io/laconic-sdk": "^0.1.16", "@graphql-tools/schema": "^10.0.2", "@graphql-tools/utils": "^10.0.12", "@octokit/oauth-app": "^6.1.0", diff --git a/packages/deployer/README.md b/packages/deployer/README.md index d297685..48050db 100644 --- a/packages/deployer/README.md +++ b/packages/deployer/README.md @@ -30,8 +30,8 @@ ## Troubleshoot -- Check deployment status [here](https://console.laconic.com/deployer). -- Check records [here](https://console.laconic.com/#/registry). +- Check deployment status in [web-app deployer](https://console.laconic.com/deployer). +- Check records in [registry console app](https://console.laconic.com/#/registry). - If deployment fails due to low bond balance - Check balances @@ -40,9 +40,9 @@ yarn laconic cns account get # Bond balance - yarn laconic cns bond get --id 8fcf44b2f326b4b63ac57547777f1c78b7d494e5966e508f09001af53cb440ac + yarn laconic cns bond get --id 99c0e9aec0ac1b8187faa579be3b54f93fafb6060ac1fd29170b860df605be32 ``` - Command to refill bond ```bash - yarn laconic cns bond refill --id 8fcf44b2f326b4b63ac57547777f1c78b7d494e5966e508f09001af53cb440ac --type aphoton --quantity 10000000 + yarn laconic cns bond refill --id 99c0e9aec0ac1b8187faa579be3b54f93fafb6060ac1fd29170b860df605be32 --type aphoton --quantity 10000000 ``` diff --git a/packages/deployer/deploy-frontend.sh b/packages/deployer/deploy-frontend.sh index 9251042..d1ae439 100755 --- a/packages/deployer/deploy-frontend.sh +++ b/packages/deployer/deploy-frontend.sh @@ -13,7 +13,7 @@ PACKAGE_VERSION=$(jq -r '.version' ../frontend/package.json) CURRENT_DATE_TIME=$(date -u) CONFIG_FILE=config.yml -REGISTRY_BOND_ID="8fcf44b2f326b4b63ac57547777f1c78b7d494e5966e508f09001af53cb440ac" +REGISTRY_BOND_ID="99c0e9aec0ac1b8187faa579be3b54f93fafb6060ac1fd29170b860df605be32" # Reference: https://git.vdb.to/cerc-io/test-progressive-web-app/src/branch/main/scripts diff --git a/packages/frontend/src/components/projects/create/ProjectRepoCard/ProjectRepoCard.tsx b/packages/frontend/src/components/projects/create/ProjectRepoCard/ProjectRepoCard.tsx index b06fc23..98eb0be 100644 --- a/packages/frontend/src/components/projects/create/ProjectRepoCard/ProjectRepoCard.tsx +++ b/packages/frontend/src/components/projects/create/ProjectRepoCard/ProjectRepoCard.tsx @@ -58,7 +58,7 @@ export const ProjectRepoCard: React.FC = ({ }); } } catch (error) { - console.error(error); + console.error((error as Error).message); toast({ id: 'failed-to-create-project', title: 'Failed to create project', diff --git a/packages/frontend/src/pages/org-slug/projects/create/template/index.tsx b/packages/frontend/src/pages/org-slug/projects/create/template/index.tsx index 777a866..305f2fa 100644 --- a/packages/frontend/src/pages/org-slug/projects/create/template/index.tsx +++ b/packages/frontend/src/pages/org-slug/projects/create/template/index.tsx @@ -1,9 +1,9 @@ import React, { useCallback, useEffect, useState } from 'react'; import { useForm, SubmitHandler, Controller } from 'react-hook-form'; import { useNavigate, useOutletContext, useParams } from 'react-router-dom'; -import toast from 'react-hot-toast'; import assert from 'assert'; import { useMediaQuery } from 'usehooks-ts'; +import { RequestError } from 'octokit'; import { useOctokit } from '../../../../../context/OctokitContext'; import { useGQLClient } from '../../../../../context/GQLClientContext'; @@ -14,6 +14,9 @@ import { Select, SelectOption } from 'components/shared/Select'; import { ArrowRightCircleFilledIcon } from 'components/shared/CustomIcon'; import { Checkbox } from 'components/shared/Checkbox'; import { Button } from 'components/shared/Button'; +import { useToast } from 'components/shared/Toast'; + +const REPO_EXIST_ERROR = 'Could not clone: Name already exists on this account'; type SubmitRepoValues = { framework: string; @@ -28,6 +31,7 @@ const CreateRepo = () => { const client = useGQLClient(); const { orgSlug } = useParams(); + const { toast, dismiss } = useToast(); const isTabletView = useMediaQuery('(min-width: 720px)'); // md: const buttonSize = isTabletView ? { size: 'lg' as const } : {}; @@ -68,18 +72,31 @@ const CreateRepo = () => { template: 'webapp', }); - if (Boolean(addProject)) { - setIsLoading(true); - navigate( - `deploy?projectId=${addProject.id}&templateId=${template.id}`, - ); - } else { - setIsLoading(false); - } + navigate(`deploy?projectId=${addProject.id}&templateId=${template.id}`); } catch (err) { - console.error(err); setIsLoading(false); - toast.error('Error deploying project'); + + if ( + err instanceof RequestError && + err.message.includes(REPO_EXIST_ERROR) + ) { + toast({ + id: 'repo-exist-error', + title: 'Could not create: repository already exists', + variant: 'error', + onDismiss: dismiss, + }); + + return; + } + + console.error((err as Error).message); + toast({ + id: 'failed-to-create-project', + title: 'Failed to create project', + variant: 'error', + onDismiss: dismiss, + }); } }, [octokit], diff --git a/yarn.lock b/yarn.lock index f0ed8b7..a9c62ce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1313,10 +1313,10 @@ lodash-clean "^2.2.3" yargs "^17.4.1" -"@cerc-io/laconic-sdk@^0.1.14", "@cerc-io/laconic-sdk@^0.1.15": - version "0.1.15" - resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Flaconic-sdk/-/0.1.15/laconic-sdk-0.1.15.tgz#1011a07933c6f1525e05e1ba7dd6a4e4df9b6edb" - integrity sha512-Ifl4JUGpckZsu2RkaGyGlObpu9B9GhwFVoDCt8WM9ApdtFnGEVSbDzRuh4f2vLj9WaZkbfdSI/Xci1Fugj3lZg== +"@cerc-io/laconic-sdk@^0.1.15", "@cerc-io/laconic-sdk@^0.1.16": + version "0.1.16" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Flaconic-sdk/-/0.1.16/laconic-sdk-0.1.16.tgz#53f12a32f156a177987f89e727eb5f16743df7db" + integrity sha512-wu6k711qHPxowgyzAmjxz8i/ZTGxW+4sHf9WQ+0hW/E9PlR3Gn8OIsN3J8tvY45wvNdKKR3bm+7w/byyYLRF9A== dependencies: "@cosmjs/amino" "^0.28.1" "@cosmjs/crypto" "^0.28.1"