Might be a bit of a newbie question (first time i’v attempting writing a plugin).
I’ve been working on a plugin which is intended to replace the build executors widget to allow us to do some filtering there. I’m now struggling to find how I am meant to be removing the default widget however. The comments on the code in for the ExecutorsWidget suggets using the getWidgets() function to swap in my own (jenkins/core/src/main/java/jenkins/widgets/ExecutorsWidget.java at 5df30de4358ca93db17eb1d80a6b3a6f1c92ffad · jenkinsci/jenkins · GitHub), but calling this on the instance doesn’t seem to show the existing widget, and the list itself seems to be unmodifiable.
I’m currently testing the plugin using mvn hpi:run and it seems to be using jenkins 2.440.3 in this configuration
Any advice where I should be going with this?
Hey Markus
Thanks for your reply - The approach there unfortunately has the same issue i’m running into too (both the plugin widget and default widget being shown), using the same method I was trying.
ah right the way widgets are chosen has changed. There is now a WidgetFactory and there are 3 extensions to show the executors widget on views, computers and computerset.
You would need to remove those factories from the extensionlist
WidgetFactory wf : ExtensionList.lookup(WidgetFactory.class)
wf.removeIf(i -> i instanceof ComputerFactoryImpl || i instanceof ComputerFactoryImpl || i instanceof ViewFactoryImpl || i instanceof ComputerSetFactoryImpl)
The 3 classes are from ExecutorsWidget
Don’t know if that really works though