-
Notifications
You must be signed in to change notification settings - Fork 31
LIMS-1389 - Add upload to ccp4 cloud button #901
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
Merged
ndg63276
merged 4 commits into
pre-release/2025-R2.1
from
improvement/LIMS-1389/add-upload-to-ccp4-cloud-button
Mar 11, 2025
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,6 +97,10 @@ | |
| font-weight: bold; | ||
| } | ||
|
|
||
| .u { | ||
| text-decoration: underline; | ||
| } | ||
|
|
||
| .nowrap { | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
|
|
||
| <div> | ||
| In order to upload to CCP4 cloud, we need your CCP4 Cloud username, and your CloudRun Id.<br /> | ||
| You can find your CloudRun Id on the 'My Account' page of CCP4 Cloud. | ||
| </div> | ||
| <br /> | ||
| <div> | ||
| Once uploaded, create or select a CCP4 Cloud project and select the task 'Import from Cloud Storage'.<br /> | ||
| Click 'Select file(s)', then click 'My Cloud Storage'. | ||
| </div> | ||
| <br /> | ||
| <div> | ||
| See <a class="u" href="https://cloud.ccp4.ac.uk/manuals/html-userguide/jscofe_synchweb.html">here</a> for more information. | ||
| </div> | ||
| <br /> | ||
|
|
||
| <div class="table"> | ||
| <table> | ||
| <tr><td><span class="b">Filename: </span></td><td><%-FILENAME%></td></tr> | ||
| <tr><td><span class="b">CCP4 Cloud Username: </span></td><td><input name="username"></input></td></tr> | ||
| <tr><td><span class="b">CCP4 CloudRun Id: </span></td><td><input name="cloudrunid" placeholder="####-####-####-####"></input></td></tr> | ||
| <tr><td><span class="b">Remember these: </span></td><td><input type="checkbox" name="remember"></input></td></tr> | ||
| </table> | ||
| </div> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| define([ | ||
| 'backbone', | ||
| 'views/dialog', | ||
| 'templates/dc/cloudupload.html', | ||
| 'jquery.cookie' | ||
| ], function( | ||
| Backbone, | ||
| DialogView, | ||
| template | ||
| ) { | ||
|
|
||
| return DialogView.extend({ | ||
| template: template, | ||
| title: 'Upload to CCP4 Cloud', | ||
|
|
||
| buttons: { | ||
| 'Upload': 'upload', | ||
| 'Cancel': 'closeDialog', | ||
| }, | ||
|
|
||
| ui: { | ||
| username: 'input[name=username]', | ||
| cloudrunid: 'input[name=cloudrunid]', | ||
| remember: 'input[name=remember]', | ||
| }, | ||
|
|
||
| upload: function() { | ||
| if (this.ui.remember.is(':checked')) { | ||
| let cookieOpts = { expires: 365, path: '/' } | ||
| $.cookie('ccp4_username', this.ui.username.val(), cookieOpts) | ||
| $.cookie('ccp4_cloudrunid', this.ui.cloudrunid.val(), cookieOpts) | ||
| } | ||
| let data = { cloudrunid: this.ui.cloudrunid.val(), username: this.ui.username.val() } | ||
| if (this.model.get('AUTOPROCPROGRAMATTACHMENTID')) { | ||
| data.AUTOPROCPROGRAMATTACHMENTID = this.model.get('AUTOPROCPROGRAMATTACHMENTID') | ||
| } else if (this.model.get('DATACOLLECTIONFILEATTACHMENTID')) { | ||
| data.DATACOLLECTIONFILEATTACHMENTID = this.model.get('DATACOLLECTIONFILEATTACHMENTID') | ||
| } | ||
| var self = this | ||
| Backbone.ajax({ | ||
| url: app.apiurl+'/processing/upload', | ||
| type: 'POST', | ||
| data: data, | ||
| success: function() { | ||
| app.alert({ className: 'message notify', message: 'File successfully uploaded' }) | ||
| self.closeDialog() | ||
| self.collection.trigger('file:uploaded') | ||
|
|
||
| }, | ||
| error: function(xhr, status, error) { | ||
| app.alert({ message: 'Something went wrong uploading this file: '+xhr.responseText }) | ||
| }, | ||
| }) | ||
| }, | ||
|
|
||
| initialize: function(options) { | ||
| this.collection = options.collection | ||
| }, | ||
|
|
||
| onRender: function() { | ||
| let ccp4_username = $.cookie('ccp4_username'); | ||
| let ccp4_cloudrunid = $.cookie('ccp4_cloudrunid'); | ||
| if (ccp4_username) this.ui.username.val(ccp4_username) | ||
| if (ccp4_cloudrunid) this.ui.cloudrunid.val(ccp4_cloudrunid) | ||
| if (ccp4_username || ccp4_cloudrunid) this.ui.remember.prop('checked', true) | ||
| } | ||
|
|
||
|
|
||
| }) | ||
|
|
||
| }) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use the native cookie management library instead, since jQuery Cookie was removed? I'm happy to do it
https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie