You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2020/04/12 04:21:36 UTC

[airavata-mft-portal] 15/16: added vue files

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

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

commit eaa98827c90cabca6a4c09b318666f96dbfd0339
Author: Aarushi Bisht <aa...@gmail.com>
AuthorDate: Sat Apr 11 23:56:17 2020 -0400

    added vue files
---
 README.md                                          |  4 ++++
 airavata_mft/apps/workspace/package.json           |  1 +
 airavata_mft/apps/workspace/templates/storage.html |  9 ++++++---
 airavata_mft/settings.py                           | 11 ++++++++++-
 airavata_mft/static/common/js/entry.js             | 19 -------------------
 airavata_mft/static/common/js/index.js             |  7 -------
 airavata_mft/templates/base.html                   | 15 +++++++++++++--
 build_js.sh                                        |  7 +++++++
 8 files changed, 41 insertions(+), 32 deletions(-)

diff --git a/README.md b/README.md
index fb36036..5c8ba10 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,10 @@ Airavata Managed File Transfer is a standalone service to orchestrate data movem
     source venv/bin/activate
     pip install -r requirements.txt
     ```
+2. Build js files
+    ```
+    ./build_js.sh
+    ```
 2.  Run the server
 
     ```
diff --git a/airavata_mft/apps/workspace/package.json b/airavata_mft/apps/workspace/package.json
index fe4f164..c1cea63 100644
--- a/airavata_mft/apps/workspace/package.json
+++ b/airavata_mft/apps/workspace/package.json
@@ -21,6 +21,7 @@
     "eslint-plugin-vue": "^6.2.2",
     "vue-loader": "^15.7.0",
     "vue-template-compiler": "^2.6.11",
+    "webpack": "^4.42.1",
     "webpack-bundle-tracker": "^0.4.3",
     "bootstrap": "^4.3.1",
     "bootstrap-vue": "^2.11.0",
diff --git a/airavata_mft/apps/workspace/templates/storage.html b/airavata_mft/apps/workspace/templates/storage.html
index 77950cf..849447a 100644
--- a/airavata_mft/apps/workspace/templates/storage.html
+++ b/airavata_mft/apps/workspace/templates/storage.html
@@ -1,9 +1,12 @@
-{#{% extends "base.html" %}#}
+{% extends "base.html" %}
 
 {% load static %}
 {% load render_bundle from webpack_loader %}
-{% render_bundle "chunk-vendors" %}
-{% render_bundle "storage" %}
+
+{% block scripts %}
+    {% render_bundle "chunk-vendors" config='WORKSPACE'%}
+    {% render_bundle "storage" config='WORKSPACE'%}
+{% endblock scripts %}
 {% block app %}
     <div id="storage" data-storage-list="{{ data }}"></div>
 {% endblock app %}
diff --git a/airavata_mft/settings.py b/airavata_mft/settings.py
index 1a53e67..12a5616 100644
--- a/airavata_mft/settings.py
+++ b/airavata_mft/settings.py
@@ -14,7 +14,6 @@ import os
 
 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-FRONTEND_DIR = os.path.join(BASE_DIR, 'airavata_mft', 'apps', 'workspace')
 
 # Quick-start development settings - unsuitable for production
 # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
@@ -129,6 +128,16 @@ STATIC_URL = '/static/'
 # Webpack loader
 WEBPACK_LOADER = {
     'DEFAULT': {
+        'BUNDLE_DIR_NAME': 'common/dist/',
+        'STATS_FILE': os.path.join(
+            BASE_DIR,
+            'airavata_mft',
+            'static',
+            'common',
+            'dist',
+            'webpack-stats.json'),
+    },
+    'WORKSPACE': {
         'BUNDLE_DIR_NAME': 'airavata_mft_workspace/dist/',
         'STATS_FILE': os.path.join(
             BASE_DIR,
diff --git a/airavata_mft/static/common/js/entry.js b/airavata_mft/static/common/js/entry.js
deleted file mode 100644
index ee979ea..0000000
--- a/airavata_mft/static/common/js/entry.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import Vue from "vue";
-import BootstrapVue from "bootstrap-vue";
-
-
-import 'bootstrap/dist/css/bootstrap.css'
-import "bootstrap-vue/dist/bootstrap-vue.css";
-
-/**
- * Common entry point function. Sets up common entry point functionality and
- * then calls the passed function with the Vue class as the first argument.
- *
- * @param {Function} entryPointFunction
- */
-export default function entry(entryPointFunction) {
-  // Common Vue configuration
-  Vue.use(BootstrapVue);
-
-  entryPointFunction(Vue);
-}
\ No newline at end of file
diff --git a/airavata_mft/static/common/js/index.js b/airavata_mft/static/common/js/index.js
deleted file mode 100644
index 976033c..0000000
--- a/airavata_mft/static/common/js/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import entry from "./entry";
-
-export default {
-    entry
-};
-
-export {entry};
\ No newline at end of file
diff --git a/airavata_mft/templates/base.html b/airavata_mft/templates/base.html
index 3e8d7c5..80a8fd3 100644
--- a/airavata_mft/templates/base.html
+++ b/airavata_mft/templates/base.html
@@ -1,3 +1,14 @@
+{% load render_bundle from webpack_loader %}
+<!DOCTYPE html>
+<head>
+
+</head>
+{% block scripts %}
+{% endblock scripts %}
+{% render_bundle 'chunk-vendors' config='DEFAULT'%}
+{% render_bundle 'app' config='DEFAULT'%}
+<body>
 <!-- TODO : header and side navigation bar" -->
- {% block app %}
- {% endblock app %}
+{% block app %}
+{% endblock app %}
+</body>
diff --git a/build_js.sh b/build_js.sh
new file mode 100644
index 0000000..a066409
--- /dev/null
+++ b/build_js.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+BASE_DIR=$(pwd)
+echo "Running javascript build"
+(cd airavata_mft/apps/workspace && npm install && npm run build && cd "$BASE_DIR") || exit
+(cd airavata_mft/static/common && npm install && npm run build && cd "$BASE_DIR") || exit
+echo "All builds finished successfully"
\ No newline at end of file