-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
391 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
deployment/src/main/java/io/quarkiverse/statiq/deployment/devui/StatiqDevUIProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.quarkiverse.statiq.deployment.devui; | ||
|
||
import io.quarkiverse.statiq.runtime.devui.StatiqJsonRPCService; | ||
import io.quarkus.deployment.IsDevelopment; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem; | ||
import io.quarkus.devui.spi.JsonRPCProvidersBuildItem; | ||
import io.quarkus.devui.spi.page.CardPageBuildItem; | ||
import io.quarkus.devui.spi.page.Page; | ||
|
||
public class StatiqDevUIProcessor { | ||
@BuildStep(onlyIf = IsDevelopment.class) | ||
CardPageBuildItem create(CurateOutcomeBuildItem bi) { | ||
CardPageBuildItem pageBuildItem = new CardPageBuildItem(); | ||
pageBuildItem.addPage(Page.webComponentPageBuilder() | ||
.title("Pages") | ||
.componentLink("qwc-statiq.js") | ||
.icon("font-awesome-solid:link")); | ||
|
||
return pageBuildItem; | ||
} | ||
|
||
@BuildStep(onlyIf = IsDevelopment.class) | ||
JsonRPCProvidersBuildItem createJsonRPCServiceForCache() { | ||
return new JsonRPCProvidersBuildItem(StatiqJsonRPCService.class); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import { LitElement, html, css} from 'lit'; | ||
import { JsonRpc } from 'jsonrpc'; | ||
import '@vaadin/icon'; | ||
import '@vaadin/button'; | ||
import '@vaadin/text-field'; | ||
import '@vaadin/text-area'; | ||
import '@vaadin/form-layout'; | ||
import '@vaadin/progress-bar'; | ||
import '@vaadin/checkbox'; | ||
import '@vaadin/grid'; | ||
import { columnBodyRenderer } from '@vaadin/grid/lit.js'; | ||
import '@vaadin/grid/vaadin-grid-sort-column.js'; | ||
|
||
export class QwcStatiq extends LitElement { | ||
|
||
jsonRpc = new JsonRpc(this); | ||
|
||
// Component style | ||
static styles = css` | ||
.button { | ||
background-color: transparent; | ||
cursor: pointer; | ||
} | ||
.clearIcon { | ||
color: orange; | ||
} | ||
`; | ||
|
||
// Component properties | ||
static properties = { | ||
"_pages": {state: true}, | ||
} | ||
|
||
constructor() { | ||
super(); | ||
} | ||
|
||
// Components callbacks | ||
|
||
/** | ||
* Called when displayed | ||
*/ | ||
connectedCallback() { | ||
super.connectedCallback(); | ||
this.jsonRpc.getPages().then(jsonRpcResponse => { | ||
this._pages = []; | ||
jsonRpcResponse.result.forEach(c => { | ||
this._pages.push(c); | ||
}); | ||
}); | ||
} | ||
|
||
/** | ||
* Called when it needs to render the components | ||
* @returns {*} | ||
*/ | ||
render() { | ||
if (this._pages) { | ||
return this._renderTable(); | ||
} else { | ||
return html`<span>Loading pages...</span>`; | ||
} | ||
} | ||
|
||
// View / Templates | ||
|
||
_renderTable() { | ||
return html` | ||
<div class="menubar"> | ||
<a href="/q/statiq/generate" target="_blank"> | ||
<vaadin-button id="start-cnt-testing-btn" theme="tertiary" tabindex="0" role="button"> | ||
<vaadin-icon icon="font-awesome-solid:play"></vaadin-icon> | ||
Generate | ||
</vaadin-button> | ||
</a> | ||
</div> | ||
<vaadin-grid .items="${this._pages}" class="datatable" theme="no-border"> | ||
<vaadin-grid-column auto-width | ||
header="Path" | ||
flex-grow="1" | ||
${columnBodyRenderer(this._pathRenderer, [])}> | ||
</vaadin-grid-column> | ||
<vaadin-grid-column auto-width | ||
header="File" | ||
flex-grow="1" | ||
${columnBodyRenderer(this._fileRenderer, [])}> | ||
</vaadin-grid-column> | ||
<vaadin-grid-column path="type" flex-grow="0" width="12em"></vaadin-grid-column> | ||
<vaadin-grid-column header="Link" | ||
width="6em" | ||
flex-grow="0" | ||
${columnBodyRenderer(this._linkRenderer, [])}> | ||
</vaadin-grid-column> | ||
</vaadin-grid> | ||
`; | ||
} | ||
|
||
_fileRenderer(page) { | ||
return html`${page.outputPath}`; | ||
} | ||
|
||
_pathRenderer(page) { | ||
return html`${page.path}`; | ||
} | ||
|
||
_linkRenderer(page) { | ||
return html`<a href="${page.path}" style="color: white" target="_blank"><vaadin-icon class="linkOut" | ||
icon="font-awesome-solid:up-right-from-square"/></a>`; | ||
} | ||
|
||
|
||
|
||
} | ||
customElements.define('qwc-statiq', QwcStatiq); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 38 additions & 17 deletions
55
integration-tests/src/main/java/io/quarkiverse/statiq/it/StatiqResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,53 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.quarkiverse.statiq.it; | ||
|
||
import java.util.List; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.inject.Singleton; | ||
import jakarta.transaction.Transactional; | ||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.QueryParam; | ||
import jakarta.ws.rs.core.MediaType; | ||
|
||
import io.quarkiverse.statiq.runtime.StatiqPage; | ||
import io.quarkiverse.statiq.runtime.StatiqPages; | ||
|
||
@Path("/statiq") | ||
@ApplicationScoped | ||
public class StatiqResource { | ||
// add some rest methods here | ||
|
||
@GET | ||
public String hello() { | ||
return "Hello statiq"; | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String hello(@QueryParam("name") String name) { | ||
return "Hello " + name; | ||
} | ||
|
||
@Produces | ||
@Singleton | ||
@Transactional | ||
StatiqPages produce() { | ||
return new StatiqPages(List.of( | ||
new StatiqPage("/statiq?name=foo"), | ||
new StatiqPage("/statiq?name=bar"))); | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
integration-tests/src/main/resources/META-INF/resources/assets/vector.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
quarkus.statiq.fixed=/,/static/**,/assets/**,/some-page |
2 changes: 2 additions & 0 deletions
2
integration-tests/src/main/resources/templates/pub/some-page.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<h1>Hello</h1> | ||
<img src="/static/logo.svg" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<h1>Hello</h1> | ||
<img src="assets/vector.svg" /> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.