-
Notifications
You must be signed in to change notification settings - Fork 490
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
feat!: replace ipfs-http-client with kubo-rpc-client #2079
Comments
I spent Friday (2023-01-13) attempting this, and we will need to upgrade to ESM first. Things need to be more manageable by doing that first. |
|
Currently blocked by ipfs/js-kubo-rpc-client#143 which has a PR out: ipfs/js-kubo-rpc-client#145 |
this work is mostly done on the esm/kubo-rpc-client branch but but failing in a single e2e test when using ipld-explorer-components (when doing the steps of the test manually, webui works as expected, but confirmed not working when running via playwright) |
the ipld-explorer-components code at https://github.com/ipfs/ipld-explorer-components/blob/23cf07da8a78b1d6d9aaa20a8e5a32ef42936ad8/src/bundles/explore.js#L182-L204 is showing undefined for some Trying to debug if ipld-explorer-components is missing a peerDependency callout, or if import is failing because of webui esm importing from the CJS ipld-explorer-components. funny thing is that this is only occurring in playwright tests though, and works perfectly fine with |
confirmed that when running things manually, it's also broken. # terminal 1
ipfs daemon
# terminal 2
npm run test:build && npx http-server ./build/ -c-1 -a 127.0.0.1 -p 3001
# browser:
http://127.0.0.1:3001/#/explore/bafkreicgkmwhdunxgdqwqveecdo3wqmgulb4azm6sfnrtvd7g47mnrixji
at least my repro steps should be easier now. |
fixed locally with a patch, diff --git a/node_modules/ipld-explorer-components/dist/bundles/explore.js b/node_modules/ipld-explorer-components/dist/bundles/explore.js
index 123bc7f..8cbbfd1 100644
--- a/node_modules/ipld-explorer-components/dist/bundles/explore.js
+++ b/node_modules/ipld-explorer-components/dist/bundles/explore.js
@@ -388,6 +394,8 @@ function getIpld() {
function _getIpld() {
_getIpld = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
+ var _ipldEthereum$default;
+
var ipldDeps, _ipldDeps$map, _ipldDeps$map2, ipld, formats, ipldEthereum, ipldJson;
return regeneratorRuntime.wrap(function _callee3$(_context4) {
@@ -405,26 +413,38 @@ function _getIpld() {
/* webpackChunkName: "ipld" */
'ipld-git'), import(
/* webpackChunkName: "ipld" */
- 'ipld-raw'), import(
- /* webpackChunkName: "ipld" */
- 'ipld-ethereum')]);
+ 'ipld-raw')]);
case 2:
ipldDeps = _context4.sent;
// CommonJs exports object is .default when imported ESM style
_ipldDeps$map = ipldDeps.map(function (mod) {
- return mod["default"];
+ var _mod$default;
+
+ var actualModule = (_mod$default = mod["default"]) !== null && _mod$default !== void 0 ? _mod$default : mod;
+
+ if (actualModule.name != null && actualModule.code != null && actualModule.codec == null) {
+ actualModule.codec = actualModule.code;
+ }
+
+ return actualModule;
}), _ipldDeps$map2 = _toArray(_ipldDeps$map), ipld = _ipldDeps$map2[0], formats = _ipldDeps$map2.slice(1); // ipldEthereum is an Object, each key points to a ipld format impl
- ipldEthereum = formats.pop();
- formats.push.apply(formats, _toConsumableArray(Object.values(ipldEthereum))); // ipldJson uses the new format, use the conversion tool
+ _context4.next = 6;
+ return import(
+ /* webpackChunkName: "ipld" */
+ 'ipld-ethereum');
+
+ case 6:
+ ipldEthereum = _context4.sent;
+ formats.push.apply(formats, _toConsumableArray(Object.values((_ipldEthereum$default = ipldEthereum["default"]) !== null && _ipldEthereum$default !== void 0 ? _ipldEthereum$default : ipldEthereum))); // ipldJson uses the new format, use the conversion tool
- _context4.next = 8;
+ _context4.next = 10;
return import(
/* webpackChunkName: "ipld" */
'@ipld/dag-json');
- case 8:
+ case 10:
ipldJson = _context4.sent;
formats.push(convert(ipldJson));
return _context4.abrupt("return", {
@@ -432,7 +452,7 @@ function _getIpld() {
formats: formats
});
- case 11:
+ case 13:
case "end":
return _context4.stop();
}
but display name is still different from explore.ipld.io:webui local changesexplore.ipld.ioFrom debugging this is due to codec numbers being used instead of names at https://github.com/ipfs/ipld-explorer-components/blob/23cf07da8a78b1d6d9aaa20a8e5a32ef42936ad8/src/components/object-info/ObjectInfo.js#L18-L29 working on a patch (and then a PR to ipld-explorer-components) |
Fixed block naming with diff --git a/node_modules/ipld-explorer-components/dist/components/object-info/ObjectInfo.js b/node_modules/ipld-explorer-components/dist/components/object-info/ObjectInfo.js
index c4bcf4e..cd8112e 100644
--- a/node_modules/ipld-explorer-components/dist/components/object-info/ObjectInfo.js
+++ b/node_modules/ipld-explorer-components/dist/components/object-info/ObjectInfo.js
@@ -15,6 +15,7 @@ import { withTranslation } from 'react-i18next';
import { ObjectInspector, chromeLight } from '@tableflip/react-inspector';
import filesize from 'filesize';
import LinksTable from './LinksTable';
+import multicodec from 'multicodec';
var humansize = filesize.partial({
round: 0
});
@@ -77,16 +78,30 @@ var nodeStyles = {
color: '#383838'
}
};
+/**
+ * Support getting the style object for a node type using the codec number by redirecting the number to the name
+ */
+
+var nodeStylesProxy = new Proxy(nodeStyles, {
+ get: function get(target, prop) {
+ if (isNaN(prop)) {
+ return target[prop];
+ }
+
+ console.log("getting codec name from code number for ".concat(prop, ": "), multicodec.getNameFromCode(prop));
+ return target[multicodec.getNameFromCode(prop)];
+ }
+});
export function shortNameForNode(type) {
- var style = nodeStyles[type];
+ var style = nodeStylesProxy[type];
return style && style.shortName || 'DAG';
}
export function nameForNode(type) {
- var style = nodeStyles[type];
+ var style = nodeStylesProxy[type];
return style && style.name || 'DAG Node';
}
export function colorForNode(type) {
- var style = nodeStyles[type];
+ var style = nodeStylesProxy[type];
return style && style.color || '#ea5037';
} // '/a/b' => ['$', '$.a', '$.a.b']
// See: https://github.com/xyc/react-inspector#api |
|
|
* feat!: ipfs-http-client -> kubo-rpc-client fix: error rendering peerId fix: peers table on peerspage fix: statusPage -> advanced -> addresses fix: most e2e tests working with kubo-rpc-client chore: update to go-ipfsv0.18.1 * chore: fix key.gen with patch needed until kubo-rpc-client fix is merged see ipfs/js-kubo-rpc-client#143 see ipfs/js-kubo-rpc-client#145 * fix: use ipld-explorer-components patch temporarily see https://github.com/ipfs/ipfs-webui/issues/2079\#issuecomment-1426219633 see #2079 (comment) must use until ipfs/ipld-explorer-components#356 * chore: fix ipld-explorer-components patch not needed once ipfs/ipld-explorer-components#356 is merged * test: add tests to explore.test.js * tmp: trying to navigate the undocumented world of parsing CIDs * chore: working on getting tests fully tied up * test(e2e): finish updating explore.test.js * chore: lint fixes * chore: remove debugging code * test: test clicking children links on explore page * tmp: fix children explore views * test: e2e explore test traverses children * Update test/e2e/explore.test.js Co-authored-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com> * chore: address PR comments --------- Co-authored-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
## [3.0.0](v2.22.0...v3.0.0) (2023-04-24) CID `bafybeic4gops3d3lyrisqku37uio33nvt6fqxvkxihrwlqsuvf76yln4fm` --- ### ⚠ BREAKING CHANGES * migrate to ESM (#2092) ### Features * ipfs-http-client -> kubo-rpc-client ([#2098](#2098)) ([5e53c79](5e53c79)), closes [#issuecomment-1426219633](https://github.com/ipfs/ipfs-webui/issues/issuecomment-1426219633) [/github.com//issues/2079#issuecomment-1426337490](https://github.com/ipfs//github.com/ipfs/ipfs-webui/issues/2079/issues/issuecomment-1426337490) * migrate to ESM ([#2092](#2092)) ([58a737c](58a737c)) ### Bug Fixes * e2e/explore.test.js succeeds in offline mode ([#2109](#2109)) ([a5e9ac6](a5e9ac6)) * ko language falls back to ko-KR ([#2102](#2102)) ([3369800](3369800)) * semantic release custom notes import ([#2113](#2113)) ([2f9f306](2f9f306)) ### Trivial Changes * add NetworkTraffic.stories.js ([#2094](#2094)) ([7a3bf46](7a3bf46)) * pull new translations ([#2101](#2101)) ([cbabac3](cbabac3)) * pull new translations ([#2104](#2104)) ([4a691a2](4a691a2)) * Pull transifex translations ([#2088](#2088)) ([a5b8a1c](a5b8a1c)) * Pull transifex translations ([#2091](#2091)) ([d209863](d209863)) * Pull transifex translations ([#2099](#2099)) ([1cf2fe7](1cf2fe7)) * Pull transifex translations ([#2111](#2111)) ([57d9b63](57d9b63))
Is your feature request related to a problem? Please describe.
Since js-kubo-rpc-client is now officially released with all interface tests passing, we should use that instead of ipfs-http-client.
Describe the solution you'd like
Describe alternatives you've considered
Discussed elsewhere, please see ipfs/kubo#9125
Additional context
Pre-reqs
Tasks
The text was updated successfully, but these errors were encountered: