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 2021/09/16 22:56:35 UTC

[airavata-django-portal] branch delta-topology-workshop updated: Check if job is ACTIVE and VNC web page exists before displaying VNC URL

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch delta-topology-workshop
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git


The following commit(s) were added to refs/heads/delta-topology-workshop by this push:
     new 8ede6d9  Check if job is ACTIVE and VNC web page exists before displaying VNC URL
8ede6d9 is described below

commit 8ede6d97941335ce890dd818ac03da4bb5912d51
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu Sep 16 18:55:28 2021 -0400

    Check if job is ACTIVE and VNC web page exists before displaying VNC URL
---
 .../js/components/experiment/ExperimentSummary.vue    | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentSummary.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentSummary.vue
index e3cec7e..525574c 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentSummary.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentSummary.vue
@@ -90,9 +90,9 @@
                     <em>You don't have access to this project.</em>
                   </td>
                 </tr>
-                <tr v-if="localFullExperiment.jobDetails && localFullExperiment.jobDetails.length > 0 && localFullExperiment.jobDetails[0].jobName">
+                <tr v-if="vncURL">
                   <th scope="row">VNC URL</th>
-                  <td><a :href="'/static/vnc/' + encodeURIComponent(localFullExperiment.jobDetails[0].jobName) + '.html'">View VNC</a></td>
+                  <td><a :href="vncURL">View VNC</a></td>
                 </tr>
                 <tr>
                   <th scope="row">Owner</th>
@@ -308,6 +308,7 @@ export default {
   data() {
     return {
       localFullExperiment: this.fullExperiment.clone(),
+      vncURL: null,
     };
   },
   components: {
@@ -468,6 +469,20 @@ export default {
         this.initPollingExperiment();
       }
     },
+    async localFullExperiment() {
+      if (this.localFullExperiment.jobDetails && this.localFullExperiment.jobDetails.length > 0 && this.localFullExperiment.jobDetails[0].jobStatusStateName === 'ACTIVE') {
+        const url = `/static/vnc/${encodeURIComponent(this.localFullExperiment.jobDetails[0].jobName)}.html`;
+        // Check that the html file exists
+        const response = await fetch(url);
+        if (response.ok) {
+          this.vncURL = url;
+        } else {
+          this.vncURL = null;
+        }
+      } else {
+        this.vncURL = null;
+      }
+    }
   },
   mounted: function () {
     this.initPollingExperiment();