Git Product home page Git Product logo

aw-webui's Introduction

aw-webui

A web-based UI for ActivityWatch, built with Vue.js

Build Status Coverage Status Known Vulnerabilities

Getting started

Getting started with setting up the development environment is pretty straight forward:

# Start an instance of aw-server running in testing mode (on port 5666, with a separate database),
# This is what the web UI will connect to by default when run in development mode.
aw-qt --testing
# or, to run without watchers:
aw-server --testing

# Install dependencies
npm install
# or, to get exact versions of dependencies:
npm ci

# start aw-webui in dev mode
npm run serve

Alternatively, you can run make dev to install dependencies and serve the application locally.

You might have to configure CORS for it to work, see the CORS section below.

You may also want to generate fake data so you have something to test with, see: https://github.com/ActivityWatch/aw-fakedata/

Building

To build the production bundle, simply run the following:

# Install dependencies
npm ci

# Build for production
npm run build

Using a pre-release with your main install

Note: Running a development version of aw-webui with an old aw-server can lead to issues due to version incompatibilities.

You can run a development version of aw-webui with your main version of ActivityWatch by building it (or fetching the latest build from CI) and replacing placing the contents of the static directory of your aw-server (or aw-server-rust) installation. For simplicity, back up the original directory for easier switching back.

The assets are stored in the following directories (relative to your installation directory), depending on if you use aw-server-python (default) or aw-server-rust:

  • aw-server-python: activitywatch/aw-server/aw_server/static/
  • aw-server-rust: activitywatch/aw-server-rust/static/

Either copy the assets manually, or run make build from the aw-server parent directory to rebuild and copy the assets for you.

Once you've put the files in the directories, you may have to do a hard refresh in your browser to invalidate any stale caches.

If you want to actively iterate on aw-webui with your local production data, you'll want to use a development build, automatically update it, and connect a aw-server running against production data. To do this, in one terminal window run:

AW_SERVER_URL="'http://localhost:5600'" npx vue-cli-service build --watch --dest=../aw_server/static

If you want to add debugger statements in your code and otherwise break linting rules, you'll need to add a --skip-plugins=no-debugger to that command. Then, in another terminal (with your venv activated, assuming you are using python aw-server) run:

poetry install
aw-server

Tests

Tests can be run with:

npm test

There are also E2E tests. You need to have an aw-server and the web UI running in development mode (with npm run serve, as instructed above). After you have that setup, you can run the tests with:

make test-e2e

Development

CORS

For development, you'll also have to add/change CORS configuration in the aw-server configs by adding cors_origins = http://localhost:27180 to your configuration file ~/.config/activitywatch/aw-server/aw-server.ini under the server-testing section.

Code structure

One of the first things that happen in the application is the execution of src/main.js. This loads things such as bootstrap-vue and a bunch of other stuff that's globally used (filters, resources).

The main.js file then loads the src/App.vue file, which is the root component of the application.

aw-webui's People

Contributors

aaayushsingh avatar ahnlabb avatar anthonkendel avatar billangli avatar chemrat avatar dependabot[bot] avatar erikbjare avatar furffico avatar ianobermiller avatar iloveitaly avatar ishitatsuyuki avatar johan-bjareholt avatar jtojnar avatar lebaux avatar matt-soft avatar mte90 avatar nandryshak avatar nicolae-stroncea avatar nicoweio avatar nikanar avatar patriklaurell avatar prplecake avatar punchagan avatar rakleed avatar salahineo avatar skuzzymiglet avatar steventrouble avatar timwsuqld avatar xylix avatar yumemio avatar

Stargazers

 avatar  avatar

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.