Skip to content

Commit

Permalink
Use new dialog design
Browse files Browse the repository at this point in the history
  • Loading branch information
zbynek committed Jan 6, 2024
1 parent cf0a900 commit 54e9df2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 48 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<properties>
<changelist>999999-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<jenkins.version>2.387.1</jenkins.version>
<jenkins.version>2.426.1</jenkins.version>
</properties>

<repositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form" xmlns:l="/lib/layout">
<l:ajax>
<div class="hd">
<h2 style="margin-top: 1rem" tooltip="${it.description}">${it.description}: ${it.displayName}</h2>
</div>
<div class="bd">
<h3>${%Add Credentials}</h3>
<form action="${it.url}/addCredentials" method="POST" id="credentials-dialog-form">
<div>
<form action="${it.url}/addCredentials" method="POST" id="credentials-dialog-form" data-title="${it.description}: ${it.displayName}" data-add="${%Add}">
<h3>${%Add Credentials}</h3>
<table width="100%">
<f:entry title="${%Domain}">
<select class="setting-input" name="_.domain">
Expand All @@ -43,10 +40,6 @@
<j:set var="descriptors" value="${it.credentialsDescriptors}"/>
<st:include page="credential"/>
</f:block>
<f:block>
<input id="credentials-add-submit" class="yui-button primary" value="${%Add}"/>
<input id="credentials-add-abort" class="yui-button" value="${%Cancel}"/>
</f:block>
</table>
</form>
</div>
Expand Down
7 changes: 0 additions & 7 deletions src/main/resources/lib/credentials/dialog.js

This file was deleted.

1 change: 0 additions & 1 deletion src/main/resources/lib/credentials/select/select.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
select.credentials-select { width:auto; vertical-align: top; }
div.credentials-select-content-inactive { display:none; }
div#credentialsDialog {overflow-y: scroll;}
body.masked {overflow-y: hidden;}
div.include-user-credentials { padding: 0.2em; }
/* adapted from Jenkins' style.css */
Expand Down
35 changes: 6 additions & 29 deletions src/main/resources/lib/credentials/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,6 @@ window.credentials.init = function () {
document.body.appendChild(div);
div.innerHTML = "<div id='credentialsDialog'><div class='bd'></div></div>";
window.credentials.body = document.getElementById('credentialsDialog');
window.credentials.dialog = new YAHOO.widget.Panel(window.credentials.body, {
fixedcenter: true,
close: true,
draggable: true,
zindex: 1000,
modal: true,
visible: false,
keylisteners: [
new YAHOO.util.KeyListener(document, {keys:27}, {
fn:(function() {window.credentials.dialog.hide();}),
scope:document,
correctScope:false
})
]
});
window.credentials.dialog.render();
}
};
window.credentials.add = function (e) {
Expand All @@ -57,12 +41,11 @@ window.credentials.add = function (e) {
window.credentials.body.innerHTML = responseText;
Behaviour.applySubtree(window.credentials.body, false);
window.credentials.form = document.getElementById('credentials-dialog-form');
// window.credentials.form.action = e;
var r = YAHOO.util.Dom.getClientRegion();
window.credentials.dialog.cfg.setProperty("width", r.width * 3 / 4 + "px");
window.credentials.dialog.cfg.setProperty("height", r.height * 3 / 4 + "px");
window.credentials.dialog.center();
window.credentials.dialog.show();
const data = window.credentials.form.dataset;
const options = {'title': data['title'], 'okText': data['add'], 'submitButton':false, 'minWidth': '75vw'};
dialog.form(window.credentials.form, options)
.then(window.credentials.addSubmit);
window.credentials.form.querySelector('select').focus();
});
}
});
Expand Down Expand Up @@ -109,9 +92,6 @@ window.credentials.refreshAll = function () {
if (window.console != null) {
console.warn("Unable to find nearby " + name);
}
if (window.YUI != null) {
YUI.log("Unable to find a nearby control of the name " + name, "warn")
}
return;
}
deps.push({name: Path.tail(name), control: c});
Expand All @@ -121,7 +101,7 @@ window.credentials.refreshAll = function () {
});
};
window.credentials.addSubmit = function (_) {
const form = document.getElementById('credentials-dialog-form');
const form = window.credentials.form;
buildFormTree(form);
ajaxFormSubmit(form);

Expand All @@ -140,9 +120,6 @@ window.credentials.addSubmit = function (_) {
// notificationBar.show(...) with logging ID could be handy here?
console.error("Could not add credentials:", e);
})
.finally(() => {
window.credentials.dialog.hide();
});
}
};

Expand Down

0 comments on commit 54e9df2

Please sign in to comment.