From 668a5a586b51a9a27fa0bdccf575aa8ad8e44571 Mon Sep 17 00:00:00 2001 From: Phillip Kruger Date: Fri, 6 Sep 2024 10:52:33 +1000 Subject: [PATCH] Add Application links on the welcome page Signed-off-by: Phillip Kruger --- .../main/resources/dev-ui/qwc/qwc-welcome.js | 61 ++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-welcome.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-welcome.js index 74ee266f324e9..42814c4dd7c3c 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-welcome.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-welcome.js @@ -1,10 +1,16 @@ import { LitElement, html, css } from 'lit'; import { devuiState } from 'devui-state'; +import { JsonRpc } from 'jsonrpc'; +import '@vaadin/progress-bar'; +import '@vaadin/grid'; +import { columnBodyRenderer } from '@vaadin/grid/lit.js'; +import '@vaadin/grid/vaadin-grid-sort-column.js'; /** * This component shows the welcome screen */ export class QwcWelcome extends LitElement { + jsonRpc = new JsonRpc("devui-endpoints"); static styles = css` a { color: inherit; } @@ -109,14 +115,20 @@ export class QwcWelcome extends LitElement { } `; - static properties = {}; + static properties = { + _info: {state: true} + }; constructor() { super(); + this._info = null; } connectedCallback() { super.connectedCallback(); + this.jsonRpc.getJsonContent().then(jsonRpcResponse => { + this._info = jsonRpcResponse.result; + }); } render() { @@ -187,6 +199,7 @@ export class QwcWelcome extends LitElement { Static assets: ${devuiState.welcomeData.resourcesDir}/META-INF/resources/ Code: ${devuiState.welcomeData.sourceDir} + ${this._renderEndpoints()}
${this._renderSelectedExtensions()} @@ -202,6 +215,52 @@ export class QwcWelcome extends LitElement {
`; } + _renderEndpoints(){ + if (this._info) { + const typeTemplates = []; + for (const [type, list] of Object.entries(this._info)) { + if(type !== "Additional endpoints") + typeTemplates.push(html`${this._renderType(type,list)}`); + } + return html`${typeTemplates}`; + }else{ + return html` +
+
Fetching information...
+ +
+ `; + } + } + + _renderType(type, items){ + return html`

${type}

+ + + + + + + `; + } + + _uriRenderer(endpoint) { + if (endpoint.uri) { + return html`${endpoint.uri}`; + } + } + + _descriptionRenderer(endpoint) { + if (endpoint.description) { + return html`${endpoint.description}`; + } + } + _renderSelectedExtensions(){ if(devuiState.welcomeData.selectedExtensions){ return html`

Selected extensions