@simitgroup/simpleapp-generator 1.2.3 → 1.2.6
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/framework.d.ts.map +1 -1
- package/dist/framework.js.map +1 -1
- package/package.json +1 -1
- package/src/framework.ts +1 -0
- package/templates/basic/nuxt/pages.form.vue.eta +4 -0
- package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +5 -9
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +69 -26
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +13 -12
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +41 -30
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +1 -1
- package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +34 -29
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +1 -4
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +22 -78
- package/templates/nuxt/components/user/UserButtonCreateTenant.vue.eta +1 -1
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +3 -3
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +2 -4
- package/templates/nuxt/error.vue._eta +9 -4
- package/templates/nuxt/lang/df.ts.eta +2 -3
- package/templates/nuxt/nuxt.config.ts._eta +1 -2
- package/templates/nuxt/pages/[xorg]/organization.vue.eta +10 -9
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +16 -22
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +7 -20
- package/templates/nuxt/server/api/[xorg]/[...].ts.eta +20 -29
- package/templates/nuxt/server/api/profile/[...].ts.eta +18 -21
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +17 -17
- package/templates/nuxt/types/events.ts.eta +2 -0
- package/templates/project/lang/default._json +10 -4
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -24,13 +24,17 @@
|
|
|
24
24
|
v-model="datevalue" @update:modelValue="updateDate" :readonly="isReadonly"
|
|
25
25
|
:placeholder="placeholder"
|
|
26
26
|
v-bind="(componentProps as CalendarProps)"/>
|
|
27
|
+
|
|
27
28
|
<!-- time component -->
|
|
28
|
-
<
|
|
29
|
-
v-else-if="inputType == SimpleAppInputType.time"
|
|
29
|
+
<Calendar :pt="pt"
|
|
30
|
+
v-else-if="inputType == SimpleAppInputType.time" timeOnly showTime
|
|
31
|
+
hourFormat="12"
|
|
32
|
+
@update:modelValue="updateTime"
|
|
30
33
|
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
31
34
|
v-model="(modelValue as string)" :readonly="isReadonly"
|
|
32
|
-
:placeholder="placeholder"
|
|
33
|
-
v-bind="(componentProps as
|
|
35
|
+
:placeholder="placeholder"
|
|
36
|
+
v-bind="(componentProps as CalendarProps)"/>
|
|
37
|
+
|
|
34
38
|
<!-- select/list component -->
|
|
35
39
|
<Listbox v-model="modelValue" :pt="pt"
|
|
36
40
|
v-else-if="SimpleAppInputType.list==inputType"
|
|
@@ -141,11 +145,8 @@
|
|
|
141
145
|
:path="setting.instancepath"
|
|
142
146
|
:placeholder="placeholder"
|
|
143
147
|
v-bind="(componentProps as InputTextProps)"
|
|
144
|
-
/>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
<!-- component require special treatment -->
|
|
148
|
-
|
|
148
|
+
/>
|
|
149
|
+
<!-- component require special treatment -->
|
|
149
150
|
</SimpleAppFieldContainer>
|
|
150
151
|
</template>
|
|
151
152
|
|
|
@@ -171,9 +172,9 @@ import Slider,{ SliderProps } from 'primevue/slider';
|
|
|
171
172
|
import Textarea, { TextareaProps } from 'primevue/textarea';
|
|
172
173
|
import {SimpleAppInputType} from '~/types'
|
|
173
174
|
|
|
174
|
-
|
|
175
|
-
const datevalue = ref('')
|
|
176
175
|
const modelValue = defineModel()
|
|
176
|
+
const datevalue = ref('')
|
|
177
|
+
const timevalue = ref<Date>()
|
|
177
178
|
|
|
178
179
|
const props = withDefaults( defineProps<{
|
|
179
180
|
inputType:SimpleAppInputType,
|
|
@@ -198,68 +199,6 @@ if(props.inputType== SimpleAppInputType.date && modelValue.value){
|
|
|
198
199
|
datevalue.value = ''
|
|
199
200
|
}
|
|
200
201
|
|
|
201
|
-
|
|
202
|
-
// switch(props.inputType){
|
|
203
|
-
// case SimpleAppInputType.text:
|
|
204
|
-
// inputComponent = InputText
|
|
205
|
-
// break;
|
|
206
|
-
// case SimpleAppInputType.textarea:
|
|
207
|
-
// inputComponent = Textarea
|
|
208
|
-
// break;
|
|
209
|
-
// case SimpleAppInputType.number:
|
|
210
|
-
// inputComponent = InputNumber
|
|
211
|
-
// break
|
|
212
|
-
// case SimpleAppInputType.date:
|
|
213
|
-
// inputComponent = InputText
|
|
214
|
-
// break;
|
|
215
|
-
// case SimpleAppInputType.time:
|
|
216
|
-
// inputComponent = InputText
|
|
217
|
-
// break;
|
|
218
|
-
// case SimpleAppInputType.calendar:
|
|
219
|
-
// inputComponent = Calendar
|
|
220
|
-
// break;
|
|
221
|
-
// case SimpleAppInputType.autocomplete:
|
|
222
|
-
// inputComponent = AutoComplete
|
|
223
|
-
// break;
|
|
224
|
-
// case SimpleAppInputType.autocompletemultiple: //*
|
|
225
|
-
// inputComponent = AutoComplete
|
|
226
|
-
// break;
|
|
227
|
-
// case SimpleAppInputType.selectmultiple: //*
|
|
228
|
-
// inputComponent = MultiSelect
|
|
229
|
-
// break;
|
|
230
|
-
// case SimpleAppInputType.listmultiple: //*
|
|
231
|
-
// break;
|
|
232
|
-
// case SimpleAppInputType.radio: //*
|
|
233
|
-
// inputComponent = RadioButton
|
|
234
|
-
// break;
|
|
235
|
-
// case SimpleAppInputType.select: //*
|
|
236
|
-
// inputComponent = Dropdown
|
|
237
|
-
// break;
|
|
238
|
-
// case SimpleAppInputType.list: //*
|
|
239
|
-
// inputComponent = Listbox
|
|
240
|
-
// break;
|
|
241
|
-
// case SimpleAppInputType.chip: //*
|
|
242
|
-
// inputComponent = Chips
|
|
243
|
-
// break;
|
|
244
|
-
// case SimpleAppInputType.checkbox:
|
|
245
|
-
// inputComponent = Checkbox
|
|
246
|
-
// break;
|
|
247
|
-
// case SimpleAppInputType.switch:
|
|
248
|
-
// inputComponent = InputSwitch
|
|
249
|
-
// break;
|
|
250
|
-
// case SimpleAppInputType.documentno: //*
|
|
251
|
-
// break;
|
|
252
|
-
// case SimpleAppInputType.password:
|
|
253
|
-
// inputComponent = Password
|
|
254
|
-
// break;
|
|
255
|
-
// case SimpleAppInputType.rating:
|
|
256
|
-
// inputComponent = Rating
|
|
257
|
-
// break;
|
|
258
|
-
// case SimpleAppInputType.slider:
|
|
259
|
-
// inputComponent = Slider
|
|
260
|
-
// break;
|
|
261
|
-
|
|
262
|
-
// }
|
|
263
202
|
const isReadonly = computed(()=>{
|
|
264
203
|
if(props.readonly){
|
|
265
204
|
return props.readonly
|
|
@@ -269,7 +208,9 @@ const isReadonly = computed(()=>{
|
|
|
269
208
|
return false
|
|
270
209
|
}
|
|
271
210
|
})
|
|
272
|
-
|
|
211
|
+
const updateTime = () =>{
|
|
212
|
+
modelValue.value = moment(timevalue.value).format("HH:mm:ss")
|
|
213
|
+
}
|
|
273
214
|
const updateDate = (value:any)=>{
|
|
274
215
|
|
|
275
216
|
if(value){
|
|
@@ -287,7 +228,12 @@ const getListOptions = () =>{
|
|
|
287
228
|
if(props.setting.fieldsetting.enum){
|
|
288
229
|
for(let i=0;i<props.setting.fieldsetting.enum.length;i++){
|
|
289
230
|
const v = props.setting.fieldsetting.enum[i]
|
|
290
|
-
|
|
231
|
+
if(typeof v == 'string'){
|
|
232
|
+
options.push({value:v, label: t(v)})
|
|
233
|
+
}else{
|
|
234
|
+
options.push({value:v.value, label: t(v.label)})
|
|
235
|
+
}
|
|
236
|
+
|
|
291
237
|
}
|
|
292
238
|
|
|
293
239
|
|
|
@@ -308,9 +254,7 @@ watch(modelValue ,(newvalue:any)=>{
|
|
|
308
254
|
}
|
|
309
255
|
|
|
310
256
|
}
|
|
311
|
-
|
|
312
|
-
// modelValue.value=autocompleteitem.value
|
|
313
|
-
// }
|
|
257
|
+
|
|
314
258
|
|
|
315
259
|
emits('change',modelValue.value)
|
|
316
260
|
emits('update:modelValue',modelValue.value)
|
|
@@ -10,7 +10,7 @@ export const reloadUserStore = async () =>{
|
|
|
10
10
|
export const getUserProfile = () =>{
|
|
11
11
|
const userstore = getUserStore()
|
|
12
12
|
|
|
13
|
-
return
|
|
13
|
+
return !userstore ? undefined :userstore.getUserInfo()
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export const getCurrentXorg = () =>{
|
|
@@ -29,5 +29,5 @@ export const canPerform = (resource:string,action:string):boolean =>{
|
|
|
29
29
|
return getUserStore().canPerform(resource,action)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export const getProfileEmail = () => getUserProfile()
|
|
33
|
-
export const getProfileFullName = () => getUserProfile()
|
|
32
|
+
export const getProfileEmail = () => getUserProfile()?.email
|
|
33
|
+
export const getProfileFullName = () => getUserProfile()?.fullName
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import plugin from 'primevue/config';
|
|
2
1
|
import _ from 'lodash'
|
|
3
|
-
|
|
4
2
|
import {Md5} from 'ts-md5'
|
|
5
3
|
import moment from "moment";
|
|
6
4
|
export const camelCaseToWords = (s: string) =>{
|
|
@@ -17,9 +15,9 @@ export const getAvatarLink = (email:string, size:number):string=>{
|
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
export const toLocalDate = (dateiso8601:string)=> new Date(String(dateiso8601)).toLocaleDateString()
|
|
20
|
-
export const t = (txt:string,options?:any):string => useNuxtApp().$i18n.t(txt,options)
|
|
18
|
+
export const t = (txt:string,options?:any):string => !txt || txt.trim()=='' ? '' : useNuxtApp().$i18n.t(txt,options)
|
|
21
19
|
export const today = () => moment().format('YYYY-MM-DD')
|
|
22
20
|
export const dateToString = (date:Date) => moment(date).format('YYYY-MM-DD')
|
|
23
21
|
export const getMoment = (startTime:string)=> moment(startTime)
|
|
24
22
|
export const lastDateOfMonth = (datestr:string) => moment(datestr).endOf('month').format('YYYY-MM-DD');
|
|
25
|
-
export const upperFirst = (str:string) => _.upperFirst(str)
|
|
23
|
+
export const upperFirst = (str:string) => _.upperFirst(str)
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
</div>
|
|
10
10
|
<div>
|
|
11
11
|
<h1 class="px-4 pt-2 pb-4 text-left text-5xl font-bold leading-10 text-gray-800">OOPS!</h1>
|
|
12
|
-
<p class="px-4 mt mb-4 text-4xl text-left font font-bold">{{error
|
|
13
|
-
<p class="px-4 pb-10 text-base leading-none text-left text-
|
|
12
|
+
<p class="px-4 mt mb-4 text-4xl text-left font font-bold">{{error?.statusCode}} Error</p>
|
|
13
|
+
<p class="px-4 pb-10 text-base leading-none text-left text-red-400">{{t(error?.statusMessage)}}</p>
|
|
14
|
+
<p> <Button @click="handleError" class="btn-primary">{{ t('backToHome') }}</Button></p>
|
|
14
15
|
</div>
|
|
15
16
|
</div>
|
|
16
17
|
|
|
@@ -22,9 +23,13 @@
|
|
|
22
23
|
</template>
|
|
23
24
|
<script setup lang="ts">
|
|
24
25
|
|
|
25
|
-
defineProps(
|
|
26
|
+
const props = defineProps({
|
|
27
|
+
error: Object
|
|
28
|
+
})
|
|
29
|
+
const handleError = () => navigateTo('/',{external:true})
|
|
30
|
+
console.error(props.error)
|
|
31
|
+
// handleError()
|
|
26
32
|
definePageMeta({
|
|
27
|
-
// // name: "Login",
|
|
28
33
|
auth: false,
|
|
29
34
|
});
|
|
30
35
|
</script>
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
2
|
//auto generate from lang/default.ts
|
|
4
3
|
<%let langkeys = Object.keys(it.lang) %>
|
|
5
4
|
<% for(let l=0; l< langkeys.length; l++){ %>
|
|
6
5
|
<% let key = langkeys[l] %>
|
|
7
|
-
<%=key%> : '<%= it.lang[key] %>',
|
|
6
|
+
'<%=key%>' : '<%= it.lang[key] %>',
|
|
8
7
|
<%}%>
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
//auto generate from schema
|
|
12
11
|
<% for(let i=0; i< it.allfields.length; i++){ %>
|
|
13
12
|
<% let f = it.allfields[i] %>
|
|
14
|
-
<%=f%> : '<%= camelCaseToWords(f) %>',
|
|
13
|
+
'<%= f %>' : '<%= camelCaseToWords(f) %>',
|
|
15
14
|
<%}%>
|
|
16
15
|
|
|
17
16
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* last change 2023-09-09
|
|
7
7
|
* author: Ks Tan
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
import { SimpleAppInputType } from "~/types";
|
|
10
10
|
import ConfirmPopup from "primevue/confirmpopup";
|
|
11
11
|
import { useConfirm } from "primevue/useconfirm";
|
|
12
12
|
const confirm = useConfirm();
|
|
@@ -44,10 +44,9 @@ const refresh = () => {
|
|
|
44
44
|
$event("RefreshDocumentList", { documentName: doc.getDocName() });
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
|
|
48
47
|
definePageMeta({
|
|
49
48
|
menuPath: "setting/organization",
|
|
50
|
-
|
|
49
|
+
});
|
|
51
50
|
|
|
52
51
|
//branch record update then reload
|
|
53
52
|
$listen("RefreshDocumentList", (data) => {
|
|
@@ -61,14 +60,11 @@ if (id) {
|
|
|
61
60
|
fetchRecord(id.value);
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
63
|
getCurrentOrg();
|
|
68
64
|
</script>
|
|
69
65
|
<template>
|
|
70
66
|
<div class="grid grid-cols-3">
|
|
71
|
-
<title>{{ t(
|
|
67
|
+
<title>{{ t("organization") }}</title>
|
|
72
68
|
<div class="">
|
|
73
69
|
<Card>
|
|
74
70
|
<template #header><h1 class="text-2xl">Organization</h1></template>
|
|
@@ -95,7 +91,7 @@ getCurrentOrg();
|
|
|
95
91
|
<ConfirmPopup></ConfirmPopup>
|
|
96
92
|
</div>
|
|
97
93
|
<div class="flex flex-col">
|
|
98
|
-
<div class="
|
|
94
|
+
<div class="grid grid-cols-2 gap-4">
|
|
99
95
|
<SimpleAppInput
|
|
100
96
|
:input-type="SimpleAppInputType.text"
|
|
101
97
|
autofocus
|
|
@@ -109,10 +105,15 @@ getCurrentOrg();
|
|
|
109
105
|
:setting="o.getField('#/properties/orgName')"
|
|
110
106
|
/>
|
|
111
107
|
<SimpleAppInput
|
|
112
|
-
|
|
108
|
+
:input-type="SimpleAppInputType.checkbox"
|
|
113
109
|
v-model="data.active"
|
|
114
110
|
:setting="o.getField('#/properties/active')"
|
|
115
111
|
/>
|
|
112
|
+
<SimpleAppInput
|
|
113
|
+
:input-type="SimpleAppInputType.text"
|
|
114
|
+
v-model="data.timeZone"
|
|
115
|
+
:setting="o.getField('#/properties/timeZone')"
|
|
116
|
+
/>
|
|
116
117
|
</div>
|
|
117
118
|
<div>
|
|
118
119
|
<SimpleAppInput
|
|
@@ -24,35 +24,29 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
24
24
|
//axios.defaults.headers.common = {"CSRF-TOKEN": csrf};
|
|
25
25
|
const myaxios = axios.create({timeout:5000})
|
|
26
26
|
myaxios.interceptors.response.use((response) => response, (error) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// navigateTo("/error503")
|
|
30
|
-
createError({statusCode:503,statusMessage:"Backend server timeout, verify it is up and running!"})
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
else if(error.response.status==401){
|
|
27
|
+
|
|
28
|
+
if(error.response.status==401){
|
|
34
29
|
console.error("axios 401 session expired, pop up for relogin")
|
|
35
30
|
}else if(error.response && error.response.status){
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
let errmsg = error.response.message
|
|
32
|
+
let errorcode =error.response.status
|
|
33
|
+
if(error.response?.data && error.response?.data?.message){
|
|
34
|
+
errmsg = error.response.data.message
|
|
35
|
+
errorcode = error.response.data.statusCode
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
throw createError({
|
|
39
|
+
statusCode:errorcode,
|
|
40
|
+
statusMessage:errmsg,
|
|
41
|
+
fatal:true
|
|
42
|
+
})
|
|
43
|
+
// return Promise.reject(error)
|
|
41
44
|
}else{
|
|
42
45
|
console.error("unknown error")
|
|
43
|
-
createError({statusCode:500,statusMessage:"Internal server error"})
|
|
46
|
+
throw createError({statusCode:500,statusMessage:"Internal server error"})
|
|
44
47
|
}
|
|
45
48
|
});
|
|
46
49
|
|
|
47
|
-
// nuxtApp.vueApp.use(PrimeVue, { ripple: true,Tailwind:true, pt: Tailwind});
|
|
48
|
-
// nuxtApp.vueApp.use(PrimeVue, { unstyled: true, pt: {} });
|
|
49
|
-
// nuxtApp.vueApp
|
|
50
|
-
// .use(ToastService)
|
|
51
|
-
// .use(ConfirmationService)
|
|
52
|
-
// .directive('tooltip', Tooltip)
|
|
53
|
-
// ;
|
|
54
|
-
|
|
55
|
-
|
|
56
50
|
return {
|
|
57
51
|
provide: {
|
|
58
52
|
|
|
@@ -12,7 +12,6 @@ import _ from 'lodash'
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
export default defineNuxtPlugin( async(nuxtApp) => {
|
|
15
|
-
console.log("start plugin 20")
|
|
16
15
|
const useUserStore = defineStore('userstore', {
|
|
17
16
|
state: ()=>({
|
|
18
17
|
_id: ref(''),
|
|
@@ -75,25 +74,15 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
75
74
|
this.roles = res.data.roles
|
|
76
75
|
this.time = res.data.time
|
|
77
76
|
this.invites = res.data.invites
|
|
78
|
-
this.moreProps = res.data.
|
|
77
|
+
this.moreProps = res.data.moreProps
|
|
79
78
|
return Promise.resolve(true)
|
|
80
79
|
// return true
|
|
81
|
-
}).catch((err:any)=>{
|
|
82
|
-
|
|
83
|
-
// console.error("no backend server")
|
|
84
|
-
const errdata = createError({statusCode:503,statusMessage:"Backend server timeout, verify it is up and running!"})
|
|
85
|
-
return Promise.reject(errdata)
|
|
86
|
-
}
|
|
87
|
-
else if(err.response && err.response.status==401){
|
|
88
|
-
console.error("Unauthorise(plugin-userstore)")
|
|
89
|
-
}else{
|
|
90
|
-
const errdata = createError({statusCode:500,statusMessage:"Unknown error"})
|
|
91
|
-
return Promise.reject(errdata)
|
|
92
|
-
}
|
|
80
|
+
}).catch((err:any)=>{
|
|
81
|
+
return Promise.reject(err)
|
|
93
82
|
})
|
|
94
83
|
},
|
|
95
84
|
getCurrentXorg(){
|
|
96
|
-
return (useRoute().params.xorg) ? String
|
|
85
|
+
return (useRoute().params.xorg) ? <String>useRoute().params.xorg : undefined
|
|
97
86
|
},
|
|
98
87
|
async pingSession(){
|
|
99
88
|
let xorg = this.getCurrentXorg()
|
|
@@ -104,7 +93,8 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
104
93
|
apiurl = `${useRuntimeConfig().public.APP_URL}/api/${xorg}`
|
|
105
94
|
}
|
|
106
95
|
const {$axios} = useNuxtApp()
|
|
107
|
-
|
|
96
|
+
const pingresult = await new PROFILEApi(undefined,apiurl,$axios).getSession()
|
|
97
|
+
return pingresult
|
|
108
98
|
},
|
|
109
99
|
async decideInvitation(id:string,decision:string){
|
|
110
100
|
const apiurl = `${useRuntimeConfig().public.APP_URL}/api`
|
|
@@ -190,17 +180,14 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
190
180
|
}
|
|
191
181
|
}
|
|
192
182
|
})
|
|
193
|
-
|
|
183
|
+
|
|
194
184
|
|
|
195
185
|
if( useRoute().meta.auth !==false){
|
|
196
186
|
|
|
197
187
|
if(await useUserStore().pingSession()){
|
|
198
|
-
console.log("ping session ok")
|
|
199
188
|
await useUserStore().loadRemoteUserInfo()
|
|
200
|
-
console.log("load remote user info ok")
|
|
201
189
|
|
|
202
190
|
}else{
|
|
203
|
-
console.log("No login session", useRoute().path)
|
|
204
191
|
await useUserStore().logout(useRoute().path)
|
|
205
192
|
}
|
|
206
193
|
}else{
|
|
@@ -87,16 +87,6 @@ export default defineEventHandler(async (event:any) => {
|
|
|
87
87
|
params: forwardData,
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
// if(key === 'system') {
|
|
91
|
-
// axiosConfig.headers["X-Global"] = true;
|
|
92
|
-
// delete axiosConfig.headers["X-Org"];
|
|
93
|
-
// }
|
|
94
|
-
|
|
95
|
-
// if(otherLink.includes('avatar')) {
|
|
96
|
-
// axiosConfig.responseType = 'arraybuffer';
|
|
97
|
-
// // axiosConfig.headers['Acceptable'] = 'text/html,image/avif,image/webp,image/apng';
|
|
98
|
-
// }
|
|
99
|
-
|
|
100
90
|
axios(axiosConfig).then((res) => {
|
|
101
91
|
if (res.headers['content-type'] === 'image/png') {
|
|
102
92
|
// Set the response headers for the image
|
|
@@ -118,27 +108,28 @@ export default defineEventHandler(async (event:any) => {
|
|
|
118
108
|
}
|
|
119
109
|
|
|
120
110
|
}).catch((error) => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
//
|
|
111
|
+
if(!error?.response){
|
|
112
|
+
console.log("backend server no response ",error.code)
|
|
113
|
+
reject({
|
|
114
|
+
statusMessage:"backendServerDownMessage",
|
|
115
|
+
statusCode: 503,
|
|
116
|
+
});
|
|
117
|
+
}else if (error.response.status == 401) {
|
|
118
|
+
return sendRedirect(event, '/login', 401)
|
|
119
|
+
}else{
|
|
120
|
+
const responseCode = error.response.data?.statusCode ? error.response.data.statusCode : error.response.status
|
|
121
|
+
const responseMsg = error.response.data ? error.response.data.message : error.response.statusText
|
|
122
|
+
// reject(error.data)
|
|
123
|
+
// console.log("----error.response.data--",responseMsg,error.response.data,error.response.status,responseCode)
|
|
124
|
+
reject({
|
|
125
|
+
statusMessage: responseMsg,
|
|
126
|
+
statusCode: responseCode ,
|
|
127
|
+
data: error.response.data
|
|
128
|
+
});
|
|
129
|
+
|
|
133
130
|
}
|
|
134
131
|
|
|
135
|
-
|
|
136
|
-
reject({
|
|
137
|
-
statusMessage: error.response.statusText,
|
|
138
|
-
statusCode: error.response.status ,
|
|
139
|
-
data: error.response.data
|
|
140
|
-
}); // resolve({ status: 'ok' })
|
|
141
|
-
// throw createError({ statusMessage: 'Bad Requests', statusCode: 404 })
|
|
132
|
+
|
|
142
133
|
})
|
|
143
134
|
|
|
144
135
|
// resolve({
|
|
@@ -117,28 +117,25 @@ export default defineEventHandler(async (event:any) => {
|
|
|
117
117
|
resolve(res.data);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
}).catch((error) => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
120
|
+
}).catch((error) => {
|
|
121
|
+
if(!error?.response){
|
|
122
|
+
console.log("backend server no response ",error.code)
|
|
123
|
+
reject({
|
|
124
|
+
statusMessage:"backendServerDownMessage",
|
|
125
|
+
statusCode: 503,
|
|
126
|
+
});
|
|
127
|
+
}else{
|
|
128
|
+
|
|
129
|
+
if (error.response?.status && error.response.status == 401) {
|
|
130
|
+
return sendRedirect(event, '/login', 401)
|
|
131
|
+
}
|
|
132
|
+
reject({
|
|
133
|
+
statusMessage: error.response.statusText,
|
|
134
|
+
statusCode: error.response.status ,
|
|
135
|
+
data: error.response.data
|
|
136
|
+
}); // resolve({ status: 'ok' })
|
|
137
|
+
// throw createError({ statusMessage: 'Bad Requests', statusCode: 404 })
|
|
133
138
|
}
|
|
134
|
-
|
|
135
|
-
// reject(error.data)
|
|
136
|
-
reject({
|
|
137
|
-
statusMessage: error.response.statusText,
|
|
138
|
-
statusCode: error.response.status ,
|
|
139
|
-
data: error.response.data
|
|
140
|
-
}); // resolve({ status: 'ok' })
|
|
141
|
-
// throw createError({ statusMessage: 'Bad Requests', statusCode: 404 })
|
|
142
139
|
})
|
|
143
140
|
|
|
144
141
|
// resolve({
|
|
@@ -91,11 +91,11 @@ export class SimpleAppClient<
|
|
|
91
91
|
.then((res: AxiosResponse) => {
|
|
92
92
|
// if(this.event){this.event('success:create',res.data);return res.data}
|
|
93
93
|
// console.log(this.getDocName(), "ok")
|
|
94
|
-
$event('Notification',{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
})
|
|
94
|
+
// $event('Notification',{
|
|
95
|
+
// documentName:this.getDocName(),
|
|
96
|
+
// summary:'Record create successfully',
|
|
97
|
+
// status:NotificationStatus.success
|
|
98
|
+
// })
|
|
99
99
|
this.data.value = { ...res.data };
|
|
100
100
|
return res;
|
|
101
101
|
}).catch((errors:any)=>{
|
|
@@ -131,12 +131,12 @@ export class SimpleAppClient<
|
|
|
131
131
|
.runUpdate(recordid, this.data.value,{timeout:this.defaultTimeOut})
|
|
132
132
|
.then((res: AxiosResponse) => {
|
|
133
133
|
// if(this.event){this.event('success:update',res.data)}
|
|
134
|
-
$event('Notification',{
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
})
|
|
134
|
+
// $event('Notification',{
|
|
135
|
+
// documentName:this.getDocName(),
|
|
136
|
+
// summary:'Record update success',
|
|
137
|
+
// status:NotificationStatus.success,
|
|
138
|
+
// data:errors
|
|
139
|
+
// })
|
|
140
140
|
this.data.value = res.data
|
|
141
141
|
return res.data;
|
|
142
142
|
}).catch((errors:any)=>{
|
|
@@ -162,12 +162,12 @@ export class SimpleAppClient<
|
|
|
162
162
|
return await this.docapi.runDelete(id,{timeout:this.defaultTimeOut})
|
|
163
163
|
.then((res:AxiosResponse)=>{
|
|
164
164
|
// if(this.event){this.event('success:delete',res.data)}
|
|
165
|
-
$event('Notification',{
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
})
|
|
165
|
+
// $event('Notification',{
|
|
166
|
+
// documentName:this.getDocName(),
|
|
167
|
+
// summary:'Record deleted successfully',
|
|
168
|
+
// status:NotificationStatus.success,
|
|
169
|
+
// data:res.data
|
|
170
|
+
// })
|
|
171
171
|
return Promise.resolve(res.data)
|
|
172
172
|
}).catch((errors:any)=>{
|
|
173
173
|
// if(this.event){this.event('error:delete',errors.response.data.data)}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Component } from 'vue';
|
|
9
9
|
import {Notification} from './notifications'
|
|
10
|
+
import { SimpleAppClient } from '~/simpleapp/generate/clients/SimpleAppClient';
|
|
10
11
|
export type ViewRecord = {
|
|
11
12
|
_id: string
|
|
12
13
|
eventId:string
|
|
@@ -15,6 +16,7 @@ export type ViewRecord = {
|
|
|
15
16
|
viewer?: any
|
|
16
17
|
readonly?:boolean
|
|
17
18
|
afterCreate?:Function
|
|
19
|
+
document?:SimpleAppClient<any,any>
|
|
18
20
|
}
|
|
19
21
|
export type RefreshDocumentList ={
|
|
20
22
|
documentName : string,
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"draft": "Draft",
|
|
11
11
|
"profile": "Profile",
|
|
12
12
|
"logout": "logout",
|
|
13
|
-
"language": "Language",
|
|
13
|
+
"language": "Language",
|
|
14
14
|
"theme": "Theme",
|
|
15
15
|
"welcomeSimpleApp": "Welcome To SimpleApp",
|
|
16
16
|
"changeHomePageMsg": "{fullName}, it is product front page and by right you shall replace it with something else.",
|
|
@@ -35,8 +35,6 @@
|
|
|
35
35
|
"suspendcustomer": "Suspend Customer",
|
|
36
36
|
"formKeyNotFound": "Formkey not found \"{formKey}\"",
|
|
37
37
|
"selectAll": "Select All",
|
|
38
|
-
|
|
39
|
-
|
|
40
38
|
"branches":"Branches",
|
|
41
39
|
"accessRights": "Access Rights",
|
|
42
40
|
"fullName":"Full Name",
|
|
@@ -45,5 +43,13 @@
|
|
|
45
43
|
"general": "General",
|
|
46
44
|
"login":"Login",
|
|
47
45
|
"sessionExpire": "Session Expire",
|
|
48
|
-
"reloginMessage": "Session Expire, relogin"
|
|
46
|
+
"reloginMessage": "Session Expire, relogin" ,
|
|
47
|
+
"backToHome":"Back To Home",
|
|
48
|
+
"undefined": "Undefined",
|
|
49
|
+
"no":"No",
|
|
50
|
+
"edit":"Edit",
|
|
51
|
+
"select":"Select",
|
|
52
|
+
"backendServerDownMessage":"Seems there is some connectivity issue, please try again later",
|
|
53
|
+
"invalidXorg":"Invalid XOrg ",
|
|
54
|
+
"userNotExistInTenant":"This tenant is not accessible"
|
|
49
55
|
}
|