Skip to content

Commit

Permalink
fix(ag-solo): be more tolerant of missing wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Feb 27, 2020
1 parent ceb0f36 commit 94c2a3e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/cosmic-swingset/lib/ag-solo/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
}

.frame {
display: none;
min-height: 20px;
min-width: 600px;
margin: 0px;
Expand Down Expand Up @@ -158,7 +159,7 @@

<div class="container">
<div class="ui">
<iframe class="left frame" title="Agoric Wallet" src="wallet/" frameBorder="0">Loading...</iframe>
<iframe class="left frame" id="walletFrame" title="Agoric Wallet" frameBorder="0">Loading...</iframe>
<div class="right">
<div class="help">Use <code>home</code> to see useful objects, and <code>history[N]</code> to refer to result
history</div>
Expand Down
22 changes: 20 additions & 2 deletions packages/cosmic-swingset/lib/ag-solo/html/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global WebSocket fetch document window */
/* global WebSocket fetch document window walletFrame */
const RECONNECT_BACKOFF_SECONDS = 3;
// Functions to run to reset the HTML state to what it was.
const resetFns = [];
Expand Down Expand Up @@ -207,7 +207,12 @@ run();
// Display version information, if possible.
const fetches = [];
const fgr = fetch('/git-revision.txt')
.then(resp => resp.text())
.then(resp => {
if (resp.status < 200 || resp.status >= 300) {
throw Error(`status ${resp.status}`);
}
return resp.text();
})
.then(text => {
return text.trimRight();
})
Expand All @@ -224,6 +229,19 @@ const fpj = fetch('/package.json')
return {};
});
fetches.push(fpj);

fetch('wallet/')
.then(resp => {
if (resp.status < 200 || resp.status >= 300) {
throw Error(`status ${resp.status}`);
}
walletFrame.style.display = 'block';
walletFrame.src = 'wallet/';
})
.catch(e => {
console.log('Cannot fetch wallet/', e);
});

Promise.all(fetches)
.then(([rev, pjson]) => {
const gr = document.getElementById('package_git');
Expand Down

0 comments on commit 94c2a3e

Please sign in to comment.