Skip to content

Commit

Permalink
device selection
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkp committed Apr 17, 2016
1 parent 015f501 commit 37df3c6
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions app/src/components/console/Console.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ export default ({
applications}) => {


const renderEntries = () => {
return log.map((result, key) => {
console.log(`result ${JSON.stringify(result)}`);
if (result.type && result.type === 'card-inserted') {
return <CardInserted key={key} device={result.device} atr={result.atr} />;
}
return <ConsoleEntry key={key}
command={result.command}
ok={result.ok}
meaning={result.meaning}
response={result.response} />
})
};

return (
<SplitPane className="console" split="horizontal" minSize={50} defaultSize={600}>
<Layout type="row">
Expand All @@ -28,24 +42,8 @@ export default ({
<div title="Clear Console Log" className="button fa fa-trash" onClick={clearLog}></div>
</Fixed>
<ScrollToBottom className="commands">
{ log.map((result, key) => {

console.log(`result ${JSON.stringify(result)}`);
if (result.type && result.type === 'card-inserted') {
return (
<div className={`card-inserted`} key={key}>
<div className={`device`}>{result.device}</div>
<div className={`atr`}>{result.atr}</div>
</div>
);
}

return <ConsoleEntry key={key}
command={result.command}
ok={result.ok}
meaning={result.meaning}
response={result.response} />
})
{
renderEntries()
}
</ScrollToBottom>
</Layout>
Expand All @@ -60,3 +58,13 @@ export default ({

)
};


const CardInserted = ({device, atr}) => {
return (
<div className={`card-inserted`} >
<div className={`device`}>{device}</div>
<div className={`atr`}>{atr}</div>
</div>
)
};

0 comments on commit 37df3c6

Please sign in to comment.