|
| 1 | +<table> |
| 2 | + <tr> |
| 3 | + <td class="labkey-form-label">NextFlow Config File Path</td> |
| 4 | + <td><input type="text" name="nextFlowConfigFilePath" size=64></td> |
| 5 | + </tr> |
| 6 | + <tr> |
| 7 | + <td class="labkey-form-label">AWS Account Name</td> |
| 8 | + <td><input type="text" name="name" size=64></td> |
| 9 | + </tr> |
| 10 | + <tr> |
| 11 | + <td class="labkey-form-label">AWS Identity</td> |
| 12 | + <td><input type="text" name="identity" size=64></td> |
| 13 | + </tr> |
| 14 | + <tr> |
| 15 | + <td class="labkey-form-label">AWS S3 Bucket Path</td> |
| 16 | + <td><input type="text" name="s3BucketPath" size=64></td> |
| 17 | + </tr> |
| 18 | + <tr> |
| 19 | + <td class="labkey-form-label">AWS Credential</td> |
| 20 | + <td><input type="password" name="credential" size=64></td> |
| 21 | + </tr> |
| 22 | +</table> |
| 23 | +<button id="submit-button">Submit</button> |
| 24 | +<button id="delete-button">Delete</button> |
| 25 | +<button id="cancel-button">Cancel</button> |
| 26 | + |
| 27 | +<script type="text/javascript" nonce="<%=scriptNonce%>"> |
| 28 | + $(document).ready(function() { |
| 29 | + // load the current configuration on page load |
| 30 | + LABKEY.Ajax.request({ |
| 31 | + url: LABKEY.ActionURL.buildURL('nextflow', 'GetNextFlowConfiguration.api'), |
| 32 | + method: 'GET', |
| 33 | + success: function(response) { |
| 34 | + const parsed = JSON.parse(response.responseText); |
| 35 | + if (parsed.config) { |
| 36 | + const response = parsed.config; |
| 37 | + $('input[name=nextFlowConfigFilePath]').val(response.nextFlowConfigFilePath); |
| 38 | + $('input[name=name]').val(response.accountName); |
| 39 | + $('input[name=identity]').val(response.identity); |
| 40 | + $('input[name=s3BucketPath]').val(response.s3BucketPath); |
| 41 | + $('input[name=credential]').val(response.credential); |
| 42 | + } |
| 43 | + |
| 44 | + }, |
| 45 | + failure: function(response) { |
| 46 | + alert('Failed to load configuration'); |
| 47 | + } |
| 48 | + }); |
| 49 | + |
| 50 | + $('#submit-button').click(function() { |
| 51 | + let data = { |
| 52 | + nextFlowConfigFilePath: $('input[name=nextFlowConfigFilePath]').val(), |
| 53 | + accountName: $('input[name=name]').val(), |
| 54 | + identity: $('input[name=identity]').val(), |
| 55 | + s3BucketPath: $('input[name=s3BucketPath]').val(), |
| 56 | + credential: $('input[name=credential]').val() |
| 57 | + }; |
| 58 | + LABKEY.Ajax.request({ |
| 59 | + url: LABKEY.ActionURL.buildURL('nextflow', 'nextFlowConfiguration.api'), |
| 60 | + method: 'POST', |
| 61 | + params: data, |
| 62 | + success: function(response) { |
| 63 | + window.location = LABKEY.ActionURL.buildURL('project', 'start'); |
| 64 | + }, |
| 65 | + failure: function(response) { |
| 66 | + alert('Failed to save configuration'); |
| 67 | + } |
| 68 | + }); |
| 69 | + }); |
| 70 | + |
| 71 | + $('#delete-button').click(function() { |
| 72 | + LABKEY.Ajax.request({ |
| 73 | + url: LABKEY.ActionURL.buildURL('nextflow', 'DeleteNextFlowConfiguration.api'), |
| 74 | + method: 'POST', |
| 75 | + success: function(response) { |
| 76 | + window.location = LABKEY.ActionURL.buildURL('project', 'start'); |
| 77 | + }, |
| 78 | + failure: function(response) { |
| 79 | + alert('Failed to delete configuration'); |
| 80 | + } |
| 81 | + }); |
| 82 | + }); |
| 83 | + |
| 84 | + $('#cancel-button').click(function() { |
| 85 | + window.location = LABKEY.ActionURL.buildURL('project', 'start'); |
| 86 | + }); |
| 87 | + }); |
| 88 | +</script> |
0 commit comments