Skip to content

Commit

Permalink
Fix npe
Browse files Browse the repository at this point in the history
  • Loading branch information
ia3andy committed May 28, 2024
1 parent 43e01bc commit 309da15
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@ void produceBeans(BuildProducer<AdditionalBeanBuildItem> additionalBeanProducer)
void initHandler(List<NotFoundPageDisplayableEndpointBuildItem> notFoundPageDisplayableEndpoints,
StaticResourcesBuildItem staticResourcesBuildItem,
StatiqRecorder recorder) {

Set<String> staticPaths = new HashSet<>(staticResourcesBuildItem.getPaths());
staticPaths.addAll(notFoundPageDisplayableEndpoints.stream()
.filter(not(NotFoundPageDisplayableEndpointBuildItem::isAbsolutePath))
.map(NotFoundPageDisplayableEndpointBuildItem::getEndpoint)
.toList());
Set<String> staticPaths = new HashSet<>();
if (staticResourcesBuildItem != null) {
staticPaths.addAll(staticResourcesBuildItem.getPaths());
}
if (notFoundPageDisplayableEndpoints != null) {
staticPaths.addAll(notFoundPageDisplayableEndpoints.stream()
.filter(not(NotFoundPageDisplayableEndpointBuildItem::isAbsolutePath))
.map(NotFoundPageDisplayableEndpointBuildItem::getEndpoint)
.toList());
}
recorder.setStatiqPages(staticPaths);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ public class StatiqDevUIProcessor {
CardPageBuildItem create(CurateOutcomeBuildItem bi) {
CardPageBuildItem pageBuildItem = new CardPageBuildItem();
pageBuildItem.addPage(Page.webComponentPageBuilder()
.title("Pages")
.title("Statiq files")
.componentLink("qwc-statiq.js")
.icon("font-awesome-solid:link"));
.icon("font-awesome-solid:link")
.dynamicLabelJsonRPCMethodName("getStatiqCount"));

return pageBuildItem;
}
Expand Down
2 changes: 1 addition & 1 deletion deployment/src/main/resources/dev-ui/qwc-statiq.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class QwcStatiq extends LitElement {
*/
connectedCallback() {
super.connectedCallback();
this.jsonRpc.getPages().then(jsonRpcResponse => {
this.jsonRpc.getStatiqPages().then(jsonRpcResponse => {
this._pages = [];
jsonRpcResponse.result.forEach(c => {
this._pages.push(c);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ public class StatiqJsonRPCService {
StatiqGenerator generator;

@Blocking
public List<StatiqPage> getPages() {
public List<StatiqPage> getStatiqPages() {
return StatiqPages.merge(statiqPages);
}

@Blocking
public int getStatiqCount() {
return getStatiqPages().size();
}

}
18 changes: 12 additions & 6 deletions runtime/src/main/resources/META-INF/quarkus-extension.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
name: Statiq
#description: Do something useful.
description: Generate static websites out of your Quarkus web application.
metadata:
# keywords:
# - statiq
keywords:
- statiq
- website
- static
- generate
- jekyll
- hugo
- web
# guide: https://quarkiverse.github.io/quarkiverse-docs/statiq/dev/ # To create and publish this guide, see https://github.com/quarkiverse/quarkiverse/wiki#documenting-your-extension
# categories:
# - "miscellaneous"
# status: "preview"
categories:
- "web"
status: "preview"

0 comments on commit 309da15

Please sign in to comment.