adminforth 1.1.74 → 1.1.75

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.
Files changed (115) hide show
  1. package/auth.ts +14 -0
  2. package/dataConnectors/postgres.ts +1 -1
  3. package/dist/auth.js +7 -0
  4. package/dist/index.js +117 -65
  5. package/dist/modules/codeInjector.js +29 -15
  6. package/dist/plugins/AuditLogPlugin/index.js +2 -17
  7. package/dist/plugins/S3UploadPlugin/custom/s3uploader.vue +120 -0
  8. package/dist/plugins/S3UploadPlugin/index.js +103 -0
  9. package/dist/plugins/S3UploadPlugin/package-lock.json +431 -0
  10. package/dist/plugins/S3UploadPlugin/package.json +15 -0
  11. package/dist/plugins/TwoFactorsAuthPlugin/custom/TwoFactorsConfirmation.vue +152 -0
  12. package/dist/plugins/TwoFactorsAuthPlugin/custom/TwoFactorsSetup.vue +188 -0
  13. package/dist/plugins/TwoFactorsAuthPlugin/index.js +150 -0
  14. package/dist/plugins/TwoFactorsAuthPlugin/types.js +1 -0
  15. package/dist/spa/index.html +1 -1
  16. package/dist/spa/package-lock.json +111 -0
  17. package/dist/spa/package.json +1 -0
  18. package/dist/spa/src/App.vue +178 -133
  19. package/dist/spa/src/components/MenuLink.vue +3 -3
  20. package/dist/spa/src/components/ResourceForm.vue +96 -96
  21. package/dist/spa/src/components/ResourceListTable.vue +69 -84
  22. package/dist/spa/src/components/ValueRenderer.vue +2 -3
  23. package/dist/spa/src/composables/useStores.ts +24 -11
  24. package/dist/spa/src/main.ts +1 -1
  25. package/dist/spa/src/router/index.ts +0 -1
  26. package/dist/spa/src/utils.ts +1 -1
  27. package/dist/spa/src/views/CreateView.vue +1 -9
  28. package/dist/spa/src/views/EditView.vue +1 -9
  29. package/dist/spa/src/views/ListView.vue +12 -3
  30. package/dist/spa/src/views/LoginView.vue +6 -1
  31. package/dist/spa/src/views/ResourceParent.vue +1 -2
  32. package/dist/spa/src/views/ShowView.vue +6 -14
  33. package/dist/spa/tailwind.config.js +3 -1
  34. package/index.ts +94 -35
  35. package/modules/codeInjector.ts +38 -27
  36. package/package.json +2 -1
  37. package/plugins/AuditLogPlugin/index.ts +4 -20
  38. package/plugins/S3UploadPlugin/custom/s3uploader.vue +120 -0
  39. package/plugins/S3UploadPlugin/index.ts +112 -0
  40. package/plugins/S3UploadPlugin/package-lock.json +431 -0
  41. package/plugins/S3UploadPlugin/package.json +15 -0
  42. package/plugins/S3UploadPlugin/types.ts +76 -0
  43. package/plugins/TwoFactorsAuthPlugin/custom/TwoFactorsConfirmation.vue +152 -0
  44. package/plugins/TwoFactorsAuthPlugin/custom/TwoFactorsOtp.vue +0 -0
  45. package/plugins/TwoFactorsAuthPlugin/custom/TwoFactorsSetup.vue +188 -0
  46. package/plugins/TwoFactorsAuthPlugin/index.ts +150 -0
  47. package/plugins/TwoFactorsAuthPlugin/types.ts +10 -0
  48. package/servers/express.ts +1 -0
  49. package/spa/src/App.vue +154 -121
  50. package/spa/src/components/ResourceForm.vue +91 -91
  51. package/spa/src/router/index.ts +0 -1
  52. package/spa/src/utils.ts +1 -1
  53. package/spa/src/views/CreateView.vue +0 -1
  54. package/spa/src/views/LoginView.vue +4 -1
  55. package/types/AdminForthConfig.ts +24 -3
  56. package/dist/plugins/AuditLog/index.js +0 -13
  57. package/dist/spa/spa/.eslintrc.cjs +0 -14
  58. package/dist/spa/spa/.vscode/extensions.json +0 -6
  59. package/dist/spa/spa/README.md +0 -39
  60. package/dist/spa/spa/env.d.ts +0 -1
  61. package/dist/spa/spa/index.html +0 -23
  62. package/dist/spa/spa/package-lock.json +0 -4470
  63. package/dist/spa/spa/package.json +0 -48
  64. package/dist/spa/spa/postcss.config.js +0 -6
  65. package/dist/spa/spa/public/assets/favicon.png +0 -0
  66. package/dist/spa/spa/src/App.vue +0 -283
  67. package/dist/spa/spa/src/assets/logo.svg +0 -19
  68. package/dist/spa/spa/src/components/AcceptModal.vue +0 -45
  69. package/dist/spa/spa/src/components/Breadcrumbs.vue +0 -40
  70. package/dist/spa/spa/src/components/BreadcrumbsWithButtons.vue +0 -26
  71. package/dist/spa/spa/src/components/CustomDatePicker.vue +0 -174
  72. package/dist/spa/spa/src/components/CustomDateRangePicker.vue +0 -218
  73. package/dist/spa/spa/src/components/CustomRangePicker.vue +0 -148
  74. package/dist/spa/spa/src/components/Dropdown.vue +0 -168
  75. package/dist/spa/spa/src/components/Filters.vue +0 -211
  76. package/dist/spa/spa/src/components/HelloWorld.vue +0 -17
  77. package/dist/spa/spa/src/components/MenuLink.vue +0 -24
  78. package/dist/spa/spa/src/components/ResourceForm.vue +0 -265
  79. package/dist/spa/spa/src/components/ResourceListTable.vue +0 -404
  80. package/dist/spa/spa/src/components/SingleSkeletLoader.vue +0 -13
  81. package/dist/spa/spa/src/components/Toast.vue +0 -66
  82. package/dist/spa/spa/src/components/ValueRenderer.vue +0 -59
  83. package/dist/spa/spa/src/components/icons/IconCalendar.vue +0 -5
  84. package/dist/spa/spa/src/components/icons/IconCommunity.vue +0 -7
  85. package/dist/spa/spa/src/components/icons/IconDocumentation.vue +0 -7
  86. package/dist/spa/spa/src/components/icons/IconEcosystem.vue +0 -7
  87. package/dist/spa/spa/src/components/icons/IconSupport.vue +0 -7
  88. package/dist/spa/spa/src/components/icons/IconTime.vue +0 -5
  89. package/dist/spa/spa/src/components/icons/IconTooling.vue +0 -19
  90. package/dist/spa/spa/src/composables/useFrontendApi.ts +0 -26
  91. package/dist/spa/spa/src/composables/useStores.ts +0 -126
  92. package/dist/spa/spa/src/index.scss +0 -26
  93. package/dist/spa/spa/src/main.ts +0 -18
  94. package/dist/spa/spa/src/router/index.ts +0 -64
  95. package/dist/spa/spa/src/spa_types/core.ts +0 -51
  96. package/dist/spa/spa/src/stores/core.ts +0 -144
  97. package/dist/spa/spa/src/stores/filters.ts +0 -22
  98. package/dist/spa/spa/src/stores/modal.ts +0 -48
  99. package/dist/spa/spa/src/stores/toast.ts +0 -15
  100. package/dist/spa/spa/src/stores/user.ts +0 -54
  101. package/dist/spa/spa/src/utils.ts +0 -101
  102. package/dist/spa/spa/src/views/CreateView.vue +0 -156
  103. package/dist/spa/spa/src/views/EditView.vue +0 -157
  104. package/dist/spa/spa/src/views/ListView.vue +0 -266
  105. package/dist/spa/spa/src/views/LoginView.vue +0 -136
  106. package/dist/spa/spa/src/views/ResourceParent.vue +0 -17
  107. package/dist/spa/spa/src/views/ShowView.vue +0 -180
  108. package/dist/spa/spa/tailwind.config.js +0 -17
  109. package/dist/spa/spa/tsconfig.app.json +0 -14
  110. package/dist/spa/spa/tsconfig.json +0 -11
  111. package/dist/spa/spa/tsconfig.node.json +0 -19
  112. package/dist/spa/spa/vite.config.ts +0 -49
  113. /package/dist/plugins/{AuditLog → S3UploadPlugin}/types.js +0 -0
  114. /package/dist/{spa/spa/src/assets/base.css → plugins/TwoFactorsAuthPlugin/custom/TwoFactorsOtp.vue} +0 -0
  115. /package/dist/spa/{spa/src → src}/components/SkeleteLoader.vue +0 -0
package/spa/src/App.vue CHANGED
@@ -1,145 +1,162 @@
1
1
  <template>
2
- <nav
3
- v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady"
4
- class="fixed h-14 top-0 z-20 w-full border-b shadow-sm bg-lightNavbar shadow-headerShadow dark:bg-darkNavbar dark:border-darkSidebarDevider">
5
- <div class="px-3 py-3 lg:px-5 lg:pl-3">
6
- <div class="flex items-center justify-between">
7
- <div class="flex items-center justify-start rtl:justify-end">
8
- <button @click="sideBarOpen = !sideBarOpen"
9
- type="button" class="inline-flex items-center p-2 text-sm rounded-lg sm:hidden hover:bg-lightSidebarItemHover focus:outline-none focus:ring-2 focus:ring-lightSidebarDevider dark:text-darkSidebarIcons dark:hover:bg-darkSidebarHover dark:focus:ring-lightSidebarDevider">
10
- <span class="sr-only">Open sidebar</span>
11
- <svg class="w-6 h-6" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
12
- <path clip-rule="evenodd" fill-rule="evenodd" d="M2 4.75A.75.75 0 012.75 4h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 4.75zm0 10.5a.75.75 0 01.75-.75h7.5a.75.75 0 010 1.5h-7.5a.75.75 0 01-.75-.75zM2 10a.75.75 0 01.75-.75h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 10z"></path>
13
- </svg>
14
- </button>
15
-
16
- </div>
17
- <div class="flex items-center">
18
- <div class="flex items-center ms-3 ">
19
- <div>
20
- <button type="button" class="flex text-sm bg- rounded-full focus:ring-4 focus:ring-lightSidebarDevider dark:focus:ring-darkSidebarDevider dark:bg-" aria-expanded="false" data-dropdown-toggle="dropdown-user">
21
- <span class="sr-only">Open user menu</span>
22
- <svg class="w-8 h-8 text-lightNavbarIcons dark:text-darkNavbarIcons" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
23
- <path fill-rule="evenodd" d="M12 20a7.966 7.966 0 0 1-5.002-1.756l.002.001v-.683c0-1.794 1.492-3.25 3.333-3.25h3.334c1.84 0 3.333 1.456 3.333 3.25v.683A7.966 7.966 0 0 1 12 20ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10c0 5.5-4.44 9.963-9.932 10h-.138C6.438 21.962 2 17.5 2 12Zm10-5c-1.84 0-3.333 1.455-3.333 3.25S10.159 13.5 12 13.5c1.84 0 3.333-1.455 3.333-3.25S13.841 7 12 7Z" clip-rule="evenodd"/>
2
+ <div v-if="defaultLayout" >
3
+
4
+ <nav
5
+ v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady"
6
+ class="fixed h-14 top-0 z-20 w-full border-b shadow-sm bg-lightNavbar shadow-headerShadow dark:bg-darkNavbar dark:border-darkSidebarDevider">
7
+ <div class="px-3 py-3 lg:px-5 lg:pl-3">
8
+ <div class="flex items-center justify-between">
9
+ <div class="flex items-center justify-start rtl:justify-end">
10
+ <button @click="sideBarOpen = !sideBarOpen"
11
+ type="button" class="inline-flex items-center p-2 text-sm rounded-lg sm:hidden hover:bg-lightSidebarItemHover focus:outline-none focus:ring-2 focus:ring-lightSidebarDevider dark:text-darkSidebarIcons dark:hover:bg-darkSidebarHover dark:focus:ring-lightSidebarDevider">
12
+ <span class="sr-only">Open sidebar</span>
13
+ <svg class="w-6 h-6" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
14
+ <path clip-rule="evenodd" fill-rule="evenodd" d="M2 4.75A.75.75 0 012.75 4h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 4.75zm0 10.5a.75.75 0 01.75-.75h7.5a.75.75 0 010 1.5h-7.5a.75.75 0 01-.75-.75zM2 10a.75.75 0 01.75-.75h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 10z"></path>
24
15
  </svg>
25
- </button>
26
- </div>
27
- <div class="z-50 hidden my-4 text-base list-none bg-white divide-y divide-gray-100 rounded shadow dark:shadow-black dark:bg-darkSidebar dark:divide-darkSidebarDevider dark:shadow-black" id="dropdown-user">
28
- <div class="px-4 py-3" role="none">
29
- <p class="text-sm text-gray-900 dark:text-darkNavbarText" role="none" v-if="coreStore.userFullname">
30
- {{ coreStore.userFullname }}
31
- </p>
32
- <p class="text-sm font-medium text-gray-900 truncate dark:text-darkSidebarText" role="none">
33
- {{ coreStore.username }}
34
- </p>
16
+ </button>
17
+
18
+ </div>
19
+ <div class="flex items-center">
20
+ <div class="flex items-center ms-3 ">
21
+ <div>
22
+ <button type="button" class="flex text-sm bg- rounded-full focus:ring-4 focus:ring-lightSidebarDevider dark:focus:ring-darkSidebarDevider dark:bg-" aria-expanded="false" data-dropdown-toggle="dropdown-user">
23
+ <span class="sr-only">Open user menu</span>
24
+ <svg class="w-8 h-8 text-lightNavbarIcons dark:text-darkNavbarIcons" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
25
+ <path fill-rule="evenodd" d="M12 20a7.966 7.966 0 0 1-5.002-1.756l.002.001v-.683c0-1.794 1.492-3.25 3.333-3.25h3.334c1.84 0 3.333 1.456 3.333 3.25v.683A7.966 7.966 0 0 1 12 20ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10c0 5.5-4.44 9.963-9.932 10h-.138C6.438 21.962 2 17.5 2 12Zm10-5c-1.84 0-3.333 1.455-3.333 3.25S10.159 13.5 12 13.5c1.84 0 3.333-1.455 3.333-3.25S13.841 7 12 7Z" clip-rule="evenodd"/>
26
+ </svg>
27
+ </button>
28
+ </div>
29
+ <div class="z-50 hidden my-4 text-base list-none bg-white divide-y divide-gray-100 rounded shadow dark:shadow-black dark:bg-darkSidebar dark:divide-darkSidebarDevider dark:shadow-black" id="dropdown-user">
30
+ <div class="px-4 py-3" role="none">
31
+ <p class="text-sm text-gray-900 dark:text-darkNavbarText" role="none" v-if="coreStore.userFullname">
32
+ {{ coreStore.userFullname }}
33
+ </p>
34
+ <p class="text-sm font-medium text-gray-900 truncate dark:text-darkSidebarText" role="none">
35
+ {{ coreStore.username }}
36
+ </p>
37
+ </div>
38
+ <ul class="py-1" role="none">
39
+ <li>
40
+ <span @click="toggleTheme" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black hover:bg-lightHtml dark:text-darkSidebarTextHover dark:hover:bg-darkHtml dark:hover:text-darkSidebarTextActive" role="menuitem">
41
+ {{ theme === 'dark' ? 'Light' : 'Dark' }}
42
+ <IconMoonSolid class="w-5 h-5 text-blue-300" v-if="theme !== 'dark'" />
43
+ <IconSunSolid class="w-5 h-5 text-yellow-300" v-else />
44
+ mode
45
+ </span>
46
+ </li>
47
+ <li>
48
+ <button @click="logout" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black hover:bg-html dark:text-darkSidebarTextHover dark:hover:bg-darkSidebarItemHover dark:hover:text-darkSidebarTextActive w-full" role="menuitem">Sign out</button>
49
+ </li>
50
+ </ul>
35
51
  </div>
36
- <ul class="py-1" role="none">
37
- <li>
38
- <span @click="toggleTheme" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black hover:bg-lightHtml dark:text-darkSidebarTextHover dark:hover:bg-darkHtml dark:hover:text-darkSidebarTextActive" role="menuitem">
39
- {{ theme === 'dark' ? 'Light' : 'Dark' }}
40
- <IconMoonSolid class="w-5 h-5 text-blue-300" v-if="theme !== 'dark'" />
41
- <IconSunSolid class="w-5 h-5 text-yellow-300" v-else />
42
- mode
43
- </span>
44
- </li>
45
- <li>
46
- <button @click="logout" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black hover:bg-html dark:text-darkSidebarTextHover dark:hover:bg-darkSidebarItemHover dark:hover:text-darkSidebarTextActive w-full" role="menuitem">Sign out</button>
47
- </li>
48
- </ul>
49
52
  </div>
50
53
  </div>
51
54
  </div>
52
55
  </div>
53
- </div>
54
- </nav>
56
+ </nav>
55
57
 
56
58
 
57
59
 
58
- <aside
60
+ <aside
59
61
 
60
- v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady"
62
+ v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady"
61
63
 
62
- id="logo-lightSidebar" class="fixed bg-lightSidebar border-none top-0 left-0 z-20 w-64 h-screen transition-transform bg-lightSidebar dark:bg-darkSidebar border-r border-lightSidebarBorder sm:translate-x-0 dark:bg-darkSidebar dark:border-darkSidebarBorder"
63
- :class="{ '-translate-x-full': !sideBarOpen, 'transform-none': sideBarOpen }"
64
- aria-label="Sidebar"
65
- >
66
- <div class="h-full px-3 pb-4 overflow-y-auto bg-lightSidebar dark:bg-darkSidebar border-r border-lightSidebarBorder dark:border-darkSidebarBorder">
67
- <div class="flex ms-2 md:me-24 m-4 ">
68
- <img :src="loadFile(coreStore.config?.brandLogo || '@/assets/logo.svg')" :alt="`${ coreStore.config?.brandName } Logo`" class="h-8 me-3" />
69
- <span class="self-center text-lightNavbarText-size font-semibold sm:text-lightNavbarText-size whitespace-nowrap dark:text-darkSidebarText text-lightSidebarText">
70
- {{ coreStore.config?.brandName }}
71
- </span>
64
+ id="logo-lightSidebar" class="fixed bg-lightSidebar border-none top-0 left-0 z-20 w-64 h-screen transition-transform bg-lightSidebar dark:bg-darkSidebar border-r border-lightSidebarBorder sm:translate-x-0 dark:bg-darkSidebar dark:border-darkSidebarBorder"
65
+ :class="{ '-translate-x-full': !sideBarOpen, 'transform-none': sideBarOpen }"
66
+ aria-label="Sidebar"
67
+ >
68
+ <div class="h-full px-3 pb-4 overflow-y-auto bg-lightSidebar dark:bg-darkSidebar border-r border-lightSidebarBorder dark:border-darkSidebarBorder">
69
+ <div class="flex ms-2 md:me-24 m-4 ">
70
+ <img :src="loadFile(coreStore.config?.brandLogo || '@/assets/logo.svg')" :alt="`${ coreStore.config?.brandName } Logo`" class="h-8 me-3" />
71
+ <span class="self-center text-lightNavbarText-size font-semibold sm:text-lightNavbarText-size whitespace-nowrap dark:text-darkSidebarText text-lightSidebarText">
72
+ {{ coreStore.config?.brandName }}
73
+ </span>
74
+ </div>
75
+
76
+ <ul class="space-y-2 font-medium">
77
+ <template v-for="(item, i) in coreStore.menu" :key="`menu-${i}`">
78
+ <div v-if="item.type === 'divider'" class="border-t border-lightSidebarDevider dark:border-darkSidebarDevider"></div>
79
+ <div v-else-if="item.type === 'gap'" class="flex items-center justify-center h-8"></div>
80
+ <div v-else-if="item.type === 'heading'" class="flex items-center justify-left pl-2 h-8 text-lightSidebarHeading dark:text-darkSidebarHeading
81
+ ">{{ item.label }}</div>
82
+ <li v-else-if="item.children" class=" ">
83
+ <button @click="clickOnMenuItem(i)" type="button" class="flex items-center w-full p-2 text-base text-lightSidebarText rounded-default transition duration-75 group hover:bg-lightSidebarItemHover hover:text-lightSidebarTextHover dark:text-darkSidebarText dark:hover:bg-darkSidebarHover dark:hover:text-darkSidebarTextHover"
84
+ :aria-controls="`dropdown-example${i}`"
85
+ :data-collapse-toggle="`dropdown-example${i}`"
86
+ >
87
+ <component v-if="item.icon" :is="getIcon(item.icon)" class="w-5 h-5 text-lightSidebarIcons group-hover:text-lightSidebarIconsHover transition duration-75 dark:group-hover:text-darkSidebarIconsHover dark:text-darkSidebarIcons" ></component>
88
+
89
+ <span class="flex-1 ms-3 text-left rtl:text-right whitespace-nowrap">{{ item.label }}</span>
90
+ <svg :class="{'rotate-180': opened.includes(i) }" class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
91
+ <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
92
+ </svg>
93
+ </button>
94
+
95
+ <ul :id="`dropdown-example${i}`" role="none" class="pt-1 space-y-1" :class="{ 'hidden': !opened.includes(i) }">
96
+ <template v-for="(child, j) in item.children" :key="`menu-${i}-${j}`">
97
+ <li>
98
+ <MenuLink :item="child" isChild="true" />
99
+ </li>
100
+ </template>
101
+ </ul>
102
+ </li>
103
+ <li v-else>
104
+ <MenuLink :item="item" />
105
+ </li>
106
+ </template>
107
+ </ul>
72
108
  </div>
109
+ </aside>
110
+
73
111
 
74
- <ul class="space-y-2 font-medium">
75
- <template v-for="(item, i) in coreStore.menu" :key="`menu-${i}`">
76
- <div v-if="item.type === 'divider'" class="border-t border-lightSidebarDevider dark:border-darkSidebarDevider"></div>
77
- <div v-else-if="item.type === 'gap'" class="flex items-center justify-center h-8"></div>
78
- <div v-else-if="item.type === 'heading'" class="flex items-center justify-left pl-2 h-8 text-lightSidebarHeading dark:text-darkSidebarHeading
79
- ">{{ item.label }}</div>
80
- <li v-else-if="item.children" class=" ">
81
- <button @click="clickOnMenuItem(i)" type="button" class="flex items-center w-full p-2 text-base text-lightSidebarText rounded-default transition duration-75 group hover:bg-lightSidebarItemHover hover:text-lightSidebarTextHover dark:text-darkSidebarText dark:hover:bg-darkSidebarHover dark:hover:text-darkSidebarTextHover"
82
- :aria-controls="`dropdown-example${i}`"
83
- :data-collapse-toggle="`dropdown-example${i}`"
84
- >
85
- <component v-if="item.icon" :is="getIcon(item.icon)" class="w-5 h-5 text-lightSidebarIcons group-hover:text-lightSidebarIconsHover transition duration-75 dark:group-hover:text-darkSidebarIconsHover dark:text-darkSidebarIcons" ></component>
86
-
87
- <span class="flex-1 ms-3 text-left rtl:text-right whitespace-nowrap">{{ item.label }}</span>
88
- <svg :class="{'rotate-180': opened.includes(i) }" class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
89
- <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
90
- </svg>
91
- </button>
112
+ <div class="sm:ml-64 dark:bg-gray-800" v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady">
113
+ <div class="p-0 dark:border-gray-700 mt-14">
114
+ <RouterView/>
115
+ </div>
116
+ </div>
92
117
 
93
- <ul :id="`dropdown-example${i}`" role="none" class="pt-1 space-y-1" :class="{ 'hidden': !opened.includes(i) }">
94
- <template v-for="(child, j) in item.children" :key="`menu-${i}-${j}`">
95
- <li>
96
- <MenuLink :item="child" isChild="true" />
97
- </li>
98
- </template>
99
- </ul>
100
- </li>
101
- <li v-else>
102
- <MenuLink :item="item" />
103
- </li>
104
- </template>
105
- </ul>
118
+ <div v-else-if="routerIsReady && loginRedirectCheckIsReady">
119
+ <RouterView/>
106
120
  </div>
107
- </aside>
108
-
109
-
110
- <div class="sm:ml-64 dark:bg-gray-800" v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady">
111
- <div class="p-0 dark:border-gray-700 mt-14">
112
- <RouterView/>
121
+ <div v-else class="flex items-center justify-center h-screen">
122
+ <div class="text-3xl text-gray-400 animate-bounce">
123
+ <svg aria-hidden="true" class="w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/><path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/></svg>
124
+ <span class="sr-only">Loading...</span>
125
+ </div>
113
126
  </div>
114
- </div>
115
-
116
- <div v-else-if="routerIsReady && loginRedirectCheckIsReady">
117
- <RouterView/>
118
- </div>
119
- <div v-else class="flex items-center justify-center h-screen">
120
- <div class="text-3xl text-gray-400 animate-bounce">
121
- <svg aria-hidden="true" class="w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/><path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/></svg>
122
- <span class="sr-only">Loading...</span>
127
+ <AcceptModal />
128
+ <div v-if="toastStore.toasts.length>0" class="fixed bottom-5 right-5 flex gap-1 flex-col-reverse">
129
+ <transition-group
130
+ name="fade"
131
+ tag="div"
132
+ class="flex flex-col-reverse gap-1"
133
+ >
134
+ <Toast :toast="t" @close="toastStore.removeToast(t)" v-for="(t,i) in toastStore.toasts" :key="`t-${t.id}`" ></Toast>
135
+ </transition-group>
123
136
  </div>
124
- </div>
125
- <AcceptModal />
126
- <div v-if="toastStore.toasts.length>0" class="fixed bottom-5 right-5 flex gap-1 flex-col-reverse">
127
- <transition-group
128
- name="fade"
129
- tag="div"
130
- class="flex flex-col-reverse gap-1"
131
- >
132
- <Toast :toast="t" @close="toastStore.removeToast(t)" v-for="(t,i) in toastStore.toasts" :key="`t-${t.id}`" ></Toast>
133
- </transition-group>
134
- </div>
135
-
136
- <div v-if="sideBarOpen"
137
- @click="sideBarOpen = false"
138
-
139
- drawer-backdrop="" class="bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-5"></div>
140
137
 
138
+ <div v-if="sideBarOpen"
139
+ @click="sideBarOpen = false"
140
+
141
+ drawer-backdrop="" class="bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-5"></div>
141
142
 
142
143
 
144
+ </div>
145
+ <div v-else>
146
+ <div v-if="routerIsReady && loginRedirectCheckIsReady">
147
+ <RouterView/>
148
+ </div>
149
+ <AcceptModal />
150
+ <div v-if="toastStore.toasts.length>0" class="fixed bottom-5 right-5 flex gap-1 flex-col-reverse">
151
+ <transition-group
152
+ name="fade"
153
+ tag="div"
154
+ class="flex flex-col-reverse gap-1"
155
+ >
156
+ <Toast :toast="t" @close="toastStore.removeToast(t)" v-for="(t,i) in toastStore.toasts" :key="`t-${t.id}`" ></Toast>
157
+ </transition-group>
158
+ </div>
159
+ </div>
143
160
  </template>
144
161
 
145
162
  <style lang="scss" scoped>
@@ -194,6 +211,7 @@ const splitAtLast = (str: string, separator: string) => {
194
211
  }
195
212
  createHead()
196
213
  const sideBarOpen = ref(false);
214
+ const defaultLayout = ref(true);
197
215
  const route = useRoute();
198
216
  const router = useRouter();
199
217
  const title = ref('');
@@ -243,13 +261,26 @@ async function loadMenu() {
243
261
  loginRedirectCheckIsReady.value = true;
244
262
  }
245
263
 
264
+ function handleCustomLayout() {
265
+ console.log(route)
266
+ if (route.meta?.customLayout) {
267
+ defaultLayout.value = false;
268
+ } else {
269
+ defaultLayout.value = true;
270
+ }
271
+ console.log(defaultLayout.value,route);
272
+ }
273
+
246
274
 
247
275
 
248
276
  watch(route, () => {
277
+ handleCustomLayout()
249
278
  title.value = `${coreStore.config?.title || coreStore.config?.brandName || 'Adminforth'} | ${ Object.values(route.params)[0] || route.meta.title || ' '}`;
250
279
  useHead({
251
280
  title: title.value,
252
281
  })
282
+
283
+
253
284
  });
254
285
 
255
286
  watch (()=>coreStore.menu, () => {
@@ -273,6 +304,8 @@ onMounted(async () => {
273
304
  loadMenu(); // run this in async mode
274
305
  // before init flowbite we have to wait router initialized because it affects dom(our v-ifs) and fetch menu
275
306
  await initRouter()
307
+ handleCustomLayout()
308
+
276
309
  })
277
310
 
278
311
  onBeforeMount(()=>{
@@ -20,17 +20,6 @@
20
20
  <tr v-for="column, i in editableColumns" :key="column.name"
21
21
  class="bg-ligftForm dark:bg-gray-800 border-b dark:border-gray-700"
22
22
  >
23
- <!-- if column is in customComponentsPerColumn, use this component. If not, use this code -->
24
- <template v-if="column?.components?.[props.source]?.file">
25
- <component
26
- :is="getCustomComponent(column.components[props.source])"
27
- :column="column"
28
- :value="currentValues[column.name]"
29
- @update:value="setCurrentValue(column.name, $event)"
30
- :meta="column.components[props.source].meta"
31
- />
32
- </template>
33
- <template v-else>
34
23
  <td class="px-6 py-4 whitespace-nowrap "> <!--align-top-->
35
24
  {{ column.label }}
36
25
  <span :data-tooltip-target="`tooltip-show-${i}`" class="relative inline-block">
@@ -45,88 +34,99 @@
45
34
  </div>
46
35
  </td>
47
36
  <td class="px-6 py-4 whitespace-nowrap whitespace-pre-wrap relative">
48
- <Dropdown
49
- single
50
- v-if="column.foreignResource"
51
- :options="columnOptions[column.name] || []"
52
- :placeholder = "columnOptions[column.name]?.length ?'Select...': 'There are no options available'"
53
- :modelValue="currentValues[column.name]"
54
- @update:modelValue="setCurrentValue(column.name, $event)"
55
- ></Dropdown>
56
- <Dropdown
57
- single
58
- v-else-if="column.enum"
59
- :options="column.enum"
60
- :modelValue="currentValues[column.name]"
61
- @update:modelValue="setCurrentValue(column.name, $event)"
62
- />
63
- <Dropdown
64
- single
65
- v-else-if="column.type === 'boolean'"
66
- :options="[{ label: 'Yes', value: true }, { label: 'No', value: false }, { label: 'Unset', value: null }]"
67
- :modelValue="currentValues[column.name]"
68
- @update:modelValue="setCurrentValue(column.name, $event)"
69
- />
70
- <input
71
- v-else-if="['integer'].includes(column.type)"
72
- type="number"
73
- step="1"
74
- class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-40 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
75
- placeholder="0"
76
- :value="currentValues[column.name]"
77
- @input="setCurrentValue(column.name, $event.target.value)"
78
- >
79
- <CustomDatePicker
80
- v-else-if="['datetime'].includes(column.type)"
81
- :column="column"
82
- :valueStart="currentValues[column.name]"
83
- auto-hide
84
- @update:valueStart="setCurrentValue(column.name, $event)"
85
- />
86
- <input
87
- v-else-if="['decimal', 'float'].includes(column.type)"
88
- type="number"
89
- step="0.1"
90
- class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-40 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
91
- placeholder="0.0"
92
- :value="currentValues[column.name]"
93
- @input="setCurrentValue(column.name, $event.target.value)"
94
- />
95
- <textarea
96
- v-else-if="['text'].includes(column.type)"
97
- class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
98
- placeholder="Text"
99
- :value="currentValues[column.name]"
100
- @input="setCurrentValue(column.name, $event.target.value)"
101
- >
102
- </textarea>
103
- <input
104
- v-else
105
- :type="!column.masked || unmasked[column.name] ? 'text' : 'password'"
106
- class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
107
- placeholder="Text"
108
- :value="currentValues[column.name]"
109
- @input="setCurrentValue(column.name, $event.target.value)"
110
- autocomplete="false"
111
- data-lpignore="true"
112
- readonly
113
- onfocus="this.removeAttribute('readonly');"
114
- >
115
37
 
116
- <button
117
- v-if="column.masked"
118
- type="button"
119
- @click="unmasked[column.name] = !unmasked[column.name]"
120
- class="h-6 absolute inset-y-2 top-6 right-6 flex items-center pr-2 z-index-100 focus:outline-none"
121
- >
122
- <IconEyeSolid class="w-6 h-6 text-gray-400" v-if="!unmasked[column.name]" />
123
- <IconEyeSlashSolid class="w-6 h-6 text-gray-400" v-else />
124
- </button>
125
- <div v-if="columnError(column) && validating" class="mt-1 text-xs text-red-500 dark:text-red-400">{{ columnError(column) }}</div>
38
+ <template v-if="column?.components?.[props.source]?.file">
39
+ <component
40
+ :is="getCustomComponent(column.components[props.source])"
41
+ :column="column"
42
+ :value="currentValues[column.name]"
43
+ @update:value="setCurrentValue(column.name, $event)"
44
+ :meta="column.components[props.source].meta"
45
+ />
46
+ </template>
47
+ <template v-else>
48
+ <Dropdown
49
+ single
50
+ v-if="column.foreignResource"
51
+ :options="columnOptions[column.name] || []"
52
+ :placeholder = "columnOptions[column.name]?.length ?'Select...': 'There are no options available'"
53
+ :modelValue="currentValues[column.name]"
54
+ @update:modelValue="setCurrentValue(column.name, $event)"
55
+ ></Dropdown>
56
+ <Dropdown
57
+ single
58
+ v-else-if="column.enum"
59
+ :options="column.enum"
60
+ :modelValue="currentValues[column.name]"
61
+ @update:modelValue="setCurrentValue(column.name, $event)"
62
+ />
63
+ <Dropdown
64
+ single
65
+ v-else-if="column.type === 'boolean'"
66
+ :options="[{ label: 'Yes', value: true }, { label: 'No', value: false }, { label: 'Unset', value: null }]"
67
+ :modelValue="currentValues[column.name]"
68
+ @update:modelValue="setCurrentValue(column.name, $event)"
69
+ />
70
+ <input
71
+ v-else-if="['integer'].includes(column.type)"
72
+ type="number"
73
+ step="1"
74
+ class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-40 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
75
+ placeholder="0"
76
+ :value="currentValues[column.name]"
77
+ @input="setCurrentValue(column.name, $event.target.value)"
78
+ >
79
+ <CustomDatePicker
80
+ v-else-if="['datetime'].includes(column.type)"
81
+ :column="column"
82
+ :valueStart="currentValues[column.name]"
83
+ auto-hide
84
+ @update:valueStart="setCurrentValue(column.name, $event)"
85
+ />
86
+ <input
87
+ v-else-if="['decimal', 'float'].includes(column.type)"
88
+ type="number"
89
+ step="0.1"
90
+ class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-40 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
91
+ placeholder="0.0"
92
+ :value="currentValues[column.name]"
93
+ @input="setCurrentValue(column.name, $event.target.value)"
94
+ />
95
+ <textarea
96
+ v-else-if="['text'].includes(column.type)"
97
+ class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
98
+ placeholder="Text"
99
+ :value="currentValues[column.name]"
100
+ @input="setCurrentValue(column.name, $event.target.value)"
101
+ >
102
+ </textarea>
103
+ <input
104
+ v-else
105
+ :type="!column.masked || unmasked[column.name] ? 'text' : 'password'"
106
+ class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
107
+ placeholder="Text"
108
+ :value="currentValues[column.name]"
109
+ @input="setCurrentValue(column.name, $event.target.value)"
110
+ autocomplete="false"
111
+ data-lpignore="true"
112
+ readonly
113
+ onfocus="this.removeAttribute('readonly');"
114
+ >
126
115
 
127
- <div v-if="column.editingNote && column.editingNote[mode]" class="mt-1 text-xs text-gray-400 dark:text-gray-500">{{ column.editingNote[mode] }}</div>
128
- </td>
129
- </template>
116
+ <button
117
+ v-if="column.masked"
118
+ type="button"
119
+ @click="unmasked[column.name] = !unmasked[column.name]"
120
+ class="h-6 absolute inset-y-2 top-6 right-6 flex items-center pr-2 z-index-100 focus:outline-none"
121
+ >
122
+ <IconEyeSolid class="w-6 h-6 text-gray-400" v-if="!unmasked[column.name]" />
123
+ <IconEyeSlashSolid class="w-6 h-6 text-gray-400" v-else />
124
+ </button>
125
+ <div v-if="columnError(column) && validating" class="mt-1 text-xs text-red-500 dark:text-red-400">{{ columnError(column) }}</div>
126
+
127
+ <div v-if="column.editingNote && column.editingNote[mode]" class="mt-1 text-xs text-gray-400 dark:text-gray-500">{{ column.editingNote[mode] }}</div>
128
+ </template>
129
+ </td>
130
130
  </tr>
131
131
 
132
132
  </tbody>
@@ -12,7 +12,6 @@ const router = createRouter({
12
12
  component: () => import('@/views/LoginView.vue'),
13
13
  meta: { title: 'login' },
14
14
  beforeEnter: async (to, from, next) => {
15
- const userStore = useUserStore()
16
15
  if(localStorage.getItem('isAuthorized') === 'true'){
17
16
  next({name: 'home'})
18
17
  } else {
package/spa/src/utils.ts CHANGED
@@ -16,7 +16,7 @@ export async function callApi({path, method, body=undefined} ) {
16
16
  };
17
17
  const fullPath = `${import.meta.env.VITE_ADMINFORTH_PUBLIC_PATH || ''}${path}`;
18
18
  const r = await fetch(fullPath, options);
19
- if (r.status == 401) {
19
+ if (r.status == 401 ) {
20
20
  useUserStore().unauthorize();
21
21
  router.push({ name: 'login' });
22
22
  return null;
@@ -136,7 +136,6 @@ async function saveRecord() {
136
136
  });
137
137
  if (response.error) {
138
138
  showErrorTost(response.error);
139
-
140
139
  }
141
140
  saving.value = false;
142
141
  if (route.query.returnTo) {
@@ -118,7 +118,10 @@ async function login() {
118
118
  inProgress.value = false;
119
119
  if (resp.error) {
120
120
  error.value = resp.error;
121
- } else {
121
+ } else if (resp.redirectTo) {
122
+ router.push(resp.redirectTo);
123
+ }
124
+ else {
122
125
  error.value = null;
123
126
  user.authorize()
124
127
  router.push('/');