diff --git a/.gitignore b/.gitignore index 8798cb4..775d7a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,7 @@ .DS_Store -/vue_app/node_modules -/vue_app/dist -/node_server/node_modules -/vue_app/package-lock.json -/node_server/package-lock.json - -/vue_app/tests/e2e/reports/ -selenium-debug.log +/node_modules +/dist +/package-lock.json # local env files .env.local diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 5314d5b..0000000 --- a/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM ubuntu:16.04 -LABEL Name=OSCAR-UI Version=1.0.0 - -RUN apt-get update -y &&\ - apt-get install -y curl &&\ - curl --silent --location https://deb.nodesource.com/setup_8.x |su - && \ - apt-get install -y nodejs build-essential vim mc - -RUN apt-get install -y gettext -COPY vue_app/. /usr/src/vue_app/. -RUN cd /usr/src/vue_app; npm install && npm run build -COPY node_server/. /usr/src/node_server/. -RUN cd /usr/src/node_server; npm install && mkdir static -RUN cp -r /usr/src/vue_app/dist/. /usr/src/node_server/static/. -COPY entrypoint.sh / -RUN ["chmod", "+x", "entrypoint.sh"] -EXPOSE 3000 -CMD ["sh","-c","/entrypoint.sh && cd /usr/src/node_server && npm start"] - - - - - - diff --git a/README.md b/README.md index c9f9303..a8ec413 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,22 @@ -# OSCAR-UI - A UI for the OSCAR framework -[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) +# oscar-ui -## Introduction -OSCAR-UI is a Vue.js-based user interface for the [OSCAR](https://github.com/grycap/oscar) framework. It is intended to be run inside a Kubernetes cluster in order to provide a unified web-based graphical user interface to interact with the [OSCAR Manager](https://o-scar.readthedocs.io/en/latest/intro.html#architecture) and the underlying data-storage back-end (e.g. Minio). +User interface for [OSCAR](https://github.com/grycap/oscar). + +Note: In the src/env.js path there are variables that the web needs to connect with the api, and with the EGI Check-in client. Also to change the values of the MINIO client, go to src/components/services.js + +## Project setup +``` +npm install +``` + +### Compiles and hot-reloads for development +``` +npm run serve +``` + +### Compiles and minifies for production +``` +npm run build +``` -## Licensing -OSCAR-UI is licensed under the Apache License, Version 2.0. See -[LICENSE](https://github.com/grycap/scar/blob/master/LICENSE) for the full -license text. \ No newline at end of file diff --git a/vue_app/babel.config.js b/babel.config.js similarity index 100% rename from vue_app/babel.config.js rename to babel.config.js diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100644 index b9eea1e..0000000 --- a/entrypoint.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh - -# Replace env vars in JavaScript files -echo "Replacing env vars in JS" -for file in /usr/src/node_server/static/js/routes.*.js; -do - echo "Processing $file ..."; - - # Use the existing JS file as template - if [ ! -f $file.tmpl.js ]; then - cp $file $file.tmpl.js - fi - - envsubst '$VUE_APP_BACKEND_HOST' < $file.tmpl.js > $file -done - -for file in /usr/src/node_server/static/js/routes.*.js.map; -do - echo "Processing $file ..."; - - # Use the existing JS file as template - if [ ! -f $file.tmpl.js.map ]; then - cp $file $file.tmpl.js.map - fi - - envsubst '$VUE_APP_BACKEND_HOST' < $file.tmpl.js.map > $file -done - -for file in /usr/src/node_server/static/js/app.*.js; -do - echo "Processing $file ..."; - - # Use the existing JS file as template - if [ ! -f $file.tmpl.js.map ]; then - cp $file $file.tmpl.js.map - fi - - envsubst '$VUE_APP_BACKEND_HOST' < $file.tmpl.js.map > $file -done - -for file in /usr/src/node_server/static/js/app.*.js.map; -do - echo "Processing $file ..."; - - # Use the existing JS file as template - if [ ! -f $file.tmpl.js.map ]; then - cp $file $file.tmpl.js.map - fi - - envsubst '$VUE_APP_BACKEND_HOST' < $file.tmpl.js.map > $file -done - -for file in /usr/src/node_server/routes/index.js; -do - echo "Processing $file ..."; - - # Use the existing JS file as template - if [ ! -f $file.tmpl.js.map ]; then - cp $file $file.tmpl.js.map - fi - - envsubst '\$MINIO_ACCESS_KEY \$MINIO_SECRET_KEY' < $file.tmpl.js.map > $file -done - -echo "Finish" - diff --git a/vue_app/jest.config.js b/jest.config.js similarity index 100% rename from vue_app/jest.config.js rename to jest.config.js diff --git a/node_server/app.js b/node_server/app.js deleted file mode 100644 index ef668c5..0000000 --- a/node_server/app.js +++ /dev/null @@ -1,53 +0,0 @@ -var createError = require('http-errors'); -var express = require('express'); -var path = require('path'); -var cookieParser = require('cookie-parser'); -var logger = require('morgan'); -var Minio = require ('minio'); - - -var indexRouter = require('./routes/index'); -var usersRouter = require('./routes/users'); - -var app = express(); - - - - -// view engine setup -app.use(function(req, res, next) { - res.header("Access-Control-Allow-Origin", "*"); - res.header("Access-Control-Allow-Headers", "*"); - res.header("Access-Control-Allow-Methods", "GET,DELETE,POST,PUT"); - next(); - }); -app.set('views', path.join(__dirname, 'views')); -app.set('view engine', 'jade'); - -app.use(logger('dev')); -app.use(express.json()); -app.use(express.urlencoded({ extended: false })); -app.use(cookieParser()); -// app.use(express.static(path.join(__dirname, 'public'))); -app.use(express.static('static')); - -app.use('/', indexRouter); -app.use('/users', usersRouter); - -// catch 404 and forward to error handler -app.use(function(req, res, next) { - next(createError(404)); -}); - -// error handler -app.use(function(err, req, res, next) { - // set locals, only providing error in development - res.locals.message = err.message; - res.locals.error = req.app.get('env') === 'development' ? err : {}; - - // render the error page - res.status(err.status || 500); - res.render('error'); -}); - -module.exports = app; diff --git a/node_server/bin/www b/node_server/bin/www deleted file mode 100755 index df6aa88..0000000 --- a/node_server/bin/www +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var app = require('../app'); -var debug = require('debug')('test3:server'); -var https = require('https'); -var fs = require ('fs'); -var path = require('path'); -/** - * Get port from environment and store in Express. - */ - -var port = normalizePort(process.env.PORT || '3001'); -app.set('port', port); - -/** - * GET key and certificate for HTTPS Server. - */ - -var privateKey = fs.readFileSync(path.resolve('ssl/localhost.key')); -var certificate = fs.readFileSync(path.resolve('ssl/localhost.cert')) -var credentials = {key: privateKey, cert: certificate}; - -/** - * Create HTTPS server. - */ - -var server = https.createServer(credentials,app); - -/** - * Listen on provided port, on all network interfaces. - */ - -server.listen(port); -server.on('error', onError); -server.on('listening', onListening); - -/** - * Normalize a port into a number, string, or false. - */ - -function normalizePort(val) { - var port = parseInt(val, 10); - - if (isNaN(port)) { - // named pipe - return val; - } - - if (port >= 0) { - // port number - return port; - } - - return false; -} - -/** - * Event listener for HTTP server "error" event. - */ - -function onError(error) { - if (error.syscall !== 'listen') { - throw error; - } - - var bind = typeof port === 'string' - ? 'Pipe ' + port - : 'Port ' + port; - - // handle specific listen errors with friendly messages - switch (error.code) { - case 'EACCES': - console.error(bind + ' requires elevated privileges'); - process.exit(1); - break; - case 'EADDRINUSE': - console.error(bind + ' is already in use'); - process.exit(1); - break; - default: - throw error; - } -} - -/** - * Event listener for HTTP server "listening" event. - */ - -function onListening() { - var addr = server.address(); - var bind = typeof addr === 'string' - ? 'pipe ' + addr - : 'port ' + addr.port; - debug('Listening on ' + bind); -} diff --git a/node_server/package.json b/node_server/package.json deleted file mode 100644 index 4dd618b..0000000 --- a/node_server/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "test3", - "version": "0.0.0", - "private": true, - "scripts": { - "start": "node ./bin/www" - }, - "dependencies": { - "archiver": "^3.0.0", - "aws-sdk": "^2.327.0", - "axios": "^0.18.0", - "cookie-parser": "~1.4.3", - "debug": "~2.6.9", - "download": "^7.1.0", - "express": "~4.16.0", - "fs": "0.0.1-security", - "http-errors": "~1.6.2", - "https": "^1.0.0", - "jade": "~1.11.0", - "minio": "^7.0.1", - "morgan": "~1.9.0", - "multer": "^1.4.0", - "node-zip": "^1.1.1", - "path": "^0.12.7", - "request": "^2.88.0", - "xmlhttprequest": "^1.8.0" - } -} diff --git a/node_server/public/stylesheets/style.css b/node_server/public/stylesheets/style.css deleted file mode 100644 index 9453385..0000000 --- a/node_server/public/stylesheets/style.css +++ /dev/null @@ -1,8 +0,0 @@ -body { - padding: 50px; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; -} - -a { - color: #00B7FF; -} diff --git a/node_server/routes/index.js b/node_server/routes/index.js deleted file mode 100644 index 6473625..0000000 --- a/node_server/routes/index.js +++ /dev/null @@ -1,347 +0,0 @@ -var express = require('express'); -var router = express.Router(); -const axios = require('axios'); -var Minio = require ('minio'); -let multer = require('multer'); -let upload = multer(); -var fs = require ('fs'); -var archiver = require('archiver'); -var path = require('path'); -const download = require('download'); - -var app = express(); - -// /************************OPENFAAS*******************************/ -// /* GET home page. */ - -// router.get('/', function(req, res, next) { -// res.render('index', { title: 'Express' }); -// }); - -// router.post('/chargeurl', function(req, res, next) { - -// var url = req.body["url"] -// download(url).then(data => { -// var filename = url.split("/"); -// fs.writeFileSync(path.join(__dirname,filename[filename.length-1]), data); -// fs.readFile(path.join(__dirname,filename[filename.length-1]), 'utf8', function(err, data) { -// if (err) throw err; -// res.write(data) -// res.end() -// }); -// fs.unlinkSync(path.join(__dirname,'/',filename[filename.length-1]), function(error){ -// if (error){ -// throw error; -// } -// console.log("Delete success") -// }) -// }); -// }); - - -// router.post('/newfaas', (req, res, next) => { -// var params = {name:req.body['service'], -// network:req.body['network'], -// image:req.body['image'], -// // envProcess:req.body['envProcess'], -// script:req.body['script'], -// annotations: req.body['annotations'], -// constraints: req.body['constraints'], -// envVars: req.body['envVars'], -// limits: req.body['limits'], -// labels: req.body['labels'], -// registryAuth: req.body['registryAuth'], -// requests: req.body['requests'], -// secrets: req.body['secrets'] -// } -// console.log(params) -// axios.post( -// req.body['url'], -// {name:req.body['service'], -// network:req.body['network'], -// image:req.body['image'], -// // envProcess:req.body['envProcess'], -// script:req.body['script'], -// annotations: req.body['annotations'], -// constraints: req.body['constraints'], -// envVars: req.body['envVars'], -// limits: req.body['limits'], -// labels: req.body['labels'], -// registryAuth: req.body['registryAuth'], -// requests: req.body['requests'], -// secrets: req.body['secrets'] -// }) -// .then((response) => { -// // handle success -// res.status(200).json(response.data); -// }) -// .catch((error) => { -// var err = error.response.data -// console.log(err) -// res.status(400).json(err) -// }) -// }); - -// router.post('/loadfaas', (req, res, next) => { - -// axios.get(req.body['url']) -// .then((response) => { -// // handle success -// res.status(200).json(response.data); -// }) -// .catch((error) => { -// // handle error -// console.log(error) -// res.status(400).json(error.response) -// }) - -// }); -// router.delete('/deletefaas', (req, res, next) => { -// var funct = req.body['functionName'] -// axios.delete(req.body['url'], {data: {name: funct} }) -// .then((response) => { -// // handle success -// res.status(200).json(response.data); - -// }) -// .catch((error) => { -// //handle error -// res.status(400).json(error.response) -// }) -// }); - -// router.put('/editfaas', (req, res, next) => { - -// axios.put(req.body['url'], -// {name:req.body['service'], -// network:req.body['network'], -// image:req.body['image'], -// // envProcess:req.body['envProcess'], -// script:req.body['script'], -// annotations: req.body['annotations'], -// constraints: req.body['constraints'], -// envVars: req.body['envVars'], -// limits: req.body['limits'], -// labels: req.body['labels'], -// registryAuth: req.body['registryAuth'], -// requests: req.body['requests'], -// secrets: req.body['secrets'] -// }) -// .then((response) => { -// // handle success -// res.status(200).json(response.data); - -// }) -// .catch((error) => { -// // handle error -// res.status(400).json(error) -// }) -// }); - - -/************************MINIO*******************************/ - - -// var minioClient = new Minio.Client({ -// endPoint: '158.42.105.147', -// port: 30300, -// useSSL: false, -// accessKey: "minioooo", -// secretKey: "M2CvXmUjVbm1q5aIVumS" -// }); - -var minioClient = new Minio.Client({ - endPoint: 'play.min.io', - port: 9000, - useSSL: true, - accessKey: 'Q3AM3UQ867SPQQA43P2F', - secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG' -}); -// console.log(minioClient) - - - -// var minioClient = new Minio.Client({ -// endPoint: 'minio-service.minio', -// port: 9000, -// useSSL: false, -// accessKey: "$MINIO_ACCESS_KEY", -// secretKey: "$MINIO_SECRET_KEY" -// }); - -router.post('/listbuckets', (req, res, next) => { - console.log("buckets") - minioClient.listBuckets(function(err, buckets) { - if (err) return console.log(err) - console.log('buckets :', buckets) - }) - // minioClient.listBuckets((err, buckets) => { - // // if (err) return res.status(400).json(err) - // if (err) return res.status(400).json(err) - // res.status(200).json(buckets); - - // }) - }); - -// router.post('/bucketExists', (req, res, next) => { -// minioClient.bucketExists(req.body["name"], function(err, exists) { -// if (err) return res.status(400).json(err) -// res.status(200).json(exists); - -// }) -// }); - -// router.post('/removeFile', (req, res, next) => { -// console.log(req.body["fileName"]) -// console.log(req.body["bucketName"]) - -// var objectList = []; -// objectList = req.body["fileName"] -// console.log(objectList) -// for (var i=0; i < objectList.length; i++) { -// minioClient.removeObject(req.body["bucketName"], objectList[i], function(err, exists) { -// if (err){ -// console.log(err) -// res.status(400).json(err) -// }else{ -// res.status(200).json(exists); -// } - -// }) -// } -// }); - -// router.post('/makeBucket', (req, res, next) => { -// minioClient.makeBucket(req.body["name"], function(err, exists) { -// console.log(exists) -// if (err) return res.status(400).json(err) -// res.status(200).json(exists); - -// }) -// }); - -// router.post('/removeBucket', (req, res, next) => { -// minioClient.removeBucket(req.body["name"], function(err, exists) { - -// if (err) return res.status(400).json(err) -// res.status(200).json(exists); - -// }) -// }); - -// router.post('/listObjects', (req, res, next) => { -// console.log(req.body["name"]) -// let stream= minioClient.listObjects(req.body["name"], '', true) - -// var funct = { -// err : "", -// files: [] -// }; -// var files = []; -// stream.on('data', function(obj) -// { -// funct.files.push(obj); - -// }) -// stream.on('error', function(err) -// { -// funct["err"] = err; -// console.log(err); -// }) -// stream.on('end', function(e) -// { -// res.status(200).json(funct); -// }) - - -// }); - - - -// router.post('/minioUpload', upload.any(), (req, res, next) => { -// var file = req.files; - -// minioClient.putObject(req.body["bucketName"],file[0].originalname,file[0].buffer, function(err, data) { -// if (err){ -// console.log(err) -// res.status(400).json({key: req.body["key"], err : err, name : file[0].originalname}) -// }else{ -// console.log(data) -// res.status(200).json({ -// key: req.body["key"], -// // etag: data.ETag.replace(/[^A-Z0-9]+/ig, ""), -// etag: data, -// name : file[0].originalname -// }); -// } -// }); - - -// }); - -// router.post('/downloadFile', (req, res, next) => { -// console.log(req.body["bucketName"]) -// console.log(req.body["fileName"]) -// console.log(req.body["fileName"].length) -// var data = {}; - -// if(req.body["select"]==1){ -// for (var i=0; i < req.body["fileName"].length; i++) { -// minioClient.getObject(req.body["bucketName"], req.body["fileName"][i], function(error, stream) { -// if(error) { -// console.log(error) -// return res.status(500).send(error); -// } -// console.log('sucess') -// stream.pipe(res) -// }); -// } -// }else{ -// nextFile(0,req,res) -// } - -// }); -// function nextFile(i, req, res){ -// minioClient.fGetObject(req.body["bucketName"], req.body["fileName"][i], path.join(__dirname , '/' ,req.body["fileName"][i]), function(err) { -// if (err) { -// return console.log(err) -// } - -// if(i < req.body["fileName"].length - 1){ -// nextFile(i+1, req, res) -// }else{ -// zipFile(req, res); -// } - -// }) -// } - -// function zipFile(req, res){ -// /*Compress files*/ -// var archive = archiver('zip'); -// archive.on('error', function(err) { -// res.status(500).send({error: err.message}); -// }); -// //on stream closed we can end the request -// archive.on('end', function() { -// console.log('Archive wrote %d bytes', archive.pointer()); -// /*Delete files */ -// for (var i=0; i < req.body["fileName"].length; i++){ -// fs.unlinkSync(path.join(__dirname + '/' + req.body["fileName"][i]), function(error){ -// if (error){ -// throw error; -// } -// console.log("Delete success") -// }) -// } -// download_finish = false -// }); -// archive.pipe(res); -// // add a file -// for (var i=0; i < req.body["fileName"].length; i++){ -// archive.file(path.join(__dirname, req.body["fileName"][i]), { name: req.body["fileName"][i] }); -// } -// archive.finalize(); -// } - -module.exports = router; diff --git a/node_server/routes/users.js b/node_server/routes/users.js deleted file mode 100644 index 623e430..0000000 --- a/node_server/routes/users.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express'); -var router = express.Router(); - -/* GET users listing. */ -router.get('/', function(req, res, next) { - res.send('respond with a resource'); -}); - -module.exports = router; diff --git a/node_server/ssl/localhost.cert b/node_server/ssl/localhost.cert deleted file mode 100644 index 7fa832c..0000000 --- a/node_server/ssl/localhost.cert +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIC+zCCAeOgAwIBAgIJAMIUEkrKmXBNMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNV -BAMMCWxvY2FsaG9zdDAeFw0xODEwMTgyMDIzMzBaFw0yODEwMTUyMDIzMzBaMBQx -EjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBAMEdljr8yKVLv52uIixO2lNbKa5SoakD3BCIufZtaNjpGdrTVOQnp7be3NEC -YT4YJpIWr9jQVuGVUHB0A9tIVoVVnupoSdlsJKOdFJVBAzAoaWP6Sa3sUPgxpiy7 -GFHJdcjdd+UAalA/wJQDm0cy8MGdcXELEI513vUySysYIfqN57GSQw6FWFLAQUwh -msfOkyGTtFTJduBpEG7n+y0NT9cGN1VgU8sm57tJ4p42ozjRcuO4qDr57IR61TqA -apfZXbbiwmF34+9iQaHOXWTTujp9jzlTduWaYUW3wbx5iDyQesumxJNoLsYdJ6xP -woyF/AK/vl5P/yPLntivFsBl8gsCAwEAAaNQME4wHQYDVR0OBBYEFJYZAOlI7TJH -YAJPQjP3WMeG7yfRMB8GA1UdIwQYMBaAFJYZAOlI7TJHYAJPQjP3WMeG7yfRMAwG -A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAE/TOcG47yVX/d3rc3pwbXm1 -T7Mbbw1W6pGZ31nWLBp3PFuBLHZsYfbPz3NrACQ3LjC4eKhIbpkjL74HVRi7G0PN -+GN83qjwiUQJtoAgLv6PZNQn2RqtDytJbfrATTAE4QeyF47nqcrNzKnYW4xx+bvA -Lz8QN+EBuAgoQejhOPy3+Ymc7MUWLUypkbb5agm0pjfIbPD74ErLX/U0mqddNZsY -FH5y6JSgMldZLsYl4ViZ72IWvdMDDZiZYsDfJ38XPjcJoz4nrUmBT/+hlempEiNs -wuuBKK+ciRs2N6v/iVdBjtxOct09VlySQau0+WO92Jhsn0kSoTuI5okmvqBppbg= ------END CERTIFICATE----- diff --git a/node_server/ssl/localhost.key b/node_server/ssl/localhost.key deleted file mode 100644 index 1a25a8d..0000000 --- a/node_server/ssl/localhost.key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEAwR2WOvzIpUu/na4iLE7aU1sprlKhqQPcEIi59m1o2OkZ2tNU -5Centt7c0QJhPhgmkhav2NBW4ZVQcHQD20hWhVWe6mhJ2Wwko50UlUEDMChpY/pJ -rexQ+DGmLLsYUcl1yN135QBqUD/AlAObRzLwwZ1xcQsQjnXe9TJLKxgh+o3nsZJD -DoVYUsBBTCGax86TIZO0VMl24GkQbuf7LQ1P1wY3VWBTyybnu0ninjajONFy47io -OvnshHrVOoBql9ldtuLCYXfj72JBoc5dZNO6On2POVN25ZphRbfBvHmIPJB6y6bE -k2guxh0nrE/CjIX8Ar++Xk//I8ue2K8WwGXyCwIDAQABAoIBADeuIDLBz9hZDtaX -7qJ32dtO3aW1jYb95eWehn/W6/QewaWmaUOfa2v+tgxNc1xD+lsEz47kAyjntFm4 -GaSQJuIq3bcYerKFy8qg795Y8GJiRIDfGX9cM7xcFF2xVEHApIVV1cvhYsXgm9YR -dCQDPAeXLa46UnvA4Jgx+BpkyudCosy6yH7lNRKTwwYCAQj+iGRQv1ZFI4ltaaxN -Sp3a2xbEJCW3jyPLtyCeTIiEAa//uwmnlRzBjfmNRGPbbr26tMJZQlXeDiBWBM3B -t8LmlYEKPb/q45drVy3SbvS9j7WE7vdaEP9kn2xPNgvTzFFnm/tM5QL4XEjmBCP0 -8M1hggECgYEA5sdMZiHgTeHzneiTABgBEJ8dJZ/2bgoVhUh8SWBwWTnPyR8cu4Qc -OjmkuoF7TiEyvxxB9M/N5FGqJ26YLhKMXK3kxNt6guM5fTsXoyO+I90K9/UUEKk+ -Fi+nOqDZkRti5jIiXm3c/WUPghzJ5yVDm8ICqndxjbq0nK8Bbl076NsCgYEA1jiO -15dFLTwBdABtV/2gnt4H9SQuYG4MnocA88MAVmcIHJMZCwJlkj5f1JCxqA8lmP1n -HEY7Ruj2bIjt1kzQVIecKmfapHu8v5TL5VP3IFdhsxd6GGK+EtHetyH1T4c2MLib -6c/YYJ8RFUMWi8eqrPLMrj2cVvK0a5esE3AjipECgYEAi6VjtJWhLl+g1BfNBAyC -cHVn5MGUE+gkN5+yHZCuyz8xXelmsI1zq0QASx9Y5uEt3PkTbDlmxFcqWGwSyCZP -KzHKsdiBnLw0qHPejMhvITJ7lamGd8KBoFk7nz2ACc+Bm/wQUgW26NqDdN9IyYcC -Dzlp9Y8LdpDZA8reWdMvEmsCgYEAgRCQVyoHfqphgb9kIZhodm71QmfrHSQQrE5Q -b4z0HhpzU6v4cZ6fDY5Q9GO89bEyiMtbnThfLGjdVyTkjrG27sbJeu8ZVvJKFO8U -LXX6NV0QOvORFzIerH4PfiySfLjNGGuRXDxidExB4ZqK8ep5VTvvv6bVE7mkpBI8 -lXWBpFECgYBUpI8Kz0igtNmxVA33/RiRys24cZ+p2YQsLpB6RkIAcBKXebHKTlVJ -KxXsf+o5M9L0cz5WFivKU4mY0GUglq5KMv0Uk2qGA9buQzviO6VGD17JQtcQzFVj -4qzpo2zqgYw2k6HHE/IsLpKulvlHumEyA9nri6jqbjjr5u2MKV/abg== ------END RSA PRIVATE KEY----- diff --git a/node_server/views/error.jade b/node_server/views/error.jade deleted file mode 100644 index 51ec12c..0000000 --- a/node_server/views/error.jade +++ /dev/null @@ -1,6 +0,0 @@ -extends layout - -block content - h1= message - h2= error.status - pre #{error.stack} diff --git a/node_server/views/index.jade b/node_server/views/index.jade deleted file mode 100644 index 3d63b9a..0000000 --- a/node_server/views/index.jade +++ /dev/null @@ -1,5 +0,0 @@ -extends layout - -block content - h1= title - p Welcome to #{title} diff --git a/node_server/views/layout.jade b/node_server/views/layout.jade deleted file mode 100644 index 15af079..0000000 --- a/node_server/views/layout.jade +++ /dev/null @@ -1,7 +0,0 @@ -doctype html -html - head - title= title - link(rel='stylesheet', href='/stylesheets/style.css') - body - block content diff --git a/vue_app/package.json b/package.json similarity index 98% rename from vue_app/package.json rename to package.json index c161ece..38e56c5 100644 --- a/vue_app/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "aws-sdk": "^2.307.0", - "axios": "^0.18.0", + "axios": "^0.21.1", "epic-spinners": "^1.0.3", "file-saver": "^2.0.2", "filesize": "^3.6.1", diff --git a/vue_app/public/favicon.ico b/public/favicon.ico similarity index 100% rename from vue_app/public/favicon.ico rename to public/favicon.ico diff --git a/vue_app/public/img/icons/android-chrome-192x192.png b/public/img/icons/android-chrome-192x192.png similarity index 100% rename from vue_app/public/img/icons/android-chrome-192x192.png rename to public/img/icons/android-chrome-192x192.png diff --git a/vue_app/public/img/icons/android-chrome-512x512.png b/public/img/icons/android-chrome-512x512.png similarity index 100% rename from vue_app/public/img/icons/android-chrome-512x512.png rename to public/img/icons/android-chrome-512x512.png diff --git a/vue_app/public/img/icons/apple-touch-icon-120x120.png b/public/img/icons/apple-touch-icon-120x120.png similarity index 100% rename from vue_app/public/img/icons/apple-touch-icon-120x120.png rename to public/img/icons/apple-touch-icon-120x120.png diff --git a/vue_app/public/img/icons/apple-touch-icon-152x152.png b/public/img/icons/apple-touch-icon-152x152.png similarity index 100% rename from vue_app/public/img/icons/apple-touch-icon-152x152.png rename to public/img/icons/apple-touch-icon-152x152.png diff --git a/vue_app/public/img/icons/apple-touch-icon-180x180.png b/public/img/icons/apple-touch-icon-180x180.png similarity index 100% rename from vue_app/public/img/icons/apple-touch-icon-180x180.png rename to public/img/icons/apple-touch-icon-180x180.png diff --git a/vue_app/public/img/icons/apple-touch-icon-60x60.png b/public/img/icons/apple-touch-icon-60x60.png similarity index 100% rename from vue_app/public/img/icons/apple-touch-icon-60x60.png rename to public/img/icons/apple-touch-icon-60x60.png diff --git a/vue_app/public/img/icons/apple-touch-icon-76x76.png b/public/img/icons/apple-touch-icon-76x76.png similarity index 100% rename from vue_app/public/img/icons/apple-touch-icon-76x76.png rename to public/img/icons/apple-touch-icon-76x76.png diff --git a/vue_app/public/img/icons/apple-touch-icon.png b/public/img/icons/apple-touch-icon.png similarity index 100% rename from vue_app/public/img/icons/apple-touch-icon.png rename to public/img/icons/apple-touch-icon.png diff --git a/vue_app/public/img/icons/favicon-16x16.png b/public/img/icons/favicon-16x16.png similarity index 100% rename from vue_app/public/img/icons/favicon-16x16.png rename to public/img/icons/favicon-16x16.png diff --git a/vue_app/public/img/icons/favicon-16x162.png b/public/img/icons/favicon-16x162.png similarity index 100% rename from vue_app/public/img/icons/favicon-16x162.png rename to public/img/icons/favicon-16x162.png diff --git a/vue_app/public/img/icons/favicon-32x32.png b/public/img/icons/favicon-32x32.png similarity index 100% rename from vue_app/public/img/icons/favicon-32x32.png rename to public/img/icons/favicon-32x32.png diff --git a/vue_app/public/img/icons/msapplication-icon-144x144.png b/public/img/icons/msapplication-icon-144x144.png similarity index 100% rename from vue_app/public/img/icons/msapplication-icon-144x144.png rename to public/img/icons/msapplication-icon-144x144.png diff --git a/vue_app/public/img/icons/mstile-150x150.png b/public/img/icons/mstile-150x150.png similarity index 100% rename from vue_app/public/img/icons/mstile-150x150.png rename to public/img/icons/mstile-150x150.png diff --git a/vue_app/public/img/icons/safari-pinned-tab.svg b/public/img/icons/safari-pinned-tab.svg similarity index 100% rename from vue_app/public/img/icons/safari-pinned-tab.svg rename to public/img/icons/safari-pinned-tab.svg diff --git a/vue_app/public/index.html b/public/index.html similarity index 100% rename from vue_app/public/index.html rename to public/index.html diff --git a/vue_app/public/manifest.json b/public/manifest.json similarity index 100% rename from vue_app/public/manifest.json rename to public/manifest.json diff --git a/vue_app/public/robots.txt b/public/robots.txt similarity index 100% rename from vue_app/public/robots.txt rename to public/robots.txt diff --git a/vue_app/public/vendors/jsonviewer/jquery.json-viewer.css b/public/vendors/jsonviewer/jquery.json-viewer.css similarity index 100% rename from vue_app/public/vendors/jsonviewer/jquery.json-viewer.css rename to public/vendors/jsonviewer/jquery.json-viewer.css diff --git a/vue_app/public/vendors/jsonviewer/jquery.json-viewer.js b/public/vendors/jsonviewer/jquery.json-viewer.js similarity index 100% rename from vue_app/public/vendors/jsonviewer/jquery.json-viewer.js rename to public/vendors/jsonviewer/jquery.json-viewer.js diff --git a/vue_app/src/App.vue b/src/App.vue similarity index 100% rename from vue_app/src/App.vue rename to src/App.vue diff --git a/vue_app/src/api/menu.js b/src/api/menu.js similarity index 100% rename from vue_app/src/api/menu.js rename to src/api/menu.js diff --git a/vue_app/src/api/notification.js b/src/api/notification.js similarity index 100% rename from vue_app/src/api/notification.js rename to src/api/notification.js diff --git a/vue_app/src/assets/Minio_Logo_Black.png b/src/assets/Minio_Logo_Black.png similarity index 100% rename from vue_app/src/assets/Minio_Logo_Black.png rename to src/assets/Minio_Logo_Black.png diff --git a/vue_app/src/assets/logo.png b/src/assets/logo.png similarity index 100% rename from vue_app/src/assets/logo.png rename to src/assets/logo.png diff --git a/vue_app/src/assets/logo2.png b/src/assets/logo2.png similarity index 100% rename from vue_app/src/assets/logo2.png rename to src/assets/logo2.png diff --git a/vue_app/src/components/AppDrawer.vue b/src/components/AppDrawer.vue similarity index 99% rename from vue_app/src/components/AppDrawer.vue rename to src/components/AppDrawer.vue index 7ac5452..d28feb5 100644 --- a/vue_app/src/components/AppDrawer.vue +++ b/src/components/AppDrawer.vue @@ -184,8 +184,9 @@ export default { } if (this.drawer2 == true){ this.expand_sto = "expand_less" + window.getApp.$emit('REFRESH_BUCKETS_LIST') }else if (this.drawer2 == false){ - this.expand_sto = "expand_more" + this.expand_sto = "expand_more" } } }, diff --git a/vue_app/src/components/AppToolbar.vue b/src/components/AppToolbar.vue similarity index 100% rename from vue_app/src/components/AppToolbar.vue rename to src/components/AppToolbar.vue diff --git a/src/components/forms/FunctionForm.vue b/src/components/forms/FunctionForm.vue new file mode 100644 index 0000000..6c6382e --- /dev/null +++ b/src/components/forms/FunctionForm.vue @@ -0,0 +1,2119 @@ + + + + + diff --git a/vue_app/src/components/services.js b/src/components/services.js similarity index 82% rename from vue_app/src/components/services.js rename to src/components/services.js index 9d941ab..bbf5636 100644 --- a/vue_app/src/components/services.js +++ b/src/components/services.js @@ -1,10 +1,10 @@ import JSZip from "jszip"; import JSZipUtils from "jszip-utils" -import qs from 'qs' +import env from '../env' export default { data: () => { return { - api: 'http://158.42.105.147:30301', + api: env.api, minioClient: '', username_auth:'', password_auth:'' @@ -23,10 +23,8 @@ export default { var Minio = require('minio') this.minioClient = new Minio.Client({ - // endPoint: minio_endpoint, - endPoint: '158.42.105.147', - port: 30300, - // port: parseInt(minio_port), + endPoint: minio_endpoint, + port: parseInt(minio_port), useSSL: true, accessKey: minio_accessKey, secretKey: minio_secretKey @@ -63,7 +61,7 @@ export default { password: this.password_auth } }).then(function (response) { - callBackHandler(response.data); + callBackHandler(response); }.bind(this)).catch(function (error) { callBackHandler(error); }) @@ -71,7 +69,7 @@ export default { deleteServiceCall(params, callBackHandler) { axios({ method: 'delete', - url: this.api + '/system/services/'+params, + url: this.api+'/system/services/'+params, auth: { username: this.username_auth, password: this.password_auth @@ -93,14 +91,14 @@ export default { } }).then(function (response) { callBackHandler(response.data); - }).catch(function (error) { + }.bind(this)).catch(function (error) { callBackHandler(error); }) }, deleteJobCall(params, callBackHandler) { axios({ method: 'delete', - url: this.api + '/system/logs/'+params.serviceName+'/'+params.jobName, + url: this.api+'/system/logs/'+params.serviceName+'/'+params.jobName, auth: { username: this.username_auth, password: this.password_auth @@ -108,7 +106,7 @@ export default { data:params, }).then(function (response) { callBackHandler(response); - }).catch(function (error) { + }.bind(this)).catch(function (error) { callBackHandler(error); }) }, @@ -121,8 +119,8 @@ export default { password: this.password_auth } }).then(function (response) { - callBackHandler(response.data); - }).catch(function (error) { + callBackHandler(response); + }.bind(this)).catch(function (error) { callBackHandler(error); }) }, @@ -133,13 +131,14 @@ export default { auth: { username: this.username_auth, password: this.password_auth - }, + } }).then(function (response) { callBackHandler(response); - }).catch(function (error) { + }.bind(this)).catch(function (error) { callBackHandler(error); }) - }, + }, + createServiceCall(params, callBackHandler){ axios({ method: 'post', @@ -212,7 +211,7 @@ export default { }, getBucketFilesCall(params, callBackHandler){ - let stream = this.minioClient.listObjects(params.name, params.prefix, true,) + let stream = this.minioClient.listObjectsV2(params.name, params.prefix, true) var funct = { err : "", files: [] @@ -220,7 +219,6 @@ export default { stream.on('data', function(obj) { funct.files.push(obj); - }) stream.on('error', function(err) { @@ -325,7 +323,7 @@ export default { var _this = this // List all object paths in bucket my-bucketname. - var objectsStream = this.minioClient.listObjects(params, '', true) + var objectsStream = this.minioClient.listObjectsV2(params, '', true) objectsStream.on('data', function(obj) { objectsList.push(obj.name); @@ -336,23 +334,43 @@ export default { }) objectsStream.on('end', function() { - - _this.minioClient.removeObjects(params,objectsList, function(e) { - if (e) { - return console.log('Unable to remove Objects ',e) + var files_count = objectsList.length; + if(objectsList.length != 0){ + for (let i = 0; i < objectsList.length; i++) { + _this.minioClient.removeObject(params,objectsList[i], function(e) { + if (e) { + return console.log('Unable to remove Objects ',e) + } + files_count = files_count - 1; + if(files_count == 0){ + _this.minioClient.removeBucket(params, function(err, exists) { + if (err){ + callBackHandler(err) + }else{ + callBackHandler('success'); + } + + }) + } + }) + console.log('Removed the objects successfully') + } + + }else{ + _this.minioClient.removeBucket(params, function(err, exists) { + console.log(err) + if (err){ + callBackHandler(err) + }else{ + callBackHandler('success'); + } + + }) } - _this.minioClient.removeBucket(params, function(err, exists) { - console.log(err) - if (err){ - callBackHandler(err) - }else{ - callBackHandler('success'); - } - - }) - console.log('Removed the objects successfully') - }) + + + }) }, diff --git a/vue_app/src/components/widgets/InputFile.vue b/src/components/widgets/InputFile.vue similarity index 100% rename from vue_app/src/components/widgets/InputFile.vue rename to src/components/widgets/InputFile.vue diff --git a/vue_app/src/components/widgets/list/NotificationList.vue b/src/components/widgets/list/NotificationList.vue similarity index 100% rename from vue_app/src/components/widgets/list/NotificationList.vue rename to src/components/widgets/list/NotificationList.vue diff --git a/src/env.js b/src/env.js new file mode 100644 index 0000000..075b2a2 --- /dev/null +++ b/src/env.js @@ -0,0 +1,8 @@ +module.exports = { + "provider_url": "https://aai-dev.egi.eu", + "client_id": "10333f08-7e8f-4cc4-bba0-e66f4e5505d0", + "redirect_uri" : "http://localhost:8080/callback.html", + "url_authorize": "https://aai-dev.egi.eu/oidc/authorize", + "url_user_info": "https://aai-dev.egi.eu/oidc/userinfo", + "api" : "http://localhost", // value of the api +} diff --git a/vue_app/src/event.js b/src/event.js similarity index 100% rename from vue_app/src/event.js rename to src/event.js diff --git a/vue_app/src/img/OpenFaaS.png b/src/img/OpenFaaS.png similarity index 100% rename from vue_app/src/img/OpenFaaS.png rename to src/img/OpenFaaS.png diff --git a/vue_app/src/img/amazon-s3.png b/src/img/amazon-s3.png similarity index 100% rename from vue_app/src/img/amazon-s3.png rename to src/img/amazon-s3.png diff --git a/vue_app/src/img/logo_one_data.jpg b/src/img/logo_one_data.jpg similarity index 100% rename from vue_app/src/img/logo_one_data.jpg rename to src/img/logo_one_data.jpg diff --git a/vue_app/src/img/minio-storage.png b/src/img/minio-storage.png similarity index 100% rename from vue_app/src/img/minio-storage.png rename to src/img/minio-storage.png diff --git a/vue_app/src/img/minio.png b/src/img/minio.png similarity index 100% rename from vue_app/src/img/minio.png rename to src/img/minio.png diff --git a/vue_app/src/main.js b/src/main.js similarity index 82% rename from vue_app/src/main.js rename to src/main.js index bc0252a..dbdb0e2 100644 --- a/vue_app/src/main.js +++ b/src/main.js @@ -3,6 +3,7 @@ import './plugins/vuetify' import App from './App.vue' import router from './router/index' import './registerServiceWorker' +import env from './env.js' // import VueMaterial from 'vue-material' // import 'vue-material/dist/vue-material.min.css' @@ -12,6 +13,14 @@ Vue.config.productionTip = false window.axios = require('axios'); window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; +Vue.mixin({ + data: function(){ + return { + env:env, + } + } +}) + new Vue({ router, render: h => h(App) diff --git a/vue_app/src/plugins/vuetify.js b/src/plugins/vuetify.js similarity index 100% rename from vue_app/src/plugins/vuetify.js rename to src/plugins/vuetify.js diff --git a/vue_app/src/registerServiceWorker.js b/src/registerServiceWorker.js similarity index 100% rename from vue_app/src/registerServiceWorker.js rename to src/registerServiceWorker.js diff --git a/vue_app/src/router/index.js b/src/router/index.js similarity index 100% rename from vue_app/src/router/index.js rename to src/router/index.js diff --git a/vue_app/src/router/paths.js b/src/router/paths.js similarity index 100% rename from vue_app/src/router/paths.js rename to src/router/paths.js diff --git a/vue_app/src/util/index.js b/src/util/index.js similarity index 100% rename from vue_app/src/util/index.js rename to src/util/index.js diff --git a/vue_app/src/views/BucketContent.vue b/src/views/BucketContent.vue similarity index 98% rename from vue_app/src/views/BucketContent.vue rename to src/views/BucketContent.vue index e6cf0d3..cefe58b 100644 --- a/vue_app/src/views/BucketContent.vue +++ b/src/views/BucketContent.vue @@ -160,7 +160,7 @@ @@ -269,6 +275,8 @@ import moment from 'moment' import filesize from 'filesize' import { IntersectingCirclesSpinner } from 'epic-spinners' import { saveAs } from 'file-saver' +import JSZip from "jszip"; +import JSZipUtils from "jszip-utils" import Services from '../components/services' export default { mixins:[Services], @@ -700,7 +708,7 @@ export default { }, downloadFileCallBack(response){ var _this = this; - if (this.selected == 1){ + if (this.selected.length == 1){ const url = window.URL.createObjectURL(new Blob([response.data])) const link = document.createElement('a') link.href = url diff --git a/vue_app/src/views/Dashboard_layout.vue b/src/views/Dashboard_layout.vue similarity index 100% rename from vue_app/src/views/Dashboard_layout.vue rename to src/views/Dashboard_layout.vue diff --git a/vue_app/src/views/Functions.vue b/src/views/Functions.vue similarity index 93% rename from vue_app/src/views/Functions.vue rename to src/views/Functions.vue index 590462b..4e57c9d 100644 --- a/vue_app/src/views/Functions.vue +++ b/src/views/Functions.vue @@ -67,6 +67,17 @@ Name: {{props.item.service}} Image: {{props.item.container}} + + Token: + + Environment variables:

 										
@@ -256,6 +267,7 @@ export default { disable_form: true, disable_storage: true, params_delete: '', + show1:false }), methods: { showEnvVars(value){ @@ -285,17 +297,19 @@ export default { editionMode: true, name: this.services[index].service, image: this.services[index].container, + token: this.services[index].token, input: this.services[index].inputs, output: this.services[index].outputs, log_Level: this.services[index].logLevel, envVars: this.services[index].envVars, + annotations: this.services[index].annotations?this.services[index].annotations:{}, + labels: this.services[index].labels?this.services[index].labels:{}, cpu: this.services[index].cpu, script: this.services[index].script, memory: this.services[index].memory, storage_provider: this.services[index].storage } - console.log(servInfo) window.getApp.$emit('FUNC_OPEN_MANAGEMENT_DIALOG', servInfo) }, deleteFunction(serv, servName) { @@ -317,20 +331,21 @@ export default { } }, listServicesCallback(response) { - if(response.length > 0){ + if(response.status == 200){ this.show_spinner = false; - this.services = Object.assign(this.services, response); - this.services = response.map((serv) => { + this.services = Object.assign(this.services, response.data); + this.services = response.data.map((serv) => { return { service: serv.name, container: serv.image, + token: serv.token, cpu: serv.cpu, logLevel: serv.log_level, envVars: serv.environment, memory: serv.memory, inputs: serv.input, outputs: serv.output, - storage: serv.storage_provider, + storage: serv.storage_providers, script: serv.script } }) diff --git a/vue_app/src/views/Login.vue b/src/views/Login.vue similarity index 94% rename from vue_app/src/views/Login.vue rename to src/views/Login.vue index de6da8c..8f8012a 100644 --- a/vue_app/src/views/Login.vue +++ b/src/views/Login.vue @@ -18,7 +18,7 @@ - + - Login + Login
@@ -53,6 +53,7 @@ export default { }), created(){ + localStorage.clear(); localStorage.setItem("authenticated", false); }, @@ -101,7 +102,7 @@ export default { var _this = this axios({ method: 'get', - url: this.api+'/system/config', + url: this.env.api+'/system/config', auth: { username: this.model.username, password: this.model.password diff --git a/vue_app/src/views/Logs.vue b/src/views/Logs.vue similarity index 83% rename from vue_app/src/views/Logs.vue rename to src/views/Logs.vue index 2fb9de6..6ea7f23 100644 --- a/vue_app/src/views/Logs.vue +++ b/src/views/Logs.vue @@ -1,9 +1,8 @@