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

Ignore missing URL #1244

Merged
merged 3 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions plugins/gatsby-source-jenkinsplugins/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const getPluginContent = async ({wiki, pluginName, reporter, createNode, createC
id: `${pluginName} <<< JenkinsPluginWiki`,
name: pluginName,
url: url,
baseHref: `${path.dirname(url)}/`,
baseHref: `${url && path.dirname(url)}/`,
Copy link
Member

Choose a reason for hiding this comment

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

won't this output false/?
path.dirname(url || '') would work maybe?

Honestly if there's no url, then there probalby isn't need to generate a wiki object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there probalby isn't need to generate a wiki object

yep, then the error message can be created in UI and we don't need to download it from API. I tried that in a new commit.

Copy link
Member

Choose a reason for hiding this comment

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

I'm going to revert this line, there's no need for it, and it could result in a random false.

internal: {
type: 'JenkinsPluginWiki',
content: content,
Expand All @@ -84,7 +84,9 @@ const getPluginContent = async ({wiki, pluginName, reporter, createNode, createC
}
});
};

if (!wiki.url) {
return null;
}
if (!shouldFetchPluginContent(pluginName)) {
return createWikiNode('text/pluginhtml', wiki.url, '');
}
Expand Down
9 changes: 5 additions & 4 deletions plugins/plugin-site/src/templates/plugin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ const PluginWikiContent = ({wiki}) => {
if (wiki?.childHtmlRehype) {
return <div className="content" dangerouslySetInnerHTML={{__html: wiki.childHtmlRehype.html}} />;
}
if (!wiki) {
return (<div className="content">No documentation found for this plugin.</div>);
}
return (<div className="content">
Documentation for this plugin is here:
{' '}
Expand Down Expand Up @@ -181,21 +184,19 @@ function PluginPage({data: {jenkinsPlugin: plugin, reverseDependencies: reverseD
<h5>Maintainers</h5>
<PluginDevelopers developers={plugin.developers} />
</div>
{shouldShowWikiUrl(plugin.wiki) &&
{shouldShowWikiUrl(plugin.wiki || {}) &&
Copy link
Member

Choose a reason for hiding this comment

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

I'm going to change it so shouldShowWikiUrl takes in a string, and then we can do plugin?.wiki?.url

<div className="sidebarSection">
<h5>Help us improve this page!</h5>
{'This content is served from the '}
<a href={plugin.wiki.url} target="_wiki">Jenkins Wiki Export</a>
{' which is now '}
<a href="https://www.jenkins.io/blog/2021/09/04/wiki-attacked/" rel="noopener noreferrer" target="_blank">permanently offline</a>
{' and before that a '}
<a href="https://groups.google.com/forum/#!msg/jenkinsci-dev/lNmas8aBRrI/eL3u7A6qBwAJ" rel="noopener noreferrer" target="_blank">read-only state</a>
{'. We would love your help in moving plugin documentation to GitHub, see '}
<a href="https://jenkins.io/blog/2019/10/21/plugin-docs-on-github/" rel="noopener noreferrer" target="_blank">the guidelines</a>
{'.'}
</div>
}
{shouldShowGitHubUrl(plugin.wiki) &&
{shouldShowGitHubUrl(plugin.wiki || {}) &&
<div className="sidebarSection">
<h5>Help us improve this page!</h5>
{'To propose a change submit a pull request to '}
Expand Down