Skip to content

Commit 10591d5

Browse files
authored
Merge pull request #50 from kaleido-io/dashboard-counts
use FF count query param in dashboard, show transaction ID in message details
2 parents b4cfc34 + e71cd16 commit 10591d5

4 files changed

Lines changed: 21 additions & 17 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ firefly-ui is the UI explorer for [FireFly](https://github.com/hyperledger-labs/
44

55
### Get started locally
66

7-
- Clone / build firefly-ui
7+
- Clone / start firefly-ui
88

99
```bash
1010
git clone https://github.com/kaleido-io/firefly-ui

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "firefly-ui",
3-
"version": "0.2.1",
3+
"version": "0.2.2",
44
"private": true,
55
"dependencies": {
66
"@material-ui/core": "^4.11.4",

src/views/Dashboard.tsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ export const Dashboard: () => JSX.Element = () => {
7777
}
7878

7979
Promise.all([
80-
fetchWithCredentials(`/api/v1/network/organizations?limit=100`),
80+
fetchWithCredentials(`/api/v1/network/organizations?count&created=>=0`),
8181
fetchWithCredentials(
82-
`/api/v1/namespaces/${namespace}/data?limit=200${createdFilterString}`
82+
`/api/v1/namespaces/${namespace}/data?count${createdFilterString}`
8383
),
8484
fetchWithCredentials(
85-
`/api/v1/namespaces/${namespace}/messages?limit=200${createdFilterString}`
85+
`/api/v1/namespaces/${namespace}/messages?limit=5&count${createdFilterString}`
8686
),
8787
fetchWithCredentials(
88-
`/api/v1/namespaces/${namespace}/transactions?limit=200&created=>=${dayjs()
88+
`/api/v1/namespaces/${namespace}/transactions?count&created=>=${dayjs()
8989
.subtract(24, 'hours')
9090
.unix()}${createdFilterString}`
9191
),
@@ -97,10 +97,14 @@ export const Dashboard: () => JSX.Element = () => {
9797
messageResponse.ok &&
9898
txResponse.ok
9999
) {
100-
setMessages(await messageResponse.json());
101-
setTransactions(await txResponse.json());
102-
setOrgs(await orgResponse.json());
103-
setData(await dataResponse.json());
100+
const messageJson = await messageResponse.json();
101+
const dataJson = await dataResponse.json();
102+
const txJson = await txResponse.json();
103+
const orgJson = await orgResponse.json();
104+
setMessages(messageJson.items);
105+
setTransactions(txJson.items);
106+
setData(dataJson.items);
107+
setOrgs(orgJson.items);
104108
}
105109
}
106110
);
@@ -126,9 +130,8 @@ export const Dashboard: () => JSX.Element = () => {
126130
t('createdOn'),
127131
];
128132

129-
const messageRecords: IDataTableRecord[] = messages
130-
.slice(0, 5)
131-
.map((message: IMessage) => ({
133+
const messageRecords: IDataTableRecord[] = messages.map(
134+
(message: IMessage) => ({
132135
key: message.header.id,
133136
columns: [
134137
{
@@ -154,7 +157,8 @@ export const Dashboard: () => JSX.Element = () => {
154157
value: dayjs(message.header.created).format('MM/DD/YYYY h:mm A'),
155158
},
156159
],
157-
}));
160+
})
161+
);
158162

159163
return (
160164
<Grid container justify="center">

src/views/Messages/MessageDetails.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ export const MessageDetails: React.FC<Props> = ({ message, open, onClose }) => {
106106
</Grid>
107107
);
108108

109-
const pinned = (txType: string | undefined, txId: string | undefined) => (
109+
const transactionLink = (txId: string | undefined) => (
110110
<Grid alignItems="center" container direction="row" justify="space-between">
111111
<Grid item xs={8}>
112112
<Typography
113113
noWrap
114114
className={clsx(classes.detailValue, classes.paddingRight)}
115115
>
116-
{txType === 'batch_pin' ? t('yes') : t('no')}
116+
{txId}
117117
</Typography>
118118
</Grid>
119119
{txId && (
@@ -194,7 +194,7 @@ export const MessageDetails: React.FC<Props> = ({ message, open, onClose }) => {
194194
direction="row"
195195
>
196196
<Grid className={classes.detailItem} sm={12} container item>
197-
{detailItem(t('pinned?'), pinned(message.header.txtype, txId))}
197+
{detailItem(t('transaction'), transactionLink(txId))}
198198
</Grid>
199199
<Grid className={classes.detailItem} sm={12} container item>
200200
{detailItem(t('dataHash'), copyableHash(message.header.datahash))}

0 commit comments

Comments
 (0)