Skip to content
Permalink
Browse files
Merge pull request #5 from aarushiibisht/master
Added first version of storage container
  • Loading branch information
smarru committed Apr 12, 2020
2 parents cc5fc40 + eaa9882 commit 6fc12a616ac2387bf59a70f6a7c37ff655f04fe5
Showing 28 changed files with 22,834 additions and 363 deletions.
@@ -2,3 +2,4 @@
venv/
**/__pycache__/
db.sqlite3
dist
@@ -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

```

Large diffs are not rendered by default.

@@ -9,7 +9,8 @@
},
"dependencies": {
"core-js": "^3.6.4",
"vue": "^2.6.11"
"vue": "^2.6.11",
"common": "file:../../static/common"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.3.0",
@@ -18,7 +19,13 @@
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"vue-template-compiler": "^2.6.11"
"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",
"jquery": "^3.5.0"
},
"eslintConfig": {
"root": true,
Binary file not shown.

This file was deleted.

This file was deleted.

Deleted file not rendered

This file was deleted.

This file was deleted.

@@ -0,0 +1,54 @@
<template>
<div id="storage">
<div class="container">
<div class="row">
<div class="col-8">
<h1 class="h4 mb-4">Storage Units</h1>
</div>
<!-- Add buttons here -->
</div>
<table class="table table-hover">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Storage size</th>
<th scope="col">Storage occupied</th>
<th scope="col">Last modified</th>
</tr>
</thead>
<tbody>
<tr v-for="storage in storageList"
:key="storage.storageList">
<th scope="row">{{storage.name}}</th>
<td>{{storage.size}}</td>
<td>
<div class="progress storage-progress" style="width: 20%">
<!-- TODO: storage value should be picked from storage.occupied -->
<div class="progress-bar bg-danger" role="progressbar" style="width: 15%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-success" role="progressbar" style="width: 85%" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</td>
<td>{{storage.lastModified}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</template>

<script>
//TODO: implement pagination
export default {
name: 'storage',
props: ["initialStorageList"],
data: function(){
return {
storageList: this.initialStorageList
}
}
}
</script>

<style>
</style>
@@ -0,0 +1,33 @@
import Vue from 'vue'
import storage from "./containers/Storage"
import { BootstrapVue } from 'bootstrap-vue'

// Install BootstrapVue
Vue.use(BootstrapVue);

import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'

window.onload = function(){

new Vue({
render(h) {
return h(storage, {
props: {
initialStorageList: this.storageList
}
});

},
data() {
return {
storageList: null
};
},
beforeMount() {
if (this.$el.dataset.storageList) {
this.storageList = JSON.parse(this.$el.dataset.storageList);
}
}
}).$mount("#storage");
};
@@ -1,3 +1,13 @@
{% extends "base.html" %}

{% load static %}
{% load render_bundle from webpack_loader %}

{% block scripts %}
{% render_bundle "chunk-vendors" config='WORKSPACE'%}
{% render_bundle "storage" config='WORKSPACE'%}
{% endblock scripts %}
{% block app %}
{% endblock app %}
<div id="storage" data-storage-list="{{ data }}"></div>
{% endblock app %}

@@ -1,7 +1,14 @@
from django.shortcuts import render

import json
# Create your views here.


def storage(request):
return render(request, 'storage.html', {})
# TODO: grpc calls to backend
storage_json = [{"storageId": "ssh-storage1", "name": "ssh-storage1", "size": "15GB", "occupied": "10GB", "lastModified":"26, March 2020"},
{"storageId": "ssh-storage1", "name": "ssh-storage1", "size": "15GB", "occupied": "10GB", "lastModified":"26, March 2020"},
{"storageId": "ssh-storage1", "name": "ssh-storage1", "size": "15GB", "occupied": "10GB", "lastModified":"26, March 2020"},
{"storageId": "ssh-storage1", "name": "ssh-storage1", "size": "15GB", "occupied": "10GB", "lastModified":"26, March 2020"}]

return render(request, 'storage.html', {'data': json.dumps(storage_json)})

@@ -0,0 +1,45 @@
const BundleTracker = require("webpack-bundle-tracker");
const path = require("path");

module.exports = {
publicPath:
process.env.NODE_ENV === "development"
? "http://localhost:9000/static/airavata_mft_workspace/dist/"
: "/static/airavata_mft_workspace/dist/",
outputDir: "./static/airavata_mft_workspace/dist",
productionSourceMap: false,
pages: {
'storage': './static/airavata_mft_workspace/js/entry-view-storage',
},
configureWebpack: {
plugins: [
new BundleTracker({
filename: "webpack-stats.json",
path: "./static/airavata_mft_workspace/dist/"
})
],
},
chainWebpack: config => {
/*
* Specify the eslint config file otherwise it complains of a missing
* config file for the ../api and ../../static/common packages
*
* See: https://github.com/vuejs/vue-cli/issues/2539#issuecomment-422295246
*/
config.module
.rule("eslint")
.use("eslint-loader")
.tap(options => {
options.configFile = path.resolve(__dirname, "package.json");
return options;
});
},
devServer: {
port: 9000,
headers: {
"Access-Control-Allow-Origin": "*"
},
hot: true,
hotOnly: true
}
};
@@ -15,7 +15,6 @@
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

@@ -38,7 +37,8 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'airavata_mft.apps.workspace'
'airavata_mft.apps.workspace',
'webpack_loader',
]

MIDDLEWARE = [
@@ -120,6 +120,33 @@
# https://docs.djangoproject.com/en/3.0/howto/static-files/

STATICFILES_DIRS = [
os.path.join(BASE_DIR, "airavata_mft/static")
os.path.join(BASE_DIR, "airavata_mft", "static"),
os.path.join(BASE_DIR, "airavata_mft", "apps", "workspace", "static")
]
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,
'airavata_mft',
'apps',
'workspace',
'static',
'airavata_mft_workspace',
'dist',
'webpack-stats.json'),
},
}

0 comments on commit 6fc12a6

Please sign in to comment.