You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2023/09/27 18:59:29 UTC
[airavata-cookiecutter-django-app] 07/16: Adding JavaScript SDK sample code
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airavata-cookiecutter-django-app.git
commit 8a72803381850bcabc62f40152fc3bd2db5409a5
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu Jun 3 11:32:56 2021 -0400
Adding JavaScript SDK sample code
---
.../{{cookiecutter.project_slug}}/home.html | 28 ++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/{{cookiecutter.project_slug}}/home.html b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/{{cookiecutter.project_slug}}/home.html
index 523a4e0..0913ce1 100644
--- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/{{cookiecutter.project_slug}}/home.html
+++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/templates/{{cookiecutter.project_slug}}/home.html
@@ -9,3 +9,31 @@
</main>
</div>
{% endblock content %}
+
+{% block scripts %}
+<!-- Load the AiravataAPI JavaScript SDK (optional) -->
+<script src="{% static 'django_airavata_api/dist/airavata-api.js' %}"></script>
+<script>
+ const { models, services, session, utils } = AiravataAPI;
+
+ // Your code here ...
+ // Example code: AiravataAPI JavaScript SDK
+ // Use the JavaScript SDK to make REST API calls. For example, load the most
+ // recent 5 experiments created by the current user:
+ //
+ // services.ExperimentSearchService
+ // .list({limit: 5,
+ // [models.ExperimentSearchFields.USER_NAME.name]: session.Session.username,
+ // })
+ // .then(data => {
+ // const experiments = data.results;
+ // // Do something with the experiments ...
+ // });
+ //
+ // See the Gateways tutorial for more examples:
+ // https://apache-airavata-django-portal.readthedocs.io/en/latest/tutorial/gateways_tutorial/#tutorial-exercise-create-a-custom-django-app
+ // To see what is in the `AiravataAPI` JavaScript library, take a look at
+ // it's index.js file:
+ // https://github.com/apache/airavata-django-portal/blob/master/django_airavata/apps/api/static/django_airavata_api/js/index.js
+</script>
+{% endblock scripts %}