-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Restyle file uploads to fit in with modern forms UI #7452
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intended to truncate the file name? Looks a bit odd to me. So is the missing space between the button and the file to upload.
Maybe we should add a page to the design lib outlining that you should use the jenkins-file-upload
class when accepting file inputs, rather than jenkins-upload or setting-upload 🤔
Good spot, hadn't tried it with a really long file name - just needed to set the width to 100%.
Definitely 👍 |
Would it not be easier / more backwards compatible to apply different rules for |
Actually this calls for a jelly template |
Not opposed (I've previously impersonated a broken record asking for Jelly components instead of changing CSS classes around), but only doing that still wouldn't take care of existing upload fields. |
see https://weekly.ci.jenkins.io/design-library/Conventions/. All new CSS is to be name-spaced and prefixed to prevent clashed with other libraries etc. If we were to modify the default styling then this would be the only component I'm aware of doing it that way and would be inconsistent with everything else. |
I've filed PRs with all plugins that look to be maintained using this search: https://github.com/search?q=org%3Ajenkinsci+input+type%3D%22file%22+NOT+repo%3Ajenkinsci%2Fjenkins&type=code&p=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, left some optional feedback for consideration.
Co-authored-by: Alexander Brandes <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/label ready-for-merge
This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.
Thanks!
Looks like you missed |
Enable structured form submission. | ||
</st:attribute> | ||
<st:attribute name="accept"> | ||
Defines the file types the file input should accept. This string is a comma-separated list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional I guess?
You could just copy unknown tag attrs to the HTML tag. There is some Jelly/Stapler trick to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, use="required"
denotes mandatory.
if can you point to it that could be useful although likely unneeded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could just copy unknown tag attrs to the HTML tag. There is some Jelly/Stapler trick to do that.
Second this as it is important for my use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jenkins/core/src/main/java/hudson/util/jelly/MorphTagLibrary.java
Lines 24 to 32 in 7c18855
* Tags from this namespace ("jelly:hudson.util.jelly.MorphTagLibrary") behaves mostly like literal static tags, | |
* except it interprets two attributes "ATTRIBUTES" and "EXCEPT" in a special way. | |
* | |
* The "ATTRIBUTES" attribute should have a Jelly expression that points to a {@link Map} object, | |
* and the contents of the map are added as attributes of this tag, with the exceptions of entries whose key | |
* values are listed in the "EXCEPT" attribute. | |
* | |
* The "EXCEPT" attribute takes a white-space separated list of attribute names that should be ignored even | |
* if it's in the map. |
jenkins/core/src/main/resources/lib/form/textbox.jelly
Lines 107 to 113 in 7c18855
<m:input xmlns:m="jelly:hudson.util.jelly.MorphTagLibrary" | |
class="jenkins-input ${attrs.checkUrl!=null?'validated':''} ${attrs.autoCompleteUrl!=null?'auto-complete':null} ${attrs.clazz}" | |
name="${name}" | |
value="${value}" | |
type="text" | |
placeholder="${placeholder}" | |
ATTRIBUTES="${attrs}" EXCEPT="field clazz" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @strangelookingnerd what is missing that you need?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm adapting the size (for visual reasons) and add an ID to add a change event in the following <script>
section
https://github.com/jenkinsci/custom-folder-icon-plugin/blob/5f60c7af85f7dfd56caca7e6ce392e70442ab616/src/main/resources/jenkins/plugins/foldericon/CustomFolderIcon/config.jelly#L61-L69
Maybe this is the wrong approach but without the ID my use case breaks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That source file should be st:adjunct
and probably Behaviour.specify
but that is another story.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Styling should be done via classes and not inline css, I added support for an ID because of your plugin but you could also do that via a CSS class anyway
A small PR to update the file upload control so that it fits in with the rest of forms. The button now resembles a standard .jenkins-button rather than the native OS one.
Before
After
Testing done
Go to a page with a file upload control, such as Plugin Manager -> Advanced.
Spot the file upload control.
Upload a file.
File uploads successfully.
Proposed changelog entries
Proposed upgrade guidelines
N/A
Submitter checklist
@Restricted
or have@since TODO
Javadocs, as appropriate.@Deprecated(since = "TODO")
or@Deprecated(forRemoval = true, since = "TODO")
, if applicable.eval
to ease future introduction of Content Security Policy (CSP) directives (see documentation).Desired reviewers
@jenkinsci/sig-ux
Maintainer checklist
Before the changes are marked as
ready-for-merge
:upgrade-guide-needed
label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidate
to be considered (see query).