Skip to content

Commit 379d02b

Browse files
authored
Merge pull request #57 from beekeeper-studio/fix/zero-rows
dont show view more button if the number of rows is zero
2 parents d62e12d + 908dfc8 commit 379d02b

File tree

1 file changed

+43
-41
lines changed

1 file changed

+43
-41
lines changed

src/components/messages/tool/RunQueryResult.vue

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,49 @@
33
<span>
44
Query returned {{ rows.length }} {{ $pluralize('row', rows.length) }}
55
</span>
6-
<div class="preview-table-container" v-if="rows.length > 0">
7-
<table class="preview-table">
8-
<thead>
9-
<tr>
10-
<th v-for="column in columns" :key="column.id">
11-
{{ column.name }}
12-
</th>
13-
</tr>
14-
</thead>
15-
<tbody>
16-
<tr v-for="(row, index) in limitedRows" :key="index">
17-
<td
18-
v-for="column in columns"
19-
:key="column.id"
20-
:class="{
21-
'null-cell': row[column.id] === null,
22-
'empty-cell': row[column.id] === '',
23-
}"
24-
>
25-
<template v-if="row[column.id] === ''">(EMPTY)</template>
26-
<template v-else-if="row[column.id] === null">(NULL)</template>
27-
<template v-else>{{ row[column.id] }}</template>
28-
</td>
29-
</tr>
30-
<tr v-if="remainingRows > 0" class="remaining-rows">
31-
<td :colspan="columns.length">
32-
... {{ remainingRows }} more {{ $pluralize('row', remainingRows) }}
33-
</td>
34-
</tr>
35-
</tbody>
36-
</table>
37-
</div>
38-
<button
39-
class="btn btn-primary view-more-btn"
40-
@click.prevent="handleViewMoreClick"
41-
>
42-
<div class="label">View more</div>
43-
<span class="material-symbols-outlined open-icon">
44-
keyboard_double_arrow_down
45-
</span>
46-
</button>
6+
<template v-if="rows.length > 0">
7+
<div class="preview-table-container">
8+
<table class="preview-table">
9+
<thead>
10+
<tr>
11+
<th v-for="column in columns" :key="column.id">
12+
{{ column.name }}
13+
</th>
14+
</tr>
15+
</thead>
16+
<tbody>
17+
<tr v-for="(row, index) in limitedRows" :key="index">
18+
<td
19+
v-for="column in columns"
20+
:key="column.id"
21+
:class="{
22+
'null-cell': row[column.id] === null,
23+
'empty-cell': row[column.id] === '',
24+
}"
25+
>
26+
<template v-if="row[column.id] === ''">(EMPTY)</template>
27+
<template v-else-if="row[column.id] === null">(NULL)</template>
28+
<template v-else>{{ row[column.id] }}</template>
29+
</td>
30+
</tr>
31+
<tr v-if="remainingRows > 0" class="remaining-rows">
32+
<td :colspan="columns.length">
33+
... {{ remainingRows }} more {{ $pluralize('row', remainingRows) }}
34+
</td>
35+
</tr>
36+
</tbody>
37+
</table>
38+
</div>
39+
<button
40+
class="btn btn-primary view-more-btn"
41+
@click.prevent="handleViewMoreClick"
42+
>
43+
<div class="label">View more</div>
44+
<span class="material-symbols-outlined open-icon">
45+
keyboard_double_arrow_down
46+
</span>
47+
</button>
48+
</template>
4749
</div>
4850
</template>
4951

0 commit comments

Comments
 (0)