mirror of
https://github.com/fluencelabs/dashboard
synced 2024-12-04 23:30:20 +00:00
add descriptions, update logs
This commit is contained in:
parent
37432ec0d2
commit
e94f3b6f76
@ -6,6 +6,7 @@ import Dict exposing (Dict)
|
||||
import Html exposing (Html, a, article, div, img, span, text)
|
||||
import Html.Attributes exposing (attribute)
|
||||
import Html.Events exposing (onClick)
|
||||
import Info exposing (getBlueprintDescription)
|
||||
import Instances.View
|
||||
import Interface.View exposing (interfaceView)
|
||||
import Model exposing (Model)
|
||||
@ -56,7 +57,7 @@ blueprintToInfo model id =
|
||||
, id = id
|
||||
, author = "Fluence Labs"
|
||||
, authorPeerId = "fluence_labs_peer_id"
|
||||
, description = "Excelent blueprint"
|
||||
, description = getBlueprintDescription bp.name
|
||||
, website = "https://github.com/fluencelabs/"
|
||||
, blueprint = bp
|
||||
, modules = modules
|
||||
|
40
src/Info.elm
40
src/Info.elm
@ -8,25 +8,45 @@ type alias ModuleDescription =
|
||||
, description : String
|
||||
}
|
||||
|
||||
type alias BlueprintDescription =
|
||||
{ description : String
|
||||
}
|
||||
|
||||
|
||||
getSite : String -> String
|
||||
getSite name =
|
||||
modulesDescription |> Dict.get name |> Maybe.map .site |> Maybe.withDefault ""
|
||||
|
||||
|
||||
getDescription : String -> String
|
||||
getDescription name =
|
||||
modulesDescription |> Dict.get name |> Maybe.map .description |> Maybe.withDefault "Awesome module without description"
|
||||
getModuleDescription : String -> String
|
||||
getModuleDescription name =
|
||||
modulesDescription |> Dict.get name |> Maybe.map .description |> Maybe.withDefault ""
|
||||
|
||||
getBlueprintDescription : String -> String
|
||||
getBlueprintDescription name =
|
||||
blueprintsDescription |> Dict.get name |> Maybe.map .description |> Maybe.withDefault ""
|
||||
|
||||
modulesDescription : Dict String ModuleDescription
|
||||
modulesDescription =
|
||||
Dict.fromList
|
||||
[ ( "sqlite3", { site = "https://github.com/fluencelabs/sqlite", description = "Popular embeddable database compiled to WebAssembly" } )
|
||||
, ( "Message History", { site = "https://github.com/fluencelabs/aqua-demo/tree/master/services/history", description = "Stores message log, used in the Chat application" } )
|
||||
, ( "User List", { site = "https://github.com/fluencelabs/aqua-demo/tree/master/services/user-list", description = "Basically an address book. Used in the Chat application to store chat users" } )
|
||||
, ( "redis", { site = "https://github.com/fluencelabs/redis", description = "Popular embeddable database compiled to WebAssembly" } )
|
||||
, ( "curl", { site = "https://github.com/fluencelabs/fce/tree/master/examples/url-downloader/curl", description = "Module that call 'curl' command" } )
|
||||
, ( "local_storage", { site = "https://github.com/fluencelabs/fce/tree/master/examples/url-downloader/local_storage", description = "Could be used to store data" } )
|
||||
, ( "Url Downloader", { site = "https://github.com/fluencelabs/fce/tree/master/examples/url-downloader/facade", description = "cURL adapter, allows to download anything by URL" } )
|
||||
[ ( "sqlite3", { site = "https://github.com/fluencelabs/sqlite", description = "Popular embeddable database compiled to WebAssembly, stores data in memory" } )
|
||||
, ( "sqlite", { site = "https://github.com/fluencelabs/sqlite", description = "Popular embeddable database compiled to WebAssembly, stores data in memory" } )
|
||||
, ( "history", { site = "https://github.com/fluencelabs/aqua-demo/tree/master/services/history", description = "Stores message log, used in History service" } )
|
||||
, ( "userlist", { site = "https://github.com/fluencelabs/aqua-demo/tree/master/services/user-list", description = "Address book implementation module, used in User List service" } )
|
||||
, ( "redis", { site = "https://github.com/fluencelabs/redis", description = "Popular embeddable database compiled to WebAssembly, stores data in memory" } )
|
||||
, ( "curl", { site = "https://github.com/fluencelabs/fce/tree/master/examples/url-downloader/curl", description = "Adapter module for cURL CLI utility" } )
|
||||
, ( "local_storage", { site = "https://github.com/fluencelabs/fce/tree/master/examples/url-downloader/local_storage", description = "Provides methods for working with file system: put and get" } )
|
||||
, ( "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" } )
|
||||
]
|
||||
|
||||
blueprintsDescription : Dict String BlueprintDescription
|
||||
blueprintsDescription =
|
||||
Dict.fromList
|
||||
[ ( "SQLite 3", { description = "Popular embeddable database compiled to WebAssembly" } )
|
||||
, ( "Message History", { description = "Stores message log, used in the Chat application" } )
|
||||
, ( "User List", { description = "Basically an address book. Used in the Chat application to store chat users" } )
|
||||
, ( "Redis", { description = "Popular embeddable database compiled to WebAssembly" } )
|
||||
, ( "URL Downloader", { description = "cURL adapter, allows to download anything by URL" } )
|
||||
]
|
||||
|
@ -3,7 +3,7 @@ module ModulePage.View exposing (..)
|
||||
import Dict exposing (Dict)
|
||||
import Html exposing (Html, a, article, div, span, text)
|
||||
import Html.Attributes exposing (attribute, property)
|
||||
import Info exposing (getDescription, getSite)
|
||||
import Info exposing (getModuleDescription, getSite)
|
||||
import Instances.View
|
||||
import Interface.View exposing (interfaceView)
|
||||
import Json.Encode exposing (string)
|
||||
@ -62,7 +62,7 @@ moduleToInfo modules id =
|
||||
, id = id
|
||||
, author = "Fluence Labs"
|
||||
, authorPeerId = ""
|
||||
, description = getDescription m.name
|
||||
, description = getModuleDescription m.name
|
||||
, website = getSite m.name
|
||||
, moduleInfo = m
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ function event(name: string,peer: string,peers?: string[],identify?: string[],se
|
||||
/* eslint-enable */
|
||||
|
||||
(async () => {
|
||||
// Fluence.setLogLevel('silent')
|
||||
Fluence.setLogLevel('silent')
|
||||
const pid = await Fluence.generatePeerId();
|
||||
const flags = genFlags(pid.toB58String());
|
||||
|
||||
@ -63,9 +63,9 @@ function event(name: string,peer: string,peers?: string[],identify?: string[],se
|
||||
});
|
||||
|
||||
const eventService = new ServiceOne('event', (fnName, args: any[]) => {
|
||||
console.log('event service called: ', fnName);
|
||||
// console.log('event service called: ', fnName);
|
||||
// console.log('from: ', args[0]);
|
||||
// console.log('event service args: ', args);
|
||||
console.log(`event from ${args[0]} received:`, args);
|
||||
|
||||
try {
|
||||
if (fnName === 'peers_discovered') {
|
||||
@ -95,6 +95,7 @@ function event(name: string,peer: string,peers?: string[],identify?: string[],se
|
||||
}
|
||||
|
||||
const particle = await build(client.selfPeerId, part.script, map, 45000);
|
||||
console.log("Building a particle with AIR script: ", particle)
|
||||
await client.sendParticle(particle);
|
||||
});
|
||||
})();
|
||||
|
93
src/script.ts
Normal file
93
src/script.ts
Normal file
@ -0,0 +1,93 @@
|
||||
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)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
`
|
Loading…
Reference in New Issue
Block a user