Skip to content

Commit bd9b8bf

Browse files
authored
Merge pull request #206 from aws-samples/feature/report
show table without pagination
2 parents 32578ce + 709d058 commit bd9b8bf

File tree

2 files changed

+63
-16
lines changed

2 files changed

+63
-16
lines changed

report-front-end/src/common/api/WebSocket.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@ export function queryWithWS(props: {
7272
session_id: Global.sessionId,
7373
user_id: props.userId
7474
};
75-
console.log("param: ", param)
75+
console.log("param: ", param);
7676
props.sendMessage(param);
7777
}

report-front-end/src/components/chatbot-panel/chat-message.tsx

Lines changed: 62 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import {
44
Box,
55
ColumnLayout,
66
Container,
7-
ExpandableSection,
7+
ExpandableSection, Header,
88
Icon,
9-
LineChart,
9+
LineChart, Modal,
1010
Pagination,
1111
PieChart,
1212
SpaceBetween,
@@ -164,6 +164,7 @@ function SQLResultPanel(props: SQLResultProps) {
164164
return Object.fromEntries(map);
165165
});
166166
}
167+
167168
return (
168169
<div>
169170
<SpaceBetween size="xxl">
@@ -284,6 +285,16 @@ function SQLResultPanel(props: SQLResultProps) {
284285
);
285286
}
286287

288+
const AllDataModalTable = (props: { distributions: []; header: [] }) => {
289+
return (
290+
<Table
291+
variant="embedded"
292+
columnDefinitions={props.header}
293+
items={props.distributions}
294+
/>
295+
);
296+
};
297+
287298
const DataTable = (props: { distributions: []; header: [] }) => {
288299
const {
289300
items,
@@ -312,21 +323,57 @@ const DataTable = (props: { distributions: []; header: [] }) => {
312323
return `${count} ${count === 1 ? "match" : "matches"}`;
313324
}
314325

326+
const [visible, setVisible] = useState(false);
327+
315328
return (
316-
<Table
317-
{...collectionProps}
318-
variant="embedded"
319-
columnDefinitions={props.header}
320-
items={items}
321-
pagination={<Pagination {...paginationProps} />}
322-
filter={
323-
<TextFilter
324-
{...filterProps}
325-
countText={filterCounter(filteredItemsCount)}
326-
filteringPlaceholder="Search"
329+
<>
330+
<Table
331+
{...collectionProps}
332+
variant="embedded"
333+
columnDefinitions={props.header}
334+
header={
335+
<Header
336+
actions={
337+
<Button
338+
variant="primary"
339+
onClick={() => setVisible(true)}
340+
>
341+
Open
342+
</Button>
343+
}
344+
>
345+
</Header>
346+
}
347+
items={items}
348+
pagination={<Pagination {...paginationProps} />}
349+
filter={
350+
<TextFilter
351+
{...filterProps}
352+
countText={filterCounter(filteredItemsCount)}
353+
filteringPlaceholder="Search"
354+
/>
355+
}
356+
/>
357+
<Modal
358+
onDismiss={() => setVisible(false)}
359+
visible={visible}
360+
header="Table"
361+
footer={
362+
<Box float="right">
363+
<Button
364+
variant="primary"
365+
onClick={() => setVisible(false)}
366+
>
367+
Close</Button>
368+
</Box>
369+
}
370+
>
371+
<AllDataModalTable
372+
distributions={props.distributions}
373+
header={props.header}
327374
/>
328-
}
329-
/>
375+
</Modal>
376+
</>
330377
);
331378
};
332379

0 commit comments

Comments
 (0)