Skip to content

Commit d5b884b

Browse files
author
James Leigh
authored
Merge pull request #808 from jamesrdf/issues/#640-async-workbench
Use async XMLHttpRequests in workbench
2 parents 03e4b2b + 2ff8f7f commit d5b884b

8 files changed

Lines changed: 34 additions & 27 deletions

File tree

core/http/workbench/src/main/java/org/eclipse/rdf4j/workbench/proxy/WorkbenchServlet.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ private void service(final String repoID, final HttpServletRequest req, final Ht
217217
if (repository == null) {
218218
final String noId = config.getInitParameter(NO_REPOSITORY);
219219
if (noId == null || !noId.equals(repoID)) {
220+
resp.setHeader("Cache-Control", "no-cache, no-store");
220221
throw new BadRequestException("No such repository: " + repoID);
221222
}
222223
}

core/http/workbench/src/main/webapp/scripts/create.js

Lines changed: 9 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/http/workbench/src/main/webapp/scripts/create.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/http/workbench/src/main/webapp/scripts/delete.js

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/http/workbench/src/main/webapp/scripts/delete.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/http/workbench/src/main/webapp/scripts/ts/create.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ function checkOverwrite() {
2424
var id = workbench.create.id.val();
2525
$.ajax({
2626
url: '../' + id + '/info',
27-
async: false,
2827
success: function () {
2928
submit = confirm('WARNING: You are about to overwrite the ' +
3029
'configuration of an existing repository!');
@@ -33,15 +32,17 @@ function checkOverwrite() {
3332
500: function () {
3433
submit = true;
3534
}
35+
},
36+
complete : function(xhr, status) {
37+
if (submit && !id.match(/^[a-z0-9._-]+$/)) {
38+
submit = confirm('WARNING: There are potentially incompatible ' +
39+
'characters in the repository id.');
40+
}
41+
if (submit) {
42+
$("form[action='create']").submit();
43+
}
3644
}
3745
});
38-
if (submit && !id.match(/^[a-z0-9._-]+$/)) {
39-
submit = confirm('WARNING: There are potentially incompatible ' +
40-
'characters in the repository id.');
41-
}
42-
if (submit) {
43-
$("form[action='create']").submit();
44-
}
4546
}
4647

4748
workbench.addLoad(function createPageLoaded() {

core/http/workbench/src/main/webapp/scripts/ts/delete.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
* DeleteServlet whether the given ID has been proxied, giving a chance to back
1111
* out if it is.
1212
*/
13-
function checkIsSafeToDelete() {
13+
function checkIsSafeToDelete(event) {
14+
event.preventDefault();
1415
var id = $('#id').val();
1516
var submitForm = false;
16-
var feedback = $('#delete-feedback');
17+
var feedback = $('#delete-feedback');
1718
$
1819
.ajax({
1920
dataType : 'json',
2021
url : 'delete',
21-
async : false,
2222
timeout : 5000,
2323
data : {
2424
checkSafe : id
@@ -36,12 +36,14 @@ function checkIsSafeToDelete() {
3636
}
3737
},
3838
success : function(data) {
39-
feedback.text('');
39+
feedback.text('');
4040
submitForm = data.safe;
4141
if (!submitForm) {
4242
submitForm = confirm('WARNING: You are about to delete a repository that has been proxied by another repository!');
4343
}
44+
if (submitForm) {
45+
$(event.target).closest('form')[0].submit();
46+
}
4447
}
4548
});
46-
return submitForm;
4749
}

core/http/workbench/src/main/webapp/transformations/delete.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<xsl:include href="template.xsl" />
1313

1414
<xsl:template match="sparql:sparql">
15-
<form action="delete" method="post" onsubmit="return checkIsSafeToDelete();">
15+
<form action="delete" method="post" onsubmit="checkIsSafeToDelete(event);">
1616
<table class="dataentry">
1717
<tbody>
1818
<tr>

0 commit comments

Comments
 (0)