-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP Wrap JobProperty in optionalProperty for UI #1656
Conversation
Refers to 3417dc0 where rowSet was set to true. Should allow avoid optionalBlock wrappers in JobProperty implementations.
What is the motivation behind this change? Why not just add the |
@olivergondza because i tired fixing plugins that exposing all job properties into projects and builds. This is also inconsistency for UI, all publishers/builder/wrappers are optional and only JobProperty bundled. |
It's not clear to me how this will improve the situation. Plugin authors can use optional blocks today already, and when they don't, why do you think they'll override a getter they don't need to? |
@daniel-beck it obvious that after |
This is true—if asked at the outset, I would have advised that |
@jglick that's why i'm adding optional field in property descriptor that set by default to the same behaviour as before. |
Alternate suggestion, which I think would require no changes to existing code, only new options: introduce /**
* Job property which may or may not be present.
* Must define {@code config-details.jelly} or {@code config-details.groovy}.
*/
public abstract class OptionalJobProperty<J extends Job<?,?>> extends JobProperty<J> {
@Override
public OptionalJobPropertyDescriptor getDescriptor() {
return (OptionalJobPropertyDescriptor) super.getDescriptor();
}
public static abstract class OptionalJobPropertyDescriptor extends JobPropertyDescriptor {
// constructors…
@Override
public JobProperty<?> newInstance(StaplerRequest req, JSONObject formData) throws FormException {
return formData.optBoolean("specified") ? super.newInstance(req, formData) : null;
}
}
} with an <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form">
<f:block>
<f:optionalBlock title="${descriptor.displayName}" name="specified" checked="${instance != null}" inline="true">
<st:include page="config-details" from="${descriptor}" class="${descriptor.clazz}"/>
</f:optionalBlock>
</f:block>
</j:jelly> |
Closing because of cosmetic 2.0 |
Refers to 3417dc0 where rowSet was set to true.
Should allow avoid optionalBlock wrappers in JobProperty implementations.
Property save doesn't work because DescriptorList binding is not fully simulated. Some jelly magic not fully generated...