@simitgroup/simpleapp-generator 1.0.32 → 1.0.35
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/.vscode/settings.json +3 -0
- package/README.md +185 -16
- package/buildinschemas copy/autoincreament.autoinc.jsonschema.json +39 -0
- package/buildinschemas copy/branch.branch.jsonschema.json +41 -0
- package/buildinschemas copy/docnoformat.docno.jsonschema.json +41 -0
- package/buildinschemas copy/organization.org.jsonschema.json +50 -0
- package/buildinschemas copy/permission.perm.jsonschema.json +23 -0
- package/buildinschemas copy/permission.perm.jsonschema.try.json +25 -0
- package/buildinschemas copy/tenant.tenant.jsonschema.json +21 -0
- package/buildinschemas copy/tenant.tenant.jsonschema.try.json +27 -0
- package/buildinschemas copy/user.user.jsonschema.json +31 -0
- package/dist/buildinschemas/autoincreament.d.ts +3 -0
- package/dist/buildinschemas/autoincreament.d.ts.map +1 -0
- package/dist/buildinschemas/autoincreament.js +36 -0
- package/dist/buildinschemas/autoincreament.js.map +1 -0
- package/dist/buildinschemas/branch.d.ts +3 -0
- package/dist/buildinschemas/branch.d.ts.map +1 -0
- package/dist/buildinschemas/branch.js +41 -0
- package/dist/buildinschemas/branch.js.map +1 -0
- package/dist/buildinschemas/docnoformat.d.ts +3 -0
- package/dist/buildinschemas/docnoformat.d.ts.map +1 -0
- package/dist/buildinschemas/docnoformat.js +60 -0
- package/dist/buildinschemas/docnoformat.js.map +1 -0
- package/dist/buildinschemas/index.d.ts +8 -0
- package/dist/buildinschemas/index.d.ts.map +1 -0
- package/dist/buildinschemas/index.js +18 -0
- package/dist/buildinschemas/index.js.map +1 -0
- package/dist/buildinschemas/organization.d.ts +3 -0
- package/dist/buildinschemas/organization.d.ts.map +1 -0
- package/dist/buildinschemas/organization.js +34 -0
- package/dist/buildinschemas/organization.js.map +1 -0
- package/dist/buildinschemas/permission.d.ts +3 -0
- package/dist/buildinschemas/permission.d.ts.map +1 -0
- package/dist/buildinschemas/permission.js +34 -0
- package/dist/buildinschemas/permission.js.map +1 -0
- package/dist/buildinschemas/tenant.d.ts +3 -0
- package/dist/buildinschemas/tenant.d.ts.map +1 -0
- package/dist/buildinschemas/tenant.js +41 -0
- package/dist/buildinschemas/tenant.js.map +1 -0
- package/dist/buildinschemas/user.d.ts +3 -0
- package/dist/buildinschemas/user.d.ts.map +1 -0
- package/dist/buildinschemas/user.js +31 -0
- package/dist/buildinschemas/user.js.map +1 -0
- package/dist/constant.d.ts +4 -0
- package/dist/constant.d.ts.map +1 -0
- package/dist/constant.js +2 -1
- package/dist/constant.js.map +1 -1
- package/dist/framework.d.ts +10 -0
- package/dist/framework.d.ts.map +1 -0
- package/dist/framework.js +120 -68
- package/dist/framework.js.map +1 -1
- package/dist/generate-allow-changebackend.js +305 -0
- package/dist/generate-allow-changebackend.js.map +1 -0
- package/dist/generate.d.ts +2 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +310 -230
- package/dist/generate.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +84 -20
- package/dist/index.js.map +1 -1
- package/dist/libs.d.ts +2 -0
- package/dist/libs.d.ts.map +1 -0
- package/dist/processors/groupsbuilder.js +2 -0
- package/dist/processors/groupsbuilder.js.map +1 -0
- package/dist/processors/jsonschemabuilder.d.ts +4 -0
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -0
- package/dist/processors/jsonschemabuilder.js +146 -172
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/schematype/baseschema.js +25 -0
- package/dist/schematype/baseschema.js.map +1 -0
- package/dist/schematype/default.js +2 -0
- package/dist/schematype/default.js.map +1 -0
- package/dist/schematype/index.js +12 -0
- package/dist/schematype/index.js.map +1 -0
- package/dist/schematype/primarymasterdata.js +38 -0
- package/dist/schematype/primarymasterdata.js.map +1 -0
- package/dist/schematype/simple.js +24 -0
- package/dist/schematype/simple.js.map +1 -0
- package/dist/schematype/simplemasterdata.js +31 -0
- package/dist/schematype/simplemasterdata.js.map +1 -0
- package/dist/schematype/transaction.js +74 -0
- package/dist/schematype/transaction.js.map +1 -0
- package/dist/storage.d.ts +3 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +2 -2
- package/dist/storage.js.map +1 -1
- package/dist/type.d.ts +164 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +16 -1
- package/dist/type.js.map +1 -1
- package/dist/validation.d.ts +1 -0
- package/dist/validation.d.ts.map +1 -0
- package/documentation/designconcept.bpmn +349 -0
- package/documentation/documentation.png +0 -0
- package/documentation/infra.drawio +141 -0
- package/documentation/infra.png +0 -0
- package/documentation/management.drawio +57 -0
- package/documentation/stack.drawio +106 -0
- package/package.json +3 -1
- package/src/buildinschemas/autoincreament.ts +34 -0
- package/src/buildinschemas/branch.ts +39 -0
- package/src/buildinschemas/docnoformat.ts +58 -0
- package/src/buildinschemas/index.ts +7 -0
- package/src/buildinschemas/organization.ts +31 -0
- package/src/buildinschemas/permission.ts +31 -0
- package/src/buildinschemas/tenant.ts +38 -0
- package/src/buildinschemas/user.ts +28 -0
- package/src/constant.ts +2 -1
- package/src/framework.ts +126 -67
- package/src/generate.ts +327 -266
- package/src/generate.ts.backup +339 -0
- package/src/index.ts +93 -18
- package/src/processors/jsonschemabuilder.ts +199 -226
- package/src/processors/jsonschemabuilder.ts-old +383 -0
- package/src/storage.ts +1 -1
- package/src/type.ts +94 -27
- package/templates/basic/nest/controller.ts.eta +255 -0
- package/templates/basic/nest/default.ts.eta +42 -0
- package/templates/basic/{model.eta → nest/model.ts.eta} +18 -5
- package/templates/basic/nest/processor.ts.eta +129 -0
- package/templates/basic/nest/service.ts.eta +64 -0
- package/templates/basic/{type.eta → nest/type.ts.eta} +3 -3
- package/templates/basic/nuxt/default.ts.eta +42 -0
- package/templates/basic/{pageindex.vue.eta → nuxt/pages.crud.vue.eta} +85 -22
- package/templates/basic/nuxt/simpleapp.doc.ts.eta +11 -0
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +212 -0
- package/templates/nest/.env.eta +31 -0
- package/templates/nest/.gitignore.eta +40 -0
- package/templates/nest/src/app.controller.ts.eta +19 -0
- package/templates/nest/src/app.module.ts.eta +77 -0
- package/templates/nest/src/app.service.ts.eta +9 -0
- package/templates/nest/src/main.ts.eta +58 -0
- package/templates/nest/src/simpleapp/generate/apischemas/index.ts.eta +16 -0
- package/templates/nest/src/simpleapp/generate/commons/decorators/appuser.decorator.ts.eta +8 -0
- package/templates/nest/src/simpleapp/generate/commons/dicts/foreignkeys.ts.eta +1 -0
- package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +101 -0
- package/templates/nest/src/simpleapp/generate/commons/exceptions/SimpleAppExceptionFilter.ts.eta +39 -0
- package/templates/nest/src/simpleapp/generate/commons/interceptors/response.interceptor.ts.eta +38 -0
- package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +88 -0
- package/templates/nest/{Workflow.eta → src/simpleapp/generate/commons/providers/workflow.provider.ts.etax} +20 -14
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.decorator.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +28 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +10 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.guard.ts.eta +34 -0
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +391 -0
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +71 -0
- package/templates/nest/src/simpleapp/generate/models/perm.model.ts.eta +53 -0
- package/templates/nest/src/simpleapp/generate/models/tenant.model.ts.eta +45 -0
- package/templates/nest/src/simpleapp/generate/models/user.model.ts.eta +57 -0
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +624 -0
- package/templates/nest/src/simpleapp/generate/types/index.ts.eta +19 -0
- package/templates/nest/src/simpleapp/profile/profile.apischema.ts.eta +74 -0
- package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +110 -0
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +195 -0
- package/templates/nest/src/simpleapp/profile/profile.types.ts.eta +18 -0
- package/templates/nest/src/simpleapp/services/autoinc.service.ts.eta +89 -0
- package/templates/nest/src/simpleapp/services/branch.service.ts.eta +66 -0
- package/templates/nest/src/simpleapp/services/docno.service.ts.eta +93 -0
- package/templates/nest/src/simpleapp/services/org.service.ts.eta +67 -0
- package/templates/nest/src/simpleapp/services/perm.service.ts.eta +102 -0
- package/templates/nest/src/simpleapp/services/tenant.service.ts.eta +69 -0
- package/templates/nest/src/simpleapp/services/user.service.ts.eta +66 -0
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +43 -0
- package/templates/nuxt/.env.eta +21 -0
- package/templates/nuxt/.gitignore.eta +28 -0
- package/templates/nuxt/app.vue.eta +5 -2
- package/templates/nuxt/assets/css/tailwind.css.eta +35 -0
- package/templates/nuxt/components/CrudNestedDoc.vue.eta +164 -0
- package/templates/nuxt/components/CrudSimple.vue.eta +179 -0
- package/templates/nuxt/{components.debugdocdata.vue.eta → components/DebugDocumentData.vue.eta} +4 -1
- package/templates/nuxt/{components.eventmonitor.vue.eta → components/EventMonitor.vue.eta} +27 -27
- package/templates/nuxt/components/Invitation.vue.eta +50 -0
- package/templates/nuxt/components/Menus.vue.eta +58 -0
- package/templates/nuxt/components/PermissionInfo.vue.eta +92 -0
- package/templates/nuxt/components/SimpleAppAutocomplete.vue.eta +131 -0
- package/templates/nuxt/components/SimpleAppAutocompletemulti.vue.eta +73 -0
- package/templates/nuxt/components/SimpleAppCalendar.vue.eta +55 -0
- package/templates/nuxt/components/SimpleAppCheckbox.vue.eta +29 -0
- package/templates/nuxt/components/SimpleAppChip.vue.eta +28 -0
- package/templates/nuxt/components/SimpleAppColor.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppDatatable.vue.eta +20 -0
- package/templates/nuxt/components/SimpleAppDocumentNo.vue.eta +90 -0
- package/templates/nuxt/components/SimpleAppDynamicInput.vue.eta +29 -0
- package/templates/nuxt/components/SimpleAppEditor.vue.eta +31 -0
- package/templates/nuxt/components/SimpleAppForm.vue.eta +131 -0
- package/templates/nuxt/components/SimpleAppInputTable.vue.eta +104 -0
- package/templates/nuxt/components/SimpleAppList.vue.eta +38 -0
- package/templates/nuxt/components/SimpleAppListmulti.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppNumber.vue.eta +32 -0
- package/templates/nuxt/components/SimpleAppPassword.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppRadio.vue.eta +42 -0
- package/templates/nuxt/components/SimpleAppRating.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppSelect.vue.eta +38 -0
- package/templates/nuxt/components/SimpleAppSelectmulti.vue.eta +39 -0
- package/templates/nuxt/components/SimpleAppSlider.vue.eta +42 -0
- package/templates/nuxt/components/SimpleAppSwitch.vue.eta +30 -0
- package/templates/nuxt/components/SimpleAppText.vue.eta +50 -0
- package/templates/nuxt/components/SimpleAppTextarea.vue.eta +30 -0
- package/templates/nuxt/components/SimpleAppValue.vue.eta +86 -0
- package/templates/nuxt/components/SimpleFieldContainer.vue.eta +102 -0
- package/templates/nuxt/components/XorgPicker.vue.eta +66 -0
- package/templates/nuxt/components/helper.ts.eta +90 -0
- package/templates/nuxt/components/type.ts.eta +32 -0
- package/templates/nuxt/composables/docformat.generate.ts.eta +5 -0
- package/templates/nuxt/{composables.getautocomplete.ts.eta → composables/getAutocomplete.generate.ts.eta} +4 -5
- package/templates/nuxt/{composables.getmenus.ts.eta → composables/getMenus.generate.ts.eta} +22 -7
- package/templates/nuxt/composables/getOpenApi.generate.ts.eta +6 -0
- package/templates/nuxt/composables/getTenant.generate.ts.eta +4 -0
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +22 -0
- package/templates/nuxt/composables/logout.generate.ts.eta +22 -0
- package/templates/nuxt/composables/roles.generate.ts.eta +48 -0
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +5 -0
- package/templates/nuxt/{layouts.default.vue.eta → layouts/default.vue.eta} +2 -0
- package/templates/nuxt/middleware/10.acl.global.ts.eta +38 -0
- package/templates/nuxt/nuxt.config.ts.eta +12 -2
- package/templates/nuxt/pages/[xorg]/branch/index.vue.eta +102 -0
- package/templates/nuxt/pages/[xorg]/docnoformat/[id].vue.eta +17 -0
- package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +269 -0
- package/templates/nuxt/pages/[xorg]/index.vue.eta +36 -0
- package/templates/nuxt/pages/[xorg]/organization/index.vue.eta +148 -0
- package/templates/nuxt/pages/[xorg]/permission/index.vue.eta +280 -0
- package/templates/nuxt/pages/[xorg]/tenant/index.vue.eta +93 -0
- package/templates/nuxt/pages/[xorg]/user/index.vue.eta +468 -0
- package/templates/nuxt/pages/index.vue.eta +191 -0
- package/templates/nuxt/pages/login.vue.eta +21 -0
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +53 -0
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +155 -0
- package/templates/nuxt/plugins/50.simpleapp-client.ts.eta +23 -0
- package/templates/nuxt/{server.api.ts.eta → server/api/[xorg]/[...].ts.eta} +5 -2
- package/templates/nuxt/server/api/auth/[...].ts.eta +68 -0
- package/templates/nuxt/{server.api.auth.logout.ts.eta → server/api/auth/logout.ts.eta} +1 -3
- package/templates/nuxt/server/api/profile/[...].ts.eta +150 -0
- package/templates/nuxt/server/api/profile/index.ts.eta +103 -0
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +187 -0
- package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +6 -0
- package/templates/nuxt/simpleapp/generate/commons/events.ts.eta +5 -0
- package/templates/nuxt/simpleapp/generate/commons/groups.ts.eta +11 -0
- package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +21 -0
- package/templates/nuxt/types/index.ts.eta +65 -0
- package/templates/project/README.md +11 -0
- package/templates/project/build.sh.eta +17 -0
- package/templates/project/config.json.eta +2 -0
- package/templates/project/generate.ts.eta +10 -0
- package/templates/project/schemas/category.ts.eta +26 -0
- package/templates/project/schemas/index.ts.eta +5 -0
- package/templates/project/schemas/product.ts.eta +59 -0
- package/templates/project/shares/hello.ts.eta +1 -0
- package/templates/project/shares/index.ts.eta +2 -0
- package/tsconfig.json +9 -2
- package/tsconfig.tsbuildinfo +1 -0
- package/definations/category.cat.jsonschema.json +0 -55
- package/definations/level.lvl.jsonschema.json +0 -48
- package/definations/product.prd.jsonschema.json +0 -46
- package/templates/basic/controller.eta +0 -152
- package/templates/basic/module.eta +0 -22
- package/templates/basic/service.eta +0 -62
- package/templates/basic/simpleappclient.eta +0 -120
- package/templates/nest/SimpleAppController.eta +0 -69
- package/templates/nest/SimpleAppService.eta +0 -366
- package/templates/nest/TenantMiddleware.eta +0 -34
- package/templates/nest/UserProvider.eta +0 -127
- package/templates/nest/app.controller.eta +0 -12
- package/templates/nest/app.module.eta +0 -64
- package/templates/nest/app.service.eta +0 -8
- package/templates/nest/inputvalidation-exception.eta +0 -6
- package/templates/nest/nest.env.eta +0 -28
- package/templates/nest/nest.main.eta +0 -31
- package/templates/nuxt/components.crudsimple.vue.eta +0 -124
- package/templates/nuxt/components.menus.vue.eta +0 -35
- package/templates/nuxt/env.eta +0 -17
- package/templates/nuxt/pages.[xorg].index.vue.eta +0 -20
- package/templates/nuxt/pages.index.vue.eta +0 -72
- package/templates/nuxt/pages.login.vue.eta +0 -20
- package/templates/nuxt/plugins.simpleapp.ts.eta +0 -88
- package/templates/nuxt/server.api.auth[...].ts.eta +0 -233
- package/templates/nuxt/tailwind.css.eta +0 -49
- /package/templates/basic/{apischema.eta → nest/apischema.ts.eta} +0 -0
- /package/templates/basic/{jsonschema.eta → nest/jsonschema.ts.eta} +0 -0
- /package/templates/basic/{pageindexwithid.vue.eta → nuxt/pages.[id].vue.eta} +0 -0
- /package/templates/nest/{oauth2-redirect.eta → public_html/oauth2-redirect.html.eta} +0 -0
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* This file was automatically generated by simpleapp generator during initialization.
|
|
4
|
-
* DO NOT MODIFY IT BY HAND.
|
|
5
|
-
* last change 2023-09-09
|
|
6
|
-
* author: Ks Tan
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { SimpleAppClient } from '@simitgroup//simpleapp-vue-component/src/SimpleAppClient';
|
|
10
|
-
import SimpleAppForm from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppForm.vue';
|
|
11
|
-
import SimpleAppDatatable from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppDatatable.vue';
|
|
12
|
-
import Dialog from 'primevue/dialog';
|
|
13
|
-
import axios from 'axios'
|
|
14
|
-
import ProgressSpinner from 'primevue/progressspinner';
|
|
15
|
-
import ConfirmPopup from 'primevue/confirmpopup';
|
|
16
|
-
import { useConfirm } from "primevue/useconfirm";
|
|
17
|
-
|
|
18
|
-
const confirm = useConfirm();
|
|
19
|
-
const props = defineProps<{
|
|
20
|
-
document:SimpleAppClient<any,any>
|
|
21
|
-
listColumns:string[]
|
|
22
|
-
path:string
|
|
23
|
-
title:string
|
|
24
|
-
}>()
|
|
25
|
-
const visible = ref(false)
|
|
26
|
-
const obj = props.document
|
|
27
|
-
const data = obj.getReactiveData()
|
|
28
|
-
const disabled=ref(false)
|
|
29
|
-
const recordlist = ref();
|
|
30
|
-
const router = useRouter()
|
|
31
|
-
const route = useRoute()
|
|
32
|
-
const filters = ref()
|
|
33
|
-
defineShortcuts({
|
|
34
|
-
'ctrl_enter': () => newData()
|
|
35
|
-
})
|
|
36
|
-
const refresh = () => {
|
|
37
|
-
obj.list().then((res:any) => {
|
|
38
|
-
recordlist.value = res;
|
|
39
|
-
disabled.value=false
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
const newData = () => {
|
|
43
|
-
router.push({ path: `${props.path}` })
|
|
44
|
-
obj.setNew()
|
|
45
|
-
visible.value=true;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const triggerEdit = (event: any) => {
|
|
49
|
-
let id = event.data._id.toString()
|
|
50
|
-
router.push({ path: `${props.path}/${id}` })
|
|
51
|
-
};
|
|
52
|
-
const editRecord = (id:string) => {
|
|
53
|
-
obj.getById(id);
|
|
54
|
-
visible.value=true
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const saveData = () => {
|
|
58
|
-
disabled.value=true
|
|
59
|
-
if (data.value._id == "") {
|
|
60
|
-
obj.create().then(()=>{visible.value=false}).finally(() => refresh());
|
|
61
|
-
} else {
|
|
62
|
-
obj.update().then(()=>visible.value=false).finally(() => refresh());
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const deleteData = (event:Event) => {
|
|
66
|
-
|
|
67
|
-
confirm.require({
|
|
68
|
-
target: event.currentTarget as HTMLElement,
|
|
69
|
-
message:'Delete?',
|
|
70
|
-
icon: 'pi pi-exclamation-triangle',
|
|
71
|
-
acceptClass: 'p-button-danger',
|
|
72
|
-
accept: ()=>{
|
|
73
|
-
disabled.value=true
|
|
74
|
-
obj.delete(data.value._id ?? "").then(()=>visible.value=false).finally(() => {
|
|
75
|
-
refresh();
|
|
76
|
-
});
|
|
77
|
-
},
|
|
78
|
-
reject: () => {
|
|
79
|
-
console.log("Cancel delete")
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
if (route.params.id) {
|
|
85
|
-
const recordid:string = route.params.id.toString()
|
|
86
|
-
editRecord(recordid)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
refresh();
|
|
90
|
-
</script>
|
|
91
|
-
|
|
92
|
-
<template>
|
|
93
|
-
<div class="simpleapp-crudsimple">
|
|
94
|
-
<button class="bg-primary" @click="newData" v-tooltip="'Add new(ctrl+enter)'" >New</button>
|
|
95
|
-
<SimpleAppDatatable
|
|
96
|
-
@row-dblclick="triggerEdit"
|
|
97
|
-
v-model="recordlist"
|
|
98
|
-
:setting="{}"
|
|
99
|
-
:columns="listColumns"
|
|
100
|
-
>
|
|
101
|
-
</SimpleAppDatatable>
|
|
102
|
-
|
|
103
|
-
<DebugDocumentData v-model="data"/>
|
|
104
|
-
</div>
|
|
105
|
-
|
|
106
|
-
<Dialog v-model:visible="visible" modal header="Header" class="crudsimple-dialog" :autoZIndex="false" :style="{zIndex:100, width: '80vw' }">
|
|
107
|
-
<SimpleAppForm :document="obj" :title="title" #default="o">
|
|
108
|
-
<div class="simpleapp-tool-bar" >
|
|
109
|
-
<button class="bg-default" :disabled="disabled" @click="newData" type="button">New</button>
|
|
110
|
-
<button class="bg-primary" :disabled="disabled" @click="saveData" type="submit">Save</button>
|
|
111
|
-
<button class="bg-danger" :disabled="disabled" @click="deleteData($event)" type="button">Delete</button>
|
|
112
|
-
<ProgressSpinner v-if="disabled==true" style="width: 2rem; height: 2rem" ></ProgressSpinner>
|
|
113
|
-
<ConfirmPopup></ConfirmPopup>
|
|
114
|
-
</div>
|
|
115
|
-
<slot :data="o.data" :getField="o.getField" name="default"></slot>
|
|
116
|
-
</SimpleAppForm>
|
|
117
|
-
</Dialog>
|
|
118
|
-
</template>
|
|
119
|
-
|
|
120
|
-
<style scoped>
|
|
121
|
-
.crudsimple-dialog{
|
|
122
|
-
z-index: 100;
|
|
123
|
-
}
|
|
124
|
-
</style>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* This file was automatically generated by simpleapp generator during initialization.
|
|
4
|
-
* You may modify it by hand
|
|
5
|
-
* last change 2023-09-10
|
|
6
|
-
* author: Ks Tan
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
// import MegaMenu from 'primevue/megamenu';
|
|
10
|
-
// import Menubar from 'primevue/menubar';
|
|
11
|
-
// const route = useRoute()
|
|
12
|
-
// const menus = getMenus(route.params.xorg)
|
|
13
|
-
const logout = async () => {
|
|
14
|
-
const { signOut } = useAuth();
|
|
15
|
-
const { data } = await <any>useFetch('/api/auth/logout');
|
|
16
|
-
const addPath = encodeURIComponent("/login");
|
|
17
|
-
signOut({ redirect: false });
|
|
18
|
-
window.location.href = data?.value?.path + addPath;
|
|
19
|
-
};
|
|
20
|
-
</script>
|
|
21
|
-
<template>
|
|
22
|
-
<!-- <header> -->
|
|
23
|
-
<!-- <MegaMenu :model="getMenus()" orientation="horizontal" /> -->
|
|
24
|
-
<div class="bg-white border-b-2 border-b-gray-300 h-10 flex">
|
|
25
|
-
|
|
26
|
-
<div class="flex-1">
|
|
27
|
-
<NuxtLink to="/"><i class="pi pi-home m-2"></i>Home</NuxtLink>
|
|
28
|
-
</div>
|
|
29
|
-
<div class="flex-1"></div>
|
|
30
|
-
<button class="text-right" @click="logout()">
|
|
31
|
-
<i class="pi pi-sign-out "></i>logout
|
|
32
|
-
</button>
|
|
33
|
-
</div>
|
|
34
|
-
<!-- </header> -->
|
|
35
|
-
</template>
|
package/templates/nuxt/env.eta
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
PORT=<%=it.frontendPort%>
|
|
2
|
-
|
|
3
|
-
SIMPLEAPP_BACKEND_URL=http://localhost:<%=it.backendPort%>
|
|
4
|
-
|
|
5
|
-
APP_URL=http://localhost:<%=it.frontendPort%>
|
|
6
|
-
|
|
7
|
-
DEBUGDATA=1
|
|
8
|
-
|
|
9
|
-
OAUTH2_CONFIGURL=<%=it.keycloaksetting.OAUTH2_CONFIGURL%>
|
|
10
|
-
|
|
11
|
-
OAUTH2_CLIENTID=<%=it.keycloaksetting.OAUTH2_CLIENTID%>
|
|
12
|
-
|
|
13
|
-
OAUTH2_CLIENTSECRET=<%=it.keycloaksetting.OAUTH2_CLIENTSECRET%>
|
|
14
|
-
|
|
15
|
-
AUTH_SECRET_KEY=<%=it.keycloaksetting.AUTH_SECRET_KEY%>
|
|
16
|
-
|
|
17
|
-
AUTH_ORIGIN=http://localhost:<%=it.frontendPort%>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
/**
|
|
3
|
-
* This file was automatically generated by simpleapp generator during initialization.
|
|
4
|
-
* You may modify it for your need
|
|
5
|
-
* last change 2023-09-09
|
|
6
|
-
* author: Ks Tan
|
|
7
|
-
*/
|
|
8
|
-
const menus = getMenus();
|
|
9
|
-
</script>
|
|
10
|
-
<template>
|
|
11
|
-
<div>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<div class="desktop-shortcut-link">
|
|
15
|
-
<div v-for="menu in menus[1].items" class="">
|
|
16
|
-
<NuxtLink :external="true" :to="menu.to">{{ menu.label }}</NuxtLink>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
/**
|
|
3
|
-
* This file was automatically generated by simpleapp generator during initialization.
|
|
4
|
-
* You may modify it for your need
|
|
5
|
-
* last change 2023-09-09
|
|
6
|
-
* author: Ks Tan
|
|
7
|
-
*/
|
|
8
|
-
import { ref, Ref } from "vue";
|
|
9
|
-
import { TenantDoc } from "../simpleapp/simpleappdocs/TenantDoc";
|
|
10
|
-
// import OrderList from 'primevue/orderlist';
|
|
11
|
-
import Panel from "primevue/panel";
|
|
12
|
-
|
|
13
|
-
const { $event, $listen } = useNuxtApp();
|
|
14
|
-
const route = useRoute();
|
|
15
|
-
const doc = new TenantDoc("", $event, $listen);
|
|
16
|
-
type tenantDataType = {
|
|
17
|
-
tenantId: number;
|
|
18
|
-
tenantCode: string;
|
|
19
|
-
tenantName: string;
|
|
20
|
-
xorg: string;
|
|
21
|
-
};
|
|
22
|
-
const initialtenant: tenantDataType[] = [];
|
|
23
|
-
const tenantlist = ref(initialtenant);
|
|
24
|
-
|
|
25
|
-
doc
|
|
26
|
-
.getApi()
|
|
27
|
-
.getMyTenant()
|
|
28
|
-
.then((res: any) => {
|
|
29
|
-
for (let i = 0; i < res.data.length; i++) {
|
|
30
|
-
const x = res.data[i];
|
|
31
|
-
const tmp: tenantDataType = {
|
|
32
|
-
xorg: x.xOrg,
|
|
33
|
-
tenantId: x.tenantId,
|
|
34
|
-
tenantCode: x.tenantCode,
|
|
35
|
-
tenantName: x.tenantName,
|
|
36
|
-
};
|
|
37
|
-
tenantlist.value.push(tmp);
|
|
38
|
-
}
|
|
39
|
-
console.log(tenantlist.value);
|
|
40
|
-
});
|
|
41
|
-
// const mytenant = doc.get
|
|
42
|
-
</script>
|
|
43
|
-
<template>
|
|
44
|
-
<div>
|
|
45
|
-
|
|
46
|
-
<Panel header="Tenant List">
|
|
47
|
-
<div>
|
|
48
|
-
<NuxtLink
|
|
49
|
-
v-for="item in tenantlist"
|
|
50
|
-
:external="true"
|
|
51
|
-
:to="item.xorg"
|
|
52
|
-
class="tenant-link"
|
|
53
|
-
>
|
|
54
|
-
<div class="flex flex-wrap p-2 align-items-center gap-3">
|
|
55
|
-
<div class="flex-1 flex flex-column gap-2">
|
|
56
|
-
<span class="font-bold">{{ item.tenantName }}</span>
|
|
57
|
-
<div class="flex align-items-center gap-2">
|
|
58
|
-
<span>{{ item.xorg }}</span>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
<span class="font-bold text-900">{{ item.tenantCode }}</span>
|
|
62
|
-
</div>
|
|
63
|
-
</NuxtLink>
|
|
64
|
-
</div>
|
|
65
|
-
</Panel>
|
|
66
|
-
</div>
|
|
67
|
-
</template>
|
|
68
|
-
<style scoped>
|
|
69
|
-
.p-panel {
|
|
70
|
-
@apply m-2;
|
|
71
|
-
}
|
|
72
|
-
</style>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<NuxtPage />
|
|
3
|
-
</template>
|
|
4
|
-
<script setup lang="ts">
|
|
5
|
-
definePageMeta({
|
|
6
|
-
name: 'Login',
|
|
7
|
-
auth: false,
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
// const route = useRoute();
|
|
11
|
-
const { signIn } = useAuth()
|
|
12
|
-
onMounted(async () => {
|
|
13
|
-
let callbackUrl = '/';
|
|
14
|
-
// if(route.params.redirect) {
|
|
15
|
-
// callbackUrl = <string>route.params.redirect;
|
|
16
|
-
// }
|
|
17
|
-
await signIn('keycloak', { callbackUrl: callbackUrl })
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
</script>
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator during initialization.
|
|
3
|
-
* DO NOT MODIFY IT BY HAND.
|
|
4
|
-
* last change 2023-09-09
|
|
5
|
-
* author: Ks Tan
|
|
6
|
-
*/
|
|
7
|
-
import { defineNuxtPlugin } from "#app";
|
|
8
|
-
import axios from 'axios'
|
|
9
|
-
import PrimeVue from "primevue/config";
|
|
10
|
-
import SimpleAppAutocomplete from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppAutocomplete.vue'
|
|
11
|
-
import SimpleAppAutocompletemulti from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppAutocompletemulti.vue'
|
|
12
|
-
import SimpleAppCalendar from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppCalendar.vue'
|
|
13
|
-
import SimpleAppCheckbox from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppCheckbox.vue'
|
|
14
|
-
import SimpleAppChip from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppChip.vue'
|
|
15
|
-
import SimpleAppColor from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppColor.vue'
|
|
16
|
-
// import SimpleAppEditor from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppEditor.vue'
|
|
17
|
-
import SimpleAppForm from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppForm.vue'
|
|
18
|
-
import SimpleAppList from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppList.vue'
|
|
19
|
-
import SimpleAppListmulti from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppListmulti.vue'
|
|
20
|
-
import SimpleAppNumber from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppNumber.vue'
|
|
21
|
-
import SimpleAppPassword from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppPassword.vue'
|
|
22
|
-
import SimpleAppRadio from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppRadio.vue'
|
|
23
|
-
import SimpleAppRating from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppRating.vue'
|
|
24
|
-
import SimpleAppSelect from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppSelect.vue'
|
|
25
|
-
import SimpleAppSelectmulti from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppSelectmulti.vue'
|
|
26
|
-
import SimpleAppSlider from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppSlider.vue'
|
|
27
|
-
import SimpleAppSwitch from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppSwitch.vue'
|
|
28
|
-
import SimpleAppText from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppText.vue'
|
|
29
|
-
import SimpleAppTextarea from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppTextarea.vue'
|
|
30
|
-
import SimpleAppValue from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppValue.vue'
|
|
31
|
-
import SimpleFieldContainer from '@simitgroup/simpleapp-vue-component/src/components/SimpleFieldContainer.vue'
|
|
32
|
-
import SimpleAppDatatable from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppDatatable.vue'
|
|
33
|
-
import SimpleAppInputTable from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppInputTable.vue'
|
|
34
|
-
import SimpleAppDynamicInput from '@simitgroup/simpleapp-vue-component/src/components/SimpleAppDynamicInput.vue'
|
|
35
|
-
|
|
36
|
-
import mitt from 'mitt'
|
|
37
|
-
import ToastService from 'primevue/toastservice';
|
|
38
|
-
import ConfirmationService from 'primevue/confirmationservice';
|
|
39
|
-
import Tooltip from 'primevue/tooltip';
|
|
40
|
-
//import Quill from 'quill'
|
|
41
|
-
const emitter = mitt()
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export default defineNuxtPlugin((nuxtApp) => {
|
|
46
|
-
//const { csrf } = useCsrf()
|
|
47
|
-
//axios.defaults.headers.common = {"CSRF-TOKEN": csrf};
|
|
48
|
-
nuxtApp.vueApp.use(PrimeVue, { ripple: true });
|
|
49
|
-
nuxtApp.vueApp
|
|
50
|
-
.component("SimpleAppAutocomplete",SimpleAppAutocomplete)
|
|
51
|
-
.component("SimpleAppAutocompletemulti",SimpleAppAutocompletemulti)
|
|
52
|
-
.component("SimpleAppCalendar",SimpleAppCalendar)
|
|
53
|
-
.component("SimpleAppCheckbox",SimpleAppCheckbox)
|
|
54
|
-
.component("SimpleAppChip",SimpleAppChip)
|
|
55
|
-
.component("SimpleAppColor",SimpleAppColor)
|
|
56
|
-
// .component("SimpleAppEditor",SimpleAppEditor) // not suitable, will cause problem in ssr mode
|
|
57
|
-
.component("SimpleAppForm",SimpleAppForm)
|
|
58
|
-
.component("SimpleAppList",SimpleAppList)
|
|
59
|
-
.component("SimpleAppListmulti",SimpleAppListmulti)
|
|
60
|
-
.component("SimpleAppNumber",SimpleAppNumber)
|
|
61
|
-
.component("SimpleAppPassword",SimpleAppPassword)
|
|
62
|
-
.component("SimpleAppRadio",SimpleAppRadio)
|
|
63
|
-
.component("SimpleAppRating",SimpleAppRating)
|
|
64
|
-
.component("SimpleAppSelect",SimpleAppSelect)
|
|
65
|
-
.component("SimpleAppSelectmulti",SimpleAppSelectmulti)
|
|
66
|
-
.component("SimpleAppSlider",SimpleAppSlider)
|
|
67
|
-
.component("SimpleAppSwitch",SimpleAppSwitch)
|
|
68
|
-
.component("SimpleAppText",SimpleAppText)
|
|
69
|
-
.component("SimpleAppTextarea",SimpleAppTextarea)
|
|
70
|
-
.component("SimpleAppValue",SimpleAppValue)
|
|
71
|
-
.component("SimpleFieldContainer",SimpleFieldContainer)
|
|
72
|
-
.component("SimpleAppDatatable",SimpleAppDatatable)
|
|
73
|
-
.component("SimpleAppDynamicInput",SimpleAppDynamicInput)
|
|
74
|
-
.component("SimpleAppInputTable",SimpleAppInputTable)
|
|
75
|
-
|
|
76
|
-
//.component("Quill",Quill) // cause problem in ssr mode
|
|
77
|
-
.use(ToastService)
|
|
78
|
-
.use(ConfirmationService)
|
|
79
|
-
.directive('tooltip', Tooltip)
|
|
80
|
-
;
|
|
81
|
-
return {
|
|
82
|
-
provide: {
|
|
83
|
-
event: emitter.emit, // Will emit an event
|
|
84
|
-
listen: emitter.on // Will register a listener for an event
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
//other components that you need
|
|
88
|
-
});
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import { NuxtAuthHandler } from "#auth";
|
|
2
|
-
import KeycloakProvider from "next-auth/providers/keycloak";
|
|
3
|
-
import type { JWT } from "next-auth/jwt";
|
|
4
|
-
// import GithubProvider from "next-auth/providers/github";
|
|
5
|
-
|
|
6
|
-
export default NuxtAuthHandler({
|
|
7
|
-
secret: process.env.AUTH_SECRET_KEY,
|
|
8
|
-
jwt: {
|
|
9
|
-
maxAge: 60 * 60 * 24 * 30,
|
|
10
|
-
},
|
|
11
|
-
providers: [
|
|
12
|
-
// GithubProvider.default({
|
|
13
|
-
// clientId: process.env.GITHUB_ID ?? '',
|
|
14
|
-
// clientSecret: process.env.GITHUB_SECRET ?? '',
|
|
15
|
-
// }),
|
|
16
|
-
// @ts-expect-error
|
|
17
|
-
KeycloakProvider.default({
|
|
18
|
-
clientId: process.env.OAUTH2_CLIENTID ?? "",
|
|
19
|
-
clientSecret: process.env.OAUTH2_CLIENTSECRET ?? "",
|
|
20
|
-
issuer: process.env.OAUTH2_CONFIGURL,
|
|
21
|
-
idToken: true,
|
|
22
|
-
scheme: "oauth2",
|
|
23
|
-
endpoints: {
|
|
24
|
-
authorization: `${process.env.OAUTH2_CONFIGURL}/protocol/openid-connect/auth`,
|
|
25
|
-
userInfo: `${process.env.OAUTH2_CONFIGURL}/protocol/openid-connect/userinfo`,
|
|
26
|
-
token: `${process.env.OAUTH2_CONFIGURL}/protocol/openid-connect/token`,
|
|
27
|
-
logout:
|
|
28
|
-
`${process.env.OAUTH2_CONFIGURL}/protocol/openid-connect/logout?redirect_uri=` +
|
|
29
|
-
encodeURIComponent(String(process.env.APP_URL)),
|
|
30
|
-
},
|
|
31
|
-
// accessTokenUrl: `${process.env.OAUTH2_CONFIGURL}/protocol/openid-connect/token`,
|
|
32
|
-
// requestTokenUrl: `${process.env.OAUTH2_CONFIGURL}/protocol/openid-connect/token`,
|
|
33
|
-
// profileUrl: `${process.env.OAUTH2_CONFIGURL}/protocol/openid-connect/userinfo`,
|
|
34
|
-
token: {
|
|
35
|
-
property: "access_token",
|
|
36
|
-
type: "Bearer",
|
|
37
|
-
name: "Authorization",
|
|
38
|
-
maxAge: 60 * 60 * 24,
|
|
39
|
-
},
|
|
40
|
-
refreshToken: {
|
|
41
|
-
property: "refresh_token",
|
|
42
|
-
maxAge: 60 * 60 * 24 * 30,
|
|
43
|
-
},
|
|
44
|
-
responseType: "code",
|
|
45
|
-
grantType: "authorization_code",
|
|
46
|
-
scope: ["openid", "profile", "email"],
|
|
47
|
-
codeChallengeMethod: "S256",
|
|
48
|
-
redirect: {
|
|
49
|
-
logout: "/",
|
|
50
|
-
callback: "/",
|
|
51
|
-
home: "/",
|
|
52
|
-
},
|
|
53
|
-
}),
|
|
54
|
-
],
|
|
55
|
-
pages: {
|
|
56
|
-
signIn: "/login",
|
|
57
|
-
},
|
|
58
|
-
callbacks: {
|
|
59
|
-
// async redirect({ url, baseUrl }) {
|
|
60
|
-
|
|
61
|
-
// console.log(url, baseUrl)
|
|
62
|
-
// return baseUrl
|
|
63
|
-
// },
|
|
64
|
-
async jwt({ token, account }) {
|
|
65
|
-
// Persist the OAuth access_token to the token right after signin
|
|
66
|
-
if (account) {
|
|
67
|
-
token.accessToken = account.access_token;
|
|
68
|
-
}
|
|
69
|
-
return token;
|
|
70
|
-
},
|
|
71
|
-
async session({ session, token, user }) {
|
|
72
|
-
// console.log("session", session);
|
|
73
|
-
// Send properties to the client, like an access_token from a provider.
|
|
74
|
-
session.accessToken = <string>token.accessToken;
|
|
75
|
-
return session;
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
/*async jwt({ token, account, user }) {
|
|
79
|
-
// Persist the OAuth access_token to the token right after signin
|
|
80
|
-
console.log("token", token);
|
|
81
|
-
console.log("account", account);
|
|
82
|
-
console.log("user", user);
|
|
83
|
-
|
|
84
|
-
// Initial sign in
|
|
85
|
-
if (account && user) {
|
|
86
|
-
// Add access_token, refresh_token and expirations to the token right after signin
|
|
87
|
-
token.accessToken = account.accessToken;
|
|
88
|
-
token.refreshToken = account.refreshToken;
|
|
89
|
-
token.accessTokenExpired =
|
|
90
|
-
Date.now() + (account.expires_in - 15) * 1000;
|
|
91
|
-
token.refreshTokenExpired =
|
|
92
|
-
Date.now() + (account.refresh_expires_in - 15) * 1000;
|
|
93
|
-
token.user = user;
|
|
94
|
-
return token;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Return previous token if the access token has not expired yet
|
|
98
|
-
if (Date.now() < token.accessTokenExpired) return token;
|
|
99
|
-
|
|
100
|
-
// Access token has expired, try to update it
|
|
101
|
-
return refreshAccessToken(token);
|
|
102
|
-
|
|
103
|
-
// if (account) {
|
|
104
|
-
// // Save the access token and refresh token in the JWT on the initial login
|
|
105
|
-
// token.accessToken = account.access_token;
|
|
106
|
-
// return {
|
|
107
|
-
// access_token: account.access_token,
|
|
108
|
-
// expires_at: Math.floor(
|
|
109
|
-
// Date.now() / 1000 + account.expires_in
|
|
110
|
-
// ),
|
|
111
|
-
// refresh_token: account.refresh_token,
|
|
112
|
-
// };
|
|
113
|
-
// } else if (Date.now() < token.expires_at * 1000) {
|
|
114
|
-
// // If the access token has not expired yet, return it
|
|
115
|
-
// return token;
|
|
116
|
-
// } else {
|
|
117
|
-
// // If the access token has expired, try to refresh it
|
|
118
|
-
// try {
|
|
119
|
-
// // ${process.env.OAUTH2_CONFIGURL}/.well-known/openid-configuration
|
|
120
|
-
// // We need the `token_endpoint`.
|
|
121
|
-
// const response = await fetch(
|
|
122
|
-
// `${process.env.OAUTH2_CONFIGURL}/protocol/openid-connect/token`,
|
|
123
|
-
// {
|
|
124
|
-
// headers: {
|
|
125
|
-
// "Content-Type":
|
|
126
|
-
// "application/x-www-form-urlencoded;charset=UTF-8",
|
|
127
|
-
// },
|
|
128
|
-
// body: new URLSearchParams({
|
|
129
|
-
// client_id: process.env.OAUTH2_CLIENTID ?? "",
|
|
130
|
-
// client_secret:
|
|
131
|
-
// process.env.OAUTH2_CLIENTSECRET ?? "",
|
|
132
|
-
// grant_type: "refresh_token",
|
|
133
|
-
// refresh_token: <string>token.refresh_token,
|
|
134
|
-
// }),
|
|
135
|
-
// method: "POST",
|
|
136
|
-
// }
|
|
137
|
-
// );
|
|
138
|
-
|
|
139
|
-
// const tokens: any = await response.json();
|
|
140
|
-
|
|
141
|
-
// if (!response.ok) throw tokens;
|
|
142
|
-
|
|
143
|
-
// return {
|
|
144
|
-
// ...token, // Keep the previous token properties
|
|
145
|
-
// access_token: tokens.access_token,
|
|
146
|
-
// expires_at: Math.floor(
|
|
147
|
-
// Date.now() / 1000 + tokens.expires_in
|
|
148
|
-
// ),
|
|
149
|
-
// // Fall back to old refresh token, but note that
|
|
150
|
-
// // many providers may only allow using a refresh token once.
|
|
151
|
-
// refresh_token:
|
|
152
|
-
// tokens.refresh_token ?? token.refresh_token,
|
|
153
|
-
// };
|
|
154
|
-
// } catch (error) {
|
|
155
|
-
// console.error("Error refreshing access token", error);
|
|
156
|
-
// // The error property will be used client-side to handle the refresh token error
|
|
157
|
-
// return {
|
|
158
|
-
// ...token,
|
|
159
|
-
// error: "RefreshAccessTokenError" as const,
|
|
160
|
-
// };
|
|
161
|
-
// }
|
|
162
|
-
// }
|
|
163
|
-
return token;
|
|
164
|
-
},
|
|
165
|
-
async session({ session, token, user }) {
|
|
166
|
-
if (token) {
|
|
167
|
-
session.error = <string>token.error;
|
|
168
|
-
session.accessToken = <string>token.accessToken;
|
|
169
|
-
}
|
|
170
|
-
return session;
|
|
171
|
-
}, */
|
|
172
|
-
},
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
/* const refreshAccessToken = async (token: JWT) => {
|
|
176
|
-
try {
|
|
177
|
-
if (Date.now() > token.refreshTokenExpired) throw Error;
|
|
178
|
-
const details = {
|
|
179
|
-
client_id: process.env.OAUTH2_CLIENTID,
|
|
180
|
-
client_secret: process.env.OAUTH2_CLIENTSECRET,
|
|
181
|
-
grant_type: ["refresh_token"],
|
|
182
|
-
refresh_token: token.refreshToken,
|
|
183
|
-
};
|
|
184
|
-
const formBody: string[] = [];
|
|
185
|
-
Object.entries(details).forEach(([key, value]: [string, any]) => {
|
|
186
|
-
const encodedKey = encodeURIComponent(key);
|
|
187
|
-
const encodedValue = encodeURIComponent(value);
|
|
188
|
-
formBody.push(encodedKey + "=" + encodedValue);
|
|
189
|
-
});
|
|
190
|
-
const formData = formBody.join("&");
|
|
191
|
-
const url = `${process.env.OAUTH2_CONFIGURL}/protocol/openid-connect/token`;
|
|
192
|
-
const response = await fetch(url, {
|
|
193
|
-
method: "POST",
|
|
194
|
-
headers: {
|
|
195
|
-
"Content-Type":
|
|
196
|
-
"application/x-www-form-urlencoded;charset=UTF-8",
|
|
197
|
-
},
|
|
198
|
-
body: formData,
|
|
199
|
-
});
|
|
200
|
-
const refreshedTokens = await response.json();
|
|
201
|
-
if (!response.ok) throw refreshedTokens;
|
|
202
|
-
return {
|
|
203
|
-
...token,
|
|
204
|
-
accessToken: refreshedTokens.access_token,
|
|
205
|
-
accessTokenExpired:
|
|
206
|
-
Date.now() + (refreshedTokens.expires_in - 15) * 1000,
|
|
207
|
-
refreshToken: refreshedTokens.refresh_token ?? token.refreshToken,
|
|
208
|
-
refreshTokenExpired:
|
|
209
|
-
Date.now() + (refreshedTokens.refresh_expires_in - 15) * 1000,
|
|
210
|
-
};
|
|
211
|
-
} catch (error) {
|
|
212
|
-
console.log('receive', error)
|
|
213
|
-
|
|
214
|
-
return {
|
|
215
|
-
...token,
|
|
216
|
-
error: "RefreshAccessTokenError",
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
}; */
|
|
220
|
-
|
|
221
|
-
// import NextAuth from "next-auth"
|
|
222
|
-
// import KeycloakProvider from 'next-auth/providers/keycloak'
|
|
223
|
-
// export const authOptions = {
|
|
224
|
-
// // Configure one or more authentication providers
|
|
225
|
-
// providers: [
|
|
226
|
-
// KeycloakProvider({
|
|
227
|
-
// clientId: process.env.OAUTH2_CLIENTID,
|
|
228
|
-
// clientSecret: process.env.OAUTH2_CLIENTSECRET,
|
|
229
|
-
// issuer: process.env.OAUTH2_CONFIGURL,
|
|
230
|
-
// }),
|
|
231
|
-
// ],
|
|
232
|
-
// }
|
|
233
|
-
// export default NextAuth(authOptions)
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
@tailwind base;
|
|
2
|
-
@tailwind components;
|
|
3
|
-
@tailwind utilities;
|
|
4
|
-
|
|
5
|
-
button {
|
|
6
|
-
@apply p-2 border-2
|
|
7
|
-
}
|
|
8
|
-
.simpleapp-input-container,.simpleapp-input-container,.simpleapp-input-container .simpleapp-inputfield{
|
|
9
|
-
@apply flex flex-col
|
|
10
|
-
}
|
|
11
|
-
.simpleapp-input-container .p-chips ul{
|
|
12
|
-
width: 100%
|
|
13
|
-
}
|
|
14
|
-
.input-error{
|
|
15
|
-
@apply text-red-500
|
|
16
|
-
}
|
|
17
|
-
.input-error input{
|
|
18
|
-
@apply border-red-600
|
|
19
|
-
}
|
|
20
|
-
.simpleapp-tool-bar button{
|
|
21
|
-
margin-right: 1rem;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.bg-primary{
|
|
25
|
-
@apply bg-green-600 text-white
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
.bg-default{
|
|
29
|
-
@apply bg-white
|
|
30
|
-
}
|
|
31
|
-
.bg-danger{
|
|
32
|
-
@apply bg-red-500 text-white
|
|
33
|
-
}
|
|
34
|
-
.bg-warning{
|
|
35
|
-
@apply bg-orange-600 text-white
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.desktop-shortcut-link{
|
|
39
|
-
@apply m-2 m-2 p-2 space-x-2 rounded-sm text-center grid grid-cols-4 gap-4
|
|
40
|
-
}
|
|
41
|
-
.desktop-shortcut-link div{
|
|
42
|
-
@apply bg-teal-300 p-2
|
|
43
|
-
}
|
|
44
|
-
.desktop-shortcut-link div:hover{
|
|
45
|
-
@apply bg-teal-600 p-2
|
|
46
|
-
}
|
|
47
|
-
.tenant-link:hover div{
|
|
48
|
-
@apply bg-gray-300
|
|
49
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|