@simitgroup/simpleapp-generator 1.2.2 → 1.2.5
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/basic/nuxt/pages.landing.vue.eta +1 -1
- package/templates/nest/src/simpleapp/generate/commons/interceptors/response.interceptor.ts.eta +1 -1
- 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 +18 -16
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +41 -30
- package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +34 -29
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +17 -11
- package/templates/nuxt/components/simpleApp/SimpleAppForm.vue.eta +9 -6
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +22 -77
- 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 +3 -2
- 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 +1 -1
- package/templates/nuxt/simpleapp/generate/defaults/index.ts.eta +4 -0
- package/templates/nuxt/types/events.ts.eta +2 -0
- package/templates/project/lang/default._json +10 -4
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -21,16 +21,15 @@
|
|
|
21
21
|
<div v-else class="p-3 border rounded-lg border-gray-300 dark:border-blue-900/40 ">
|
|
22
22
|
<span :readonly="readonly" class="cursor-pointer text-primary-600 dark:text-primary-400 "
|
|
23
23
|
tabindex="0" @click="openViewer(true)">{{ modelValue && modelValue.label ? modelValue.label:'-' }}</span>
|
|
24
|
-
</div>
|
|
24
|
+
</div>
|
|
25
25
|
</template>
|
|
26
26
|
<script setup lang="ts">
|
|
27
27
|
import { isNull } from 'lodash';
|
|
28
|
+
import * as jsonpath from 'jsonpath';
|
|
28
29
|
import {autocompletetype,SchemaConfig,SchemaType} from '~/types'
|
|
29
30
|
const autocompleteinput = ref()
|
|
30
31
|
const {$event} = useNuxtApp()
|
|
31
32
|
const list = ref<any[]>([])
|
|
32
|
-
const emptyautocomplete =():autocompletetype=> ({_id:'',code:'',label:''})
|
|
33
|
-
|
|
34
33
|
const props = withDefaults(defineProps<{
|
|
35
34
|
setting:any
|
|
36
35
|
allowAddNew?:boolean
|
|
@@ -41,15 +40,22 @@ const props = withDefaults(defineProps<{
|
|
|
41
40
|
}>(),{
|
|
42
41
|
allowAddNew:true,showNull:true
|
|
43
42
|
})
|
|
44
|
-
|
|
43
|
+
|
|
44
|
+
const path = '$'+props.setting.instancepath
|
|
45
|
+
const modifiedpath = path.replaceAll('/','.')
|
|
46
|
+
const queryresult = jsonpath.query(props.setting.defaultValue,modifiedpath)[0]
|
|
47
|
+
|
|
48
|
+
const emptyautocomplete = computed(():autocompletetype=> queryresult)
|
|
49
|
+
|
|
50
|
+
const autocompleteitem = ref<autocompletetype>(emptyautocomplete.value)
|
|
45
51
|
const modelValue = defineModel<autocompletetype>()
|
|
46
52
|
if(modelValue.value && modelValue.value._id){
|
|
47
53
|
autocompleteitem.value={...modelValue.value}
|
|
48
54
|
}
|
|
49
55
|
//clear auto complete auto set value = empty
|
|
50
56
|
const clear = ()=>{
|
|
51
|
-
autocompleteitem.value = emptyautocomplete
|
|
52
|
-
modelValue.value = emptyautocomplete
|
|
57
|
+
autocompleteitem.value = emptyautocomplete.value
|
|
58
|
+
modelValue.value = emptyautocomplete.value
|
|
53
59
|
}
|
|
54
60
|
const buttonClass=computed(()=>modelValue.value?._id ? 'pi pi-link' : 'pi pi-angle-down')
|
|
55
61
|
|
|
@@ -63,7 +69,7 @@ const beforeShow = ()=>{
|
|
|
63
69
|
//recorrect data if lose focus
|
|
64
70
|
const onBlurAutocomplete = ()=>{
|
|
65
71
|
if( autocompleteitem.value === null){
|
|
66
|
-
autocompleteitem.value = emptyautocomplete
|
|
72
|
+
autocompleteitem.value = emptyautocomplete.value
|
|
67
73
|
}
|
|
68
74
|
if(isNull(modelValue.value )){
|
|
69
75
|
modelValue.value = autocompleteitem.value
|
|
@@ -94,13 +100,13 @@ const pickAutoComplete = (event:any)=>{
|
|
|
94
100
|
console.log("event",event,'event.value._id',"'"+event.value._id+"'")
|
|
95
101
|
if(event.value._id===''){
|
|
96
102
|
|
|
97
|
-
modelValue.value = emptyautocomplete
|
|
98
|
-
autocompleteitem.value = emptyautocomplete
|
|
103
|
+
modelValue.value = emptyautocomplete.value
|
|
104
|
+
autocompleteitem.value = emptyautocomplete.value
|
|
99
105
|
console.log(modelValue.value )
|
|
100
106
|
} else if(event.value._id==='new'){
|
|
101
107
|
|
|
102
|
-
modelValue.value = emptyautocomplete
|
|
103
|
-
autocompleteitem.value = emptyautocomplete
|
|
108
|
+
modelValue.value = emptyautocomplete.value
|
|
109
|
+
autocompleteitem.value = emptyautocomplete.value
|
|
104
110
|
openViewer(false)
|
|
105
111
|
}
|
|
106
112
|
else if(typeof event.value.query == 'undefined'){
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<form class="simpleapp-form" @submit.prevent="true">
|
|
2
|
+
<form class="simpleapp-form" @submit.prevent="true">
|
|
3
3
|
<slot name="header"><h3 class="flex flex-col">{{ title }}</h3></slot>
|
|
4
4
|
<slot name="default" :data="document.getData()" :getField="getField"></slot>
|
|
5
5
|
</form>
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
import * as jsonpath from 'jsonpath';
|
|
10
10
|
import { SimpleAppClient } from '~/simpleapp/generate/clients/SimpleAppClient'
|
|
11
11
|
import type { JSONSchema7,JSONSchema7Definition } from 'json-schema';
|
|
12
|
-
import
|
|
12
|
+
import * as alldefaults from '~/simpleapp/generate/defaults'
|
|
13
|
+
import _, { upperFirst } from 'lodash'
|
|
13
14
|
const props = defineProps<{
|
|
14
15
|
title?:string,
|
|
15
16
|
document: SimpleAppClient<any,any>
|
|
@@ -29,7 +30,11 @@ import _ from 'lodash'
|
|
|
29
30
|
const fieldsetting = getPathObject(schema,path)
|
|
30
31
|
// console.log("setting",fieldsetting)
|
|
31
32
|
|
|
33
|
+
type defaulttype = typeof alldefaults
|
|
34
|
+
type keytype = keyof defaulttype
|
|
32
35
|
|
|
36
|
+
const x : keytype = 'Default'+ props.document.getDocName(true) as keytype
|
|
37
|
+
const defaultvalue = alldefaults[x](crypto.randomUUID())
|
|
33
38
|
return {
|
|
34
39
|
path: path,
|
|
35
40
|
key: _.last(path.split('/')),
|
|
@@ -41,15 +46,13 @@ import _ from 'lodash'
|
|
|
41
46
|
modelField: 'email',
|
|
42
47
|
isrequired: getIsRequired(schema,path),
|
|
43
48
|
errors: props.document.getErrors(),
|
|
44
|
-
readonly: isreadonly.value
|
|
49
|
+
readonly: isreadonly.value,
|
|
50
|
+
defaultValue: defaultvalue
|
|
45
51
|
} //as SimpleAppFieldSetting
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
// "schemaPath": "#/properties/email/format",
|
|
49
55
|
|
|
50
|
-
const getModelValue=(data:any,path:string)=>{
|
|
51
|
-
|
|
52
|
-
}
|
|
53
56
|
const getIsRequired=(schema:any,path:string)=>{
|
|
54
57
|
if(!path){
|
|
55
58
|
console.error('unknown path')
|
|
@@ -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="componentProps && componentProps['hourFormat']? componentProps['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,10 @@ import Slider,{ SliderProps } from 'primevue/slider';
|
|
|
171
172
|
import Textarea, { TextareaProps } from 'primevue/textarea';
|
|
172
173
|
import {SimpleAppInputType} from '~/types'
|
|
173
174
|
|
|
174
|
-
|
|
175
175
|
const datevalue = ref('')
|
|
176
176
|
const modelValue = defineModel()
|
|
177
|
+
const timestr = `${today()}T${modelValue.value??'00:00:00Z'}`
|
|
178
|
+
const timevalue = ref<Date>(moment(timestr).toDate())
|
|
177
179
|
|
|
178
180
|
const props = withDefaults( defineProps<{
|
|
179
181
|
inputType:SimpleAppInputType,
|
|
@@ -198,68 +200,6 @@ if(props.inputType== SimpleAppInputType.date && modelValue.value){
|
|
|
198
200
|
datevalue.value = ''
|
|
199
201
|
}
|
|
200
202
|
|
|
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
203
|
const isReadonly = computed(()=>{
|
|
264
204
|
if(props.readonly){
|
|
265
205
|
return props.readonly
|
|
@@ -269,7 +209,9 @@ const isReadonly = computed(()=>{
|
|
|
269
209
|
return false
|
|
270
210
|
}
|
|
271
211
|
})
|
|
272
|
-
|
|
212
|
+
const updateTime = () =>{
|
|
213
|
+
modelValue.value = moment(timevalue.value).format("HH:mm:ss")
|
|
214
|
+
}
|
|
273
215
|
const updateDate = (value:any)=>{
|
|
274
216
|
|
|
275
217
|
if(value){
|
|
@@ -287,7 +229,12 @@ const getListOptions = () =>{
|
|
|
287
229
|
if(props.setting.fieldsetting.enum){
|
|
288
230
|
for(let i=0;i<props.setting.fieldsetting.enum.length;i++){
|
|
289
231
|
const v = props.setting.fieldsetting.enum[i]
|
|
290
|
-
|
|
232
|
+
if(typeof v == 'string'){
|
|
233
|
+
options.push({value:v, label: t(v)})
|
|
234
|
+
}else{
|
|
235
|
+
options.push({value:v.value, label: t(v.label)})
|
|
236
|
+
}
|
|
237
|
+
|
|
291
238
|
}
|
|
292
239
|
|
|
293
240
|
|
|
@@ -308,9 +255,7 @@ watch(modelValue ,(newvalue:any)=>{
|
|
|
308
255
|
}
|
|
309
256
|
|
|
310
257
|
}
|
|
311
|
-
|
|
312
|
-
// modelValue.value=autocompleteitem.value
|
|
313
|
-
// }
|
|
258
|
+
|
|
314
259
|
|
|
315
260
|
emits('change',modelValue.value)
|
|
316
261
|
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,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _ from 'lodash'
|
|
2
2
|
import {Md5} from 'ts-md5'
|
|
3
3
|
import moment from "moment";
|
|
4
4
|
export const camelCaseToWords = (s: string) =>{
|
|
@@ -19,4 +19,5 @@ export const t = (txt:string,options?:any):string => useNuxtApp().$i18n.t(txt,op
|
|
|
19
19
|
export const today = () => moment().format('YYYY-MM-DD')
|
|
20
20
|
export const dateToString = (date:Date) => moment(date).format('YYYY-MM-DD')
|
|
21
21
|
export const getMoment = (startTime:string)=> moment(startTime)
|
|
22
|
-
export const lastDateOfMonth = (datestr:string) => moment(datestr).endOf('month').format('YYYY-MM-DD');
|
|
22
|
+
export const lastDateOfMonth = (datestr:string) => moment(datestr).endOf('month').format('YYYY-MM-DD');
|
|
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({
|