airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [1/4] airavata-django-portal git commit: Simple Vue component build setup
Date Thu, 14 Sep 2017 14:21:26 GMT
Repository: airavata-django-portal
Updated Branches:
  refs/heads/master 88e8db3d4 -> 4253233ff


http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/c10a85de/django_airavata/apps/workspace/package.json
----------------------------------------------------------------------
diff --git a/django_airavata/apps/workspace/package.json b/django_airavata/apps/workspace/package.json
new file mode 100644
index 0000000..028d70d
--- /dev/null
+++ b/django_airavata/apps/workspace/package.json
@@ -0,0 +1,27 @@
+{
+  "name": "django-airavata-workspace-views",
+  "description": "A Vue.js project",
+  "version": "1.0.0",
+  "author": "Marcus Christie <machristie@apache.org>",
+  "private": true,
+  "scripts": {
+    "dev": "cross-env NODE_ENV=development webpack --progress --hide-modules",
+    "watch": "cross-env NODE_ENV=development webpack --watch",
+    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
+  },
+  "dependencies": {
+    "vue": "^2.3.3"
+  },
+  "devDependencies": {
+    "babel-core": "^6.0.0",
+    "babel-loader": "^6.0.0",
+    "babel-preset-env": "^1.5.1",
+    "cross-env": "^3.0.0",
+    "css-loader": "^0.25.0",
+    "file-loader": "^0.9.0",
+    "vue-loader": "^12.1.0",
+    "vue-template-compiler": "^2.3.3",
+    "webpack": "^2.6.1",
+    "webpack-dev-server": "^2.4.5"
+  }
+}

http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/c10a85de/django_airavata/apps/workspace/static/django_airavata_workspace/.gitignore
----------------------------------------------------------------------
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/.gitignore b/django_airavata/apps/workspace/static/django_airavata_workspace/.gitignore
new file mode 100644
index 0000000..c795b05
--- /dev/null
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/.gitignore
@@ -0,0 +1 @@
+build
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/c10a85de/django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-project-list.js
----------------------------------------------------------------------
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-project-list.js
b/django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-project-list.js
new file mode 100644
index 0000000..14d61c1
--- /dev/null
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-project-list.js
@@ -0,0 +1,7 @@
+import Vue from 'vue'
+import ProjectList from './views/ProjectList.vue'
+
+new Vue({
+  el: '#app',
+  render: h => h(ProjectList)
+})

http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/c10a85de/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectList.vue
----------------------------------------------------------------------
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectList.vue
b/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectList.vue
new file mode 100644
index 0000000..89d380b
--- /dev/null
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ProjectList.vue
@@ -0,0 +1,26 @@
+<template>
+    <ul id="project-list">
+        <li v-for="project in projects">
+            {{ project.name }}
+        </li>
+    </ul>
+</template>
+
+<script>
+export default {
+  name: 'project-list',
+  data () {
+    return {
+      projects: [
+              {"name": "Project 1"},
+              {"name": "Project 2"},
+              {"name": "Project 3"},
+              {"name": "Project 4"},
+          ]
+      }
+  }
+}
+</script>
+
+<style>
+</style>

http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/c10a85de/django_airavata/apps/workspace/templates/django_airavata_workspace/projects_list.html
----------------------------------------------------------------------
diff --git a/django_airavata/apps/workspace/templates/django_airavata_workspace/projects_list.html
b/django_airavata/apps/workspace/templates/django_airavata_workspace/projects_list.html
index 1d09647..4a52225 100644
--- a/django_airavata/apps/workspace/templates/django_airavata_workspace/projects_list.html
+++ b/django_airavata/apps/workspace/templates/django_airavata_workspace/projects_list.html
@@ -1,28 +1,16 @@
+{% extends 'base.html' %}
 
-{% extends 'base-vue.html' %}
+{% load static %}
 
 {% block content %}
 
 <h1>Projects</h1>
 
-<ul id="projects-list">
-    <li v-for="project in projects">
-        ${ project.name }
-    </li>
-</ul>
+<div id="app"></div>
 
 {% endblock content %}
 
 {% block scripts %}
-{{ block.super }}
 
-<script type="text/javascript">
-    new Vue({
-        delimiters: ['${', '}'],
-        el: '#projects-list',
-        data: {
-            projects: {{ projects_data|safe }}
-        }
-    })
-</script>
+<script src="{% static "django_airavata_workspace/build/main.js" %}"></script>
 {% endblock %}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/c10a85de/django_airavata/apps/workspace/webpack.config.js
----------------------------------------------------------------------
diff --git a/django_airavata/apps/workspace/webpack.config.js b/django_airavata/apps/workspace/webpack.config.js
new file mode 100644
index 0000000..b5e5c1b
--- /dev/null
+++ b/django_airavata/apps/workspace/webpack.config.js
@@ -0,0 +1,70 @@
+var path = require('path')
+var webpack = require('webpack')
+
+module.exports = {
+  entry: './static/django_airavata_workspace/js/entry-project-list.js',
+  output: {
+    path: path.resolve(__dirname, './static/django_airavata_workspace/build/'),
+    publicPath: '/static/django_airavata_workspace/build/',
+    filename: '[name].js'
+  },
+  module: {
+    rules: [
+      {
+        test: /\.vue$/,
+        loader: 'vue-loader',
+        options: {
+          loaders: {
+          }
+          // other vue-loader options go here
+        }
+      },
+      {
+        test: /\.js$/,
+        loader: 'babel-loader',
+        exclude: /node_modules/
+      },
+      {
+        test: /\.(png|jpg|gif|svg)$/,
+        loader: 'file-loader',
+        options: {
+          name: '[name].[ext]?[hash]'
+        }
+      }
+    ]
+  },
+  resolve: {
+    alias: {
+      'vue$': 'vue/dist/vue.esm.js'
+    }
+  },
+  devServer: {
+    historyApiFallback: true,
+    noInfo: true
+  },
+  performance: {
+    hints: false
+  },
+  devtool: '#eval-source-map'
+}
+
+if (process.env.NODE_ENV === 'production') {
+  module.exports.devtool = '#source-map'
+  // http://vue-loader.vuejs.org/en/workflow/production.html
+  module.exports.plugins = (module.exports.plugins || []).concat([
+    new webpack.DefinePlugin({
+      'process.env': {
+        NODE_ENV: '"production"'
+      }
+    }),
+    new webpack.optimize.UglifyJsPlugin({
+      sourceMap: true,
+      compress: {
+        warnings: false
+      }
+    }),
+    new webpack.LoaderOptionsPlugin({
+      minimize: true
+    })
+  ])
+}


Mime
View raw message