Skip to content

Commit 2a78fc6

Browse files
committed
refactor
1 parent c35cf31 commit 2a78fc6

File tree

9 files changed

+182
-772
lines changed

9 files changed

+182
-772
lines changed

src/components/DataTable.vue

-85
This file was deleted.

src/components/ExampleQueries.vue

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<template>
2+
<div class="example-queries">
3+
<h3>Example Queries</h3>
4+
<div class="query-buttons">
5+
<button
6+
v-for="(query, index) in exampleQueries"
7+
:key="index"
8+
@click="$emit('select-query', query.sql)"
9+
class="query-button"
10+
>
11+
{{ query.label }}
12+
</button>
13+
</div>
14+
</div>
15+
</template>
16+
17+
<script setup lang="ts">
18+
const exampleQueries = [
19+
{
20+
label: 'Select All',
21+
sql: 'SELECT * FROM test_table;'
22+
},
23+
{
24+
label: 'Insert Row',
25+
sql: "INSERT INTO test_table (name) VALUES ('New Item');"
26+
},
27+
{
28+
label: 'Update Row',
29+
sql: "UPDATE test_table SET name = 'Updated Name' WHERE id = 1;"
30+
},
31+
{
32+
label: 'Delete Row',
33+
sql: 'DELETE FROM test_table WHERE id = 1;'
34+
},
35+
{
36+
label: 'Count Records',
37+
sql: 'SELECT COUNT(*) as count FROM test_table;'
38+
},
39+
{
40+
label: 'Latest Records',
41+
sql: 'SELECT * FROM test_table ORDER BY created_at DESC LIMIT 5;'
42+
}
43+
]
44+
45+
defineEmits<{
46+
(e: 'select-query', query: string): void
47+
}>()
48+
</script>
49+
50+
<style scoped>
51+
.example-queries {
52+
margin: 1rem 0;
53+
}
54+
55+
.query-buttons {
56+
display: flex;
57+
flex-wrap: wrap;
58+
gap: 0.5rem;
59+
}
60+
61+
.query-button {
62+
padding: 0.5rem 1rem;
63+
border: 1px solid #ddd;
64+
border-radius: 4px;
65+
background-color: #f5f5f5;
66+
cursor: pointer;
67+
}
68+
69+
.query-button:hover {
70+
background-color: #e0e0e0;
71+
}
72+
</style>

src/components/QueryEditor.vue

-99
This file was deleted.

0 commit comments

Comments
 (0)