Skip to content

Commit

Permalink
YDA-5737: add configuration commands with copy to clipboard functiona…
Browse files Browse the repository at this point in the history
…lity
  • Loading branch information
leonidastri committed Jun 12, 2024
1 parent b39b942 commit ac34842
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 14 deletions.
19 changes: 19 additions & 0 deletions user/static/user/js/data_transfer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
$(document).ready(function () {
$('.btn-copy-to-clipboard').on('click', function(event) {
if (this.id == 'button1')
var codeBlockId = "code-block1"
else
var codeBlockId = "code-block2"

const codeContent = document.getElementById(codeBlockId).textContent;

var textArea = document.createElement('textarea');
textArea.textContent = codeContent;
document.body.append(textArea)

textArea.select();
document.execCommand('copy');

textArea.remove();
})
})
70 changes: 56 additions & 14 deletions user/templates/user/data_transfer.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

{% block title %}{{ super() }} ‐ Data Transfer{% endblock %}

{% block scripts %}
<script src="{{ url_for('user_bp.static', filename='js/data_transfer.js') }}"></script>
{% endblock %}

{% block content %}
<h1>Data Transfer</h1>
<div class="container mt-3">
<div class="card">
<div class="card-header">
<!-- Nav tabs -->
Expand All @@ -20,20 +23,59 @@ <h1>Data Transfer</h1>
<div class="card-body">
<!-- Tab panes -->
<div class="tab-content">
<div id="iCommands" class="container tab-pane active"><br>
<p>
Yoda is based on iRODS technology.
The iCommands allows you to interact with the iRODS backend of Yoda directly.
Therefore, it is possible to transfer data to and from Yoda using the iRODS communication protocol.
You need to configure the iCommands to connect to this Yoda environment.
Copy and paste this configuration into your ~/.irods/irods_environment.json configuration file.
</p>
</div>
<div id="Gocommands" class="container tab-pane fade"><br>
<p>Gocommands can read configuration from an YAML file. Create config.yaml file using an editor and type in followings.</p>
</div>
<div id="iCommands" class="container tab-pane active"><br>
<p>
Yoda is based on iRODS technology.
The iCommands allows you to interact with the iRODS backend of Yoda directly.
Therefore, it is possible to transfer data to and from Yoda using the iRODS communication protocol.
You need to configure the iCommands to connect to this Yoda environment.
Copy and paste this configuration into your ~/.irods/irods_environment.json configuration file.
</p>
<div class="card">
<div class="card-body">
<div class="float-md-end">
<button id="button1" type="button" class="btn btn-secondary btn-copy-to-clipboard">
<i class="fa fa-copy"></i> Copy
</button>
<a href="#" class="btn btn-outline-secondary download-configuration-as-json">Download as JSON</a>
</div>
<p class="card-text"><pre><code id="code-block1">{
"irods_host": "{{ config.get('IRODS_ICAT_HOSTNAME') }}",
"irods_port": 1247,
"irods_home": "/{{ config.get('IRODS_DEFAULT_ZONE') }}/home",
"irods_user_name": "{{ g.user }}",
"irods_zone_name": "{{ config.get('IRODS_DEFAULT_ZONE') }}",
"irods_authentication_scheme": "pam",
"irods_encryption_algorithm": "AES-256-CBC",
"irods_encryption_key_size": 32,
"irods_encryption_num_hash_rounds": 16,
"irods_encryption_salt_size": 8,
"irods_client_server_negotiation": "request_server_negotiation",
"irods_client_server_policy": "CS_NEG_REQUIRE"
}</code></pre></p>
</div>
</div>
</div>
<div id="Gocommands" class="container tab-pane fade"><br>
<p>Gocommands can read configuration from an YAML file. Create config.yaml file using an editor and type in followings.</p>
<div class="card">
<div class="card-body">
<div class="float-md-end">
<button id="button2" type="button" class="btn btn-secondary btn-copy-to-clipboard">
<i class="fa fa-copy"></i> Copy
</button>
<a href="#" class="btn btn-outline-secondary download-configuration-as-yaml">Download as YAML</a>
</div>
<p class="card-text"><pre><code id="code-block2">irods_host: "{{ config.get('IRODS_ICAT_HOSTNAME') }}"
irods_port: 1247
irods_user_name: "{{ g.user }}"
irods_zone_name: "iplant"
irods_user_password: "your password"
</code></pre></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock content %}

0 comments on commit ac34842

Please sign in to comment.