Adding a Status Panel

I've followed this post in trying to add a status panel to my Module

However it's a pretty old post and it doesn't seem to work.

I have created all the items outlined in the post and it does compile

I have further more followed the WebPage-Gateway example and added an Abstract Tab in my Hook as follows

private static final INamedTab WEBSOCKET_STATUS_PAGE = new AbstractNamedTab(
	            "websocket",
	            StatusCategories.SYSTEMS,
	            "WebSocketsConnector.nav.status.header") {

	        
					private static final long serialVersionUID = 1L;

			@Override
	        public WebMarkupContainer getPanel(String panelId) {
	         

				return new WebSocketStatusWebMarkupContainer("contents");
	        }

	        @Override
	        public Iterable<String> getSearchTerms(){
	            return Arrays.asList("home connect", "hce");
	        }
	    };

Then I overrode the getStatusPanels()

@Override
	 public List<? extends INamedTab> getStatusPanels() 
	    {
		    return Arrays.asList(WEBSOCKET_STATUS_PAGE);
	    }

This gives me a link in the System Status Menu to my WebSocket status

However clicking on the link yields an error

org.apache.wicket.markup.MarkupException: Unable to find component with id 'child' in [WebMarkupContainer [Component id = contents]] Expected: 'contents.child'. Found with similar names: ''

My guess is that my issue is in my WebSocketMarkupContainer.java I couldn't find any documentation on this, I created this class but it seems that getPanel requires a WebMarkupContainer

package com.jnjdodev.ignition.modules.websocket.web;

import org.apache.wicket.markup.html.WebMarkupContainer;

public class WebSocketStatusWebMarkupContainer extends WebMarkupContainer {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public WebSocketStatusWebMarkupContainer(String id) {
		super(id);
		// TODO Auto-generated constructor stub
		this.add(new WebSocketStatusWebPanel("contents"));
	}

}

All this is doing is instantiating a WebMarkupContainer and then adding my simple "WebSocketStatusWebPanel" to it as a component.

However this yields the above error, am I anywhere in the ballpark here?

I have corrected the error by passing in the id from AbstractNamedTab through WebSocketStatusWebMarkupContainer and through WebSocketStatusWebPanel (as shown below)

Now I get an Empty / Blank page when I click the link, I am expecting to get hello world. See full setup below

WebSocketStatusWebPanel.html

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.sourceforge.net/">
	<body>
		<wicket:panel>
			<div class='homepage-item'>
				<span wicket:id="message">Messages goes here</span>
			</div>
		</wicket:panel>
	</body>
</html>

WebSocketStatusWebPanel.java

package com.jnjdodev.ignition.modules.websocket.web;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;

public class WebSocketStatusWebPanel extends Panel {

	private static final long serialVersionUID = 1L;

	public WebSocketStatusWebPanel(String id) {
		super(id);
		add(new Label("message", "Hello World!"));
	}

}

WebSocketStatusWebMarkupContainer.java

package com.jnjdodev.ignition.modules.websocket.web;

import org.apache.wicket.markup.html.WebMarkupContainer;

public class WebSocketStatusWebMarkupContainer extends WebMarkupContainer {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public WebSocketStatusWebMarkupContainer(String id) {
		super(id);
		// TODO Auto-generated constructor stub
		this.add(new WebSocketStatusWebPanel(id));
	}

}

Hook

private static final INamedTab WEBSOCKET_STATUS_PAGE = new AbstractNamedTab(
	            "websocket",
	            StatusCategories.SYSTEMS,
	            "WebSocketsConnector.nav.status.header") {

	        
					private static final long serialVersionUID = 1L;

			@Override
	        public WebMarkupContainer getPanel(String panelId) {
	            // We've set  GatewayHook.getMountPathAlias() to return hce, so we need to use that alias here.
	            //return new WebSocketStatusWebPanel("WebSocket").getMarkup();
				return new WebSocketStatusWebMarkupContainer(panelId);
	        }

	        @Override
	        public Iterable<String> getSearchTerms(){
	            return Arrays.asList("home connect", "hce");
	        }
	    };

@Override
	 public List<? extends INamedTab> getStatusPanels() 
	    {
		    return Arrays.asList(WEBSOCKET_STATUS_PAGE);
	    }

Again it “works” (as in it doesn’t throw errors, but from my limited understanding I would hope to get “Hello World” from my WebSocketStatusWebPanel

Am I wrong?

Got it to work using a NamedTab instead of an AbstractNamedTab

 NamedTab nt = new  NamedTab("Test", "WebSocketsConnector.nav.status.header", WebSocketStatusWebPanel.class);
		    return Arrays.asList(nt);
1 Like