From a5f2377b65479457ec723d1892ac3337263e88f9 Mon Sep 17 00:00:00 2001 From: Stanislaw Adaszewski Date: Thu, 30 Jan 2020 18:56:53 +0100 Subject: [PATCH] A basic navigation is in place. --- backend/srv.py | 10 ++++- frontend/package.json | 2 - frontend/rollup.config.js | 2 +- frontend/src/js/component/wb-app.js | 37 +++++++------------ .../src/js/component/wb-project-listing.js | 2 +- frontend/src/js/page/wb-browse.js | 19 ++++++++++ 6 files changed, 43 insertions(+), 29 deletions(-) create mode 100644 frontend/src/js/page/wb-browse.js diff --git a/backend/srv.py b/backend/srv.py index 9972690..711e099 100644 --- a/backend/srv.py +++ b/backend/srv.py @@ -1,7 +1,15 @@ import BaseHTTPServer, SimpleHTTPServer import ssl -httpd = BaseHTTPServer.HTTPServer(('0.0.0.0', 4443), SimpleHTTPServer.SimpleHTTPRequestHandler) +class RequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): + def do_GET(self): + print(self.path) + if '.' not in self.path: + self.path = '/' + SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) + # RequestHandler, self).do_GET() + +httpd = BaseHTTPServer.HTTPServer(('0.0.0.0', 4443), RequestHandler) httpd.socket = ssl.wrap_socket (httpd.socket, certfile='/pstore/home/adaszews/workspace/arvados-workbench-advanced/backend/server.pem', server_side=True) httpd.serve_forever() diff --git a/frontend/package.json b/frontend/package.json index 30b05ca..86ac08b 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -2,13 +2,11 @@ "dependencies": { "@fortawesome/fontawesome-free": "^5.12.0", "bootstrap": "^4.4.1", - "font-awesome": "^4.7.0", "jquery": "^3.4.1", "linkstate": "^1.1.1", "popper.js": "^1.16.1", "preact": "^8.2.9", "preact-router": "^2.6.1", - "random-bytes": "^1.0.0", "rollup": "^0.62.0", "rollup-plugin-buble": "^0.19.2", "rollup-plugin-copy": "^0.2.3", diff --git a/frontend/rollup.config.js b/frontend/rollup.config.js index 2a9330a..b1c184b 100755 --- a/frontend/rollup.config.js +++ b/frontend/rollup.config.js @@ -16,7 +16,7 @@ export default { }, plugins: [ includePaths({ - paths: ['src/js', 'src/js/widget', 'src/js/misc', 'src/js/component'] + paths: ['src/js', 'src/js/widget', 'src/js/misc', 'src/js/component', 'src/js/page'] }), copy({ 'src/html/index.html': 'dist/index.html', diff --git a/frontend/src/js/component/wb-app.js b/frontend/src/js/component/wb-app.js index a449c5e..8c7f7b6 100644 --- a/frontend/src/js/component/wb-app.js +++ b/frontend/src/js/component/wb-app.js @@ -1,37 +1,26 @@ import { h, Component } from 'preact'; +import { Router, route } from 'preact-router'; import WBTabs from 'wb-tabs'; import WBTable from 'wb-table'; import WBPagination from 'wb-pagination'; import WBProjectListing from 'wb-project-listing'; import WBNavbar from 'wb-navbar'; +import WBBrowse from 'wb-browse'; class WBApp extends Component { render({}, { activePage }) { return ( -
-

WBApp

- - - - this.setState({ 'activePage': i }) } /> - - alert(idx) } /> -
+ +
+ Hello, world! +
+ +
+ +
+ + +
); } } diff --git a/frontend/src/js/component/wb-project-listing.js b/frontend/src/js/component/wb-project-listing.js index 9b5c647..6b43f03 100644 --- a/frontend/src/js/component/wb-project-listing.js +++ b/frontend/src/js/component/wb-project-listing.js @@ -29,7 +29,7 @@ class WBProjectListing extends Component { let filters = [ [ 'group_class', '=', 'project' ] ]; - if (this.props.ownerUuid !== null) + if (this.props.ownerUuid) filters.push([ 'owner_uuid', '=', this.props.ownerUuid ]); let prom = makeArvadosRequest(this.props.arvHost, this.props.arvToken, '/arvados/v1/groups?filters=' + encodeURIComponent(JSON.stringify(filters)) + diff --git a/frontend/src/js/page/wb-browse.js b/frontend/src/js/page/wb-browse.js new file mode 100644 index 0000000..30eed7a --- /dev/null +++ b/frontend/src/js/page/wb-browse.js @@ -0,0 +1,19 @@ +import { h, Component } from 'preact'; +import WBNavbar from 'wb-navbar'; +import WBProjectListing from 'wb-project-listing'; + +class WBBrowse extends Component { + render({ ownerUuid }) { + return ( +
+ + +
+ ); + } +} + +export default WBBrowse;