Giter Club home page Giter Club logo

karmen's Introduction

Karmen frontend

Frontend browser UI for Karmen bootstrapped with react-scripts.

Development

It is possible to run this as a standalone app, but since you need the backend as well, it is recommended to run the whole bundle with docker-compose as described in the global README.

npm install
echo 'window.env = {BACKEND_BASE: "http://localhost:8000/api/2"};' > public/env.js
# (for the first time or if you changed styles)
npm rebuild node-sass
npm start

Visit http://localhost:3000.

To make the code more readable, apply the automatic formatting by running npm run lint -- --fix.

Icons

Do you need more icons? We are using IcoMoon. To add more icons to the project:

  1. Visit the IcoMoon app
  2. Click Untitled Project (or Manage Projects)
  3. Use the Import project and upload the selection.json file
  4. Load the project
  5. Use the search function to add more icons. Try to keep the style consistent.
  6. When you are happy, select Generate Font and then download the zip file.
  7. Copy everything except demo-files, Read Me.txt and demo.html into src/assets/icons. The git diff should now show the added icons in style.css.
  8. Use your new icon like <i className="icon-new"></i>.

Docker

docker build --build-arg REACT_APP_GIT_REV=`git rev-parse --short HEAD` -t fragaria/karmen-frontend .
docker run -p 3000:9765 -e ENV=develop fragaria/karmen-frontend

You can control the exposed interface and port with the following environment variables. This is useful when container is run in the docker's networking host mode.

  • SERVICE_HOST - Interface on which the proxy will be exposed, defaults to 0.0.0.0.
  • SERVICE_PORT - Port on which the proxy will be exposed, defaults to 9766

There are problems with compiling the app directly for arm/v7 architecture, so the resulting docker image is Dockerfile.serve serving a JS bundle compiled with Dockerfile.build. The Dockerfile is used for development only.

User access model

Since all of the operations require a valid JWT tied to a user account, you have to go through a login screen every time you want to access the application. The JWT's are stored in your browser, however, and you will be automatically logged in if you come back within 30 days.

If you want a more permanent setup, for example for a monitoring dashboard, create an API token that has no expiration date. You can then run the app with the token query param such as:

http://karmen.local?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9......

If no valid user session is detected, the token gets consumed by the frontend app and is remembered by the browser until you press the logout button.

karmen's People

Contributors

adamjezek98 avatar czervenka avatar dependabot-preview[bot] avatar dependabot[bot] avatar jirkachadima avatar martinbilek avatar michalmanena avatar tibor-kulcar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

karmen's Issues

is connected and Printer is not responding

Hi guys,

so this happens quite often
Screenshot 2020-11-21 at 15 18 04

I am almost sure that the printer is still printing, I'll check later today, but sometimes the web UI gets into this state, which does not make sense...

  • Why is there a connect button visible, when supposedly the printer is connected.
  • Why the stream is not visible? It should not be related to any printer state, once the pill is connected to the internet I should be able to see the stream.

This sometimes goes away, it can take up to 30 minutes of open browser page, but sometimes it does not.

I suggest better state info on this screen, for example if the pill connected to the internet...

Setup CI

We can probably use Travis, since this is an opensource project.

Dependabot couldn't find a package.json for this project

Dependabot couldn't find a package.json for this project.

Dependabot requires a package.json to evaluate your project's current JavaScript dependencies. It had expected to find one at the path: /src/karmen_frontend/package.json.

If this isn't a JavaScript project, or if it is a library, you may wish to disable updates for it from within Dependabot.

View the update logs.

Dockerize the project for easier development

There are system-wide dependencies (arp-scan, avahi-utils) and external dependencies (postgres, redis) that are probably not necessary to be installed externally during the development.

They can probably be isolated by running the whole karmen system with a bunch of docker containers with docker-compose.

docker-compose could also be used to run this easily in a production setup.

Ditch custom opneresty docker image in favour of openresty/openresty

Since we have introduced the overarching proxy that handles the lua-redis-based webcam proxying, we no longer need the python-openresty combination. The backend is fine with plain nginx and the proxy is fine without python. Unfortunately, the official docker images are not published for arm, so we have to 1) wait or 2) change the base image of https://github.com/fragaria/python-openresty to alpine instead of python:3-6.slim

Blocked by: openresty/docker-openresty#130

All automated builds for feat/backend2 fail

After the backend has been separated from this repository in the branch feat/backend2 the directory structure changed, which was not reflected in the Travis configuration.
This causes all Travis jobs to fail at the beginning no matter what.
Therefore neither FE tests nor linter is triggered, so the FE code starts to fill up with unprettified code.

Dependabot couldn't find a package.json for this project

Dependabot couldn't find a package.json for this project.

Dependabot requires a package.json to evaluate your project's current JavaScript dependencies. It had expected to find one at the path: /src/karmen_frontend/package.json.

If this isn't a JavaScript project, or if it is a library, you may wish to disable updates for it from within Dependabot.

View the update logs.

Stream might need to be proxied

If the original secure design with printers on a private isolated network is used, the webcam streams won't be accessible from the browser. They need to be proxied by the karmen_backend.

Luckily, it works easily with this snippet

Improve README

  • Add installation and usage instructions.
  • Add development setup instructions
  • Add contributing guidelines

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.