@hostlink/nuxt-light 0.0.104 → 0.0.106
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.
- package/dist/module.json +1 -1
- package/dist/runtime/components/l-audit-card.vue +4 -4
- package/dist/runtime/components/l-form.vue +17 -25
- package/dist/runtime/components/l-page.vue +2 -2
- package/dist/runtime/components/l-table.vue +2 -2
- package/dist/runtime/lib/index.d.ts +1 -4
- package/dist/runtime/lib/index.mjs +0 -6
- package/dist/runtime/lib/list.d.ts +1 -1
- package/dist/runtime/lib/model.d.ts +7 -2
- package/dist/runtime/lib/model.mjs +16 -32
- package/dist/runtime/pages/EventLog/index.vue +2 -4
- package/dist/runtime/pages/MailLog/index.vue +3 -3
- package/dist/runtime/pages/User/index.vue +2 -2
- package/dist/runtime/pages/UserLog/index.vue +2 -2
- package/package.json +1 -1
- package/dist/runtime/lib/addObject.d.ts +0 -2
- package/dist/runtime/lib/addObject.mjs +0 -23
- package/dist/runtime/lib/deleteObject.d.ts +0 -1
- package/dist/runtime/lib/deleteObject.mjs +0 -12
- package/dist/runtime/lib/removeObject.d.ts +0 -1
- package/dist/runtime/lib/removeObject.mjs +0 -12
package/dist/module.json
CHANGED
|
@@ -11,10 +11,10 @@ defineProps({
|
|
|
11
11
|
<template>
|
|
12
12
|
<l-card title="Audit info">
|
|
13
13
|
<l-list>
|
|
14
|
-
<l-item label="Created time">{{ modelValue.createdTime }}</l-item>
|
|
15
|
-
<l-item label="Created by">{{ modelValue.createdBy }}</l-item>
|
|
16
|
-
<l-item label="Updated time">{{ modelValue.updatedTime }}</l-item>
|
|
17
|
-
<l-item label="Updated by">{{ modelValue.
|
|
14
|
+
<l-item label="Created time" v-if="modelValue.createdTime">{{ modelValue.createdTime }}</l-item>
|
|
15
|
+
<l-item label="Created by" v-if="modelValue.createdBy">{{ modelValue.createdBy }}</l-item>
|
|
16
|
+
<l-item label="Updated time" v-if="modelValue.updatedTime">{{ modelValue.updatedTime }}</l-item>
|
|
17
|
+
<l-item label="Updated by" v-if="modelValue.updatedBy">{{ modelValue.updatedBy }}</l-item>
|
|
18
18
|
</l-list>
|
|
19
19
|
</l-card>
|
|
20
20
|
</template>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref } from "vue";
|
|
3
3
|
import { useRouter, useRoute } from "vue-router";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { Dialog } from "quasar";
|
|
5
|
+
import { model } from "@hostlink/light"
|
|
6
6
|
|
|
7
7
|
const route = useRoute();
|
|
8
8
|
const router = useRouter();
|
|
@@ -32,7 +32,6 @@ const props = defineProps({
|
|
|
32
32
|
|
|
33
33
|
const loading = ref(false)
|
|
34
34
|
|
|
35
|
-
const que = useQuasar();
|
|
36
35
|
const emit = defineEmits(["save", "submit"]);
|
|
37
36
|
const save = async () => {
|
|
38
37
|
|
|
@@ -44,37 +43,30 @@ const save = async () => {
|
|
|
44
43
|
emit('submit');
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
49
46
|
if (props.modelValue) {
|
|
50
47
|
const [module, id_name] = route.name.split("-");
|
|
51
48
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
try {
|
|
50
|
+
if (route.params[id_name]) {//edit
|
|
51
|
+
if (await model(module).update(parseInt(route.params[id_name]), props.modelValue)) {
|
|
52
|
+
router.push(`/${module}`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
if (await model(module).add(props.modelValue)) {
|
|
59
57
|
router.push(`/${module}`);
|
|
60
58
|
return;
|
|
61
59
|
}
|
|
62
|
-
} catch (e) {
|
|
63
|
-
//show error
|
|
64
|
-
que.dialog({
|
|
65
|
-
title: "Error",
|
|
66
|
-
message: e.message,
|
|
67
|
-
ok: "OK"
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
} else { // add
|
|
72
|
-
if (await addObject(module, props.modelValue)) {
|
|
73
|
-
router.push(`/${module}`);
|
|
74
|
-
return;
|
|
75
60
|
}
|
|
61
|
+
} catch (e) {
|
|
62
|
+
Dialog.create({
|
|
63
|
+
title: "Error",
|
|
64
|
+
message: e.message,
|
|
65
|
+
ok: "OK"
|
|
66
|
+
});
|
|
76
67
|
}
|
|
77
68
|
}
|
|
69
|
+
|
|
78
70
|
loading.value = false
|
|
79
71
|
}
|
|
80
72
|
const onSubmit = (e) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useHead, useLight } from "#imports";
|
|
3
3
|
import { useRouter, useRoute } from "vue-router"
|
|
4
|
-
import {
|
|
4
|
+
import { model, getID } from '../'
|
|
5
5
|
|
|
6
6
|
const router = useRouter();
|
|
7
7
|
const route = useRoute();
|
|
@@ -80,7 +80,7 @@ title = title.trim()
|
|
|
80
80
|
const module = route.path.split("/")[1];
|
|
81
81
|
const onDelete = async () => {
|
|
82
82
|
|
|
83
|
-
if (await
|
|
83
|
+
if (await model(module).delete(getID())) {
|
|
84
84
|
router.push(`/${module}`);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useQuasar, QTable, is } from 'quasar';
|
|
3
3
|
import { ref, computed, onMounted, useSlots, useAttrs } from "vue";
|
|
4
|
-
import { t,
|
|
4
|
+
import { t, q, useLight, GQLFieldBuilder, model } from '../';
|
|
5
5
|
import { toQuery } from '@hostlink/light';
|
|
6
6
|
|
|
7
7
|
const errors = ref<InstanceType<any>>([]);
|
|
@@ -436,7 +436,7 @@ const qua = useQuasar();
|
|
|
436
436
|
const onDelete = async (id: any) => {
|
|
437
437
|
|
|
438
438
|
try {
|
|
439
|
-
await
|
|
439
|
+
await model(modelName.value).delete(id);
|
|
440
440
|
} catch (e: any) {
|
|
441
441
|
qua.notify({
|
|
442
442
|
message: e.message,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import addObject from "./addObject";
|
|
2
1
|
import f from "./f";
|
|
3
2
|
import getApiUrl from "./getApiUrl";
|
|
4
3
|
import getCurrentUser from "./getCurrentUser";
|
|
@@ -6,8 +5,6 @@ import getObject from "./getObject";
|
|
|
6
5
|
import list from "./list";
|
|
7
6
|
import m from "./m";
|
|
8
7
|
import q from "./q";
|
|
9
|
-
import removeObject from "./removeObject";
|
|
10
|
-
import deleteObject from "./deleteObject";
|
|
11
8
|
import t from "./t";
|
|
12
9
|
import updateObject from "./updateObject";
|
|
13
10
|
import listObject from "./listObject";
|
|
@@ -23,4 +20,4 @@ declare const notify: (message: string, color?: string) => void;
|
|
|
23
20
|
import getID from "./getID";
|
|
24
21
|
declare const getApiBase: () => {};
|
|
25
22
|
import { getGQLFields } from '@hostlink/light';
|
|
26
|
-
export {
|
|
23
|
+
export { f, getApiUrl, getCurrentUser, getObject, list, m, q, t, updateObject, notify, getID, listObject, isGranted, getApiBase, loadObject, GQLFieldBuilder, getModelField, getModelFields, getModelColumns, getGQLFields, sv, model };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useRuntimeConfig } from "nuxt/app";
|
|
2
2
|
import { Notify } from "quasar";
|
|
3
|
-
import addObject from "./addObject.mjs";
|
|
4
3
|
import f from "./f.mjs";
|
|
5
4
|
import getApiUrl from "./getApiUrl.mjs";
|
|
6
5
|
import getCurrentUser from "./getCurrentUser.mjs";
|
|
@@ -8,8 +7,6 @@ import getObject from "./getObject.mjs";
|
|
|
8
7
|
import list from "./list.mjs";
|
|
9
8
|
import m from "./m.mjs";
|
|
10
9
|
import q from "./q.mjs";
|
|
11
|
-
import removeObject from "./removeObject.mjs";
|
|
12
|
-
import deleteObject from "./deleteObject.mjs";
|
|
13
10
|
import t from "./t.mjs";
|
|
14
11
|
import updateObject from "./updateObject.mjs";
|
|
15
12
|
import listObject from "./listObject.mjs";
|
|
@@ -35,7 +32,6 @@ const getApiBase = () => {
|
|
|
35
32
|
};
|
|
36
33
|
import { getGQLFields } from "@hostlink/light";
|
|
37
34
|
export {
|
|
38
|
-
addObject,
|
|
39
35
|
f,
|
|
40
36
|
getApiUrl,
|
|
41
37
|
getCurrentUser,
|
|
@@ -43,12 +39,10 @@ export {
|
|
|
43
39
|
list,
|
|
44
40
|
m,
|
|
45
41
|
q,
|
|
46
|
-
removeObject,
|
|
47
42
|
t,
|
|
48
43
|
updateObject,
|
|
49
44
|
notify,
|
|
50
45
|
getID,
|
|
51
|
-
deleteObject,
|
|
52
46
|
listObject,
|
|
53
47
|
isGranted,
|
|
54
48
|
getApiBase,
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
declare const _default: (name: string) => {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
name: string;
|
|
3
|
+
update(id: number, data: Object): Promise<any>;
|
|
4
|
+
delete(id: number): Promise<any>;
|
|
5
|
+
add(data: Object): Promise<any>;
|
|
6
|
+
fields(fields: string[]): import("@hostlink/light").ModelField[];
|
|
7
|
+
get(filters: any, fields: import("@hostlink/light").Fields): Promise<any>;
|
|
8
|
+
list(filters: any, fields: import("@hostlink/light").Fields): Promise<any>;
|
|
4
9
|
};
|
|
5
10
|
export default _default;
|
|
@@ -1,35 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { model, getModelField } from "@hostlink/light";
|
|
2
2
|
export default (name) => {
|
|
3
|
-
const
|
|
4
|
-
return {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
return resp["list" + _name]["data"][0];
|
|
20
|
-
},
|
|
21
|
-
async list(filters, fields) {
|
|
22
|
-
const resp = await query({
|
|
23
|
-
["list" + _name]: {
|
|
24
|
-
__args: {
|
|
25
|
-
filters
|
|
26
|
-
},
|
|
27
|
-
data: {
|
|
28
|
-
...toQuery(fields)
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
return resp["list" + _name]["data"];
|
|
3
|
+
const m = model(name);
|
|
4
|
+
return Object.assign(m, {
|
|
5
|
+
columns(fields) {
|
|
6
|
+
let columns = [];
|
|
7
|
+
for (let f of fields) {
|
|
8
|
+
const field = getModelField(name, f);
|
|
9
|
+
if (!field)
|
|
10
|
+
continue;
|
|
11
|
+
const option = field.getRaw();
|
|
12
|
+
option.name = field.getName();
|
|
13
|
+
columns.push(option);
|
|
14
|
+
}
|
|
15
|
+
return columns;
|
|
33
16
|
}
|
|
34
|
-
};
|
|
17
|
+
});
|
|
18
|
+
return m;
|
|
35
19
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
const columns =
|
|
4
|
-
|
|
2
|
+
import { model } from "#imports"
|
|
3
|
+
const columns = model('EventLog').columns(['eventlog_id', 'class', 'id', 'action', 'created_time', 'username'])
|
|
5
4
|
</script>
|
|
6
|
-
|
|
7
5
|
<template>
|
|
8
6
|
<l-page>
|
|
9
7
|
<l-table @request="$event.loadObjects('EventLog')" :columns="columns" sort-by="eventlog_id:desc"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { model } from "#imports"
|
|
3
3
|
import { ref } from 'vue'
|
|
4
|
-
const columns =
|
|
4
|
+
const columns = model("MailLog").columns(["maillog_id", "from", "to", "subject", "created_time"])
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
columns.push({
|
|
@@ -16,7 +16,7 @@ const content = ref("")
|
|
|
16
16
|
<template>
|
|
17
17
|
<l-page>
|
|
18
18
|
<q-dialog v-model="show" full-width>
|
|
19
|
-
<l-card>
|
|
19
|
+
<l-card title="Mail content">
|
|
20
20
|
<q-card-section>
|
|
21
21
|
<iframe width="100%" height="500px" :srcdoc="content" frameborder="0"></iframe>
|
|
22
22
|
</q-card-section>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref } from 'vue'
|
|
3
|
-
import
|
|
3
|
+
import { model } from "#imports"
|
|
4
4
|
const onRequest = async (request) => {
|
|
5
5
|
request.loadObjects("User", { status: status.value });
|
|
6
6
|
//request.loadObjects("User");
|
|
7
7
|
};
|
|
8
|
-
const columns =
|
|
8
|
+
const columns = model("User").columns(["username", "first_name", "label_name", "email", "phone", "join_date", "status"]);
|
|
9
9
|
const status = ref("0");
|
|
10
10
|
</script>
|
|
11
11
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import
|
|
3
|
-
const columns =
|
|
2
|
+
import { model } from "#imports"
|
|
3
|
+
const columns = model("UserLog").columns(["userlog_id", "username", "login_dt", "logout_dt", "result", "user_agent"]);
|
|
4
4
|
</script>
|
|
5
5
|
<template>
|
|
6
6
|
<l-page>
|
package/package.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Dialog } from "quasar";
|
|
2
|
-
import m from "./m.mjs";
|
|
3
|
-
import { VariableType } from "json-to-graphql-query";
|
|
4
|
-
export default async (name, data) => {
|
|
5
|
-
try {
|
|
6
|
-
const variables = {};
|
|
7
|
-
Object.entries(data).forEach(([key, value]) => {
|
|
8
|
-
if (value instanceof File) {
|
|
9
|
-
variables[key] = {
|
|
10
|
-
type: "Upload!",
|
|
11
|
-
value
|
|
12
|
-
};
|
|
13
|
-
data[key] = new VariableType(key);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return await m(`add${name}`, { data }, [{ __variables: variables }]);
|
|
17
|
-
} catch (e) {
|
|
18
|
-
Dialog.create({
|
|
19
|
-
title: "Error",
|
|
20
|
-
message: e.message
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function deleteObject(name: string, id: number): Promise<any>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Dialog } from "quasar";
|
|
2
|
-
import m from "./m.mjs";
|
|
3
|
-
export default async function deleteObject(name, id) {
|
|
4
|
-
try {
|
|
5
|
-
return await m(`delete${name}`, { id });
|
|
6
|
-
} catch (e) {
|
|
7
|
-
Dialog.create({
|
|
8
|
-
title: "Error",
|
|
9
|
-
message: e.message
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function removeObject(name: string, id: number): Promise<any>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Dialog } from "quasar";
|
|
2
|
-
import m from "./m.mjs";
|
|
3
|
-
export default async function removeObject(name, id) {
|
|
4
|
-
try {
|
|
5
|
-
return await m(`remove${name}`, { id });
|
|
6
|
-
} catch (e) {
|
|
7
|
-
Dialog.create({
|
|
8
|
-
title: "Error",
|
|
9
|
-
message: e.message
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
}
|