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

Project board fixes #96

Merged
merged 72 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
5e96c10
Fix balena deploy script on tag
maggie44 Aug 15, 2022
efbc2d0
Switch from VPN to Cloudlink
maggie44 Aug 15, 2022
f4dc6e7
Switch to development on device mode
maggie44 Aug 15, 2022
ab55269
Fix image size on Firefox
maggie44 Aug 15, 2022
e8552ab
Fix Network page layout
maggie44 Aug 15, 2022
e22abcc
Tidy env var settings page
maggie44 Aug 15, 2022
1875fb2
Refactor config page
maggie44 Aug 15, 2022
ef06898
Allow UI to run on any port
maggie44 Aug 16, 2022
23119f9
Add USB mount support
maggie44 Aug 16, 2022
d3d9033
Bump node version to 18
maggie44 Aug 16, 2022
b9adfb8
Package updates
maggie44 Aug 16, 2022
2085c21
Additional spacing on env config controls
maggie44 Aug 16, 2022
08e4883
Warp long sysinfo strings
maggie44 Aug 16, 2022
27cf3da
Add wrapping to additional expansion-items
maggie44 Aug 16, 2022
dc1ec03
Show add env button when table is empty
maggie44 Aug 16, 2022
d30c0f8
Display env var loading indicator immediately
maggie44 Aug 16, 2022
23c8774
Add Regex control for env var keys
maggie44 Aug 16, 2022
0d67314
Improve user experience when setting env vars
maggie44 Aug 16, 2022
5485ae1
Update wifi i18n strings
maggie44 Aug 16, 2022
14ef50b
Fix missing ref when editing env vars
maggie44 Aug 17, 2022
013975b
Add warning on container restart after deleting envs
maggie44 Aug 17, 2022
514ffd8
Replace 'volume manager' references with 'file manager'
maggie44 Aug 17, 2022
0478314
Standardise spacing in shell files
maggie44 Aug 17, 2022
06e27ca
Remount USB drives already connected at boot
maggie44 Aug 22, 2022
b5b77a0
Clean shell scripts
maggie44 Aug 22, 2022
aa66536
Apply USB mount only to known USB devices
maggie44 Aug 22, 2022
81b5c9b
Change BACKEND_HOSTNAME to DEVICE_HOSTNAME
maggie44 Aug 22, 2022
438da2c
Hide tag icon on mobile
maggie44 Aug 22, 2022
28810b3
Switch .then promises to try/catch
maggie44 Aug 22, 2022
d710cd0
Sort imports
maggie44 Aug 22, 2022
936faad
Refactor system info
maggie44 Aug 23, 2022
627971c
Remove unused i18n string
maggie44 Aug 23, 2022
d1f35e7
Add electron build process
maggie44 Aug 24, 2022
cc460c4
Tree shaking for charts
maggie44 Aug 24, 2022
8804ed1
Add missing chart imports
maggie44 Aug 25, 2022
01af137
Electron: Restyle close icon
maggie44 Aug 25, 2022
d4302f9
Electron: Fix Cloudlink icon color
maggie44 Aug 25, 2022
e310476
Add PWA build
maggie44 Aug 25, 2022
ffece18
Add cleanup steps to push-dir
maggie44 Aug 25, 2022
d99505b
Update PUBLIC_PATH and PWA colour theme
maggie44 Aug 25, 2022
27f1e5a
Fix incorrect image sizes
maggie44 Aug 25, 2022
9544c57
Electron: Disable submit button when input box is empty
maggie44 Aug 25, 2022
565ccc8
Add install prompt listener for PWA install
maggie44 Aug 25, 2022
b761932
Add filter for white space on input
maggie44 Aug 25, 2022
85cd042
Fix lint issues
maggie44 Aug 25, 2022
28d58e5
Add install instructions
maggie44 Aug 25, 2022
b03b626
Add header logo to PWA and Electron
maggie44 Aug 25, 2022
bb9cd8f
Apply prettier formatter
maggie44 Aug 25, 2022
f2e2ac4
Remove unused yarn command
maggie44 Aug 26, 2022
2fd4a53
Rename Electron portal to App portal
maggie44 Aug 26, 2022
f1acba2
Adjust padding
maggie44 Aug 26, 2022
3d7d24a
Add control panel tooltip
maggie44 Aug 26, 2022
0bf7a7a
Handle direct device page loading from Electron
maggie44 Aug 26, 2022
069873e
Electron: Open new windows with menu item visible
maggie44 Aug 29, 2022
5677bb8
Monitor offline status in device info more accurately
maggie44 Aug 30, 2022
9cc07ab
Prevent flashing of device name on loading
maggie44 Aug 30, 2022
214cd3a
Use custom header on Electron
maggie44 Aug 30, 2022
9f9eae3
Add ability to perform another internet connectivity check
maggie44 Aug 30, 2022
e018178
Initiate internet check on Electron load
maggie44 Aug 30, 2022
51e6ecb
Amend internet tooltip text
maggie44 Aug 30, 2022
2fb0a40
Add PWA build process
maggie44 Aug 31, 2022
b0bc892
Begin rename to starter interface
maggie44 Aug 31, 2022
0448f02
Group q-chips by screen size
maggie44 Aug 31, 2022
1260fbc
Fix Electron production build misreading start state
maggie44 Aug 31, 2022
1b09820
Fix missing tab arrows when multiple tabs are open
maggie44 Aug 31, 2022
48a61ce
Validate input field is not blank on welcome page
maggie44 Aug 31, 2022
01a85a8
Allow passing of protocols in Electron input box
maggie44 Sep 1, 2022
f7a5f2a
Use Axios settings store for all configurations
maggie44 Sep 1, 2022
9372309
Separate apps in to components
maggie44 Sep 1, 2022
354c0d6
Rename device selector
maggie44 Sep 1, 2022
7188d4e
Add ON_DEVICE var for controlling display states
maggie44 Sep 1, 2022
f95c9ec
Extend internet_check timeout
maggie44 Sep 2, 2022
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
11 changes: 6 additions & 5 deletions .github/workflows/deploy-to-bcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy to Balena
uses: balena-io/deploy-to-balena-action@master
id: build
- name: balena CLI Action
uses: balena-community/[email protected]
with:
balena_token: ${{ secrets.BALENA_TOKEN }}
fleet: maggie0002/balena-device-ui
balena_token: ${{secrets.BALENA_TOKEN}}
balena_cli_commands: >
maggie0002/balena-device-ui;
balena_cli_version: 13.7.1

- name: Log release ID built
run: echo "Built release ID ${{ steps.build.outputs.release_id }}"
2 changes: 1 addition & 1 deletion .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "16"
node-version: "18"
- run: yarn install --immutable
- run: yarn lint
- run: yarn formatcheck
785 changes: 0 additions & 785 deletions .yarn/releases/yarn-3.2.0.cjs

This file was deleted.

783 changes: 783 additions & 0 deletions .yarn/releases/yarn-3.2.2.cjs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ plugins:
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
yarnPath: .yarn/releases/yarn-3.2.0.cjs

yarnPath: .yarn/releases/yarn-3.2.2.cjs
34 changes: 28 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## Build ExpressJS and UI
FROM node:16.13.2-alpine3.15 AS build

# Tell the UI that this is being deployed to a Balena device
ENV ON_DEVICE=true
FROM node:18.7.0-alpine3.16 AS build

# Specify that this is being built for production
ENV NODE_ENV=production

# Public path for PWA
ARG PUBLIC_PWA_PATH=/app

WORKDIR /build-context

# Copy required files for installs
Expand All @@ -27,27 +27,49 @@ COPY ui ui
# Run lint to ensure build fails if there are coding issues
RUN yarn lint

# Build ExpressJS and UI
# Build ExpressJS and UI.
# ON_DEVICE=false informs the build that there my not be a backend available, and therefore
# not to perform certain function like communicating with the backend on boot
RUN yarn build
RUN ON_DEVICE=false yarn build-pwa

# Reduce the node_modules folder down to the essentials required for ExpressJS
RUN yarn workspaces focus expressjs --production


## Compile container
FROM node:16.13.2-alpine3.15
FROM node:18.7.0-alpine3.16

# Install USB mount requirements
RUN apk add --no-cache \
findmnt \
grep \
udev \
util-linux

ENV NODE_ENV=production

WORKDIR /app

# Enable USB support on device
ENV UDEV=on
COPY expressjs/src/usb/udev/usb.rules /etc/udev/rules.d/usb.rules
COPY expressjs/src/usb/scripts /usr/src/scripts
COPY expressjs/src/usb/entrypoint.sh .
RUN chmod +x entrypoint.sh
RUN chmod +x /usr/src/scripts/*

# Copy app to container
COPY --from=build /build-context/ui/dist/spa public
COPY --from=build /build-context/ui/dist/pwa public/app
COPY --from=build /build-context/expressjs/dist .
COPY --from=build /build-context/node_modules node_modules

# Copy startup scripts
COPY scripts .

# Setup UDEV for USB support
ENTRYPOINT ["./entrypoint.sh"]

# Run the start script
CMD ["sh", "start.sh"]
41 changes: 0 additions & 41 deletions Dockerfile.dev

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Balena Device UI
# Balena Starter Interface

This project is still under heavy development and subject to significant changes. Apologies if the documentation is out of date in places, we are moving quickly and will try and keep up as best as possible.
This project is still under heavy development and subject to significant changes. Apologies if the documentation is out of date in places, we are moving quickly and will try and keep up as best as possible.

---

Expand All @@ -26,7 +26,7 @@ Some of the features include:
- Pre-built endpoints for interacting with the Balena SDK or Supervisor
- Connect the device to nearby Wi-Fi networks
- Container manager (list, stop, start, restart)
- Volume manager (create folders, upload, delete, etc...)
- File manager (create folders, upload, delete, etc...)
- Captive portal
- System info and stats
- I18n language translations
Expand Down
2 changes: 1 addition & 1 deletion balena.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Device UI
name: balena Starter Interface
description: >-
A UI for interacting with the Balena OS and a starter project for creating your own.
joinable: false
Expand Down
4 changes: 0 additions & 4 deletions development/.env_vars

This file was deleted.

29 changes: 0 additions & 29 deletions development/start.sh

This file was deleted.

68 changes: 0 additions & 68 deletions docker-compose-dev.yml

This file was deleted.

12 changes: 6 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
version: "2.1"
version: "2"

services:
balena-device-ui:
balena-starter-interface:
build:
context: .
dockerfile: Dockerfile
environment:
NETWORK_MODE: bridge # Tell the app if running in `bridge` or `host` network mode
ON_DEVICE: true # Specify that this is being deployed to hardware with Balena OS
SET_HOSTNAME: "balena" # Optional. Changes the device hostname. UI will become accesible on `balena.local`.
restart: always
ports:
- "80:80"
volumes:
- "bdu_db:/app/db" # Stores UI database files
- "bdu_storage:/app/storage" # Storage for the Volume Manager. See docs for more info.
- "bdu_storage:/app/storage" # Storage for the File Manager. See docs for more info.
privileged: true # This can be removed if not using the USB mounting feature

# If using the Volume Manager to access volumes on other containers, ensure this container `depends_on` your
# If using the File Manager to access volumes on other containers, ensure this container `depends_on` your
# other container using the below:
# depends_on:
# - "your-other-container-name"
Expand All @@ -34,7 +34,7 @@ services:
PWC_PORT: 9090

## Hotspot details ##
PWC_HOTSPOT_SSID: "Balena Device UI"
PWC_HOTSPOT_SSID: "Balena Starter Interface"

## Required system variables ##
DBUS_SYSTEM_BUS_ADDRESS: "unix:path=/host/run/dbus/system_bus_socket"
Expand Down
3 changes: 3 additions & 0 deletions expressjs/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ module.exports = {
],

rules: {
// ESLint
'import/order': 'off',

// AirBnB
'no-shadow': 'off',
'no-use-before-define': 'off',
Expand Down
29 changes: 14 additions & 15 deletions expressjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
"repository": "https://github.com/maggie0002/balena-device-ui",
"scripts": {
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"test": "echo \"No test specified\" && exit 0",
"format": "prettier --write \"**/*.{js,ts,vue,scss,html,md}\" --ignore-path .gitignore",
"formatcheck": "prettier \"**/*.{js,ts,vue,scss,html,md}\" --ignore-path .gitignore --check",
"test": "echo \"No test specified\" && exit 0",
"dev": "nodemon -r tsconfig-paths/register ./src/index.ts",
"oddev": "nodemon -r tsconfig-paths/register ./src/index.ts",
"start": "node ./dist/index.js",
"build": "yarn tsc -p tsconfig.json && tsc-alias -p tsconfig.json"
},
"dependencies": {
"axios": "^0.27.2",
"balena-sdk": "^16.21.0",
"balena-sdk": "^16.25.1",
"compression": "^1.7.4",
"cors": "^2.8.5",
"express": "^5.0.0-beta.1",
Expand All @@ -24,8 +23,8 @@
"fs-extra": "^10.1.0",
"klaw-sync": "^6.0.0",
"lockfile": "^1.0.4",
"systeminformation": "^5.11.16",
"winston": "^3.7.2"
"systeminformation": "^5.12.5",
"winston": "^3.8.1"
},
"devDependencies": {
"@types/compression": "^1.7.2",
Expand All @@ -36,18 +35,18 @@
"@types/fs-extra": "^9.0.13",
"@types/klaw-sync": "^6.0.1",
"@types/lockfile": "^1.0.2",
"@types/node": "^17.0.40",
"@typescript-eslint/eslint-plugin": "^5.25.0",
"@typescript-eslint/parser": "^5.25.0",
"eslint": "^8.15.0",
"@types/node": "^18.7.5",
"@typescript-eslint/eslint-plugin": "^5.33.1",
"@typescript-eslint/parser": "^5.33.1",
"eslint": "^8.22.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"nodemon": "^2.0.16",
"prettier": "^2.6.2",
"ts-node": "^10.7.0",
"tsc-alias": "^1.6.7",
"tsconfig-paths": "^4.0.0",
"typescript": "^4.6.4"
"nodemon": "^2.0.19",
"prettier": "^2.7.1",
"ts-node": "^10.9.1",
"tsc-alias": "^1.7.0",
"tsconfig-paths": "^4.1.0",
"typescript": "^4.7.4"
}
}
4 changes: 2 additions & 2 deletions expressjs/src/boot/setHostname.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import createAxiosInstance from '@/common/axios'
import Logger from '@/common/logger'
import { AxiosResponse } from 'axios'
import fse from 'fs-extra'
import process from 'process'
import createAxiosInstance from '@/common/axios'
import Logger from '@/common/logger'

interface hostConfigHostname {
network: { hostname: string }
Expand Down
2 changes: 1 addition & 1 deletion expressjs/src/common/axios.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import axios, { AxiosError } from 'axios'
import Logger from '@/common/logger'
import axios, { AxiosError } from 'axios'

// Axios instance generator. It allows Axios instances to share interceptors and
// allows instances to be created in the file using it. This means when someone deletes
Expand Down
Loading