mirror of https://github.com/embarklabs/embark.git
Added event to obtain list of contracts and show them on the dashboard
This commit is contained in:
parent
502d2c0dec
commit
56afed906a
|
@ -26,6 +26,22 @@ class Deploy {
|
|||
cb(self.contractsManager.getContract(contractName));
|
||||
});
|
||||
|
||||
self.events.setCommandHandler("contracts:all", (contractName, cb) => {
|
||||
let contracts = self.contractsManager.listContracts();
|
||||
let results = {};
|
||||
for (let className in contracts) {
|
||||
let contract = contracts[className];
|
||||
|
||||
results[className] = {
|
||||
name: contract.className,
|
||||
deploy: contract.deploy,
|
||||
error: contract.error,
|
||||
address: contract.deployedAddress
|
||||
};
|
||||
}
|
||||
cb(results);
|
||||
});
|
||||
|
||||
let plugin = this.plugins.createPlugin('deployment', {});
|
||||
plugin.registerAPICall(
|
||||
'get',
|
||||
|
@ -34,6 +50,14 @@ class Deploy {
|
|||
self.events.request('contracts:contract', req.params.contractName, res.send.bind(res));
|
||||
}
|
||||
);
|
||||
|
||||
plugin.registerAPICall(
|
||||
'get',
|
||||
'/embark/contracts',
|
||||
(req, res) => {
|
||||
self.events.request('contracts:all', null, res.send.bind(res));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
initTracker(cb) {
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
<div class="header">
|
||||
<div class="container">
|
||||
<div class="d-flex">
|
||||
<a class="navbar-brand" href="./index.html">
|
||||
<a class="navbar-brand" href="/embark/index.html">
|
||||
<img src="../assets/images/logo.png" class="navbar-brand-img" alt="Embark">
|
||||
</a>
|
||||
<div class="ml-auto d-flex order-lg-2">
|
||||
|
@ -150,7 +150,7 @@
|
|||
<div class="col">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<a href="./index.html" class="nav-link"><i class="fe fe-home"></i> Home</a>
|
||||
<a href="/embark/index.html" class="nav-link"><i class="fe fe-home"></i> Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="javascript:void(0)" class="nav-link active"><i class="fe fe-box"></i> Contracts</a>
|
||||
|
|
Loading…
Reference in New Issue