agama/web
Imobach González Sosa 0750fea56e
Update changes files
2024-05-17 10:54:09 +01:00
..
__mocks__ [web] Change how Icon sizes are handled 2023-12-19 11:49:57 +00:00
package Update changes files 2024-05-17 10:54:09 +01:00
po Update web PO files 2024-05-12 02:44:41 +00:00
public [web] Add Vite as a development dependency 2022-02-23 14:41:35 +00:00
share Do not use Cockpit manifest for storing supported languages (#1121) 2024-03-27 14:26:20 +01:00
src web: fetchLogs returns the blob or an exception 2024-05-17 07:33:59 +01:00
.babelrc.json Add Cockpit Starter Kit infrastructure 2022-04-08 21:07:13 +01:00
.editorconfig Add a React-based web interface 2021-12-22 10:02:10 +00:00
.eslintignore web: add Result section to Storage page (#1088) 2024-03-18 09:18:55 +00:00
.eslintrc.json Disable @typescript-eslint/no-unused-vars 2024-03-26 12:17:16 +00:00
.gitignore [web][doc] Update github-pages workflow and others 2024-01-08 15:38:05 +00:00
.prettierignore [web] Add 'lint' and 'prettier' tasks 2022-02-04 12:17:13 +00:00
.prettierrc Set prettier printWidth to 100 2022-03-09 09:48:08 +00:00
.stylelintrc.json [web] Follow the stylelint migration guide 2023-03-02 22:35:57 +00:00
.svgrrc [web] Change how Icon sizes are handled 2023-12-19 11:49:57 +00:00
babel.config.js [web] Fix the use of env variables 2023-02-10 09:49:32 +00:00
build_pot Use "c-format" flag instead of "javascript-format" in POT 2023-09-14 10:19:52 +02:00
cspell.json Drop manifest.json 2024-05-09 20:49:04 +02:00
jest.config.js drop COCKPIT_TARGET_URL 2024-02-28 22:58:47 +01:00
org.opensuse.agama.metainfo.xml Fix some links 2023-03-29 15:37:41 +01:00
package-lock.json web: update follow-redirects via npm audit fix 2024-05-07 13:32:49 +01:00
package.json web: drop no longer needed dependency override 2024-05-07 13:04:36 +01:00
README.md Use port 80 by default 2024-05-16 07:48:25 +01:00
svgo.config.js [web] Add @svgr/webpack dependency 2022-12-27 22:58:24 +00:00
tsconfig.json Do not use Cockpit manifest for storing supported languages (#1121) 2024-03-27 14:26:20 +01:00
typedoc.json [web][doc] Exclude not documented symbols 2024-01-08 14:26:37 +00:00
webpack.config.js Use port 80 by default 2024-05-16 07:48:25 +01:00

Agama Web UI

The Agama web user interface is a React-based application that offers a user interface to the Agama service.

Development

The easiest way to work on the Agama Web UI is to use the development server. The advantage is that you can use the [Hot Module Replacement] (https:// webpack.js.org/concepts/hot-module-replacement/) feature for automatically updating the code and stylesheet in the browser without reloading the page.

Using a development server

To start the webpack-dev-server use this command:

    npm run server -- --open

The extra --open option automatically opens the server page in your default web browser. In this case the server will use the https://localhost:8080 URL and expects a running agama-web-server at https://localhost.

This can work also remotely, with a Agama instance running in a different machine (a virtual machine as well). In that case run

    AGAMA_SERVER=https://<IP>:<port> npm run server -- --open

Where AGAMA_SERVER is the IP address, the hostname or the full URL of the running Agama server instance. This is especially useful if you use the Live ISO which does not contain any development tools, you can develop the web frontend easily from your workstation.

Example of running from different machine:

  # backend machine
  # using ip of machine instead of localhost is important to be network accessible
  # second address is needed for SSL which is mandatory for remote access
  agama-web-server serve --address :::80 --address2 :::443

  # frontend machine
  # ESLINT=0 is useful to ignore linter problems during development
  ESLINT=0 AGAMA_SERVER=https://10.100.1.1 npm run server

Debugging Hints

There are several places to look when something does not work and requires debugging. The first place is the browser's console which can give some hints. The second location to check for errors or warnings is output of npm run server where you can find issues when communicating with the backend. And last but on least is journal on backend machine where is logged backend activity journalctl -b. If the journal does not contain the required info, you can inspect the D-Bus communication which can give hint about data flow. Command is busctl monitor --address unix:path=/run/agama/bus

Special Environment Variables

AGAMA_SERVER - When running the development server set up a proxy to the specified Agama web server. See the [using a development server] (#using-a-development-server) section above.

LOCAL_CONNECTION - Force behaving as in a local connection, useful for development or testing some Agama features. For example the keyboard layout switcher is displayed only in local installation because it cannot work in remote connection. This option will force displaying it even in a remote connection.

TypeDoc Documentation

This project uses TypeDoc to generate the API documentation. The typedoc task generates the documentation to the typedoc.out directory. If you need to adjust any TypeDoc option, please check the typedoc.json file.

npm run typedoc
xdg-open typedoc.out/client/index.html
xdg-open typedoc.out/components/index.html

GitHub Actions will automatically publish the result to https://agama-frontend.surge.sh/.

Type-Checking Support

This module started as a JavaScript-only project. We have decided to add type-checking support, but instead of converting the code to TypeScript, we prefer to use TypeScript support for JSDoc annotations.

Run the following command to check the types:

npm run check-types

Not our JavaScript code is properly documented yet, so type-checking is an opt-in feature by now. If you want a JavaScript file to be type-checked, please add a // @ts-check comment before any code.