openvsx
openvsx copied to clipboard
Added download terms to page settings object, use in detailed overview
Signed-off-by: Martin Lowe [email protected]
Leaving this as a draft as the code is complete, but I need to figure out how to test this properly. Based the code on other typography elements that provide similar functions.
@spoenemann I tried to run a test locally, updating the openvsx-webui package with the lib + src folders from this package in the open-vsx.org repository. When I start the server and load the landing page, I receive this error:
(anonymous) | @ | utils.ts:88 | |
---|---|---|---|
Ec.handleError | @ | main.tsx:120 | |
(anonymous) | @ | extension-list.tsx:93 | |
s | @ | bundle.js:2 |
The source of this error seems to be the chunk that loads in the extensions from the mock-service. Here is the surrounding function for the failure, with the stack pointing in the catch block as the source of the issue.
try {
const result = await this.context.service.search(newFilter);
if (isError(result)) {
throw result;
}
this.props.onUpdate(result.totalSize);
const actualSize = result.extensions.length;
this.pageOffset = this.lastRequestedPage;
const extensionKeys = new Set<string>();
for (const ext of result.extensions) {
extensionKeys.add(`${ext.namespace}.${ext.name}`);
}
this.setState({
extensions: result.extensions,
extensionKeys,
appliedFilter: newFilter,
hasMore: actualSize < result.totalSize && actualSize > 0,
loading: false
});
} catch (err) {
this.context.handleError(err);
this.setState({ loading: false });
}
I'm not sure if this is a case of me hacking in the update badly, or something else. I don't have enough experience with the project to debug, could you or someone else that works on the project lend their expertise?
The trace points to this lne:
https://github.com/eclipse/openvsx/blob/a9154dc61d4aa50b9e6c7fcf60f8c3827aa3047e/webui/src/utils.ts#L88
Maybe it would be a good idea to wrap that console output in a try-catch.
The trace points to this lne:
https://github.com/eclipse/openvsx/blob/a9154dc61d4aa50b9e6c7fcf60f8c3827aa3047e/webui/src/utils.ts#L88
Maybe it would be a good idea to wrap that console output in a try-catch.
When you use console.error, it outputs as an error as if an exception is thrown, isn't it? So this seems to be working as expected. The point of the code was to track the error and give a stack trace in a central way by looks.
Ok, but what is the actual error message here? I haven't found any in your description.
Ok, but what is the actual error message here? I haven't found any in your description.
Apologies! The message is as follows:
utils.ts:88 SyntaxError: Unexpected token < in JSON at position 0
Ok that's probably an error returned by the server, e.g. the server returned an html document, but the frontend tried to parse it as JSON. You should look in the browser network tool to see the actual server message.
Ok that's probably an error returned by the server, e.g. the server returned an html document, but the frontend tried to parse it as JSON. You should look in the browser network tool to see the actual server message.
It seems like the mock service is returning just an empty HTML page, even though it's responding w/ Status 200 OK. The body just contains an empty main div, and otherwise some standard meta tags.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Open VSX Registry</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
<meta property="og:url" content="https://open-vsx.org">
<meta property="og:type" content="website" />
<meta property="og:title" content="Open VSX Registry">
<meta property="og:description" content="Open VSX is a vendor-neutral open-source alternative to the Visual Studio Marketplace. It provides a server application that manages VS Code extensions in a database, a web application similar to the VS Code Marketplace, and a command-line tool for publishing extensions similar to vsce.">
<meta property="og:image" content="https://open-vsx.org/openvsx-preview.png">
<!-- Google Meta Tags -->
<meta itemprop="name" content="Open VSX Registry">
<meta itemprop="description" content="Open VSX is a vendor-neutral open-source alternative to the Visual Studio Marketplace. It provides a server application that manages VS Code extensions in a database, a web application similar to the VS Code Marketplace, and a command-line tool for publishing extensions similar to vsce.">
<meta itemprop="image" content="https://open-vsx.org/openvsx-preview.png">
<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Open VSX Registry">
<meta name="twitter:description" content="Open VSX is a vendor-neutral open-source alternative to the Visual Studio Marketplace. It provides a server application that manages VS Code extensions in a database, a web application similar to the VS Code Marketplace, and a command-line tool for publishing extensions similar to vsce.">
<meta name="twitter:image" content="https://open-vsx.org/openvsx-preview.png">
<link rel="stylesheet" type="text/css"
href="//www.eclipse.org/eclipse.org-common/themes/solstice/public/stylesheets/vendor/cookieconsent/cookieconsent.min.css" />
<script
src="//www.eclipse.org/eclipse.org-common/themes/solstice/public/javascript/vendor/cookieconsent/default.min.js">
</script>
<style>
a.cc-btn.cc-allow {
background-color: #c160ef;
}
a.cc-btn.cc-allow:hover, a.cc-btn.cc-allow:focus {
background-color: #444;
}
.cc-revoke {
display: none !important;
}
</style>
</head>
<body>
<div id="main"></div>
<script src='/bundle.js' ></script>
</body>
</html>
Ok that's because of the dev server configuration: https://github.com/EclipseFdn/open-vsx.org/blob/9e5d75ac5754ee22976bab34f8ae71b1a4b0e1f7/website/dev/server/index.js#L22-L24
The MockRegistryService is supposed to return hard-coded data instead of sending server requests. It does that by overriding methods of its superclass. Maybe it's missing a method or it does not override it properly. What is the request path that causes the error?
Ok that's because of the dev server configuration: https://github.com/EclipseFdn/open-vsx.org/blob/9e5d75ac5754ee22976bab34f8ae71b1a4b0e1f7/website/dev/server/index.js#L22-L24
The MockRegistryService is supposed to return hard-coded data instead of sending server requests. It does that by overriding methods of its superclass. Maybe it's missing a method or it does not override it properly. What is the request path that causes the error?
http://localhost:3000/api/-/search?size=10&sortBy=relevance&sortOrder=desc
The MockRegistryService should override this and return hard-coded data: https://github.com/EclipseFdn/open-vsx.org/blob/9e5d75ac5754ee22976bab34f8ae71b1a4b0e1f7/website/dev/mock-service.ts#L27
I don't know why that isn't happening, setting breakpoints might help.
The MockRegistryService should override this and return hard-coded data: https://github.com/EclipseFdn/open-vsx.org/blob/9e5d75ac5754ee22976bab34f8ae71b1a4b0e1f7/website/dev/mock-service.ts#L27
I don't know why that isn't happening, setting breakpoints might help.
Are you able to reproduce this locally, or do you need me to set some breakpoints? What lines would you like me to add breakpoints to if that is the case?
Sorry, I don't have time to look into this myself at the moment.
Hi @autumnfound,
I've fixed your branch. The download terms are now shown:
When the pull request is done, can you mark it ready for review?
@autumnfound Good add, we need this. Before we merge can we get some help from @chrisguindon and team on the styling of the words?
Code LGTM - Let me know when I can review this on staging!
You can review it on staging: https://staging.open-vsx.org/extension/genuitecllc/codetogether
Fixes #263