Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

QuickBuild plugin to add tab and its content #3042

Ariel.C ·
Hello,

i would like to write a QuickBuild plugin which will add a tab to concrete node view (near UserAttributes, Resources, Server Log tabs). I tried to add MainTab for training, but i have some problems with filling it with content. I created MainTab, that works. I created MainPage to add it to constructor of MainTab, but if i add html file it loops up to StackOverflowError.

How can i add content to MainTab?
How can i add a tab to concrete node view and fill it with content? (the main thing i want to do)

MyPlugin.java
new MainTabContribution() {

@SuppressWarnings("unchecked")
@Override
public List<MainTab> getTabs() {
List<MainTab> mainTabs = new ArrayList<MainTab>();

mainTabs.add(new MainTab("MyCustomMainTab", MyMainPage.class));
return mainTabs;
}

@Override
public int getOrder() {

return 500;
}
}


MyMainTab.java - class of my tab
import com.pmease.quickbuild.extensionpoint.support.MainTab;
import com.pmease.quickbuild.web.page.MainPage;

public class MyMainTab extends MainTab{
private static final long serialVersionUID = 1L;

public MyMainTab(String title, Class<? extends MainPage>[] pageClasses) {
super(title, pageClasses);
}
}



MyMainPage.java - page that i would like to load when i click MyMainTab
package com.example.myplugin;

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

import com.pmease.quickbuild.web.page.MainPage;

public class MyMainPage extends MainPage{
private static final long serialVersionUID = 1L;
public MyMainPage() {
super();
add(new Label("message", "Here will be nice content of the page"));
}
}


HTML code of MyMainPage (MyMainPage.html)
<html>
<body>
<span wicket:id="message">Message goes here</span>
</body>
</html>

Cheers
  • replies 13
  • views 5476
  • stars 0
robinshen ADMIN ·
Please modify content of MyMainPage.html as below as the markup should also be extended from the parent markup.

<wicket:extend>
<span wicket:id="message">Message goes here</span>
</wicket:extend>
Ariel.C ·
Ok, great. Thanks.

And what with "How can i add a tab to concrete node view and fill it with content? (the main thing i want to do)"

Is there any extension point or another way to add tab to node view?

Cheers
robinshen ADMIN ·
The extension point "GridTabContribution" can be used to add tabs to node view.
Ariel.C ·
Adding tab to GridPanelContribution resulted with a tab in global "Grid" view. I would like to add a tab to concrete node view. Its in Grid tab -> Active Nodes tab -> Concrete node -> there, near UserAttributes, Resources and Server Log tabs. Its a parameter, specific panel or another contribution point?
robinshen ADMIN ·
There is no extension point for specific node view yet. Please file an improvement request at track.pmease.com.
Ariel.C ·
Oh, hm. Ok.
I have another one question, can i have an access to node through quickbuild plugin?
I mean, for example, i have file data.txt on node and in plugin i would like to read this file.

I tried to get it by gridNode.executeJob, where myNodeJob had to return string, but i get error "cannot deserialize".

This is how i call execute Job
String result= (String) selectedNode.executeJob(MyNodeJob.class, filePathParam);


Code of MyNodeJob
@Override
public Serializable execute(Serializable... params) {
String result = "";
if (params[0] != null && params[0] instanceof String) {
String filePath = (String) params[0];
File file = null;
try {
file = new File(filePath).getCanonicalFile();
} catch (IOException e1) {
e1.printStackTrace();
}
StringBuilder sb = new StringBuilder();

if (file != null) {
FileReader fileReader = null;
BufferedReader bufferedReader = null;
try {
fileReader = new FileReader(file);
bufferedReader = new BufferedReader(fileReader);
String currentLine = "";
while ((currentLine = bufferedReader.readLine()) != null) {
sb.append(currentLine).append(
System.getProperty("line.separator"));
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (bufferedReader != null)
try {
bufferedReader.close();
} catch (IOException e) {
e.printStackTrace();
}
if (fileReader != null)
try {
fileReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
result = sb.toString();
}
return result;
}

What is strange, it works on my local node (on pc with running quickbuild) but not on another nodes (com.pmease.quickbuild.RemotingException: could not deserialize)
robinshen ADMIN ·
Your code seems fine to me, please make sure the plugin also get deployed to the agent running this job. In production mode QB will copy it automatically, however in development mode you may need copy it manually.
Ariel.C ·
Deserialization problem was due to deployment plugin on node, thanks.

But now im facing problem that from local node (quickbuild server node - 8810 port) my result is good, but when i try to read from another node i get empty string. I can't even debug where the fail is. The main thing is that if node job method execute is set to always return "test" string -> returns empty string. Do You have any idea?

Also, on clear version of quickbuild i have such error after connecting a node:
2014-12-12 14:36:17,592 WARN  - handle failed?
org.eclipse.jetty.io.EofException
at org.eclipse.jetty.http.HttpParser.fill(HttpParser.java:1041)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:280)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)
at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at org.eclipse.jetty.io.ByteArrayBuffer.readFrom(ByteArrayBuffer.java:375)
at org.eclipse.jetty.io.bio.StreamEndPoint.fill(StreamEndPoint.java:141)
at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.fill(SocketConnector.java:227)
at org.eclipse.jetty.http.HttpParser.fill(HttpParser.java:1035)
... 7 more
robinshen ADMIN ·
Can you please send me [robin at pmease dot com] the full plugin code? I will run it my at my side to see what might be wrong.
Ariel.C ·
thanks for help, i found that the problem was due to hidden network firewall.

I would like to also (again ^^') ask You, how to link css file to plugin, that will override all other styles.
I tried some ways, but always facing 404 or 500 - could not find asset.

Cheers
robinshen ADMIN ·
Just put your css file in your Java package, and reference it with Wicket css reference resource. For details:
https://cwiki.apache.org/confluence/dis ... +resources
Ariel.C ·
I tried it but it searched by default for file in com.pmease.quickbuild.bootstrap package instead of my package.
I made it by reading css and using response.renderCSS in renderHead override <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->.

1. I would like also to ask for priority order of tabs. In MainTab we can override method which is responsible for it. For gridTab if i override setOrder in my Tab to return super.setOrder(huge_number), nothing happens.

2. Second thing is that i would like to ask about dataTable. I have DataTable with custom DataProvider that cointains list. whenever i change values in list or list in dataProvider - it takes long time for plugin to display it. Is it normal?

Cheers and thanks for continuous help <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
robinshen ADMIN ·
For css issue and datatable issue, can you please send your full plugin code to [robin AT pmease DOT com], and let me know steps to reproduce?

As to order of grid page tab, I guess you want to put your custom tabs at bottom of the page? If so, it is an issue of QB as QB now always put custom tabs at top of the page in regardless of the order, and it will be fixed in QB6.