-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpostgresMigration.html
More file actions
47 lines (45 loc) · 1.59 KB
/
postgresMigration.html
File metadata and controls
47 lines (45 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<div class="col-lg-3">
<div class="lead">
<div><a id="dropIndicesLink" class="labkey-text-link" href="#">Drop Indices</a></div>
<div><a id="addIndicesLink" class="labkey-text-link" href="#">Add Indices</a></div>
</div>
</div>
<script type="text/javascript" nonce="<%=scriptNonce%>">
function indexAction(operation) {
LABKEY.Ajax.request({
url: LABKEY.ActionURL.buildURL('ehr', 'updateEHRIndices'),
method: 'POST',
jsonData: {
operation: operation
},
success: function(response) {
var json = JSON.parse(response.responseText);
if (json.success) {
alert('Success!');
} else {
alert('Failure: ' + (json.message || 'Unknown error'));
}
},
failure: function(response) {
var message = 'Request failed';
try {
var json = JSON.parse(response.responseText);
if (json.exception) {
message = json.exception;
}
} catch (e) {
// ignore parse error
}
alert('Failure: ' + message);
}
});
}
LABKEY.Utils.attachEventHandler('dropIndicesLink', 'click', function(e) {
e.preventDefault();
indexAction('drop');
}, 1);
LABKEY.Utils.attachEventHandler('addIndicesLink', 'click', function(e) {
e.preventDefault();
indexAction('add');
}, 1);
</script>