Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Dashboard plugin lists plugin endpoints (#8812)
Browse files Browse the repository at this point in the history
* 🐛 Dashboard plugin list endpoints from registered plugins

* 🎨
  • Loading branch information
has5aan authored Aug 7, 2023
1 parent 37f9425 commit 097c17e
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,18 +229,17 @@ const MainPage: React.FC = () => {
const subscribeEvents = () => {
getClient().subscribe('chain_newBlock', newBlockListener);
getClient().subscribe('txpool_newTransaction', newTransactionListener);
const endpoints = getClient().metadata.reduce<string[]>((prev, curr) => {
prev.push(...curr.endpoints.map(e => `${curr.name}_${e.name}`));
return prev;
}, []);
const listOfEvents = getClient().metadata.reduce<string[]>((prev, curr) => {
prev.push(...curr.events.map(e => `${curr.name}_${e.name}`));
return prev;
}, []);
setActions(endpoints);
setEvents(listOfEvents);
};

const loadActions = async () => {
setActions(await getClient().invoke<string[]>('app_getRegisteredActions'));
};

const loadNodeInfo = async () => {
setNodeInfo(await getClient().node.getNodeInfo());
};
Expand Down Expand Up @@ -289,6 +288,7 @@ const MainPage: React.FC = () => {
React.useEffect(() => {
if (dashboard.connected) {
subscribeEvents();
loadActions().catch(console.error);
loadNodeInfo().catch(console.error);
loadPeersInfo().catch(console.error);
}
Expand Down

0 comments on commit 097c17e

Please sign in to comment.