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 2019/02/22 17:03:14 UTC

[airavata-django-portal] branch master updated: AIRAVATA-2958 Add share button to experiment views

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3cf220f  AIRAVATA-2958 Add share button to experiment views
3cf220f is described below

commit 3cf220faf66cf8845b07cd509a090c3d9cf59c9e
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Fri Feb 22 12:00:14 2019 -0500

    AIRAVATA-2958 Add share button to experiment views
---
 .../js/components/experiment/ExperimentEditor.vue    | 20 +++++++++++++++++---
 .../js/components/experiment/ExperimentSummary.vue   |  4 +++-
 .../static/common/js/components/ShareButton.vue      |  5 ++++-
 django_airavata/static/common/scss/main.scss         |  6 ++++++
 4 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentEditor.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentEditor.vue
index 8768086..a5a1dd1 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentEditor.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentEditor.vue
@@ -1,7 +1,7 @@
 <template>
   <div>
     <div class="row">
-      <div class="col">
+      <div class="col-auto mr-auto">
         <h1 class="h4 mb-4">
           <div
             v-if="appModule"
@@ -13,6 +13,13 @@
           <slot name="title">Experiment Editor</slot>
         </h1>
       </div>
+      <div class="col-auto">
+        <share-button
+          ref="shareButton"
+          :entity-id="localExperiment.experimentId"
+          :auto-add-default-gateway-users-group="false"
+        />
+      </div>
     </div>
     <b-form novalidate>
       <div class="row">
@@ -139,7 +146,7 @@ import ComputationalResourceSchedulingEditor from "./ComputationalResourceSchedu
 import GroupResourceProfileSelector from "./GroupResourceProfileSelector.vue";
 import InputEditorContainer from "./input-editors/InputEditorContainer.vue";
 import { models, services, utils as apiUtils } from "django-airavata-api";
-import { utils } from "django-airavata-common-ui";
+import { components, utils } from "django-airavata-common-ui";
 
 export default {
   name: "edit-experiment",
@@ -163,7 +170,8 @@ export default {
   components: {
     ComputationalResourceSchedulingEditor,
     GroupResourceProfileSelector,
-    InputEditorContainer
+    InputEditorContainer,
+    "share-button": components.ShareButton
   },
   mounted: function() {
     services.ProjectService.listAll().then(
@@ -217,6 +225,12 @@ export default {
       } else {
         return services.ExperimentService.create({
           data: this.localExperiment
+        }).then(experiment => {
+          // Can't save sharing settings for a new experiment until it has been
+          // created
+          return this.$refs.shareButton
+            .mergeAndSave(experiment.experimentId)
+            .then(() => experiment);
         });
       }
     },
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 4c85160..4ffa668 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
@@ -7,6 +7,7 @@
         </h1>
       </div>
       <div class="col-auto">
+          <share-button :entity-id="experiment.experimentId" />
           <b-link v-if="experiment.isEditable" class="btn btn-primary" :href="editLink">
             Edit
             <i class="fa fa-edit" aria-hidden="true"></i>
@@ -185,7 +186,8 @@ export default {
   },
   components: {
     DataProductViewer,
-    "clipboard-copy-link": components.ClipboardCopyLink
+    "clipboard-copy-link": components.ClipboardCopyLink,
+    "share-button": components.ShareButton
   },
   computed: {
     creationTime: function() {
diff --git a/django_airavata/static/common/js/components/ShareButton.vue b/django_airavata/static/common/js/components/ShareButton.vue
index b4db829..1e890cb 100644
--- a/django_airavata/static/common/js/components/ShareButton.vue
+++ b/django_airavata/static/common/js/components/ShareButton.vue
@@ -1,5 +1,5 @@
 <template>
-  <div class="share-button">
+  <div class="share-button btn-container">
     <b-button :variant="'outline-primary'" :title="title" :disabled="!shareButtonEnabled" @click="openSharingSettingsModal">
       Share
       <b-badge>{{ totalCount }}</b-badge>
@@ -223,6 +223,9 @@ export default {
 button {
   background-color: white;
 }
+.share-button {
+  display: inline-block;
+}
 .share-button >>> .modal-share-settings .modal-body {
   max-height: 50vh;
   min-height: 300px;
diff --git a/django_airavata/static/common/scss/main.scss b/django_airavata/static/common/scss/main.scss
index 26def2c..394cd58 100644
--- a/django_airavata/static/common/scss/main.scss
+++ b/django_airavata/static/common/scss/main.scss
@@ -234,7 +234,13 @@ body {
   opacity: 0;
 }
 
+/**
+ * spacing between buttons. .btn-container is a class applied to a wrapper
+ * around a button that may be a sibling of a .btn or .action-link
+ */
+.btn-container + .btn,
 .btn + .btn,
+.btn-container + .action-link,
 .action-link + .action-link {
   margin-left: .25rem;
 }