mirror of
https://github.com/fluencelabs/dashboard
synced 2024-12-04 23:30:20 +00:00
New builtins (#10)
This commit is contained in:
parent
85957413e8
commit
891237b373
119
package-lock.json
generated
119
package-lock.json
generated
@ -1111,7 +1111,6 @@
|
||||
"version": "7.12.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.5.tgz",
|
||||
"integrity": "sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"regenerator-runtime": "^0.13.4"
|
||||
}
|
||||
@ -1222,17 +1221,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"@fluencelabs/aquamarine-stepper": {
|
||||
"version": "0.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aquamarine-stepper/-/aquamarine-stepper-0.3.4.tgz",
|
||||
"integrity": "sha512-0NPg9dWvANtc3If8C8O8XjKwzMCq2492lA73faKJdCwUv7m+xHX9G3l6UJULTfV1T4mWVtMQZIKopNOlRYSrKA=="
|
||||
"@fluencelabs/aquamarine-interpreter": {
|
||||
"version": "0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aquamarine-interpreter/-/aquamarine-interpreter-0.7.0.tgz",
|
||||
"integrity": "sha512-2GPsOXSakpRPJFiKAcylK6Q/UhYHrQgrs8a1GCgr/OlrQEYkC4PY4HxnrdErt8fzTUDBHH4veKHKGM+IByYhxA=="
|
||||
},
|
||||
"@fluencelabs/fluence": {
|
||||
"version": "0.9.7",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.9.7.tgz",
|
||||
"integrity": "sha512-z9l9+nzJASnNfJpOE9iAX/iRbKrFMgZHIFqC0qYTHm0GFEMQe1YApnWNYXCS49f9tJlJte9TclaJ/f5FFwOrjg==",
|
||||
"version": "0.9.25",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.9.25.tgz",
|
||||
"integrity": "sha512-LZRr9qDkkLgxmoQIhlKndPkF/9kX+JiwEmfla8tpU1xXfnz/N+HlE82kJCYZk0b5KHz756SEFYF7amW/uhpArQ==",
|
||||
"requires": {
|
||||
"@fluencelabs/aquamarine-stepper": "0.3.4",
|
||||
"@fluencelabs/aquamarine-interpreter": "^0.7.0",
|
||||
"async": "3.2.0",
|
||||
"base64-js": "1.3.1",
|
||||
"bs58": "4.0.1",
|
||||
@ -1478,6 +1477,11 @@
|
||||
"integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=",
|
||||
"dev": true
|
||||
},
|
||||
"@types/lodash": {
|
||||
"version": "4.14.168",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.168.tgz",
|
||||
"integrity": "sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q=="
|
||||
},
|
||||
"@types/minimatch": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
|
||||
@ -1577,6 +1581,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"@types/yup": {
|
||||
"version": "0.29.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/yup/-/yup-0.29.11.tgz",
|
||||
"integrity": "sha512-9cwk3c87qQKZrT251EDoibiYRILjCmxBvvcb4meofCmx1vdnNcR9gyildy5vOHASpOKMsn42CugxUvcwK5eu1g==",
|
||||
"dev": true
|
||||
},
|
||||
"@typescript-eslint/eslint-plugin": {
|
||||
"version": "4.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.9.0.tgz",
|
||||
@ -1910,6 +1920,12 @@
|
||||
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@zxing/text-encoding": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@zxing/text-encoding/-/text-encoding-0.9.0.tgz",
|
||||
"integrity": "sha512-U/4aVJ2mxI0aDNI8Uq0wEhMgY+u4CNtEb0om3+y3+niDAsoTCOB33UF0sxpzqzdqXLqmvc+vZyAt4O8pPdfkwA==",
|
||||
"optional": true
|
||||
},
|
||||
"abab": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz",
|
||||
@ -2740,9 +2756,9 @@
|
||||
}
|
||||
},
|
||||
"bl": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.0.3.tgz",
|
||||
"integrity": "sha512-fs4G6/Hu4/EE+F75J8DuN/0IpQqNjAdC7aEQv7Qt8MHGUH7Ckv2MwTEEeN9QehD0pfIDkMI1bkHYkKy7xHyKIg==",
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
||||
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
||||
"requires": {
|
||||
"buffer": "^5.5.0",
|
||||
"inherits": "^2.0.4",
|
||||
@ -3211,9 +3227,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"chai": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz",
|
||||
"integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==",
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/chai/-/chai-4.3.0.tgz",
|
||||
"integrity": "sha512-/BFd2J30EcOwmdOgXvVsmM48l0Br0nmZPlO0uOW4XKh6kpsUumRXBgPV+IlaqFaqr9cYbeoZAM1Npx0i4A+aiA==",
|
||||
"requires": {
|
||||
"assertion-error": "^1.1.0",
|
||||
"check-error": "^1.0.2",
|
||||
@ -8439,9 +8455,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"it-all": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/it-all/-/it-all-1.0.4.tgz",
|
||||
"integrity": "sha512-7K+gjHHzZ7t+bCkrtulYiow35k3UgqH7miC+iUa9RGiyDRXJ6hVDeFsDrnWrlscjrkLFOJRKHxNOke4FNoQnhw=="
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/it-all/-/it-all-1.0.5.tgz",
|
||||
"integrity": "sha512-ygD4kA4vp8fi+Y+NBgEKt6W06xSbv6Ub/0V8d1r3uCyJ9Izwa1UspkIOlqY9fOee0Z1w3WRo1+VWyAU4DgtufA=="
|
||||
},
|
||||
"it-buffer": {
|
||||
"version": "0.1.2",
|
||||
@ -8453,9 +8469,9 @@
|
||||
}
|
||||
},
|
||||
"it-drain": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/it-drain/-/it-drain-1.0.3.tgz",
|
||||
"integrity": "sha512-KxwHBEpWW+0/EkGCOPR2MaHanvBW2A76tOC5CiitoJGLd8J56FxM6jJX3uow20v5qMidX5lnKgwH5oCIyYDszQ=="
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/it-drain/-/it-drain-1.0.4.tgz",
|
||||
"integrity": "sha512-coB7mcyZ4lWBQKoQGJuqM+P94pvpn2T3KY27vcVWPqeB1WmoysRC76VZnzAqrBWzpWcoEJMjZ+fsMBslxNaWfQ=="
|
||||
},
|
||||
"it-glob": {
|
||||
"version": "0.0.8",
|
||||
@ -8565,9 +8581,9 @@
|
||||
}
|
||||
},
|
||||
"it-pushable": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-1.4.1.tgz",
|
||||
"integrity": "sha512-XOnbDxD5YoiVtL/vobQW/ZGkzQzJv9Fs9TJlO2McfkIbolBBO2IGY6XjE1ooLfw8gQeH8XbgpoLajtPUVO8Qew==",
|
||||
"version": "1.4.2",
|
||||
"resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-1.4.2.tgz",
|
||||
"integrity": "sha512-vVPu0CGRsTI8eCfhMknA7KIBqqGFolbRx+1mbQ6XuZ7YCz995Qj7L4XUviwClFunisDq96FdxzF5FnAbw15afg==",
|
||||
"requires": {
|
||||
"fast-fifo": "^1.0.0"
|
||||
}
|
||||
@ -9333,8 +9349,12 @@
|
||||
"lodash": {
|
||||
"version": "4.17.20",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
|
||||
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
|
||||
},
|
||||
"lodash-es": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
|
||||
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="
|
||||
},
|
||||
"lodash._reinterpolate": {
|
||||
"version": "3.0.0",
|
||||
@ -9948,6 +9968,11 @@
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz",
|
||||
"integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ=="
|
||||
},
|
||||
"nanoclone": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/nanoclone/-/nanoclone-0.2.1.tgz",
|
||||
"integrity": "sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA=="
|
||||
},
|
||||
"nanoid": {
|
||||
"version": "3.1.18",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.18.tgz",
|
||||
@ -10003,9 +10028,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"nise": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/nise/-/nise-4.0.4.tgz",
|
||||
"integrity": "sha512-bTTRUNlemx6deJa+ZyoCUTRvH3liK5+N6VQZ4NIw90AgDXY6iPnsqplNFf6STcj+ePk0H/xqxnP75Lr0J0Fq3A==",
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/nise/-/nise-4.1.0.tgz",
|
||||
"integrity": "sha512-eQMEmGN/8arp0xsvGoQ+B1qvSkR73B1nWSCh7nOt5neMCtwcQVYQGdzQMhcNscktTsWB54xnlSQFzOAPJD8nXA==",
|
||||
"requires": {
|
||||
"@sinonjs/commons": "^1.7.0",
|
||||
"@sinonjs/fake-timers": "^6.0.0",
|
||||
@ -11884,6 +11909,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"property-expr": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/property-expr/-/property-expr-2.0.4.tgz",
|
||||
"integrity": "sha512-sFPkHQjVKheDNnPvotjQmm3KD3uk1fWKUN7CrpdbwmUx3CrG3QiM8QpTSimvig5vTXmTvjz7+TDvXOI9+4rkcg=="
|
||||
},
|
||||
"protocol-buffers-schema": {
|
||||
"version": "3.5.1",
|
||||
"resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.5.1.tgz",
|
||||
@ -12544,8 +12574,7 @@
|
||||
"regenerator-runtime": {
|
||||
"version": "0.13.7",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz",
|
||||
"integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==",
|
||||
"dev": true
|
||||
"integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew=="
|
||||
},
|
||||
"regenerator-transform": {
|
||||
"version": "0.14.5",
|
||||
@ -14754,6 +14783,11 @@
|
||||
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==",
|
||||
"dev": true
|
||||
},
|
||||
"toposort": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz",
|
||||
"integrity": "sha1-riF2gXXRVZ1IvvNUILL0li8JwzA="
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
|
||||
@ -15729,9 +15763,12 @@
|
||||
}
|
||||
},
|
||||
"web-encoding": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/web-encoding/-/web-encoding-1.0.6.tgz",
|
||||
"integrity": "sha512-26wEnRPEFAc5d5lmH1Q/DuvWEYsRF1D2alX2jlKpdmqv7cj+BbANL7Xlcl9r4s72Eg9kItZa9RWVbBMC9dMv4w=="
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/web-encoding/-/web-encoding-1.1.0.tgz",
|
||||
"integrity": "sha512-KzYonGdJnZB3qvhK8hKca5qXk/wp+hgwGNTY1TnqtF2CzDzpN8szOC3ejhX9+wbhCq3vQs/TjM8BykS1kor0lQ==",
|
||||
"requires": {
|
||||
"@zxing/text-encoding": "0.9.0"
|
||||
}
|
||||
},
|
||||
"webpack": {
|
||||
"version": "5.7.0",
|
||||
@ -17463,6 +17500,20 @@
|
||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
||||
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
|
||||
"dev": true
|
||||
},
|
||||
"yup": {
|
||||
"version": "0.32.9",
|
||||
"resolved": "https://registry.npmjs.org/yup/-/yup-0.32.9.tgz",
|
||||
"integrity": "sha512-Ci1qN+i2H0XpY7syDQ0k5zKQ/DoxO0LzPg8PAR/X4Mpj6DqaeCoIYEEjDJwhArh3Fa7GWbQQVDZKeXYlSH4JMg==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.10.5",
|
||||
"@types/lodash": "^4.14.165",
|
||||
"lodash": "^4.17.20",
|
||||
"lodash-es": "^4.17.15",
|
||||
"nanoclone": "^0.2.1",
|
||||
"property-expr": "^2.0.4",
|
||||
"toposort": "^2.0.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,11 +20,13 @@
|
||||
},
|
||||
"homepage": "https://github.com/fluencelabs/fluence-admin#readme",
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence": "0.9.7",
|
||||
"@fluencelabs/fluence": "0.9.25",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.8",
|
||||
"tachyons": "^4.12.0"
|
||||
"tachyons": "^4.12.0",
|
||||
"yup": "^0.32.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/yup": "^0.29.11",
|
||||
"@babel/core": "7.12.9",
|
||||
"@typescript-eslint/eslint-plugin": "^4.9.0",
|
||||
"@typescript-eslint/parser": "^4.9.0",
|
||||
|
@ -15,13 +15,13 @@ air peerId relayId =
|
||||
|
||||
airScript =
|
||||
seq
|
||||
(callBI "relayId" ( "dht", "neighborhood" ) [ "clientId" ] (Just "peers"))
|
||||
(callBI "relayId" ( "kad", "neighborhood" ) [ "clientId" ] (Just "peers"))
|
||||
(par
|
||||
(relayEvent "peers_discovered" [ "relayId", "peers" ])
|
||||
(fold "peers" "p" <|
|
||||
par
|
||||
(seq
|
||||
(callBI "p" ( "dht", "neighborhood" ) [ "clientId" ] (Just "morePeers"))
|
||||
(callBI "p" ( "kad", "neighborhood" ) [ "clientId" ] (Just "morePeers"))
|
||||
(relayEvent "peers_discovered" [ "p", "morePeers" ])
|
||||
)
|
||||
(next "p")
|
||||
|
@ -54,11 +54,11 @@ findAndAskNeighboursSchema =
|
||||
seq
|
||||
(callBI "relayId" ( "op", "identity" ) [] Nothing)
|
||||
(seq
|
||||
(callBI "relayId" ( "dht", "neighborhood" ) [ "clientId" ] (Just "neigh"))
|
||||
(callBI "relayId" ( "kad", "neighborhood" ) [ "clientId" ] (Just "neigh"))
|
||||
(fold "neigh" "n" <|
|
||||
par
|
||||
(seq
|
||||
(callBI "n" ( "dht", "neighborhood" ) [ "clientId" ] (Just "moreNeigh"))
|
||||
(callBI "n" ( "kad", "neighborhood" ) [ "clientId" ] (Just "moreNeigh"))
|
||||
(fold "moreNeigh" "mp" <|
|
||||
par
|
||||
(askAllAndSend "mp")
|
||||
@ -115,14 +115,14 @@ air peerId relayId peers =
|
||||
askAllAndSend : String -> Air
|
||||
askAllAndSend var =
|
||||
seq
|
||||
(callBI var ( "op", "identify" ) [] (Just "ident"))
|
||||
(callBI var ( "peer", "identify" ) [] (Just "ident"))
|
||||
(seq
|
||||
(callBI var ( "dist", "get_blueprints" ) [] (Just "blueprints"))
|
||||
(callBI var ( "dist", "list_blueprints" ) [] (Just "blueprints"))
|
||||
(seq
|
||||
(callBI var ( "dist", "get_modules" ) [] (Just "modules"))
|
||||
(callBI var ( "dist", "list_modules" ) [] (Just "modules"))
|
||||
(seq
|
||||
(callBI var ( "srv", "get_interfaces" ) [] (Just "interfaces"))
|
||||
(relayEvent "all_info" [ var, "ident", "interfaces", "blueprints", "modules" ])
|
||||
(callBI var ( "srv", "list" ) [] (Just "services"))
|
||||
(relayEvent "all_info" [ var, "ident", "services", "blueprints", "modules" ])
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -14,6 +14,7 @@ import Modules.Model exposing (Module)
|
||||
import Msg exposing (Msg(..))
|
||||
import Palette exposing (classes, darkRed, redFont)
|
||||
import Service.Model exposing (Interface)
|
||||
import List.Unique exposing (..)
|
||||
|
||||
|
||||
view : Model -> String -> Html Msg
|
||||
@ -49,8 +50,15 @@ blueprintToInfo model id =
|
||||
case Dict.get id model.blueprints of
|
||||
Just bp ->
|
||||
let
|
||||
hashes = bp.dependencies
|
||||
|> List.map (\d -> String.split ":" d)
|
||||
|> List.map (\p -> Maybe.withDefault [] (List.tail p))
|
||||
|> List.map (\p -> Maybe.withDefault "" (List.head p))
|
||||
modules =
|
||||
bp.dependencies |> List.map (\d -> Dict.get d model.modules) |> List.filterMap identity
|
||||
modulesByHash =
|
||||
hashes |> List.map (\d -> Dict.get d model.modulesByHash) |> List.filterMap identity
|
||||
m = List.Unique.filterDuplicates (List.concat [modules, modulesByHash])
|
||||
in
|
||||
Just
|
||||
{ name = bp.name
|
||||
@ -60,7 +68,7 @@ blueprintToInfo model id =
|
||||
, description = getBlueprintDescription bp.name
|
||||
, website = "https://github.com/fluencelabs/"
|
||||
, blueprint = bp
|
||||
, modules = modules
|
||||
, modules = m
|
||||
, openedModule = model.toggledInterface
|
||||
}
|
||||
|
||||
@ -82,9 +90,10 @@ viewInfo blueprintInfo =
|
||||
, div [ classes "fl w-100 w-80-ns mv3" ] [ span [ classes "fl w-100 black lucida pv1" ] [ text blueprintInfo.description ] ]
|
||||
, div [ classes "fl w-100 w-20-ns gray-font mv3" ] [ text "MODULES" ]
|
||||
, div [ classes "fl w-100 w-80-ns mv3" ]
|
||||
(blueprintInfo.modules
|
||||
|> List.map (\m -> viewToggledInterface (checkToggle m.name) m.name m.interface)
|
||||
)
|
||||
[text (String.join ", " (blueprintInfo.modules |> List.map (\m -> m.name)))]
|
||||
--(blueprintInfo.modules
|
||||
-- |> List.map (\m -> viewToggledInterface (checkToggle m.name) m.name)
|
||||
--)
|
||||
]
|
||||
|
||||
|
||||
@ -93,28 +102,29 @@ alwaysPreventDefault msg =
|
||||
{ message = msg, stopPropagation = True, preventDefault = True }
|
||||
|
||||
|
||||
viewToggledInterface : Bool -> String -> Interface -> Html Msg
|
||||
viewToggledInterface isOpen name interface =
|
||||
--viewToggledInterface : Bool -> String -> Interface -> Html Msg
|
||||
viewToggledInterface : Bool -> String -> Html Msg
|
||||
viewToggledInterface isOpen name =
|
||||
let
|
||||
interfaceViewEl =
|
||||
if isOpen then
|
||||
[ div [ classes "fl w-100 ph3" ] (interfaceView interface) ]
|
||||
|
||||
--[ div [ classes "fl w-100 ph3" ] (interfaceView interface) ]
|
||||
[]
|
||||
else
|
||||
[]
|
||||
in
|
||||
div []
|
||||
([ div [ classes "fl w-100 light-shadow bg-near-white pa2 mv2 pointer", onClick (ToggleInterface name) ]
|
||||
[ span [ classes "fl mh2 pv1 tldib v-mid dib v-mid" ] [ text name ]
|
||||
, a [ attribute "href" ("/module/" ++ name), classes "fl dib v-mid mt1" ] [ img [ attribute "src" "/images/link.svg" ] [] ]
|
||||
, div [ classes "fl o-40 f4 fr pr3 dib v-mid" ]
|
||||
[ if isOpen then
|
||||
text "▲"
|
||||
|
||||
else
|
||||
text "▼"
|
||||
--, a [ attribute "href" ("/module/" ++ name), classes "fl dib v-mid mt1" ] [ img [ attribute "src" "/images/link.svg" ] [] ]
|
||||
--, div [ classes "fl o-40 f4 fr pr3 dib v-mid" ]
|
||||
-- [ if isOpen then
|
||||
-- text "▲"
|
||||
--
|
||||
-- else
|
||||
-- text "▼"
|
||||
-- ]
|
||||
]
|
||||
]
|
||||
]
|
||||
++ interfaceViewEl
|
||||
--++ interfaceViewEl
|
||||
)
|
||||
|
@ -6,4 +6,4 @@ import AirScripts.CallPeers
|
||||
|
||||
air : String -> String -> List String -> Air
|
||||
air peerId relayId peers =
|
||||
AirScripts.CallPeers.air peerId relayId ( "blueprints_discovered", "dist", "get_blueprints" ) peers
|
||||
AirScripts.CallPeers.air peerId relayId ( "blueprints_discovered", "dist", "list_blueprints" ) peers
|
||||
|
@ -42,6 +42,7 @@ modulesDescription =
|
||||
, ( "curl_adapter", { site = "https://github.com/fluencelabs/fce/tree/master/examples/url-downloader/facade", description = "Adapter module for cURL CLI utility" } )
|
||||
, ( "url_downloader", { site = "https://github.com/fluencelabs/fce/tree/master/examples/url-downloader/facade", description = "Adapter module for cURL CLI utility" } )
|
||||
, ( "facade_url_downloader", { site = "https://github.com/fluencelabs/fce/tree/master/examples/url-downloader/facade", description = "Adapter module for cURL CLI utility" } )
|
||||
, ( "curl_template", { site = "https://github.com/fluencelabs/examples/tree/main/curl_template", description = "Template service to start hacking on Fluence with curl" } )
|
||||
]
|
||||
|
||||
|
||||
@ -53,4 +54,7 @@ blueprintsDescription =
|
||||
, ( "User List", { description = "Basically an address book. Used in the Chat application to store chat users" } )
|
||||
, ( "Redis", { description = "Popular NoSQL K/V storage compiled to WebAssembly, stores data in memory" } )
|
||||
, ( "URL Downloader", { description = "cURL adapter, allows to download anything by URL" } )
|
||||
, ( "history", { description = "Stores message log, used in History service" } )
|
||||
, ( "userlist", { description = "Address book implementation module, used in User List service" } )
|
||||
, ( "curl_template", { description = "Template service to start hacking on Fluence with curl" } )
|
||||
]
|
||||
|
@ -30,7 +30,7 @@ toInstance peerId identify blueprints service =
|
||||
--|> Maybe.andThen List.head
|
||||
|> Maybe.withDefault "unknown"
|
||||
in
|
||||
{ name = name, blueprintId = blueprintId, instance = service.service_id, peerId = peerId, ip = ip }
|
||||
{ name = name, blueprintId = blueprintId, instance = service.id, peerId = peerId, ip = ip }
|
||||
|
||||
|
||||
view : Model -> (Service -> Bool) -> ( Int, Html msg )
|
||||
|
@ -54,6 +54,7 @@ init flags url key =
|
||||
, page = r
|
||||
, discoveredPeers = Dict.empty
|
||||
, modules = Dict.empty
|
||||
, modulesByHash = Dict.empty
|
||||
, blueprints = Dict.empty
|
||||
, toggledInterface = Nothing
|
||||
, knownPeers = flags.knownPeers
|
||||
|
@ -53,6 +53,7 @@ type alias Model =
|
||||
, page : Route
|
||||
, discoveredPeers : Dict String PeerData
|
||||
, modules : Dict String Module
|
||||
, modulesByHash : Dict String Module
|
||||
, blueprints : Dict String Blueprint
|
||||
, toggledInterface : Maybe String
|
||||
, knownPeers : List String
|
||||
|
@ -82,7 +82,10 @@ empty =
|
||||
viewInfo : ModuleViewInfo -> Html msg
|
||||
viewInfo moduleInfo =
|
||||
article [ classes "cf" ]
|
||||
[ div [ classes "fl w-100 w-20-ns gray mv3" ] [ text "AUTHOR" ]
|
||||
[ div [ classes "fl w-100 w-20-ns gray mv3" ] [ text "HASH" ]
|
||||
, div [ classes "fl w-100 w-80-ns mv3" ]
|
||||
[ span [ classes "fl w-100 black b lucida" ] [ text moduleInfo.moduleInfo.hash ] ]
|
||||
, div [ classes "fl w-100 w-20-ns gray mv3" ] [ text "AUTHOR" ]
|
||||
, div [ classes "fl w-100 w-80-ns mv3" ]
|
||||
[ span [ classes "fl w-100 black b lucida" ] [ text moduleInfo.author ] ]
|
||||
, div [ classes "fl w-100 w-20-ns gray mv3" ] [ text "WEBSITE" ]
|
||||
@ -96,7 +99,7 @@ viewInfo moduleInfo =
|
||||
, div [ classes "fl w-100 w-20-ns gray mv3" ] [ text "DESCRIPTION" ]
|
||||
, div [ classes "fl w-100 w-80-ns mv3 lucida" ]
|
||||
[ span [ classes "fl w-100 black", property "innerHTML" (string " 123") ] [ text moduleInfo.description ] ]
|
||||
, div [ classes "fl w-100 w-20-ns gray mv3" ] [ text "INTERFACE" ]
|
||||
, div [ classes "fl w-100 w-80-ns mv3" ]
|
||||
[ span [ classes "fl w-100 black" ] (interfaceView moduleInfo.moduleInfo.interface) ]
|
||||
--, div [ classes "fl w-100 w-20-ns gray mv3" ] [ text "INTERFACE" ]
|
||||
--, div [ classes "fl w-100 w-80-ns mv3" ]
|
||||
-- [ span [ classes "fl w-100 black" ] (interfaceView moduleInfo.moduleInfo.interface) ]
|
||||
]
|
||||
|
@ -6,4 +6,4 @@ import AirScripts.CallPeers
|
||||
|
||||
air : String -> String -> List String -> Air
|
||||
air peerId relayId peers =
|
||||
AirScripts.CallPeers.air peerId relayId ( "modules_discovered", "dist", "get_modules" ) peers
|
||||
AirScripts.CallPeers.air peerId relayId ( "modules_discovered", "dist", "list_modules" ) peers
|
||||
|
@ -5,7 +5,8 @@ import Service.Model exposing (Interface)
|
||||
|
||||
type alias Module =
|
||||
{ name : String
|
||||
, interface : Interface
|
||||
, hash: String
|
||||
--, interface : Interface
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,4 +6,4 @@ import AirScripts.CallPeers
|
||||
|
||||
air : String -> String -> List String -> Air
|
||||
air peerId relayId peers =
|
||||
AirScripts.CallPeers.air peerId relayId ( "peer_identity", "op", "identify" ) peers
|
||||
AirScripts.CallPeers.air peerId relayId ( "peer_identity", "peer", "identify" ) peers
|
||||
|
@ -6,4 +6,4 @@ import AirScripts.CallPeers
|
||||
|
||||
air : String -> String -> List String -> Air
|
||||
air peerId relayId peers =
|
||||
AirScripts.CallPeers.air peerId relayId ( "services_discovered", "srv", "get_interfaces" ) peers
|
||||
AirScripts.CallPeers.air peerId relayId ( "services_discovered", "srv", "list" ) peers
|
||||
|
@ -22,7 +22,8 @@ type alias Interface =
|
||||
|
||||
|
||||
type alias Service =
|
||||
{ service_id : String
|
||||
{ id : String
|
||||
, blueprint_id : String
|
||||
, interface : Interface
|
||||
--, interface : Interface
|
||||
, owner_id : String
|
||||
}
|
||||
|
@ -117,12 +117,18 @@ updateModel model peer identify services modules blueprints =
|
||||
moduleDict =
|
||||
modules |> List.map (\m -> ( m.name, m )) |> Dict.fromList
|
||||
|
||||
moduleDictByHash =
|
||||
modules |> List.map (\m -> ( m.hash, m )) |> Dict.fromList
|
||||
|
||||
blueprintDict =
|
||||
blueprints |> List.map (\b -> ( b.id, b )) |> Dict.fromList
|
||||
|
||||
updatedModules =
|
||||
Dict.union moduleDict model.modules
|
||||
|
||||
updatedModulesByHash =
|
||||
Dict.union moduleDictByHash model.modulesByHash
|
||||
|
||||
updatedBlueprints =
|
||||
Dict.union blueprintDict model.blueprints
|
||||
|
||||
@ -132,4 +138,4 @@ updateModel model peer identify services modules blueprints =
|
||||
updated =
|
||||
Dict.insert peer newData model.discoveredPeers
|
||||
in
|
||||
{ model | discoveredPeers = updated, modules = updatedModules, blueprints = updatedBlueprints }
|
||||
{ model | discoveredPeers = updated, modules = updatedModules, modulesByHash = updatedModulesByHash, blueprints = updatedBlueprints }
|
||||
|
35
src/index.ts
35
src/index.ts
@ -22,10 +22,11 @@ import { Node, dev, testNet } from '@fluencelabs/fluence-network-environment';
|
||||
import { createClient, generatePeerId, Particle, sendParticle, subscribeToEvent } from '@fluencelabs/fluence';
|
||||
import { Elm } from './Main.elm';
|
||||
import * as serviceWorker from './serviceWorker';
|
||||
import {EventType, eventType} from "./types";
|
||||
|
||||
const relayIdx = 3;
|
||||
|
||||
const relays: Node[] = testNet;
|
||||
const relays: Node[] = dev;
|
||||
// const relays: Node[] = dev;
|
||||
|
||||
function genFlags(peerId: string): any {
|
||||
@ -41,10 +42,10 @@ function event(
|
||||
name: string,
|
||||
peer: string,
|
||||
peers?: string[],
|
||||
identify?: string[],
|
||||
identify?: any,
|
||||
services?: any[],
|
||||
blueprints?: string[],
|
||||
modules?: string[],
|
||||
modules?: any[],
|
||||
blueprints?: any[],
|
||||
) {
|
||||
if (!peers) {
|
||||
peers = null;
|
||||
@ -67,10 +68,10 @@ function event(
|
||||
/* eslint-enable */
|
||||
|
||||
(async () => {
|
||||
log.setLevel('silent')
|
||||
log.setLevel('silent');
|
||||
const pid = await generatePeerId();
|
||||
const flags = genFlags(pid.toB58String());
|
||||
console.log("connect with client: " + pid.toB58String())
|
||||
console.log(`connect with client: ${pid.toB58String()}`);
|
||||
|
||||
// If the relay is ever changed, an event shall be sent to elm
|
||||
const client = await createClient(relays[relayIdx].multiaddr, pid);
|
||||
@ -90,7 +91,23 @@ function event(
|
||||
|
||||
subscribeToEvent(client, 'event', 'all_info', (args, _tetraplets) => {
|
||||
try {
|
||||
app.ports.eventReceiver.send(event('all_info', args[0], undefined, args[1], args[2], args[3], args[4]));
|
||||
let peerId = args[0];
|
||||
let identify = args[1];
|
||||
let services = args[2];
|
||||
let blueprints = args[3];
|
||||
let modules = args[4];
|
||||
let eventRaw = {
|
||||
peerId: peerId,
|
||||
identify: identify,
|
||||
services: services,
|
||||
blueprints: blueprints,
|
||||
modules: modules,
|
||||
}
|
||||
|
||||
const inputEventRaw: any = eventType.cast(eventRaw);
|
||||
const inputEvent = inputEventRaw as EventType;
|
||||
|
||||
app.ports.eventReceiver.send(event('all_info', inputEvent.peerId, undefined, inputEvent.identify, inputEvent.services, inputEvent.modules, inputEvent.blueprints));
|
||||
} catch (err) {
|
||||
log.error('Elm eventreceiver failed: ', err);
|
||||
}
|
||||
@ -108,7 +125,7 @@ function event(
|
||||
serviceWorker.unregister();
|
||||
|
||||
function setLogLevel(level: any) {
|
||||
log.setLevel(level)
|
||||
log.setLevel(level);
|
||||
}
|
||||
|
||||
declare global {
|
||||
@ -118,4 +135,4 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
window.setLogLevel = setLogLevel
|
||||
window.setLogLevel = setLogLevel;
|
||||
|
@ -1,93 +0,0 @@
|
||||
export const SCRIPT: string = `
|
||||
(seq
|
||||
(call %init_peer_id% ("" "load") ["relayId"] relayId)
|
||||
(seq
|
||||
(call %init_peer_id% ("" "load") ["knownPeers"] knownPeers)
|
||||
(seq
|
||||
(call %init_peer_id% ("" "load") ["clientId"] clientId)
|
||||
(par
|
||||
(seq
|
||||
(call relayId ("op" "identity") [])
|
||||
(seq
|
||||
(call relayId ("op" "identify") [] ident)
|
||||
(seq
|
||||
(call relayId ("dist" "get_blueprints") [] blueprints)
|
||||
(seq
|
||||
(call relayId ("dist" "get_modules") [] modules)
|
||||
(seq
|
||||
(call relayId ("srv" "get_interfaces") [] interfaces)
|
||||
(seq
|
||||
(call relayId ("op" "identity") [])
|
||||
(call %init_peer_id% ("event" "all_info") [relayId ident interfaces blueprints modules])
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(par
|
||||
(fold knownPeers p
|
||||
(par
|
||||
(seq
|
||||
(call p ("op" "identity") [])
|
||||
(seq
|
||||
(call p ("op" "identify") [] ident)
|
||||
(seq
|
||||
(call p ("dist" "get_blueprints") [] blueprints)
|
||||
(seq
|
||||
(call p ("dist" "get_modules") [] modules)
|
||||
(seq
|
||||
(call p ("srv" "get_interfaces") [] interfaces)
|
||||
(seq
|
||||
(call relayId ("op" "identity") [])
|
||||
(call %init_peer_id% ("event" "all_info") [p ident interfaces blueprints modules])
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(next p)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(call relayId ("op" "identity") [])
|
||||
(seq
|
||||
(call relayId ("dht" "neighborhood") [clientId] neigh)
|
||||
(fold neigh n
|
||||
(par
|
||||
(seq
|
||||
(call n ("dht" "neighborhood") [clientId] moreNeigh)
|
||||
(fold moreNeigh mp
|
||||
(par
|
||||
(seq
|
||||
(call mp ("op" "identify") [] ident)
|
||||
(seq
|
||||
(call mp ("dist" "get_blueprints") [] blueprints)
|
||||
(seq
|
||||
(call mp ("dist" "get_modules") [] modules)
|
||||
(seq
|
||||
(call mp ("srv" "get_interfaces") [] interfaces)
|
||||
(seq
|
||||
(call relayId ("op" "identity") [])
|
||||
(call %init_peer_id% ("event" "all_info") [mp ident interfaces blueprints modules])
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(next mp)
|
||||
)
|
||||
)
|
||||
)
|
||||
(next n)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
`
|
91
src/types.ts
Normal file
91
src/types.ts
Normal file
@ -0,0 +1,91 @@
|
||||
import { object, number, string, array, SchemaOf, boolean } from "yup";
|
||||
|
||||
export const service: SchemaOf<Service> = object({
|
||||
id: string().required(),
|
||||
owner_id: string().required(),
|
||||
blueprint_id: string().required(),
|
||||
});
|
||||
|
||||
export const blueprint: SchemaOf<Blueprint> = object({
|
||||
dependencies: array(string()).required(),
|
||||
id: string().required(),
|
||||
name: string().required(),
|
||||
facade: string().nullable().notRequired(),
|
||||
});
|
||||
|
||||
export const identify: SchemaOf<Identify> = object({
|
||||
external_addresses: array(string()).required(),
|
||||
});
|
||||
|
||||
export const wasi: SchemaOf<Wasi> = object({
|
||||
envs: object().notRequired().nullable(),
|
||||
mapped_dirs: object().notRequired().nullable(),
|
||||
preopened_files: array(string()).notRequired().nullable(),
|
||||
})
|
||||
|
||||
export const config: SchemaOf<Config> = object({
|
||||
logger_enabled: boolean().notRequired().nullable(),
|
||||
logging_mask: object().notRequired().nullable(),
|
||||
mem_pages_count: number().notRequired().nullable(),
|
||||
mounted_binaries: object().notRequired().nullable(),
|
||||
wasi: wasi.notRequired().nullable(),
|
||||
})
|
||||
|
||||
export const module: SchemaOf<Module> = object({
|
||||
config: config.required(),
|
||||
hash: string().required(),
|
||||
name: string().required(),
|
||||
})
|
||||
|
||||
export const eventType: SchemaOf<EventType> = object({
|
||||
peerId: string().required(),
|
||||
identify: identify.required(),
|
||||
services: array(service).required(),
|
||||
blueprints: array(blueprint).required(),
|
||||
modules: array(module).required(),
|
||||
})
|
||||
|
||||
export interface Service {
|
||||
blueprint_id: string;
|
||||
id: string;
|
||||
owner_id: string;
|
||||
}
|
||||
|
||||
export interface Blueprint {
|
||||
dependencies: string[];
|
||||
facade?: any;
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Wasi {
|
||||
envs?: any;
|
||||
mapped_dirs?: any;
|
||||
preopened_files: any[];
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
logger_enabled?: boolean;
|
||||
logging_mask?: any;
|
||||
mem_pages_count?: number;
|
||||
mounted_binaries?: any;
|
||||
wasi?: Wasi;
|
||||
}
|
||||
|
||||
export interface Module {
|
||||
config: Config;
|
||||
hash: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Identify {
|
||||
external_addresses: string[]
|
||||
}
|
||||
|
||||
export interface EventType {
|
||||
peerId: string,
|
||||
identify: Identify,
|
||||
services: Service[],
|
||||
blueprints: Blueprint[],
|
||||
modules: Module[],
|
||||
}
|
Loading…
Reference in New Issue
Block a user