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 2020/09/05 16:41:15 UTC
[airavata-django-portal] branch web-component-input-editors updated
(d9d1c2b -> 62e5d60)
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a change to branch web-component-input-editors
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git.
discard d9d1c2b WIP
new 62e5d60 Initial support for input editor web components (WIP)
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (d9d1c2b)
\
N -- N -- N refs/heads/web-component-input-editors (62e5d60)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
[airavata-django-portal] 01/01: Initial support for input editor
web components (WIP)
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch web-component-input-editors
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
commit 62e5d606e53f61207e094289607c48e747604bc3
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Sat Sep 5 12:41:01 2020 -0400
Initial support for input editor web components (WIP)
---
.../js/models/InputDataObjectType.js | 26 +++++++++++++++++
.../input-editors/InputEditorContainer.vue | 34 +++++++++++++++++++++-
django_airavata/static/common/js/entry.js | 5 ++++
3 files changed, 64 insertions(+), 1 deletion(-)
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/InputDataObjectType.js b/django_airavata/apps/api/static/django_airavata_api/js/models/InputDataObjectType.js
index dcc7537..0d4c523 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/InputDataObjectType.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/InputDataObjectType.js
@@ -84,6 +84,32 @@ export default class InputDataObjectType extends BaseModel {
}
}
+ get editorWebComponentURL() {
+ const metadata = this._getMetadata();
+ if (
+ metadata &&
+ "editor" in metadata &&
+ "web-component" in metadata["editor"]
+ ) {
+ return metadata["editor"]["web-component"]["url"];
+ } else {
+ return null;
+ }
+ }
+
+ get editorWebComponentTagName() {
+ const metadata = this._getMetadata();
+ if (
+ metadata &&
+ "editor" in metadata &&
+ "web-component" in metadata["editor"]
+ ) {
+ return metadata["editor"]["web-component"]["tag-name"];
+ } else {
+ return null;
+ }
+ }
+
/**
* Get the configuration for the editor component, which will be available
* to the editor component for customizing its look and functionality.
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/InputEditorContainer.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/InputEditorContainer.vue
index ecb03b8..c6a0514 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/InputEditorContainer.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/InputEditorContainer.vue
@@ -1,7 +1,7 @@
<template>
<input-editor-form-group :label="experimentInput.name" :label-for="inputEditorComponentId"
:state="validationState" :feedback-messages="validationFeedback" :description="experimentInput.userFriendlyDescription">
- <component :is="inputEditorComponentName"
+ <component v-if="!isWebComponent" :is="inputEditorComponentName"
:id="inputEditorComponentId"
:experiment-input="experimentInput"
:experiment="experiment"
@@ -12,6 +12,17 @@
@input="valueChanged"
@uploadstart="uploadStart"
@uploadend="uploadEnd"/>
+ <component v-else :is="experimentInput.editorWebComponentTagName"
+ :id="inputEditorComponentId"
+ :experiment-input="experimentInput"
+ :experiment="experiment"
+ :read-only="experimentInput.isReadOnly"
+ :value="data"
+ @invalid="recordInvalidInputEditorValue"
+ @valid="recordValidInputEditorValue"
+ @input="webComponentValueChanged"
+ @uploadstart="uploadStart"
+ @uploadend="uploadEnd"/>
</input-editor-form-group>
</template>
@@ -31,6 +42,8 @@ import TextareaInputEditor from './TextareaInputEditor.vue'
import {models} from 'django-airavata-api'
import { mixins, utils } from 'django-airavata-common-ui';
+import Vue from "vue";
+
export default {
name: 'input-editor-container',
mixins: [mixins.VModelMixin],
@@ -60,6 +73,14 @@ export default {
if (!this.show) {
this.handleHidingInput();
}
+ if (this.isWebComponent) {
+ // The web component is packaged assuming that Vue will be accessible in
+ // the global (window) scope
+ if (!window.Vue) {
+ window.Vue = Vue;
+ }
+ import(/* webpackIgnore: true */ this.experimentInput.editorWebComponentURL);
+ }
},
data: function() {
return {
@@ -74,6 +95,9 @@ export default {
computed: {
inputEditorComponentName: function() {
+ if (this.isWebComponent) {
+ return this.experimentInput.editorWebComponentTagName;
+ }
// If input specifices an editor UI component, use that
if (this.experimentInput.editorUIComponentId) {
return this.experimentInput.editorUIComponentId;
@@ -89,6 +113,9 @@ export default {
// Default
return 'string-input-editor';
},
+ isWebComponent() {
+ return this.experimentInput.editorWebComponentURL !== null;
+ },
inputEditorComponentId: function() {
return utils.sanitizeHTMLId(this.experimentInput.name);
},
@@ -115,6 +142,11 @@ export default {
valueChanged: function() {
this.inputHasBegun = true;
},
+ webComponentValueChanged: function(e) {
+ if (e.detail && e.detail.length && e.detail.length > 0) {
+ this.data = e.detail[0];
+ }
+ },
handleHidingInput: function() {
this.oldValue = this.data;
this.data = null;
diff --git a/django_airavata/static/common/js/entry.js b/django_airavata/static/common/js/entry.js
index 6dac815..29d3523 100644
--- a/django_airavata/static/common/js/entry.js
+++ b/django_airavata/static/common/js/entry.js
@@ -18,6 +18,11 @@ import "bootstrap-vue/dist/bootstrap-vue.css";
export default function entry(entryPointFunction) {
// Common Vue configuration
Vue.use(BootstrapVue);
+ Vue.config.ignoredElements = [
+ // Custom input editors that have a tag name starting with "adpf-plugin-"
+ // Vue will ignore and not warn about
+ /^adpf-plugin-/,
+ ]
entryPointFunction(Vue);
}