Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add react-based frontend #69

Merged
merged 6 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Build and Test

on:
push:
branches: master
pull_request:
branches: "*"

jobs:
build:
name: Build tljh_repo2docker
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Lint the application
run: |
set -eux
npm install
npm run lint:check

- name: Package the application
run: |
set -eux
python -m pip install build
python -m build .

- name: Upload package
uses: actions/upload-artifact@v3
with:
name: tljh_repo2docker-artifacts
path: |
dist/tljh_repo2docker*.whl
if-no-files-found: error

isolated-tests:
name: Isolated tests
needs: build
runs-on: ubuntu-latest

steps:
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- uses: actions/download-artifact@v3
with:
name: tljh_repo2docker-artifacts

- name: Install and Test
run: |
set -eux
# Remove NodeJS, twice to take care of system and locally installed node versions.
sudo rm -rf $(which node)
sudo rm -rf $(which node)

python -m pip install git+https://github.com/jupyterhub/the-littlest-jupyterhub tljh_repo2docker*.whl

- name: Test import
run: python -c "import tljh_repo2docker"

unit-tests:
name: Unit tests
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Download app package
uses: actions/download-artifact@v3
with:
name: tljh_repo2docker-artifacts

- name: Install package
run: |
set -eux
python -m pip install -r dev-requirements.txt
python -m pip install tljh_repo2docker*.whl
npm -g install configurable-http-proxy

- name: Run Tests
run: |
python -m pytest --cov

integration-tests:
name: Integration tests
needs: build
runs-on: ubuntu-latest

env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Download app package
uses: actions/download-artifact@v3
with:
name: tljh_repo2docker-artifacts

- name: Install package
run: |
set -eux
python -m pip install -r dev-requirements.txt
python -m pip install tljh_repo2docker*.whl
npm -g install configurable-http-proxy

- name: Install UI test dependencies
working-directory: ui-tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: npm install

- name: Set up browser cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/pw-browsers
key: ${{ runner.os }}-${{ hashFiles('ui-tests/package-lock.json') }}

- name: Install browser
run: npx playwright install chromium
working-directory: ui-tests

- name: Execute integration tests
working-directory: ui-tests
run: |
npx playwright test

- name: Upload Playwright Test report
if: always()
uses: actions/upload-artifact@v3
with:
name: tljh-playwright-tests
path: |
ui-tests/test-results
ui-tests/playwright-report
1 change: 0 additions & 1 deletion .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
version_spec: next
shell: bash -l {0}

- name: Upload Distributions
uses: actions/upload-artifact@v3
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/test.yml

This file was deleted.

15 changes: 13 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ docs/_build
docs/build
.ipynb_checkpoints
jupyterhub_cookie_secret
jupyterhub.sqlite
jupyterhub-proxy.pid
**/jupyterhub.sqlite
**/jupyterhub-proxy.pid
*.egg-info
MANIFEST
.coverage
Expand All @@ -19,3 +19,14 @@ MANIFEST

# Local TLJH config file
config.yaml

# Frontend assets
node_modules
dist/
ui-tests/playwright-report
ui-tests/test-results
**/js
lib/

# Hatch version
_version.py
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/package-lock.json
69 changes: 35 additions & 34 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,43 @@ You can find below the list of changes since the creation of the plugin.

## What's Changed

* Add installation instructions to the README by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/1
* Fix manifest by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/2
* Add optional name to the environment by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/7
* Show more information on the spawner options page by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/10
* Add minimal documentation to the README by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/11
* Update README instructions to install the plugin by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/12
* Expose list_images by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/13
* Show human readable value for mem and cpu limits by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/16
* Rename from PlasmaBio to Plasma by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/17
* Add a simple CI workflow by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/18
* Replace the service by extra hub handlers by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/19
* Add tests by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/21
* Show the build logs in a dialog by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/22
* Lowercase the autogenerated name from the repo by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/23
* Package the tests by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/25
* Async start method in the default spawner by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/28
* Hide 'Cancel' button from logs window by @pierrepo in https://github.com/plasmabio/tljh-repo2docker/pull/33
* Update instead of overwrite extra_host_config by @TimoRoth in https://github.com/plasmabio/tljh-repo2docker/pull/34
* Await rendered template if neccesary by @TimoRoth in https://github.com/plasmabio/tljh-repo2docker/pull/40
* Pin dependencies by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/41
* Add support for GIT_CREDENTIAL_ENV to build private repos by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/42
* Update repo2docker image by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/49
* Pin to `jupyterhub~=1.5` for development, update `dockerspawner`, default ref to `HEAD` by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/50
* Update Python versions on CI by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/51
* Use --label to set labels by @TimoRoth in https://github.com/plasmabio/tljh-repo2docker/pull/48
* Expose custom build-args as advanced option in the UI by @TimoRoth in https://github.com/plasmabio/tljh-repo2docker/pull/52
* Update test binder repo to the new URL by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/53
* Rename test repo to `tljh-repo2docker-test-binder` by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/54
* Pin `notebook<7` and `sqlalchemy<2` for now by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/62
* Resolve 'Show Logs' issue by adding _xsrf token by @yamaton in https://github.com/plasmabio/tljh-repo2docker/pull/61
- Add installation instructions to the README by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/1
- Fix manifest by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/2
- Add optional name to the environment by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/7
- Show more information on the spawner options page by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/10
- Add minimal documentation to the README by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/11
- Update README instructions to install the plugin by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/12
- Expose list_images by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/13
- Show human readable value for mem and cpu limits by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/16
- Rename from PlasmaBio to Plasma by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/17
- Add a simple CI workflow by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/18
- Replace the service by extra hub handlers by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/19
- Add tests by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/21
- Show the build logs in a dialog by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/22
- Lowercase the autogenerated name from the repo by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/23
- Package the tests by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/25
- Async start method in the default spawner by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/28
- Hide 'Cancel' button from logs window by @pierrepo in https://github.com/plasmabio/tljh-repo2docker/pull/33
- Update instead of overwrite extra_host_config by @TimoRoth in https://github.com/plasmabio/tljh-repo2docker/pull/34
- Await rendered template if neccesary by @TimoRoth in https://github.com/plasmabio/tljh-repo2docker/pull/40
- Pin dependencies by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/41
- Add support for GIT_CREDENTIAL_ENV to build private repos by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/42
- Update repo2docker image by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/49
- Pin to `jupyterhub~=1.5` for development, update `dockerspawner`, default ref to `HEAD` by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/50
- Update Python versions on CI by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/51
- Use --label to set labels by @TimoRoth in https://github.com/plasmabio/tljh-repo2docker/pull/48
- Expose custom build-args as advanced option in the UI by @TimoRoth in https://github.com/plasmabio/tljh-repo2docker/pull/52
- Update test binder repo to the new URL by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/53
- Rename test repo to `tljh-repo2docker-test-binder` by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/54
- Pin `notebook<7` and `sqlalchemy<2` for now by @jtpio in https://github.com/plasmabio/tljh-repo2docker/pull/62
- Resolve 'Show Logs' issue by adding \_xsrf token by @yamaton in https://github.com/plasmabio/tljh-repo2docker/pull/61

## New Contributors
* @jtpio made their first contribution in https://github.com/plasmabio/tljh-repo2docker/pull/1
* @pierrepo made their first contribution in https://github.com/plasmabio/tljh-repo2docker/pull/33
* @TimoRoth made their first contribution in https://github.com/plasmabio/tljh-repo2docker/pull/34
* @yamaton made their first contribution in https://github.com/plasmabio/tljh-repo2docker/pull/61

- @jtpio made their first contribution in https://github.com/plasmabio/tljh-repo2docker/pull/1
- @pierrepo made their first contribution in https://github.com/plasmabio/tljh-repo2docker/pull/33
- @TimoRoth made their first contribution in https://github.com/plasmabio/tljh-repo2docker/pull/34
- @yamaton made their first contribution in https://github.com/plasmabio/tljh-repo2docker/pull/61

**Full Changelog**: https://github.com/plasmabio/tljh-repo2docker/commits/v1

Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ source bin/activate

## Install the development requirements


```bash
python -m pip install -r dev-requirements.txt

Expand Down Expand Up @@ -63,4 +62,4 @@ To run the tests:

```bash
python -m pytest --cov
```
```
26 changes: 22 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ for more info on installing TLJH plugins.

### List the environments

The *Environments* page shows the list of built environments, as well as the ones currently being built:
The _Environments_ page shows the list of built environments, as well as the ones currently being built:

![environments](https://user-images.githubusercontent.com/591645/80962805-056df500-8e0e-11ea-81ab-6efc1c97432d.png)

### Add a new environment

Just like on [Binder](https://mybinder.org), new environments can be added by clicking on the *Add New* button and providing a URL to the repository. Optional names, memory, and CPU limits can also be set for the environment:
Just like on [Binder](https://mybinder.org), new environments can be added by clicking on the _Add New_ button and providing a URL to the repository. Optional names, memory, and CPU limits can also be set for the environment:

![add-new](https://user-images.githubusercontent.com/591645/80963115-9fce3880-8e0e-11ea-890b-c9b928f7edb1.png)

### Follow the build logs

Clicking on the *Logs* button will open a new dialog with the build logs:
Clicking on the _Logs_ button will open a new dialog with the build logs:

![logs](https://user-images.githubusercontent.com/591645/82306574-86f18580-99bf-11ea-984b-4749ddde15e7.png)

Expand All @@ -73,6 +73,24 @@ On GitHub and GitLab, a user might have to first create an access token with `re

![image](https://user-images.githubusercontent.com/591645/107350843-39c3bf80-6aca-11eb-8b82-6fa95ba4c7e4.png)

### Set CPU and Memory via machine profiles

Instead of entering directly the CPU and Memory value, `tljh-repo2docker` can be configured with pre-defined machine profiles and users can only choose from the available options. The following snippet will add 3 machines with labels `Small`, `Medium` and `Large` to the profile list:

```python
from tljh.configurer import apply_config, load_config

tljh_config = load_config()
tljh_config["limits"]["machine_profiles"] = [
{"label": "Small", "cpu": 2, "memory": 2},
{"label": "Medium", "cpu": 4, "memory": 4},
{"label": "Large", "cpu": 8, "memory": 8},
]
apply_config(tljh_config, c)
```

![image](https://github.com/plasmabio/tljh-repo2docker/assets/4451292/c1f0231e-a02d-41dc-85e0-97a97ffa0311)

### Extra documentation

`tljh-repo2docker` is currently developed as part of the [Plasma project](https://github.com/plasmabio/plasma).
Expand All @@ -85,4 +103,4 @@ See: https://repo2docker.readthedocs.io/en/latest/howto/jupyterhub_images.html

## Run Locally

Check out the instructions in [CONTRIBUTING.md](./CONTRIBUTING.md) to setup a local environment.
Check out the instructions in [CONTRIBUTING.md](./CONTRIBUTING.md) to set up a local environment.
Loading
Loading