Skip to content
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

[JENKINS-35333] New job popup #2388

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 40 additions & 0 deletions core/src/main/resources/hudson/model/View/popup.jelly
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:s="/lib/form">
<div class="remodal new-job-popup" data-remodal-id="newjob" id="add-item-panel">
<form method="post" action="${rootURL}/${it.viewUrl}createItem" name="createItem" id="createItem">
<div class="header">
<div class="add-item-name">
<label for="name">${%ItemName.label}</label>
<input name="name" id="name" type="text" tabindex="0" />
<div class="input-help">&#187; ${%ItemName.help}</div>
<div id="itemname-required" class="input-validation-message input-message-disabled">&#187; ${%ItemName.validation.required}</div>
<div id="itemname-invalid" class="input-validation-message input-message-disabled"></div>
<div id="itemtype-required" class="input-validation-message input-message-disabled">&#187; ${%ItemType.validation.required}</div>
</div>
</div>

<div id="items" class="categories flat" role="radiogroup" aria-labelledby="Items" />

<j:if test="${!empty(app.itemMap)}">
<div class="item-copy">
<p class="description">${%CopyOption.description}:</p>
<div class="add-item-copy">
<input type="radio" name="mode" value="copy" />
<div class="icon">
<img src="${resURL}/images/48x48/copy.png" />
</div>
<label>${%CopyOption.label}</label>
<j:set var="descriptor" value="${it.descriptor}" />
<s:textbox id="from" name="from" placeholder="${%CopyOption.placeholder}" field="copyNewItemFrom"/>
</div>
</div>
</j:if>

<div class="footer">
<div class="btn-decorator">
<button type="submit" id="ok-button">OK</button>
</div>
</div>
</form>
</div>
</j:jelly>
9 changes: 9 additions & 0 deletions core/src/main/resources/hudson/model/View/popup.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
JobName={0} name
ItemName.help=Required field
ItemName.label=Enter an item name
ItemName.validation.required=This field cannot be empty, please enter a valid name
ItemType.validation.required=Please select an item type
CopyOption.placeholder=Type to autocomplete
CopyOption.description=if you want to create a new item from other existing, you can use this option
CopyOption.label=Copy from
CopyExisting=Copy existing {0}
8 changes: 7 additions & 1 deletion core/src/main/resources/hudson/model/View/sidepanel.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,22 @@ THE SOFTWARE.
<link rel="alternate" title="Jenkins:${it.viewName} (all builds) (RSS 2.0)" href="${rootURL}/${it.url}rssAll?flavor=rss20" type="application/rss+xml" />
<link rel="alternate" title="Jenkins:${it.viewName} (failed builds)" href="${rootURL}/${it.url}rssFailed" type="application/rss+xml" />
<link rel="alternate" title="Jenkins:${it.viewName} (failed builds) (RSS 2.0)" href="${rootURL}/${it.url}rssFailed?flavor=rss20" type="application/rss+xml" />

<l:css src="jsbundles/remodal.css" />
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed new styles from style.css and added remodal library styles to remodal.css
Is this correct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think it not correct. Place it to some vendor dir close to less, and try to find how to process this file to jsbundles

Copy link
Author

@samatdav samatdav Jun 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the file to src/main/js/remodal.css and added changes to gulpfile.js to process it to jsbundles. I asked Tom if I placed the file to the right foldr and if changes in gulpfile are valid. He approved it.

<l:js src="jsbundles/add-item.js" />
<l:css src="jsbundles/add-item.css" />
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to add .new-job-popup style to add-item.css
However, every time I rebuild jenkins, all my changes from my file are removed. Could you explain why? It is strange to me since that was not the case with add-item.js

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where exactly you put your code? (full path)
Maybe it combined from different sources as bundle with help of gulp?

Copy link
Author

@samatdav samatdav Jun 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I found it. It is because add-item.css is compiled from add-item.less
add-item.less imports addform.less where I added my rule.

</l:header>
<l:side-panel>
<l:tasks>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you throw away this logic?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, my bad. I missed it. I updated the file so the only change is the href="#modal"

<st:include page="tasks-top.jelly" it="${it.owner}" optional="true" />

<st:include page="tasks-new.jelly" it="${it.owner}" optional="true">
<!-- made overridable for ViewGroup that doesn't allow modifications -->
<l:task href="${rootURL}/${it.viewUrl}newJob" icon="icon-new-package icon-md" it="${app}" permission="${it.itemCreatePermission}" title="${%NewJob(it.newPronoun)}"/>
<l:task href="#newjob" icon="icon-new-package icon-md" it="${app}" permission="${it.itemCreatePermission}" title="${%NewJob(it.newPronoun)}"/>
</st:include>

<st:include page="popup.jelly" optional="true" />

<j:choose>
<j:when test="${it.class.name=='hudson.model.AllView'}">
<l:task href="${rootURL}/asynchPeople/" icon="icon-user icon-md" title="${%People}"/>
Expand Down
1 change: 1 addition & 0 deletions war/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"gulp-less": "^3.1.0"
},
"dependencies": {
"remodal-detached": "^1.0.7-v4",
"bootstrap-detached": "^3.3.5-v1",
"jenkins-js-modules": "^1.5.0",
"jquery-detached": "^2.1.4-v2",
Expand Down
1 change: 1 addition & 0 deletions war/src/main/js/add-item.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Initialize all modules by requiring them. Also makes sure they get bundled (see gulpfile.js).
var $ = require('jquery-detached').getJQuery();
require('remodal-detached').getRemodal();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this required but then not used?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is like a bootstrap library. I do not need to use the rules by myself. But I need predifined rules for the standard behaviour

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok 👍🏻


var getItems = function() {
var d = $.Deferred();
Expand Down
1 change: 1 addition & 0 deletions war/src/main/js/add-item.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
* Widget styles
*/
@import "widgets/config/tabbar";
@import "widgets/add/remodal";
@import "widgets/add/addform";
6 changes: 6 additions & 0 deletions war/src/main/js/widgets/add/addform.less
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,9 @@
}
}
}

.new-job-popup {
max-width: 800px;
padding: 0;
text-align: left;
}