@live-change/db-admin 0.6.6 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,71 @@
1
+ <template>
2
+ <div class="w-full">
3
+ <div class="w-full flex flex-row justify-content-center">
4
+ <Button v-if="!editorVisible" @click="showNewObjectEditor"
5
+ icon="pi pi-plus-circle" label="Create new object" class="p-button-rounded p-button-primary" />
6
+ </div>
7
+
8
+ <div class="surface-0 shadow-1 w-full">
9
+ <object-editor v-if="editorVisible"
10
+ :dbApi="props.dbApi"
11
+ :currentData="JSON.stringify(newObjectData)"
12
+ :write="writeNewObject" :remove="removeObject" />
13
+ </div>
14
+
15
+ </div>
16
+ </template>
17
+
18
+ <script setup>
19
+
20
+ import Button from "primevue/button"
21
+ import ObjectEditor from "./ObjectEditor.vue"
22
+
23
+ import { ref, watch, computed, defineProps } from 'vue'
24
+ import { useRouter, useRoute } from 'vue-router'
25
+ import { path, live, actions, useApi, rangeBuckets, reverseRange } from '@live-change/vue3-ssr'
26
+ const api = useApi()
27
+
28
+ const props = defineProps({
29
+ dbApi: {
30
+ type: String,
31
+ default: 'serverDatabase'
32
+ },
33
+ write: {
34
+ type: Function,
35
+ default: null
36
+ },
37
+ })
38
+
39
+ const editorVisible = ref(false)
40
+ const newObjectData = ref(null)
41
+
42
+ function showNewObjectEditor() {
43
+ newObjectData.value = {
44
+ id: api.uid()
45
+ }
46
+ editorVisible.value = true
47
+ }
48
+
49
+ function writeNewObject(...args) {
50
+ console.log("write args", args)
51
+ const result = props.write(...args)
52
+ console.log("write result", result)
53
+ /* setTimeout(() => {
54
+ editorVisible.value = false
55
+ newObjectData.value = null
56
+ }, 200)*/
57
+ return result
58
+ }
59
+
60
+ function removeObject(data) {
61
+ console.log("object remove", arguments)
62
+ editorVisible.value = false
63
+ newObjectData.value = null
64
+ return false
65
+ }
66
+
67
+ </script>
68
+
69
+ <style scoped>
70
+
71
+ </style>
@@ -7,6 +7,8 @@
7
7
 
8
8
  <!-- <p>{{ path }}</p>-->
9
9
 
10
+ <CreateObject v-if="write" :dbApi="dbApi" :write="write.result" class="mt-2" />
11
+
10
12
  <template v-if="read?.external?.includes('range')">
11
13
  <DataRangeView v-if="read && write && remove" :key="'rangeView' + version"
12
14
  :dbApi="dbApi" :read="read.result" :write="write.result" :remove="remove.result" />
@@ -16,6 +18,8 @@
16
18
  :dbApi="dbApi" :read="read.result" :write="write.result" :remove="remove.result" />
17
19
  </template>
18
20
 
21
+ <CreateObject v-if="write" :dbApi="props.dbApi" :write="write.result" class="mt-2" />
22
+
19
23
  </template>
20
24
 
21
25
  <script setup>
@@ -24,6 +28,7 @@
24
28
  import PathEditor from "./PathEditor.vue"
25
29
  import DataRangeView from "./DataRangeView.vue"
26
30
  import DataView from "./DataView.vue"
31
+ import CreateObject from "./CreateObject.vue"
27
32
 
28
33
  const props = defineProps({
29
34
  dbApi: {
@@ -52,8 +57,6 @@
52
57
  }
53
58
  })
54
59
 
55
-
56
-
57
60
  import { ref, watch } from 'vue'
58
61
  import { useRouter, useRoute } from 'vue-router'
59
62
 
@@ -76,7 +79,7 @@
76
79
  const paramsArray = value.params.flat()
77
80
  router.replace({ name: route.name, params: {
78
81
  read: value.read,
79
- write: value.write,
82
+ write: value.write,
80
83
  remove: value.remove,
81
84
  params: paramsArray
82
85
  } })
@@ -92,6 +92,7 @@
92
92
 
93
93
  function deleteObject(event) {
94
94
  const removeRequest = remove({ object: initialData.value }, dbRequestSugar)
95
+ if(removeRequest === false) return // remove handled elsewhere
95
96
  const requestInfo =
96
97
  `${removeRequest[0].join('.')}(${removeRequest.slice(1).map(v => JSON.stringify(v)).join(', ')})`
97
98
  const id = initialData.value.id
@@ -115,6 +116,7 @@
115
116
 
116
117
  function updateObject(event) {
117
118
  const updateRequest = write({ object: editedData.value }, dbRequestSugar)
119
+ if(updateRequest === false) return // update handled elsewhere
118
120
  const requestInfo =
119
121
  `${updateRequest[0].join('.')}(${updateRequest.slice(1).map(v => JSON.stringify(v)).join(', ')})`
120
122
  const id = editedData.value.id
@@ -140,4 +142,4 @@
140
142
 
141
143
  <style scoped>
142
144
 
143
- </style>
145
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/db-admin",
3
- "version": "0.6.6",
3
+ "version": "0.6.8",
4
4
  "scripts": {
5
5
  "memDev": "lcli memDev --initScript ./init.js --dbAccess",
6
6
  "localDevInit": "rm tmp.db; lcli localDev --initScript ./init.js --dbAccess",
@@ -17,13 +17,13 @@
17
17
  "debug": "node --inspect-brk server"
18
18
  },
19
19
  "dependencies": {
20
- "@live-change/cli": "0.7.21",
21
- "@live-change/dao": "0.5.18",
22
- "@live-change/dao-vue3": "0.5.18",
23
- "@live-change/dao-websocket": "0.5.18",
24
- "@live-change/framework": "0.7.21",
25
- "@live-change/vue3-components": "0.2.25",
26
- "@live-change/vue3-ssr": "0.2.25",
20
+ "@live-change/cli": "0.7.24",
21
+ "@live-change/dao": "0.5.19",
22
+ "@live-change/dao-vue3": "0.5.19",
23
+ "@live-change/dao-websocket": "0.5.19",
24
+ "@live-change/framework": "0.7.24",
25
+ "@live-change/vue3-components": "0.2.26",
26
+ "@live-change/vue3-ssr": "0.2.26",
27
27
  "@vitejs/plugin-vue": "^2.3.1",
28
28
  "@vitejs/plugin-vue-jsx": "^1.3.10",
29
29
  "@vueuse/core": "^9.1.0",
@@ -51,7 +51,7 @@
51
51
  "vue3-scroll-border": "0.1.5"
52
52
  },
53
53
  "devDependencies": {
54
- "@live-change/codeceptjs-helper": "0.7.21",
54
+ "@live-change/codeceptjs-helper": "0.7.24",
55
55
  "@wdio/selenium-standalone-service": "^7.20.8",
56
56
  "codeceptjs": "^3.3.4",
57
57
  "generate-password": "1.7.0",
@@ -63,5 +63,5 @@
63
63
  "author": "",
64
64
  "license": "ISC",
65
65
  "description": "",
66
- "gitHead": "3a16e043de07836bc79e82c9c519cc7bf48d57a3"
66
+ "gitHead": "f22582ca19b5ff9b05b4e45091221d3be33a172e"
67
67
  }