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

IPFS nodes healthcheck and API client #618

Closed

Conversation

bludnic
Copy link
Member

@bludnic bludnic commented Apr 27, 2024

No description provided.

Copy link

vercel bot commented Apr 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
adamant-im ❌ Failed (Inspect) Apr 27, 2024 10:22pm

@bludnic
Copy link
Member Author

bludnic commented Apr 27, 2024

import IpfsNodesTableItem from './IpfsNodesTableItem.vue'
import { sortNodesFn } from '@/components/nodes/utils/sortNodesFn'

const className = 'adm-nodes-table'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const className = 'adm-nodes-table'
const className = 'ipfs-nodes-table'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add this selector in <style> block. Leave empty if no styles

Comment on lines +75 to +102
const computedResult = computed(() => {
const baseUrl = new URL(url.value)
const protocol = baseUrl.protocol
const hostname = baseUrl.hostname
const port = baseUrl.port
const result = /^[\d.]+$/.test(hostname)

let nodeName = null
let domain = null

if (!result) {
const regex = /([^.]*)\.(.*)/
const parts = hostname.match(regex)
if (parts !== null) {
nodeName = parts[1]
domain = parts[2]
}
}

return {
protocol,
hostname,
nodeName,
domain,
result,
port
}
})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you convert this part into a hook and reuse it in both components: IpfsNodesTableItem.vue and AdmNodesTableItem.vue?

Example of usage:

const { protocol, hostname, nodeName, domain, result, port } = useNodeUrl(url);

Put the hook in src/components/nodes/hooks

Copy link
Member Author

@bludnic bludnic Apr 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's important not to lose the reactivity of protocol, hostname, etc., after destructuring. You probably need to use toRefs inside the hook.

Comment on lines +5 to +11
/**
* Provides methods for calling the ADAMANT API.
*
* The `ApiClient` instance automatically selects an ADAMANT node to
* send the API-requests to and switches to another node if the current one
* is not available at the moment.
*/
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update JSDoc: ADAMANT API -> IPFS NODE API

@bludnic
Copy link
Member Author

bludnic commented Apr 29, 2024

Added IPFS nodes to adamant-wallets
https://github.com/Adamant-im/adamant-wallets/pull/78/files

You can regenerate the config using the PR branch: npm run wallets:data:generate feat/ipfs-nodes

@RealGoodProgrammer

@bludnic
Copy link
Member Author

bludnic commented May 3, 2024

Duplicates #625

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants