-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
245 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<template> | ||
<div> | ||
<h2>document list</h2> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
}, | ||
"dependencies": { | ||
"@pinia/nuxt": "^0.4.11", | ||
"laf-client-sdk": "^1.0.0-beta.8", | ||
"pinia": "^2.1.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,6 @@ | |
<template> | ||
<div> | ||
index ! | ||
<ApplicationsList></ApplicationsList> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters