Skip to content

Commit 85e2b4c

Browse files
authored
Merge pull request #500 from dappnode/v0.2.38
v0.2.38 Release
2 parents 461feef + 940e42b commit 85e2b4c

File tree

432 files changed

+10798
-6469
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

432 files changed

+10798
-6469
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Build test
2+
on:
3+
push:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- run: npx @dappnode/dappnodesdk github-action build
12+
env:
13+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14+
PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }}
15+
PINATA_SECRET_API_KEY: ${{ secrets.PINATA_SECRET_API_KEY }}

.github/workflows/main.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
- run: yarn bootstrap
2323
- run: yarn generate
2424
- run: yarn test
25+
- run: yarn server-mock:check-types
26+
working-directory: packages/admin-ui
2527

2628
integration-test:
2729
runs-on: ubuntu-16.04
@@ -37,15 +39,6 @@ jobs:
3739
- run: yarn generate
3840
- run: yarn test:int
3941

40-
build-test:
41-
runs-on: ubuntu-16.04
42-
name: Build test
43-
if: github.event_name != 'push'
44-
steps:
45-
- name: Checkout
46-
uses: actions/checkout@v2
47-
- run: docker-compose build
48-
4942
release:
5043
name: Release
5144
runs-on: ubuntu-latest

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,40 @@ docker-compose up -d
6060
docker-compose logs -f
6161
```
6262

63+
### Developing
64+
65+
There are 3 different developing modes:
66+
67+
1. Standalone UI: this mode allows developers to have a standalone UI with basic functionality, to develop and test UI elements without connecting to a DAppNode or a mock server. This is a fully static site that will be deployed to Netlify on every PR to speed up the reviewing process of PRs.
68+
69+
```
70+
cd packages/admin-ui
71+
yarn mock-standalone
72+
```
73+
74+
2. Server mock: this mode allow to simulate backend situations, such as cookies and sessions, alerts, or notifications. You should run the UI devserver and a mock backend server with:
75+
76+
```
77+
cd packages/admin-ui
78+
yarn server-mock
79+
```
80+
81+
```
82+
cd packages/admin-ui
83+
yarn mock
84+
```
85+
86+
3. Actual DAPPMANAGER: this mode will connect to your DAppNode's actual DAPPMANAGER, useful to develop and test functionality OS dependant such as the SSH manager, host password manager, etc. You must be connected to your DAppNode via VPN or WIFI.
87+
88+
```
89+
cd packages/admin-ui
90+
yarn start
91+
```
92+
93+
*Note: This mode is not working a the moment since cross-domain cookies are not enabled.*
94+
95+
96+
6397
### Distributing
6498

6599
Now, generate a tar.xz image ([get the xz library](https://tukaani.org/xz/)).

dappnode_package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dappmanager.dnp.dappnode.eth",
3-
"version": "0.2.37",
3+
"version": "0.2.38",
44
"description": "Dappnode package responsible for providing the DappNode Package Manager",
55
"type": "dncore",
66
"architectures": [

docker-compose.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3.4'
1+
version: "3.4"
22
networks:
33
network:
44
driver: bridge
@@ -10,20 +10,21 @@ volumes:
1010
services:
1111
dappmanager.dnp.dappnode.eth:
1212
build: .
13-
image: 'dappmanager.dnp.dappnode.eth:0.2.37'
13+
image: "dappmanager.dnp.dappnode.eth:0.2.38"
1414
container_name: DAppNodeCore-dappmanager.dnp.dappnode.eth
1515
restart: always
1616
volumes:
17-
- '/run/dbus/system_bus_socket:/run/dbus/system_bus_socket'
18-
- 'dappmanagerdnpdappnodeeth_data:/usr/src/app/dnp_repo/'
19-
- '/usr/src/dappnode/DNCORE/:/usr/src/app/DNCORE/'
20-
- '/var/run/docker.sock:/var/run/docker.sock'
21-
- '/etc/hostname:/etc/dappnodename:ro'
17+
- "/run/dbus/system_bus_socket:/run/dbus/system_bus_socket"
18+
- "dappmanagerdnpdappnodeeth_data:/usr/src/app/dnp_repo/"
19+
- "/usr/src/dappnode/DNCORE/:/usr/src/app/DNCORE/"
20+
- "/var/run/docker.sock:/var/run/docker.sock"
21+
- "/etc/hostname:/etc/dappnodename:ro"
2222
environment:
2323
- LOG_LEVEL=info
2424
- WEB3_HOST=
2525
- IPFS_HOST=
2626
- REMOTE_MAINNET_RPC_URL=
27+
- DISABLE_UPNP=
2728
dns: 172.33.1.2
2829
networks:
2930
network:

packages/admin-ui/nodemon.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"watch": ["server-mock", "../dappmanager/src", "src"],
3+
"ext": "js,ts,json",
4+
"ignore": ["*.test.ts"],
5+
"execMap": {
6+
"ts": "ts-node --project server-mock/tsconfig.json"
7+
}
8+
}

packages/admin-ui/package.json

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,27 @@
22
"name": "@dappnode/admin-ui",
33
"version": "0.1.0",
44
"license": "GPL-3.0",
5+
"scripts": {
6+
"start": "REACT_APP_API_TEST=true react-scripts start",
7+
"generate": "cd ../.. && node packages/admin-ui/src/common/validation/generateSchemas.js packages/admin-ui/tsconfig.json packages/admin-ui/src/common/schemas/",
8+
"prebuild": "npm run generate",
9+
"build": "react-scripts build",
10+
"test": "TEST=true react-scripts test --env=jsdom --watchAll=false",
11+
"test:watch": "TEST=true react-scripts test --env=jsdom",
12+
"eject": "react-scripts eject",
13+
"analyze": "npx source-map-explorer build/static/js/main.*",
14+
"lint": "eslint --ext ts,tsx,js,jsx --fix src",
15+
"prettier": "prettier --write 'src/**/*.*'",
16+
"pre-commit": "yarn lint && CI=true yarn test",
17+
"mock": "REACT_APP_API_URL=http://localhost:5000 yarn start",
18+
"server-mock": "PORT=5000 nodemon server-mock/index.ts",
19+
"server-mock:check-types": "tsc --noEmit --project tsconfig.server-mock.json",
20+
"mock-standalone": "REACT_APP_MOCK=true yarn start",
21+
"mock-standalone:build": "REACT_APP_MOCK=true yarn build"
22+
},
523
"dependencies": {
624
"@reduxjs/toolkit": "^1.3.5",
725
"@types/clipboard": "^2.0.1",
8-
"@types/file-saver": "^2.0.1",
926
"@types/jest": "^24.9.1",
1027
"@types/lodash": "^4.14.144",
1128
"@types/node": "^14.0.4",
@@ -21,13 +38,10 @@
2138
"clipboard": "^2.0.1",
2239
"deepmerge": "^2.1.1",
2340
"ethereum-blockies-base64": "^1.0.2",
24-
"file-saver": "^2.0.0",
2541
"is-ipfs": "^0.6.0",
26-
"jquery": "^3.3.1",
2742
"lodash": "^4.17.15",
2843
"mitt": "^2.1.0",
2944
"node-sass": "^4.14.1",
30-
"popper.js": "^1.14.3",
3145
"pretty-bytes": "^5.3.0",
3246
"qrcode.react": "^0.8.0",
3347
"react": "^16.8.5",
@@ -42,43 +56,26 @@
4256
"react-toastify": "^4.1.0",
4357
"redux": "^4.0.0",
4458
"redux-thunk": "^2.3.0",
45-
"reselect": "^3.0.1",
4659
"semver": "^5.5.0",
4760
"socket.io-client": "^2.3.0",
4861
"styled-components": "^4.2.0",
4962
"swr": "^0.2.0",
50-
"tether": "^1.4.4",
5163
"tweetnacl": "^1.0.1",
5264
"tweetnacl-util": "^0.15.0",
5365
"typescript": "^3.7.2",
5466
"typescript-json-schema": "^0.42.0"
5567
},
56-
"scripts": {
57-
"start": "react-scripts start",
58-
"generate": "cd ../.. && node packages/admin-ui/src/common/validation/generateSchemas.js packages/admin-ui/tsconfig.json packages/admin-ui/src/common/schemas/",
59-
"prebuild": "npm run generate",
60-
"build": "react-scripts build",
61-
"gzip": "gzip -r -k build",
62-
"test": "TEST=true react-scripts test --env=jsdom --watchAll=false",
63-
"test:watch": "TEST=true react-scripts test --env=jsdom",
64-
"eject": "react-scripts eject",
65-
"analyze": "npx source-map-explorer build/static/js/main.*",
66-
"lint": "eslint --ext ts,tsx,js,jsx --fix src",
67-
"prettier": "prettier --write 'src/**/*.*'",
68-
"pre-commit": "yarn lint && CI=true yarn test",
69-
"mock": "REACT_APP_API_URL=http://localhost:5000 yarn start",
70-
"server-mock": "PORT=5000 nodemon -w server-mock -w src -e js,ts,json -x ts-node --project server-mock/tsconfig.json server-mock/index.ts"
71-
},
7268
"devDependencies": {
69+
"@dappnode/dappmanager": "^0.1.0",
7370
"@types/cors": "^2.8.6",
7471
"@types/express": "^4.17.6",
72+
"cookie-session": "^1.4.0",
7573
"cors": "^2.8.5",
7674
"eslint-config-prettier": "^4.1.0",
7775
"eslint-plugin-prettier": "^3.0.1",
7876
"express": "^4.17.1",
7977
"nodemon": "^2.0.4",
80-
"prettier": "^1.16.4",
81-
"why-did-you-update": "0.1.1"
78+
"prettier": "^1.16.4"
8279
},
8380
"browserslist": {
8481
"production": [
Lines changed: 25 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,25 @@
1-
import { EventEmitter } from "events";
2-
import {
3-
ChainData,
4-
ProgressLog,
5-
UserActionLog,
6-
PackageNotification,
7-
DirectoryItem,
8-
InstalledPackageData
9-
} from "../src/common/types";
10-
11-
/** HOW TO:
12-
* - ON:
13-
* eventBus.on(eventBusTag.logUi, (data) => {
14-
* doStuff(data);
15-
* });
16-
*
17-
* - EMIT:
18-
* eventBus.emit(eventBusTag.logUi, data);
19-
*/
20-
class MyEmitter extends EventEmitter {}
21-
22-
const eventBus = new MyEmitter();
23-
24-
/**
25-
* Offer a default mechanism to run listeners within a try/catch block
26-
*/
27-
28-
function eventBusOnSafe<T>(
29-
eventName: string,
30-
listener: (arg: T) => void
31-
): void {
32-
eventBus.on(eventName, (arg: T) => {
33-
try {
34-
listener(arg);
35-
} catch (e) {
36-
console.error("Error on event", eventName, e);
37-
}
38-
});
39-
}
40-
41-
function eventBusOnSafeAsync<T>(
42-
eventName: string,
43-
listener: (arg: T) => void
44-
): void {
45-
eventBus.on(eventName, async (arg: T) => {
46-
try {
47-
await listener(arg);
48-
} catch (e) {
49-
console.error("Error on event", eventName, e);
50-
}
51-
});
52-
}
53-
54-
/* eslint-disable-next-line @typescript-eslint/explicit-function-return-type */
55-
const busFactoryNoArgAsync = (event: string) => ({
56-
on: (listener: () => Promise<void>): void =>
57-
eventBusOnSafeAsync(event, listener),
58-
emit: (): void => {
59-
eventBus.emit(event);
60-
}
61-
});
62-
/* eslint-disable-next-line @typescript-eslint/explicit-function-return-type */
63-
const busFactoryNoArg = (event: string) => ({
64-
on: (listener: () => void): void => eventBusOnSafe(event, listener),
65-
emit: (): void => {
66-
eventBus.emit(event);
67-
}
68-
});
69-
// const busFactoryAsync = <T>(event: string) => ({
70-
// on: (listener: (arg: T) => Promise<void>) =>
71-
// eventBusOnSafeAsync<T>(event, listener),
72-
// emit: (arg: T): void => {
73-
// eventBus.emit(event, arg);
74-
// }
75-
// });
76-
/* eslint-disable-next-line @typescript-eslint/explicit-function-return-type */
77-
const busFactory = <T>(event: string) => ({
78-
on: (listener: (arg: T) => void): void => eventBusOnSafe<T>(event, listener),
79-
emit: (arg: T): void => {
80-
eventBus.emit(event, arg);
81-
}
82-
});
83-
84-
// call: "INTERNAL_CALL",
85-
86-
export const chainData = busFactory<ChainData[]>("CHAIN_DATAS");
87-
type PackageModifiedType = { dnpNames: string[]; removed?: boolean };
88-
export const packagesModified = busFactory<PackageModifiedType>(
89-
"PACKAGE_MODIFIED"
90-
);
91-
export const directory = busFactory<DirectoryItem[]>("DIRECTORY");
92-
export const packages = busFactory<InstalledPackageData[]>("PACKAGES");
93-
export const logUi = busFactory<ProgressLog>("LOGUI");
94-
export const logUserAction = busFactory<UserActionLog>("LOG_USER_ACTION");
95-
export const notification = busFactory<PackageNotification>("NOTIFICATION");
96-
97-
// Requests (without argument)
98-
export const requestChainData = busFactoryNoArg("REQUEST_CHAIN_DATA");
99-
export const requestAutoUpdateData = busFactoryNoArgAsync(
100-
"REQUEST_AUTO_UPDATE_DATA"
101-
);
102-
export const requestDevices = busFactoryNoArgAsync("REQUEST_DEVICES");
103-
export const requestPackages = busFactoryNoArgAsync("REQUEST_PACKAGES");
104-
export const requestSystemInfo = busFactoryNoArgAsync("REQUEST_SYSTEM_INFO");
105-
export const runNatRenewal = busFactoryNoArg("RUN_NAT_RENEWAL");
106-
export const initializedDb = busFactoryNoArg("INITIALIZED_DB");
107-
export const runEthClientInstaller = busFactoryNoArg(
108-
"RUN_ETH_MULTI_CLIENT_WATCHER"
109-
);
1+
import { EventBus } from "@dappnode/dappmanager/src/eventBus";
2+
3+
// Mock placeholder empty subscription object to allow compilation
4+
const emptySubscription = { on: () => {}, emit: () => {} };
5+
6+
export const eventBus: EventBus = {
7+
chainData: emptySubscription,
8+
directory: emptySubscription,
9+
logUi: emptySubscription,
10+
logUserAction: emptySubscription,
11+
notification: emptySubscription,
12+
packages: emptySubscription,
13+
packagesModified: emptySubscription,
14+
telegramStatusChanged: emptySubscription,
15+
16+
// Events without arguments
17+
initializedDb: emptySubscription,
18+
requestAutoUpdateData: emptySubscription,
19+
requestChainData: emptySubscription,
20+
requestDevices: emptySubscription,
21+
requestPackages: emptySubscription,
22+
requestSystemInfo: emptySubscription,
23+
runEthClientInstaller: emptySubscription,
24+
runNatRenewal: emptySubscription
25+
};

0 commit comments

Comments
 (0)