Skip to content

Commit dda37b4

Browse files
authored
Add node red dashboard project (#629)
Follow up from #628 Adds [dashboard](https://github.com/PlanktoScope/dashboard/) as a Node-RED project using a git submodule. Why git submodule and not import `dashboard` into this repository? Because it seems Node-RED is having issues with `git` when dealing with higher up repos. Might fix it later but for now this will do. Clicking on a changed file such as ![image](https://github.com/user-attachments/assets/f32875f5-4dee-4df8-b402-58c51ce62e82) results in ![image](https://github.com/user-attachments/assets/8a975e2c-0cf3-4abe-8fdd-37a843554115) for `planktoscopehat` and `adafruithat` projects it's fine as we're used to using `git` cli anyway but for the new dashboard we want all the bells and whistles of Node-RED --- The `enable-developer-mode` script was removed as we don't clear the `.git` folder anymore. It only saved ~100mb and clearing it is causing headaches with submodules.
1 parent 8ccad71 commit dda37b4

File tree

11 files changed

+26
-47
lines changed

11 files changed

+26
-47
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "node-red/projects/dashboard"]
2+
path = node-red/projects/dashboard
3+
url = https://github.com/PlanktoScope/dashboard.git

documentation/docs/community/contribute/tips-and-tricks.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -74,33 +74,17 @@ You can now SSH into your PlanktoScope without username / password (using `ssh $
7474

7575
```sh
7676
cd ~/PlanktoScope
77-
# Enable Developer Mode
78-
./software/distro/setup/planktoscope-app-env/PlanktoScope/enable-developer-mode
7977

8078
# Configure git
8179
git config --global user.email "you@example.com"
8280
git config --global user.name "Your Name"
8381

84-
# [Optional] change the remote
85-
86-
# If you are a contributor to github.com/PlanktoScope/PlanktoScope
87-
git remote set-url origin git@github.com:PlanktoScope/PlanktoScope.git
88-
89-
# If you have your own fork
90-
git remote set-url origin git@github.com:MYUSERNAME/PlanktoScope.git
82+
git fetch origin
83+
git checkout master
9184
```
9285

9386
</details>
9487

95-
You can now use `~/PlanktoScope` as a regular git repository.
96-
97-
```sh
98-
ssh $planktoscope
99-
cd PlanktoScope
100-
git status
101-
git checkout master
102-
```
103-
10488
We recommend developping directly from the PlanktoScope using [Visual Studio Code and the Remote - SSH extension](https://code.visualstudio.com/docs/remote/ssh).
10589
Use `$planktoscope` as the host to connect to and open the `/home/pi/PlanktoScope` directory.
10690

node-red/.config.projects.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
{
22
"projects": {
3-
"planktoscopehat": {},
4-
"adafruithat": {}
3+
"planktoscopehat": {
4+
"credentialSecret": false
5+
},
6+
"adafruithat": {
7+
"credentialSecret": false
8+
},
9+
"dashboard": {
10+
"credentialSecret": false
11+
}
512
},
613
"activeProject": "planktoscopehat"
714
}

node-red/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node-red/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"private": true,
33
"dependencies": {
4+
"@flowfuse/node-red-dashboard": "~1.24.1",
5+
"@flowfuse/node-red-dashboard-2-ui-flowviewer": "~1.0.1",
6+
"node-red-contrib-cron-plus": "~2.1.0",
47
"node-red-contrib-dir2files": "~0.3.0",
58
"node-red-contrib-gpsd": "~1.0.8",
69
"node-red-contrib-python3-function": "^0.0.4",

node-red/projects/dashboard

Submodule dashboard added at f13d67d

node-red/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ module.exports = {
466466

467467
multiplayer: {
468468
/** To enable the Multiplayer feature, set this value to true */
469-
enabled: false
469+
enabled: true
470470
},
471471
},
472472

node-red/setup.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ console.log(`Hardware variant: ${variant}`)
4343
const CONFIG_PROJECT_PATH = path.join(__dirname, ".config.projects.json")
4444

4545
const config = require(CONFIG_PROJECT_PATH)
46-
config.activeProject = variant
4746

48-
fs.writeFileSync(CONFIG_PROJECT_PATH, JSON.stringify(config, null, 4))
47+
if (config.activeProject !== "dashboard") {
48+
config.activeProject = variant
49+
fs.writeFileSync(CONFIG_PROJECT_PATH, JSON.stringify(config, null, 4))
50+
}

software/distro/setup/planktoscope-app-env/PlanktoScope/enable-developer-mode

Lines changed: 0 additions & 18 deletions
This file was deleted.

software/distro/setup/planktoscope-app-env/cleanup.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#!/bin/bash -eux
22
# Cleanup removes unnecessary files from the operating system for a smaller and more secure disk image.
33

4-
# Clear git repo - can be re-init with enable-developer-mode.sh
5-
rm -rf $HOME/PlanktoScope/.git
6-
74
# Clean up any unnecessary apt files
85
sudo apt-get autoremove -y
96
sudo apt-get clean -y

0 commit comments

Comments
 (0)