Upgrade laconic-sdk package for showing error with reason in console (#165)

* Upgrade laconic sdk version

* Update toast message for add project

* Log error messages

* Update bond id in readme

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
Nabarun Gogoi 2024-04-03 20:26:34 +05:30 committed by GitHub
parent 78f04c3669
commit 351db16336
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 39 additions and 22 deletions

View File

@ -3,7 +3,7 @@
"version": "1.0.0", "version": "1.0.0",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@cerc-io/laconic-sdk": "^0.1.14", "@cerc-io/laconic-sdk": "^0.1.16",
"@graphql-tools/schema": "^10.0.2", "@graphql-tools/schema": "^10.0.2",
"@graphql-tools/utils": "^10.0.12", "@graphql-tools/utils": "^10.0.12",
"@octokit/oauth-app": "^6.1.0", "@octokit/oauth-app": "^6.1.0",

View File

@ -30,8 +30,8 @@
## Troubleshoot ## Troubleshoot
- Check deployment status [here](https://console.laconic.com/deployer). - Check deployment status in [web-app deployer](https://console.laconic.com/deployer).
- Check records [here](https://console.laconic.com/#/registry). - Check records in [registry console app](https://console.laconic.com/#/registry).
- If deployment fails due to low bond balance - If deployment fails due to low bond balance
- Check balances - Check balances
@ -40,9 +40,9 @@
yarn laconic cns account get yarn laconic cns account get
# Bond balance # Bond balance
yarn laconic cns bond get --id 8fcf44b2f326b4b63ac57547777f1c78b7d494e5966e508f09001af53cb440ac yarn laconic cns bond get --id 99c0e9aec0ac1b8187faa579be3b54f93fafb6060ac1fd29170b860df605be32
``` ```
- Command to refill bond - Command to refill bond
```bash ```bash
yarn laconic cns bond refill --id 8fcf44b2f326b4b63ac57547777f1c78b7d494e5966e508f09001af53cb440ac --type aphoton --quantity 10000000 yarn laconic cns bond refill --id 99c0e9aec0ac1b8187faa579be3b54f93fafb6060ac1fd29170b860df605be32 --type aphoton --quantity 10000000
``` ```

View File

@ -13,7 +13,7 @@ PACKAGE_VERSION=$(jq -r '.version' ../frontend/package.json)
CURRENT_DATE_TIME=$(date -u) CURRENT_DATE_TIME=$(date -u)
CONFIG_FILE=config.yml 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 # Reference: https://git.vdb.to/cerc-io/test-progressive-web-app/src/branch/main/scripts

View File

@ -58,7 +58,7 @@ export const ProjectRepoCard: React.FC<ProjectRepoCardProps> = ({
}); });
} }
} catch (error) { } catch (error) {
console.error(error); console.error((error as Error).message);
toast({ toast({
id: 'failed-to-create-project', id: 'failed-to-create-project',
title: 'Failed to create project', title: 'Failed to create project',

View File

@ -1,9 +1,9 @@
import React, { useCallback, useEffect, useState } from 'react'; import React, { useCallback, useEffect, useState } from 'react';
import { useForm, SubmitHandler, Controller } from 'react-hook-form'; import { useForm, SubmitHandler, Controller } from 'react-hook-form';
import { useNavigate, useOutletContext, useParams } from 'react-router-dom'; import { useNavigate, useOutletContext, useParams } from 'react-router-dom';
import toast from 'react-hot-toast';
import assert from 'assert'; import assert from 'assert';
import { useMediaQuery } from 'usehooks-ts'; import { useMediaQuery } from 'usehooks-ts';
import { RequestError } from 'octokit';
import { useOctokit } from '../../../../../context/OctokitContext'; import { useOctokit } from '../../../../../context/OctokitContext';
import { useGQLClient } from '../../../../../context/GQLClientContext'; import { useGQLClient } from '../../../../../context/GQLClientContext';
@ -14,6 +14,9 @@ import { Select, SelectOption } from 'components/shared/Select';
import { ArrowRightCircleFilledIcon } from 'components/shared/CustomIcon'; import { ArrowRightCircleFilledIcon } from 'components/shared/CustomIcon';
import { Checkbox } from 'components/shared/Checkbox'; import { Checkbox } from 'components/shared/Checkbox';
import { Button } from 'components/shared/Button'; 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 = { type SubmitRepoValues = {
framework: string; framework: string;
@ -28,6 +31,7 @@ const CreateRepo = () => {
const client = useGQLClient(); const client = useGQLClient();
const { orgSlug } = useParams(); const { orgSlug } = useParams();
const { toast, dismiss } = useToast();
const isTabletView = useMediaQuery('(min-width: 720px)'); // md: const isTabletView = useMediaQuery('(min-width: 720px)'); // md:
const buttonSize = isTabletView ? { size: 'lg' as const } : {}; const buttonSize = isTabletView ? { size: 'lg' as const } : {};
@ -68,18 +72,31 @@ const CreateRepo = () => {
template: 'webapp', template: 'webapp',
}); });
if (Boolean(addProject)) { navigate(`deploy?projectId=${addProject.id}&templateId=${template.id}`);
setIsLoading(true);
navigate(
`deploy?projectId=${addProject.id}&templateId=${template.id}`,
);
} else {
setIsLoading(false);
}
} catch (err) { } catch (err) {
console.error(err);
setIsLoading(false); 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], [octokit],

View File

@ -1313,10 +1313,10 @@
lodash-clean "^2.2.3" lodash-clean "^2.2.3"
yargs "^17.4.1" yargs "^17.4.1"
"@cerc-io/laconic-sdk@^0.1.14", "@cerc-io/laconic-sdk@^0.1.15": "@cerc-io/laconic-sdk@^0.1.15", "@cerc-io/laconic-sdk@^0.1.16":
version "0.1.15" version "0.1.16"
resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Flaconic-sdk/-/0.1.15/laconic-sdk-0.1.15.tgz#1011a07933c6f1525e05e1ba7dd6a4e4df9b6edb" 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-Ifl4JUGpckZsu2RkaGyGlObpu9B9GhwFVoDCt8WM9ApdtFnGEVSbDzRuh4f2vLj9WaZkbfdSI/Xci1Fugj3lZg== integrity sha512-wu6k711qHPxowgyzAmjxz8i/ZTGxW+4sHf9WQ+0hW/E9PlR3Gn8OIsN3J8tvY45wvNdKKR3bm+7w/byyYLRF9A==
dependencies: dependencies:
"@cosmjs/amino" "^0.28.1" "@cosmjs/amino" "^0.28.1"
"@cosmjs/crypto" "^0.28.1" "@cosmjs/crypto" "^0.28.1"