Skip to content

Commit

Permalink
chore: 应用列表,集合列表,语句执行
Browse files Browse the repository at this point in the history
  • Loading branch information
NMTuan committed Jul 1, 2023
1 parent 0af3e6d commit c06f804
Show file tree
Hide file tree
Showing 10 changed files with 245 additions and 2 deletions.
21 changes: 21 additions & 0 deletions components/applications/list.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<template>
<div>
<h1>applications</h1>
<div v-if="error">error</div>
<ApplicationsListItem v-for="item in list" :data="item"></ApplicationsListItem>
</div>
</template>
<script setup>
const error = ref(false)
const list = ref([])
request({
path: '/v1/applications'
})
.then(res => {
list.value = res.data
})
.catch(err => {
error.value = true
})
</script>
28 changes: 28 additions & 0 deletions components/applications/list/item.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!--
* @Author: NMTuan
* @Email: NMTuan@qq.com
* @Date: 2023-06-30 21:07:14
* @LastEditTime: 2023-06-30 21:53:11
* @LastEditors: NMTuan
* @Description:
* @FilePath: \laf_curd\components\applications\list\item.vue
-->
<template>
<li class="p-4 hover:(bg-gray-100)">
<NuxtLink :to="{
name: 'app-appid', params: {
appid: data.appid
}
}">
{{ data.name }} (appId: {{ data.appid }})
</NuxtLink>
</li>
</template>
<script setup>
const props = defineProps({
data: {
type: Object,
default: () => { }
}
})
</script>
30 changes: 30 additions & 0 deletions components/database/list.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!--
* @Author: NMTuan
* @Email: NMTuan@qq.com
* @Date: 2023-06-30 21:25:04
* @LastEditTime: 2023-06-30 21:54:01
* @LastEditors: NMTuan
* @Description:
* @FilePath: \laf_curd\components\database\list.vue
-->
<template>
<div>
<h2>database</h2>
<div v-if="error">error</div>
<DatabaseListItem v-for="item in list" :data="item"></DatabaseListItem>
</div>
</template>
<script setup>
const error = ref(false)
const route = useRoute()
const list = ref([])
request({
path: `/v1/apps/${route.params.appid}/collections`,
})
.then(res => {
list.value = res.data
})
.catch(err => {
error.value = true
})
</script>
22 changes: 22 additions & 0 deletions components/database/list/item.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<template>
<li class="p-4 hover:(bg-gray-100)">
<NuxtLink :to="{
name: 'app-appid-collection-collectionid', params: {
appid: route.params.appid,
collectionid: data.name
}
}">
{{ data.name }}
</NuxtLink>
<!-- <pre>{{ data }}</pre> -->
</li>
</template>
<script setup>
const route = useRoute()
const props = defineProps({
data: {
type: Object,
default: () => { }
}
})
</script>
5 changes: 5 additions & 0 deletions components/document/list.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div>
<h2>document list</h2>
</div>
</template>
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"dependencies": {
"@pinia/nuxt": "^0.4.11",
"laf-client-sdk": "^1.0.0-beta.8",
"pinia": "^2.1.4"
}
}
18 changes: 18 additions & 0 deletions pages/app/[appid].vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<div>
<h1>{{ id }}</h1>

<div class="flex">
<DatabaseList></DatabaseList>
<NuxtPage></NuxtPage>


</div>
</div>
</template>
<script setup>
const route = useRoute()
const { id } = route.params
</script>
70 changes: 70 additions & 0 deletions pages/app/[appid]/collection/[collectionid].vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!--
* @Author: NMTuan
* @Email: NMTuan@qq.com
* @Date: 2023-06-30 21:51:32
* @LastEditTime: 2023-07-01 00:07:54
* @LastEditors: NMTuan
* @Description:
* @FilePath: \laf_curd\pages\app\[appid]\collection\[collectionId].vue
-->
<template>
<div>
<div v-if="error">error</div>
collection id
<pre>{{ route.params }}</pre>
<textarea v-model="querySentence"></textarea>
<button @click="query">submit</button>
<pre>{{ list }}</pre>
</div>
</template>
<script setup>
import { Cloud } from 'laf-client-sdk'

const route = useRoute()
const { appid, collectionid } = route.params
const error = ref(false)
// const collection = ref()
const list = ref([])
let cloud
// request({
// path: `/v1/apps/${appid}/collections/${collectionid}`
// })
// .then(response => {
// list.value = response.data
// })
// .catch(err => {
// error.value = true
// })
const querySentence = ref(`collection('memos_test_requestIp').where({_id: '64980b1c9fd1dd9bcf58fc3e'}).get()`)
const query = () => {
error.value = false
eval(`cloud.database().${querySentence.value}`)
.then(response => {
if (!response.code) {
list.value = response.data
}
})
.catch(err => {
error.value = true
})
}

onMounted(() => {
cloud = new Cloud({
baseUrl: `https://${appid}.laf.run`,
dbProxyUrl: '/proxy/laf_curd'
})
// collection.value = cloud.database().collection(collectionid)
// cloud.database().collection(collectionid).get()
// .then((response) => {
// console.log(response)
// if (!response.code) {
// console.log(1, response.data)
// list.value = response.data
// }
// })
// .catch(err => {
// error.value = true
// })
})
</script>
1 change: 1 addition & 0 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
<template>
<div>
index !
<ApplicationsList></ApplicationsList>
</div>
</template>
51 changes: 49 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,13 @@ available-typed-arrays@^1.0.5:
resolved "https://registry.npmmirror.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7"
integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==

axios@^0.21.1:
version "0.21.4"
resolved "https://registry.npmmirror.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575"
integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==
dependencies:
follow-redirects "^1.14.0"

axios@^0.27.2:
version "0.27.2"
resolved "https://registry.npmmirror.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972"
Expand Down Expand Up @@ -1868,6 +1875,13 @@ browserslist@^4.0.0, browserslist@^4.21.3, browserslist@^4.21.4, browserslist@^4
node-releases "^2.0.12"
update-browserslist-db "^1.0.11"

bson@^4.5.3:
version "4.7.2"
resolved "https://registry.npmmirror.com/bson/-/bson-4.7.2.tgz#320f4ad0eaf5312dd9b45dc369cc48945e2a5f2e"
integrity sha512-Ry9wCtIZ5kGqkJoi6aD8KjxFZEx78guTQDnpXWiNthsxzrxAK/i8E6pCHAIZTbaEFWcOCvbecMukfK7XUvyLpQ==
dependencies:
buffer "^5.6.0"

buffer-alloc-unsafe@^1.1.0:
version "1.1.0"
resolved "https://registry.npmmirror.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0"
Expand Down Expand Up @@ -1896,7 +1910,7 @@ buffer-from@^1.0.0:
resolved "https://registry.npmmirror.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5"
integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==

buffer@^5.2.1, buffer@^5.5.0:
buffer@^5.2.1, buffer@^5.5.0, buffer@^5.6.0:
version "5.7.1"
resolved "https://registry.npmmirror.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0"
integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==
Expand Down Expand Up @@ -2365,6 +2379,16 @@ data-uri-to-buffer@^4.0.0:
resolved "https://registry.npmmirror.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e"
integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==

database-ql@^1.0.0-beta.2:
version "1.0.0-beta.2"
resolved "https://registry.npmmirror.com/database-ql/-/database-ql-1.0.0-beta.2.tgz#ab43f4c31e81ce85180a3aada91e187a0ee341c6"
integrity sha512-3q1ttPwaOdaOpG8BiKZOs6Jr8g9cxCM4hBbmFP1VOwijAcXNsbEj04dB6WJjX+THFxa3VFSxvReGC0TfHFxo5g==
dependencies:
bson "^4.5.3"
lodash.clonedeep "4.5.0"
lodash.set "4.3.2"
lodash.unset "4.5.2"

debug@2.6.9:
version "2.6.9"
resolved "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
Expand Down Expand Up @@ -2930,7 +2954,7 @@ flat@^5.0.2:
resolved "https://registry.npmmirror.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241"
integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==

follow-redirects@^1.0.0, follow-redirects@^1.14.9:
follow-redirects@^1.0.0, follow-redirects@^1.14.0, follow-redirects@^1.14.9:
version "1.15.2"
resolved "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
Expand Down Expand Up @@ -3794,6 +3818,14 @@ kolorist@^1.7.0, kolorist@^1.8.0:
resolved "https://registry.npmmirror.com/kolorist/-/kolorist-1.8.0.tgz#edddbbbc7894bc13302cdf740af6374d4a04743c"
integrity sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==

laf-client-sdk@^1.0.0-beta.8:
version "1.0.0-beta.8"
resolved "https://registry.npmmirror.com/laf-client-sdk/-/laf-client-sdk-1.0.0-beta.8.tgz#f7642385ae3f5052f5f3f04841a86fbae5b5d939"
integrity sha512-Maa68HGq5rkCRpnosIMKmMLGQ2Eg468hzWlbUwbw8q5JtQgc+FW7v/T+b1mA3nv467JW1yUO8d/urBBy06/p9g==
dependencies:
axios "^0.21.1"
database-ql "^1.0.0-beta.2"

launch-editor@^2.6.0:
version "2.6.0"
resolved "https://registry.npmmirror.com/launch-editor/-/launch-editor-2.6.0.tgz#4c0c1a6ac126c572bd9ff9a30da1d2cae66defd7"
Expand Down Expand Up @@ -3840,6 +3872,11 @@ locate-path@^6.0.0:
dependencies:
p-locate "^5.0.0"

lodash.clonedeep@4.5.0:
version "4.5.0"
resolved "https://registry.npmmirror.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
integrity sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==

lodash.debounce@^4.0.8:
version "4.0.8"
resolved "https://registry.npmmirror.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
Expand Down Expand Up @@ -3880,6 +3917,11 @@ lodash.pick@^4.4.0:
resolved "https://registry.npmmirror.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3"
integrity sha512-hXt6Ul/5yWjfklSGvLQl8vM//l3FtyHZeuelpzK6mm99pNvN9yTDruNZPEJZD1oWrqo+izBmB7oUfWgcCX7s4Q==

lodash.set@4.3.2:
version "4.3.2"
resolved "https://registry.npmmirror.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"
integrity sha512-4hNPN5jlm/N/HLMCO43v8BXKq9Z7QdAGc/VGrRD61w8gN9g/6jF9A4L1pbUgBLCffi0w9VsXfTOij5x8iTyFvg==

lodash.union@^4.6.0:
version "4.6.0"
resolved "https://registry.npmmirror.com/lodash.union/-/lodash.union-4.6.0.tgz#48bb5088409f16f1821666641c44dd1aaae3cd88"
Expand All @@ -3890,6 +3932,11 @@ lodash.uniq@^4.5.0:
resolved "https://registry.npmmirror.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==

lodash.unset@4.5.2:
version "4.5.2"
resolved "https://registry.npmmirror.com/lodash.unset/-/lodash.unset-4.5.2.tgz#370d1d3e85b72a7e1b0cdf2d272121306f23e4ed"
integrity sha512-bwKX88k2JhCV9D1vtE8+naDKlLiGrSmf8zi/Y9ivFHwbmRfA8RxS/aVJ+sIht2XOwqoNr4xUPUkGZpc1sHFEKg==

lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
Expand Down

0 comments on commit c06f804

Please sign in to comment.