Skip to content

Commit

Permalink
Initial break cockpt (#1061)
Browse files Browse the repository at this point in the history
## Problem

According to new architecture for 2024 there is decision to use http
based API instead of using cockpit and public dbus API.


## Solution

Start new architecture 2024 branch and use this as initial change that
remove some specific cockpit stuff. Goal is not to have it in working
state, but `npm build run` and `npm build server` still has to work and
serve some content so we have starting point for more changes.
  • Loading branch information
jreidinger committed Mar 4, 2024
2 parents 2244bab + 825d3f1 commit 9ae1ae3
Show file tree
Hide file tree
Showing 24 changed files with 69 additions and 888 deletions.
70 changes: 35 additions & 35 deletions .github/workflows/ci-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,38 +57,38 @@ jobs:

- name: Install dependencies
run: npm install

- name: Build the application
run: make

- name: Run check spell
run: npm run cspell

- name: Check types
run: npm run check-types

- name: Run ESLint
run: npm run eslint

- name: Run Stylelint
run: npm run stylelint

- name: Run the tests and generate coverage report
run: npm test -- --coverage

# send the code coverage for the web part to the coveralls.io
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2
with:
base-path: ./web
flag-name: web
parallel: true

# close the code coverage and inherit the previous coverage for the Ruby and
# Rust parts (it needs a separate step, the "carryforward" flag can be used
# only with the "parallel-finished: true" option)
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
carryforward: "service,rust"
#
# - name: Build the application
# run: make
#
# - name: Run check spell
# run: npm run cspell
#
# - name: Check types
# run: npm run check-types
#
# - name: Run ESLint
# run: npm run eslint
#
# - name: Run Stylelint
# run: npm run stylelint
#
# - name: Run the tests and generate coverage report
# run: npm test -- --coverage
#
# # send the code coverage for the web part to the coveralls.io
# - name: Coveralls GitHub Action
# uses: coverallsapp/github-action@v2
# with:
# base-path: ./web
# flag-name: web
# parallel: true
#
# # close the code coverage and inherit the previous coverage for the Ruby and
# # Rust parts (it needs a separate step, the "carryforward" flag can be used
# # only with the "parallel-finished: true" option)
# - name: Coveralls Finished
# uses: coverallsapp/github-action@v2
# with:
# parallel-finished: true
# carryforward: "service,rust"
3 changes: 1 addition & 2 deletions web/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
],
"globals": {
"require": false,
"module": false,
"COCKPIT_TARGET_URL": "readonly"
"module": false
}
}
200 changes: 0 additions & 200 deletions web/Makefile

This file was deleted.

27 changes: 2 additions & 25 deletions web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This Cockpit modules offers a UI to the [Agama service](file:../service). The co

## Development

TODO: update when new way is clear how to do
There are basically two ways how to develop the Agama fronted. You can
override the original Cockpit plugins with your own code in your `$HOME` directory
or you can run a development server which works as a proxy and sends the Cockpit
Expand All @@ -16,33 +17,9 @@ The advantage of using the development server is that you can use the
feature for automatically updating the code and stylesheet in the browser
without reloading the page.

### Overriding the Cockpit Plugin

Cockpit searches for modules in the `$HOME/.local/share/cockpit` directory of the logged in user,
which is really handy when working on a module. To make the module available to Cockpit, you can
link your build folder (`dist`) or just rely on the `devel-install` task:

```
make devel-install
```

Then you can visit the Agama module through the following URL:

http://localhost:9090/cockpit/@localhost/agama/index.html.

Bear in mind that if something goes wrong while building the application (e.g., the linter fails),
the link will not be created.

To automatically rebuild the sources after any change you can run

```
npm run watch
```

*But do not forget that you have to reload the code in your browser manually after each change!*

### Using a development server

TODO: update when new way is clear how to do
To start the [webpack-dev-server](https://github.com/webpack/webpack-dev-server)
use this command:

Expand Down
1 change: 0 additions & 1 deletion web/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ module.exports = {

// A set of global variables that need to be available in all test environments
globals: {
COCKPIT_TARGET_URL: "https://localhost:9090",
},

// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
Expand Down
4 changes: 2 additions & 2 deletions web/package/_service
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<param name="subdir">web</param>
<param name="without-version">enable</param>
<param name="extract">package-lock.json</param>
<param name="extract">package/cockpit-agama.changes</param>
<param name="extract">package/cockpit-agama.spec</param>
<param name="extract">package/agama-web-ui.changes</param>
<param name="extract">package/agama-web-ui.spec</param>
</service>
<service name="node_modules" mode="manual">
<param name="cpio">node_modules.obscpio</param>
Expand Down
File renamed without changes.
10 changes: 3 additions & 7 deletions web/package/cockpit-agama.spec → web/package/agama-web-ui.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
#


Name: cockpit-agama
Name: agama-web-ui
Version: 0
Release: 0
Summary: Cockpit module for Agama
Summary: Web UI for Agama installer
License: GPL-2.0-only
URL: https://github.com/openSUSE/agama
# source_validator insists that if obscpio has no version then
Expand All @@ -30,22 +30,18 @@ Source11: node_modules.spec.inc
Source12: node_modules.sums
%include %_sourcedir/node_modules.spec.inc
BuildArch: noarch
Requires: cockpit
BuildRequires: cockpit
BuildRequires: cockpit-devel >= 243
BuildRequires: local-npm-registry
BuildRequires: appstream-glib

%description
Cockpit module for the experimental Agama installer.
Agama web UI for the experimental Agama installer.

%prep
%autosetup -p1 -n agama
rm -f package-lock.json
local-npm-registry %{_sourcedir} install --with=dev --legacy-peer-deps || ( find ~/.npm/_logs -name '*-debug.log' -print0 | xargs -0 cat; false)

%build
# cp -r %{_datadir}/cockpit/devel/lib src/lib
NODE_ENV="production" npm run build

%install
Expand Down
Loading

0 comments on commit 9ae1ae3

Please sign in to comment.