adminforth 2.4.0-next.24 → 2.4.0-next.240
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/commands/callTsProxy.js +14 -4
- package/commands/cli.js +10 -3
- package/commands/createApp/templates/custom/tsconfig.json.hbs +2 -3
- package/commands/createApp/templates/index.ts.hbs +10 -2
- package/commands/createApp/templates/package.json.hbs +1 -1
- package/commands/createApp/utils.js +27 -2
- package/commands/createCustomComponent/configLoader.js +17 -4
- package/commands/createCustomComponent/main.js +1 -0
- package/commands/createCustomComponent/templates/customCrud/beforeActionButtons.vue.hbs +38 -0
- package/commands/createPlugin/templates/custom/tsconfig.json.hbs +2 -5
- package/commands/createPlugin/templates/package.json.hbs +1 -1
- package/commands/generateModels.js +30 -22
- package/dist/auth.d.ts +9 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +15 -2
- package/dist/auth.js.map +1 -1
- package/dist/dataConnectors/baseConnector.d.ts.map +1 -1
- package/dist/dataConnectors/baseConnector.js +46 -15
- package/dist/dataConnectors/baseConnector.js.map +1 -1
- package/dist/dataConnectors/clickhouse.d.ts.map +1 -1
- package/dist/dataConnectors/clickhouse.js +15 -0
- package/dist/dataConnectors/clickhouse.js.map +1 -1
- package/dist/dataConnectors/mongo.d.ts.map +1 -1
- package/dist/dataConnectors/mongo.js +50 -15
- package/dist/dataConnectors/mongo.js.map +1 -1
- package/dist/dataConnectors/mysql.d.ts.map +1 -1
- package/dist/dataConnectors/mysql.js +11 -0
- package/dist/dataConnectors/mysql.js.map +1 -1
- package/dist/dataConnectors/postgres.d.ts.map +1 -1
- package/dist/dataConnectors/postgres.js +11 -0
- package/dist/dataConnectors/postgres.js.map +1 -1
- package/dist/dataConnectors/sqlite.d.ts.map +1 -1
- package/dist/dataConnectors/sqlite.js +11 -0
- package/dist/dataConnectors/sqlite.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -9
- package/dist/index.js.map +1 -1
- package/dist/modules/codeInjector.d.ts +2 -0
- package/dist/modules/codeInjector.d.ts.map +1 -1
- package/dist/modules/codeInjector.js +52 -8
- package/dist/modules/codeInjector.js.map +1 -1
- package/dist/modules/configValidator.d.ts +6 -0
- package/dist/modules/configValidator.d.ts.map +1 -1
- package/dist/modules/configValidator.js +184 -19
- package/dist/modules/configValidator.js.map +1 -1
- package/dist/modules/restApi.d.ts.map +1 -1
- package/dist/modules/restApi.js +154 -26
- package/dist/modules/restApi.js.map +1 -1
- package/dist/modules/styles.d.ts +499 -13
- package/dist/modules/styles.d.ts.map +1 -1
- package/dist/modules/styles.js +555 -31
- package/dist/modules/styles.js.map +1 -1
- package/dist/modules/utils.d.ts +7 -15
- package/dist/modules/utils.d.ts.map +1 -1
- package/dist/modules/utils.js +45 -68
- package/dist/modules/utils.js.map +1 -1
- package/dist/servers/express.d.ts +5 -0
- package/dist/servers/express.d.ts.map +1 -1
- package/dist/servers/express.js +40 -1
- package/dist/servers/express.js.map +1 -1
- package/dist/spa/index.html +1 -1
- package/dist/spa/package-lock.json +5 -4
- package/dist/spa/package.json +1 -1
- package/dist/spa/src/App.vue +58 -173
- package/dist/spa/src/adminforth.ts +42 -18
- package/dist/spa/src/afcl/BarChart.vue +2 -2
- package/dist/spa/src/afcl/Button.vue +6 -6
- package/dist/spa/src/afcl/ButtonGroup.vue +91 -0
- package/dist/spa/src/afcl/Card.vue +25 -0
- package/dist/spa/src/afcl/Checkbox.vue +21 -13
- package/dist/spa/src/afcl/CountryFlag.vue +4 -1
- package/dist/spa/src/{components/CustomDatePicker.vue → afcl/DatePicker.vue} +95 -9
- package/dist/spa/src/afcl/Dialog.vue +47 -27
- package/dist/spa/src/afcl/Dropzone.vue +12 -12
- package/dist/spa/src/afcl/Input.vue +5 -5
- package/dist/spa/src/afcl/JsonViewer.vue +25 -0
- package/dist/spa/src/afcl/LinkButton.vue +3 -3
- package/dist/spa/src/afcl/PieChart.vue +5 -5
- package/dist/spa/src/afcl/ProgressBar.vue +7 -7
- package/dist/spa/src/afcl/Select.vue +68 -34
- package/dist/spa/src/afcl/Skeleton.vue +6 -6
- package/dist/spa/src/afcl/Table.vue +213 -74
- package/dist/spa/src/afcl/Textarea.vue +31 -0
- package/dist/spa/src/afcl/Toggle.vue +32 -0
- package/dist/spa/src/afcl/Tooltip.vue +26 -18
- package/dist/spa/src/afcl/VerticalTabs.vue +16 -7
- package/dist/spa/src/afcl/index.ts +6 -3
- package/dist/spa/src/components/AcceptModal.vue +7 -7
- package/dist/spa/src/components/Breadcrumbs.vue +5 -5
- package/dist/spa/src/components/ColumnValueInput.vue +38 -18
- package/dist/spa/src/components/ColumnValueInputWrapper.vue +4 -3
- package/dist/spa/src/components/CustomDateRangePicker.vue +9 -8
- package/dist/spa/src/components/CustomRangePicker.vue +37 -8
- package/dist/spa/src/components/ErrorMessage.vue +21 -0
- package/dist/spa/src/components/Filters.vue +85 -39
- package/dist/spa/src/components/GroupsTable.vue +9 -8
- package/dist/spa/src/components/MenuLink.vue +90 -23
- package/dist/spa/src/components/ResourceForm.vue +94 -51
- package/dist/spa/src/components/ResourceListTable.vue +90 -80
- package/dist/spa/src/components/ResourceListTableVirtual.vue +86 -76
- package/dist/spa/src/components/ShowTable.vue +21 -15
- package/dist/spa/src/components/Sidebar.vue +448 -0
- package/dist/spa/src/components/SingleSkeletLoader.vue +6 -6
- package/dist/spa/src/components/SkeleteLoader.vue +3 -3
- package/dist/spa/src/components/ThreeDotsMenu.vue +73 -14
- package/dist/spa/src/components/Toast.vue +27 -9
- package/dist/spa/src/components/UserMenuSettingsButton.vue +67 -0
- package/dist/spa/src/components/ValueRenderer.vue +43 -16
- package/dist/spa/src/controls/BoolToggle.vue +34 -0
- package/dist/spa/src/i18n.ts +1 -1
- package/dist/spa/src/renderers/CompactField.vue +1 -1
- package/dist/spa/src/renderers/CompactUUID.vue +1 -1
- package/dist/spa/src/router/index.ts +8 -0
- package/dist/spa/src/shims-vue.d.ts +5 -0
- package/dist/spa/src/spa_types/core.ts +13 -1
- package/dist/spa/src/stores/core.ts +1 -1
- package/dist/spa/src/stores/filters.ts +29 -2
- package/dist/spa/src/stores/modal.ts +6 -1
- package/dist/spa/src/stores/toast.ts +22 -3
- package/dist/spa/src/types/Back.ts +158 -22
- package/dist/spa/src/types/Common.ts +81 -32
- package/dist/spa/src/types/FrontendAPI.ts +31 -5
- package/dist/spa/src/types/adapters/CaptchaAdapter.ts +34 -0
- package/dist/spa/src/types/adapters/CompletionAdapter.ts +25 -0
- package/dist/spa/src/types/adapters/EmailAdapter.ts +27 -0
- package/dist/spa/src/types/adapters/ImageGenerationAdapter.ts +50 -0
- package/dist/spa/src/types/adapters/ImageVisionAdapter.ts +30 -0
- package/dist/spa/src/types/adapters/KeyValueAdapter.ts +16 -0
- package/dist/spa/src/types/adapters/OAuth2Adapter.ts +34 -0
- package/dist/spa/src/types/adapters/StorageAdapter.ts +73 -0
- package/dist/spa/src/types/adapters/index.ts +8 -0
- package/dist/spa/src/utils.ts +279 -9
- package/dist/spa/src/views/CreateView.vue +18 -19
- package/dist/spa/src/views/EditView.vue +25 -19
- package/dist/spa/src/views/ListView.vue +139 -86
- package/dist/spa/src/views/LoginView.vue +37 -37
- package/dist/spa/src/views/ResourceParent.vue +2 -2
- package/dist/spa/src/views/SettingsView.vue +121 -0
- package/dist/spa/src/views/ShowView.vue +59 -39
- package/dist/spa/src/websocket.ts +6 -1
- package/dist/spa/tsconfig.app.json +1 -1
- package/dist/spa/vite.config.ts +45 -2
- package/dist/types/Back.d.ts +134 -14
- package/dist/types/Back.d.ts.map +1 -1
- package/dist/types/Back.js +15 -0
- package/dist/types/Back.js.map +1 -1
- package/dist/types/Common.d.ts +96 -29
- package/dist/types/Common.d.ts.map +1 -1
- package/dist/types/Common.js.map +1 -1
- package/dist/types/FrontendAPI.d.ts +31 -3
- package/dist/types/FrontendAPI.d.ts.map +1 -1
- package/dist/types/FrontendAPI.js.map +1 -1
- package/dist/types/adapters/CaptchaAdapter.d.ts +30 -0
- package/dist/types/adapters/CaptchaAdapter.d.ts.map +1 -0
- package/dist/types/adapters/CaptchaAdapter.js +5 -0
- package/dist/types/adapters/CaptchaAdapter.js.map +1 -0
- package/dist/types/adapters/CompletionAdapter.d.ts +20 -0
- package/dist/types/adapters/CompletionAdapter.d.ts.map +1 -0
- package/dist/types/adapters/CompletionAdapter.js +2 -0
- package/dist/types/adapters/CompletionAdapter.js.map +1 -0
- package/dist/types/adapters/EmailAdapter.d.ts +20 -0
- package/dist/types/adapters/EmailAdapter.d.ts.map +1 -0
- package/dist/types/adapters/EmailAdapter.js +2 -0
- package/dist/types/adapters/EmailAdapter.js.map +1 -0
- package/dist/types/adapters/ImageGenerationAdapter.d.ts +37 -0
- package/dist/types/adapters/ImageGenerationAdapter.d.ts.map +1 -0
- package/dist/types/adapters/ImageGenerationAdapter.js +2 -0
- package/dist/types/adapters/ImageGenerationAdapter.js.map +1 -0
- package/dist/types/adapters/ImageVisionAdapter.d.ts +25 -0
- package/dist/types/adapters/ImageVisionAdapter.d.ts.map +1 -0
- package/dist/types/adapters/ImageVisionAdapter.js +2 -0
- package/dist/types/adapters/ImageVisionAdapter.js.map +1 -0
- package/dist/types/adapters/KeyValueAdapter.d.ts +10 -0
- package/dist/types/adapters/KeyValueAdapter.d.ts.map +1 -0
- package/dist/types/adapters/KeyValueAdapter.js +2 -0
- package/dist/types/adapters/KeyValueAdapter.js.map +1 -0
- package/dist/types/adapters/OAuth2Adapter.d.ts +32 -0
- package/dist/types/adapters/OAuth2Adapter.d.ts.map +1 -0
- package/dist/types/adapters/OAuth2Adapter.js +2 -0
- package/dist/types/adapters/OAuth2Adapter.js.map +1 -0
- package/dist/types/adapters/StorageAdapter.d.ts +63 -0
- package/dist/types/adapters/StorageAdapter.d.ts.map +1 -0
- package/dist/types/adapters/StorageAdapter.js +2 -0
- package/dist/types/adapters/StorageAdapter.js.map +1 -0
- package/dist/types/adapters/index.d.ts +9 -0
- package/dist/types/adapters/index.d.ts.map +1 -0
- package/dist/types/adapters/index.js +2 -0
- package/dist/types/adapters/index.js.map +1 -0
- package/package.json +4 -2
- package/dist/spa/src/types/Adapters.ts +0 -213
- package/dist/types/Adapters.d.ts +0 -168
- package/dist/types/Adapters.d.ts.map +0 -1
- package/dist/types/Adapters.js +0 -2
- package/dist/types/Adapters.js.map +0 -1
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
<Teleport to="body">
|
|
4
4
|
<Filters
|
|
5
5
|
:columns="coreStore.resource?.columns"
|
|
6
|
-
:columnsMinMax="columnsMinMax"
|
|
6
|
+
:columnsMinMax="columnsMinMax"
|
|
7
|
+
:show="filtersShow"
|
|
7
8
|
@hide="filtersShow = false"
|
|
8
9
|
/>
|
|
9
10
|
</Teleport>
|
|
@@ -11,98 +12,105 @@
|
|
|
11
12
|
<component
|
|
12
13
|
v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.beforeBreadcrumbs || []"
|
|
13
14
|
:is="getCustomComponent(c)"
|
|
14
|
-
:meta="c.meta"
|
|
15
|
+
:meta="(c as AdminForthComponentDeclarationFull).meta"
|
|
15
16
|
:resource="coreStore.resource"
|
|
16
17
|
:adminUser="coreStore.adminUser"
|
|
17
18
|
/>
|
|
18
19
|
|
|
19
20
|
<BreadcrumbsWithButtons>
|
|
21
|
+
<component
|
|
22
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.beforeActionButtons || []"
|
|
23
|
+
:is="getCustomComponent(c)"
|
|
24
|
+
:meta="(c as AdminForthComponentDeclarationFull).meta"
|
|
25
|
+
:resource="coreStore.resource"
|
|
26
|
+
:adminUser="coreStore.adminUser"
|
|
27
|
+
/>
|
|
20
28
|
<button
|
|
21
29
|
@click="()=>{checkboxes = []}"
|
|
22
30
|
v-if="checkboxes.length"
|
|
23
31
|
data-tooltip-target="tooltip-remove-all"
|
|
24
|
-
class="flex gap-1 items-center py-1 px-3 me-2 text-sm font-medium text-
|
|
32
|
+
class="flex gap-1 items-center py-1 px-3 me-2 text-sm font-medium text-lightListViewButtonText focus:outline-none bg-lightListViewButtonBackground rounded border border-lightListViewButtonBorder hover:bg-lightListViewButtonBackgroundHover hover:text-lightListViewButtonTextHover focus:z-10 focus:ring-4 focus:ring-lightListViewButtonFocusRing dark:focus:ring-darkListViewButtonFocusRing dark:bg-darkListViewButtonBackground dark:text-darkListViewButtonText dark:border-darkListViewButtonBorder dark:hover:text-darkListViewButtonTextHover dark:hover:bg-darkListViewButtonBackgroundHover rounded-default"
|
|
25
33
|
>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</div>
|
|
34
|
+
<Tooltip>
|
|
35
|
+
<IconBanOutline class="w-5 h-5 "/>
|
|
36
|
+
<template #tooltip >
|
|
37
|
+
Remove selection
|
|
38
|
+
</template>
|
|
39
|
+
</Tooltip>
|
|
33
40
|
</button>
|
|
34
41
|
|
|
35
|
-
|
|
36
|
-
v-if="checkboxes.length"
|
|
42
|
+
<div
|
|
43
|
+
v-if="checkboxes.length"
|
|
37
44
|
v-for="(action,i) in coreStore.resource?.options?.bulkActions"
|
|
38
|
-
:key="action.id"
|
|
39
|
-
@click="startBulkAction(action.id)"
|
|
40
|
-
class="flex gap-1 items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-default border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
|
|
41
|
-
:class="{
|
|
42
|
-
'bg-red-100 text-red-800 border-red-400 dark:bg-red-700 dark:text-red-400 dark:border-red-400':action.state==='danger',
|
|
43
|
-
'bg-green-100 text-green-800 border-green-400 dark:bg-green-700 dark:text-green-400 dark:border-green-400':action.state==='success',
|
|
44
|
-
'bg-lightPrimaryOpacity text-lightPrimary border-blue-400 dark:bg-blue-700 dark:text-blue-400 dark:border-blue-400':action.state==='active',
|
|
45
|
-
}"
|
|
46
45
|
>
|
|
47
|
-
<
|
|
48
|
-
v-if="
|
|
49
|
-
:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
{{ action.
|
|
72
|
-
|
|
73
|
-
|
|
46
|
+
<button
|
|
47
|
+
v-if="!action.showInThreeDotsDropdown"
|
|
48
|
+
:key="action.id"
|
|
49
|
+
@click="startBulkAction(action.id!)"
|
|
50
|
+
class="flex gap-1 items-center py-1 px-3 text-sm font-medium text-lightListViewButtonText focus:outline-none bg-lightListViewButtonBackground rounded-default border border-lightListViewButtonBorder hover:bg-lightListViewButtonBackgroundHover hover:text-lightListViewButtonTextHover focus:z-10 focus:ring-4 focus:ring-lightListViewButtonFocusRing dark:focus:ring-darkListViewButtonFocusRing dark:bg-darkListViewButtonBackground dark:text-darkListViewButtonText dark:border-darkListViewButtonBorder dark:hover:text-darkListViewButtonTextHover dark:hover:bg-darkListViewButtonBackgroundHover"
|
|
51
|
+
:class="action.buttonCustomCssClass || ''"
|
|
52
|
+
>
|
|
53
|
+
<component
|
|
54
|
+
v-if="action.icon && !bulkActionLoadingStates[action.id!]"
|
|
55
|
+
:is="getIcon(action.icon)"
|
|
56
|
+
class="w-5 h-5 transition duration-75 group-hover:text-gray-900 dark:group-hover:text-white"></component>
|
|
57
|
+
<div v-if="bulkActionLoadingStates[action.id!]">
|
|
58
|
+
<svg
|
|
59
|
+
aria-hidden="true"
|
|
60
|
+
class="w-5 h-5 animate-spin text-gray-200 dark:text-gray-500 fill-gray-500 dark:fill-gray-300"
|
|
61
|
+
viewBox="0 0 100 101"
|
|
62
|
+
fill="none"
|
|
63
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
64
|
+
>
|
|
65
|
+
<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"/>
|
|
66
|
+
<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"/>
|
|
67
|
+
</svg>
|
|
68
|
+
<span class="sr-only">Loading...</span>
|
|
69
|
+
</div>
|
|
70
|
+
{{ `${action.label} (${checkboxes.length})` }}
|
|
71
|
+
<div v-if="action.badge" class="text-white bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 hover:bg-gradient-to-br focus:ring-4 focus:outline-none focus:ring-purple-300 dark:focus:ring-purple-800
|
|
72
|
+
font-medium rounded-sm text-xs px-1 ml-1 text-center ">
|
|
73
|
+
{{ action.badge }}
|
|
74
|
+
</div>
|
|
75
|
+
</button>
|
|
76
|
+
</div>
|
|
74
77
|
|
|
75
78
|
<RouterLink v-if="coreStore.resource?.options?.allowedActions?.create"
|
|
76
79
|
:to="{ name: 'resource-create', params: { resourceId: $route.params.resourceId } }"
|
|
77
|
-
class="af-create-button flex items-center py-1 px-3 text-sm font-medium text-
|
|
80
|
+
class="af-create-button flex items-center py-1 px-3 text-sm font-medium text-lightListViewButtonText focus:outline-none bg-lightListViewButtonBackground rounded border border-lightListViewButtonBorder hover:bg-lightListViewButtonBackgroundHover hover:text-lightListViewButtonTextHover focus:z-10 focus:ring-4 focus:ring-lightListViewButtonFocusRing dark:focus:ring-darkListViewButtonFocusRing dark:bg-darkListViewButtonBackground dark:text-darkListViewButtonText dark:border-darkListViewButtonBorder dark:hover:text-darkListViewButtonTextHover dark:hover:bg-darkListViewButtonBackgroundHover rounded-default gap-1"
|
|
78
81
|
>
|
|
79
|
-
<IconPlusOutline class="w-4 h-4
|
|
82
|
+
<IconPlusOutline class="w-4 h-4"/>
|
|
80
83
|
{{ $t('Create') }}
|
|
81
84
|
</RouterLink>
|
|
82
85
|
|
|
83
86
|
<button
|
|
84
|
-
class="af-filter-button flex gap-1 items-center py-1 px-3 me-2 text-sm font-medium text-
|
|
87
|
+
class="af-filter-button flex gap-1 items-center py-1 px-3 me-2 text-sm font-medium text-lightListViewButtonText focus:outline-none bg-lightListViewButtonBackground rounded border border-lightListViewButtonBorder hover:bg-lightListViewButtonBackgroundHover hover:text-lightListViewButtonTextHover focus:z-10 focus:ring-4 focus:ring-lightListViewButtonFocusRing dark:focus:ring-darkListViewButtonFocusRing dark:bg-darkListViewButtonBackground dark:text-darkListViewButtonText dark:border-darkListViewButtonBorder dark:hover:text-darkListViewButtonTextHover dark:hover:bg-darkListViewButtonBackgroundHover rounded-default"
|
|
85
88
|
@click="()=>{filtersShow = !filtersShow}"
|
|
86
89
|
v-if="coreStore.resource?.options?.allowedActions?.filter"
|
|
87
90
|
>
|
|
88
|
-
<IconFilterOutline class="w-4 h-4
|
|
91
|
+
<IconFilterOutline class="w-4 h-4"/>
|
|
89
92
|
{{ $t('Filter') }}
|
|
90
93
|
<span
|
|
91
94
|
class="bg-red-100 text-red-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-gray-700 dark:text-red-400 border border-red-400"
|
|
92
|
-
v-if="filtersStore.
|
|
93
|
-
{{ filtersStore.
|
|
95
|
+
v-if="filtersStore.visibleFiltersCount">
|
|
96
|
+
{{ filtersStore.visibleFiltersCount }}
|
|
94
97
|
</span>
|
|
95
98
|
</button>
|
|
96
99
|
|
|
97
100
|
<ThreeDotsMenu
|
|
98
|
-
:threeDotsDropdownItems="coreStore.resourceOptions?.pageInjections?.list?.threeDotsDropdownItems"
|
|
99
|
-
|
|
101
|
+
:threeDotsDropdownItems="(coreStore.resourceOptions?.pageInjections?.list?.threeDotsDropdownItems as [])"
|
|
102
|
+
:bulkActions="coreStore.resource?.options?.bulkActions"
|
|
103
|
+
:checkboxes="checkboxes"
|
|
104
|
+
@startBulkAction="startBulkAction"
|
|
105
|
+
:updateList="getList"
|
|
106
|
+
:clearCheckboxes="clearCheckboxes"
|
|
107
|
+
></ThreeDotsMenu>
|
|
100
108
|
</BreadcrumbsWithButtons>
|
|
101
109
|
|
|
102
110
|
<component
|
|
103
111
|
v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.afterBreadcrumbs || []"
|
|
104
112
|
:is="getCustomComponent(c)"
|
|
105
|
-
:meta="c.meta"
|
|
113
|
+
:meta="(c as AdminForthComponentDeclarationFull).meta"
|
|
106
114
|
:resource="coreStore.resource"
|
|
107
115
|
:adminUser="coreStore.adminUser"
|
|
108
116
|
/>
|
|
@@ -119,12 +127,23 @@
|
|
|
119
127
|
:pageSize="pageSize"
|
|
120
128
|
:totalRows="totalRows"
|
|
121
129
|
:checkboxes="checkboxes"
|
|
122
|
-
:customActionsInjection="coreStore.resourceOptions?.pageInjections?.list?.customActionIcons
|
|
123
|
-
|
|
130
|
+
:customActionsInjection="Array.isArray(coreStore.resourceOptions?.pageInjections?.list?.customActionIcons)
|
|
131
|
+
? coreStore.resourceOptions.pageInjections.list.customActionIcons
|
|
132
|
+
: coreStore.resourceOptions?.pageInjections?.list?.customActionIcons
|
|
133
|
+
? [coreStore.resourceOptions.pageInjections.list.customActionIcons]
|
|
134
|
+
: []
|
|
135
|
+
"
|
|
136
|
+
:tableBodyStartInjection="Array.isArray(coreStore.resourceOptions?.pageInjections?.list?.tableBodyStart)
|
|
137
|
+
? coreStore.resourceOptions.pageInjections.list.tableBodyStart
|
|
138
|
+
: coreStore.resourceOptions?.pageInjections?.list?.tableBodyStart
|
|
139
|
+
? [coreStore.resourceOptions.pageInjections.list.tableBodyStart]
|
|
140
|
+
: []
|
|
141
|
+
"
|
|
124
142
|
:container-height="1100"
|
|
125
143
|
:item-height="52.5"
|
|
126
144
|
:buffer-size="listBufferSize"
|
|
127
145
|
/>
|
|
146
|
+
|
|
128
147
|
<ResourceListTable
|
|
129
148
|
v-else
|
|
130
149
|
:resource="coreStore.resource"
|
|
@@ -138,14 +157,24 @@
|
|
|
138
157
|
:pageSize="pageSize"
|
|
139
158
|
:totalRows="totalRows"
|
|
140
159
|
:checkboxes="checkboxes"
|
|
141
|
-
:customActionsInjection="coreStore.resourceOptions?.pageInjections?.list?.customActionIcons
|
|
142
|
-
|
|
160
|
+
:customActionsInjection="Array.isArray(coreStore.resourceOptions?.pageInjections?.list?.customActionIcons)
|
|
161
|
+
? coreStore.resourceOptions.pageInjections.list.customActionIcons
|
|
162
|
+
: coreStore.resourceOptions?.pageInjections?.list?.customActionIcons
|
|
163
|
+
? [coreStore.resourceOptions.pageInjections.list.customActionIcons]
|
|
164
|
+
: []
|
|
165
|
+
"
|
|
166
|
+
:tableBodyStartInjection="Array.isArray(coreStore.resourceOptions?.pageInjections?.list?.tableBodyStart)
|
|
167
|
+
? coreStore.resourceOptions.pageInjections.list.tableBodyStart
|
|
168
|
+
: coreStore.resourceOptions?.pageInjections?.list?.tableBodyStart
|
|
169
|
+
? [coreStore.resourceOptions.pageInjections.list.tableBodyStart]
|
|
170
|
+
: []
|
|
171
|
+
"
|
|
143
172
|
/>
|
|
144
173
|
|
|
145
174
|
<component
|
|
146
175
|
v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.bottom || []"
|
|
147
176
|
:is="getCustomComponent(c)"
|
|
148
|
-
:meta="c.meta"
|
|
177
|
+
:meta="(c as AdminForthComponentDeclarationFull).meta"
|
|
149
178
|
:resource="coreStore.resource"
|
|
150
179
|
:adminUser="coreStore.adminUser"
|
|
151
180
|
/>
|
|
@@ -160,11 +189,13 @@ import ResourceListTable from '@/components/ResourceListTable.vue';
|
|
|
160
189
|
import { useCoreStore } from '@/stores/core';
|
|
161
190
|
import { useFiltersStore } from '@/stores/filters';
|
|
162
191
|
import { callAdminForthApi, currentQuery, getIcon, setQuery } from '@/utils';
|
|
163
|
-
import { computed, onMounted, ref, watch, nextTick, type Ref } from 'vue';
|
|
192
|
+
import { computed, onMounted, onUnmounted, ref, watch, nextTick, type Ref } from 'vue';
|
|
164
193
|
import { useRoute } from 'vue-router';
|
|
165
194
|
import { showErrorTost } from '@/composables/useFrontendApi'
|
|
166
195
|
import { getCustomComponent, initThreeDotsDropdown } from '@/utils';
|
|
167
196
|
import ThreeDotsMenu from '@/components/ThreeDotsMenu.vue';
|
|
197
|
+
import { Tooltip } from '@/afcl'
|
|
198
|
+
import type { AdminForthComponentDeclarationFull } from '@/types/Common';
|
|
168
199
|
|
|
169
200
|
|
|
170
201
|
import {
|
|
@@ -185,7 +216,7 @@ const route = useRoute();
|
|
|
185
216
|
|
|
186
217
|
const page = ref(1);
|
|
187
218
|
const columnsMinMax = ref({});
|
|
188
|
-
const sort = ref(
|
|
219
|
+
const sort = ref();
|
|
189
220
|
|
|
190
221
|
watch(() => sort, async (to, from) => {
|
|
191
222
|
// in store sort might be needed for plugins
|
|
@@ -229,11 +260,11 @@ async function getList() {
|
|
|
229
260
|
totalRows.value = 0;
|
|
230
261
|
return {error: data.error};
|
|
231
262
|
}
|
|
232
|
-
rows.value = data.data?.map(row => {
|
|
233
|
-
if (coreStore.resource
|
|
234
|
-
row._primaryKeyValue = row[coreStore.resource.columns.find(c => c.primaryKey)
|
|
235
|
-
} else {
|
|
236
|
-
row._primaryKeyValue = row[coreStore.resource.columns.find(c => c.primaryKey)
|
|
263
|
+
rows.value = data.data?.map((row: any) => {
|
|
264
|
+
if (coreStore.resource?.columns?.find(c => c.primaryKey)?.foreignResource) {
|
|
265
|
+
row._primaryKeyValue = row[coreStore.resource.columns.find(c => c.primaryKey)!.name].pk;
|
|
266
|
+
} else if (coreStore.resource) {
|
|
267
|
+
row._primaryKeyValue = row[coreStore.resource.columns.find(c => c.primaryKey)!.name];
|
|
237
268
|
}
|
|
238
269
|
return row;
|
|
239
270
|
});
|
|
@@ -245,6 +276,10 @@ async function getList() {
|
|
|
245
276
|
return {}
|
|
246
277
|
}
|
|
247
278
|
|
|
279
|
+
function clearCheckboxes() {
|
|
280
|
+
checkboxes.value = [];
|
|
281
|
+
}
|
|
282
|
+
|
|
248
283
|
async function refreshExistingList(pk?: any) {
|
|
249
284
|
const currentData = rows.value;
|
|
250
285
|
if (!currentData) {
|
|
@@ -297,9 +332,9 @@ async function refreshExistingList(pk?: any) {
|
|
|
297
332
|
}
|
|
298
333
|
|
|
299
334
|
|
|
300
|
-
async function startBulkAction(actionId) {
|
|
301
|
-
const action = coreStore.resource
|
|
302
|
-
if (action
|
|
335
|
+
async function startBulkAction(actionId: string) {
|
|
336
|
+
const action = coreStore.resource?.options?.bulkActions?.find(a => a.id === actionId);
|
|
337
|
+
if (action?.confirm) {
|
|
303
338
|
const confirmed = await adminforth.confirm({
|
|
304
339
|
message: action.confirm,
|
|
305
340
|
});
|
|
@@ -339,10 +374,10 @@ async function startBulkAction(actionId) {
|
|
|
339
374
|
|
|
340
375
|
|
|
341
376
|
class SortQuerySerializer {
|
|
342
|
-
static serialize(sort) {
|
|
377
|
+
static serialize(sort: {field: string, direction: 'asc' | 'desc'}[]) {
|
|
343
378
|
return sort.map(s => `${s.field}__${s.direction}`).join(',');
|
|
344
379
|
}
|
|
345
|
-
static deserialize(str) {
|
|
380
|
+
static deserialize(str: string) {
|
|
346
381
|
return str.split(',').map(s => {
|
|
347
382
|
const [field, direction] = s.split('__');
|
|
348
383
|
return { field, direction };
|
|
@@ -352,10 +387,17 @@ class SortQuerySerializer {
|
|
|
352
387
|
|
|
353
388
|
let listAutorefresher: any = null;
|
|
354
389
|
|
|
390
|
+
function clearAutoRefresher() {
|
|
391
|
+
if (listAutorefresher) {
|
|
392
|
+
clearInterval(listAutorefresher);
|
|
393
|
+
listAutorefresher = null;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
355
397
|
async function init() {
|
|
356
398
|
|
|
357
399
|
await coreStore.fetchResourceFull({
|
|
358
|
-
resourceId: route.params.resourceId
|
|
400
|
+
resourceId: route.params.resourceId as string
|
|
359
401
|
});
|
|
360
402
|
isPageLoaded.value = true;
|
|
361
403
|
// !!! clear filters should be in same tick with sort assignment so that watch can catch it as one change
|
|
@@ -366,7 +408,7 @@ async function init() {
|
|
|
366
408
|
return {
|
|
367
409
|
field,
|
|
368
410
|
operator,
|
|
369
|
-
value: JSON.parse(decodeURIComponent(route.query[k]))
|
|
411
|
+
value: JSON.parse(decodeURIComponent(route.query[k] as string))
|
|
370
412
|
}
|
|
371
413
|
});
|
|
372
414
|
if (filters.length) {
|
|
@@ -376,8 +418,8 @@ async function init() {
|
|
|
376
418
|
}
|
|
377
419
|
|
|
378
420
|
if (route.query.sort) {
|
|
379
|
-
sort.value = SortQuerySerializer.deserialize(route.query.sort);
|
|
380
|
-
} else if (coreStore
|
|
421
|
+
sort.value = SortQuerySerializer.deserialize(route.query.sort as string);
|
|
422
|
+
} else if (coreStore?.resource?.options?.defaultSort) {
|
|
381
423
|
sort.value = [{
|
|
382
424
|
field: coreStore.resource.options.defaultSort.columnName,
|
|
383
425
|
direction: coreStore.resource.options.defaultSort.direction
|
|
@@ -387,7 +429,7 @@ async function init() {
|
|
|
387
429
|
}
|
|
388
430
|
// page init should be also in same tick
|
|
389
431
|
if (route.query.page) {
|
|
390
|
-
page.value = parseInt(route.query.page);
|
|
432
|
+
page.value = parseInt(route.query.page as string);
|
|
391
433
|
}
|
|
392
434
|
|
|
393
435
|
// getList(); - Not needed here, watch will trigger it
|
|
@@ -399,10 +441,7 @@ async function init() {
|
|
|
399
441
|
}
|
|
400
442
|
});
|
|
401
443
|
|
|
402
|
-
|
|
403
|
-
clearInterval(listAutorefresher);
|
|
404
|
-
listAutorefresher = null;
|
|
405
|
-
}
|
|
444
|
+
clearAutoRefresher();
|
|
406
445
|
if (coreStore.resource!.options?.listRowsAutoRefreshSeconds) {
|
|
407
446
|
listAutorefresher = setInterval(async () => {
|
|
408
447
|
await adminforth.list.silentRefresh();
|
|
@@ -416,8 +455,18 @@ watch([page, sort, () => filtersStore.filters], async () => {
|
|
|
416
455
|
}, { deep: true });
|
|
417
456
|
|
|
418
457
|
adminforth.list.refresh = async () => {
|
|
419
|
-
|
|
420
|
-
|
|
458
|
+
const result = await getList();
|
|
459
|
+
|
|
460
|
+
if (!result) {
|
|
461
|
+
return {};
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
if ('error' in result && result.error != null) {
|
|
465
|
+
return { error: String(result.error) };
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
return {};
|
|
469
|
+
};
|
|
421
470
|
|
|
422
471
|
adminforth.list.silentRefresh = async () => {
|
|
423
472
|
return await refreshExistingList();
|
|
@@ -437,10 +486,10 @@ watch(() => filtersStore.filters, async (to, from) => {
|
|
|
437
486
|
page.value = 1;
|
|
438
487
|
checkboxes.value = []; // TODO: not sure absolutely needed here
|
|
439
488
|
// update query param for each filter as filter_<column_name>=value
|
|
440
|
-
const query = {};
|
|
489
|
+
const query: Record<string, string | undefined> = {};
|
|
441
490
|
const currentQ = currentQuery();
|
|
442
491
|
filtersStore.filters.forEach(f => {
|
|
443
|
-
if (f.value) {
|
|
492
|
+
if (f.value !== undefined && f.value !== null && f.value !== '') {
|
|
444
493
|
query[`filter__${f.field}__${f.operator}`] = encodeURIComponent(JSON.stringify(f.value));
|
|
445
494
|
}
|
|
446
495
|
});
|
|
@@ -460,6 +509,10 @@ onMounted(async () => {
|
|
|
460
509
|
initInProcess = false;
|
|
461
510
|
});
|
|
462
511
|
|
|
512
|
+
onUnmounted(() => {
|
|
513
|
+
clearAutoRefresher();
|
|
514
|
+
});
|
|
515
|
+
|
|
463
516
|
watch([page], async () => {
|
|
464
517
|
setQuery({ page: page.value });
|
|
465
518
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="relative flex items-center justify-center min-h-screen bg-
|
|
2
|
+
<div class="relative flex items-center justify-center min-h-screen bg-lightHtml dark:bg-darkHtml w-screen h-screen"
|
|
3
3
|
:style="coreStore.config?.loginBackgroundImage && backgroundPosition === 'over' ? {
|
|
4
4
|
'background-image': 'url(' + loadFile(coreStore.config?.loginBackgroundImage) + ')',
|
|
5
5
|
'background-size': 'cover',
|
|
6
6
|
'background-position': 'center',
|
|
7
|
-
'background-blend-mode': 'darken'
|
|
7
|
+
'background-blend-mode': coreStore.config?.removeBackgroundBlendMode ? 'normal' : 'darken'
|
|
8
8
|
}: {}"
|
|
9
9
|
>
|
|
10
10
|
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
overflow-x-hidden z-50 min-w-[350px] justify-center items-center md:inset-0 h-[calc(100%-1rem)] max-h-full">
|
|
28
28
|
<div class="relative p-4 w-full max-h-full max-w-[400px]">
|
|
29
29
|
<!-- Modal content -->
|
|
30
|
-
<div class="af-login-modal-content relative bg-
|
|
30
|
+
<div class="af-login-popup af-login-modal-content relative bg-lightLoginViewBackground rounded-lg shadow dark:bg-darkLoginViewBackground dark:shadow-black" :class=" { 'rounded-b-none overflow-hidden': error } ">
|
|
31
31
|
<!-- Modal header -->
|
|
32
32
|
<div class="af-login-modal-header flex items-center justify-between flex-col p-4 md:p-5 border-b rounded-t dark:border-gray-600">
|
|
33
33
|
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
:meta="c.meta"
|
|
40
40
|
/>
|
|
41
41
|
</template>
|
|
42
|
-
<h3 v-else class="text-xl font-semibold text-
|
|
42
|
+
<h3 v-else class="text-xl font-semibold text-lightLoginViewText dark:text-darkLoginViewTextColor">
|
|
43
43
|
{{ $t('Sign in to') }} {{ coreStore.config?.brandName }}
|
|
44
44
|
</h3>
|
|
45
45
|
</div>
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
<div class="af-login-modal-body p-4 md:p-5">
|
|
48
48
|
<form class="space-y-4" @submit.prevent>
|
|
49
49
|
<div>
|
|
50
|
-
<label for="username" class="block mb-2 text-sm font-medium text-
|
|
50
|
+
<label for="username" class="block mb-2 text-sm font-medium text-lightLoginViewText dark:text-darkLoginViewTextColor">{{ $t('Your') }} {{ coreStore.config?.usernameFieldName?.toLowerCase() }}</label>
|
|
51
51
|
<Input
|
|
52
52
|
v-model="username"
|
|
53
53
|
autocomplete="username"
|
|
@@ -55,22 +55,20 @@
|
|
|
55
55
|
name="username"
|
|
56
56
|
id="username"
|
|
57
57
|
ref="usernameInput"
|
|
58
|
-
oninput="setCustomValidity('')"
|
|
59
58
|
@keydown.enter="passwordInput.focus()"
|
|
60
59
|
class="w-full"
|
|
61
60
|
placeholder="name@company.com" required />
|
|
62
61
|
</div>
|
|
63
62
|
<div class="">
|
|
64
|
-
<label for="password" class="block mb-2 text-sm font-medium text-
|
|
63
|
+
<label for="password" class="block mb-2 text-sm font-medium text-lightLoginViewText dark:text-darkLoginViewTextColor">{{ $t('Your password') }}</label>
|
|
65
64
|
<Input
|
|
66
65
|
v-model="password"
|
|
67
66
|
ref="passwordInput"
|
|
68
67
|
autocomplete="current-password"
|
|
69
|
-
oninput="setCustomValidity('')"
|
|
70
68
|
@keydown.enter="login"
|
|
71
69
|
:type="!showPw ? 'password': 'text'" name="password" id="password" placeholder="••••••••" class="w-full" required>
|
|
72
70
|
<template #rightIcon>
|
|
73
|
-
<button type="button" @click="showPw = !showPw" class="text-
|
|
71
|
+
<button type="button" @click="showPw = !showPw" class="text-lightLoginViewSubTextColor dark:text-darkLoginViewSubTextColor">
|
|
74
72
|
<IconEyeSolid class="w-5 h-5" v-if="!showPw" />
|
|
75
73
|
<IconEyeSlashSolid class="w-5 h-5" v-else />
|
|
76
74
|
</button>
|
|
@@ -92,34 +90,31 @@
|
|
|
92
90
|
v-for="c in coreStore?.config?.loginPageInjections?.underInputs || []"
|
|
93
91
|
:is="getCustomComponent(c)"
|
|
94
92
|
:meta="c.meta"
|
|
93
|
+
@update:disableLoginButton="setDisableLoginButton($event)"
|
|
95
94
|
/>
|
|
96
|
-
|
|
97
|
-
<div v-if="
|
|
98
|
-
|
|
99
|
-
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"/>
|
|
100
|
-
</svg>
|
|
101
|
-
<span class="sr-only">{{ $t('Info') }}</span>
|
|
102
|
-
<div>
|
|
103
|
-
{{ error }}
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
|
|
107
|
-
<div v-if="coreStore.config?.loginPromptHTML"
|
|
108
|
-
class="flex items-center p-4 mb-4 text-sm text-gray-800 rounded-lg bg-gray-50 dark:bg-gray-800 dark:text-gray-400" role="alert"
|
|
95
|
+
|
|
96
|
+
<div v-if="loginPromptHTML"
|
|
97
|
+
class="flex items-center p-4 mb-4 text-sm text-lightLoginViewPromptText rounded-lg bg-lightLoginViewPromptBackground dark:bg-darkLoginViewPromptBackground dark:text-darkLoginViewPromptText" role="alert"
|
|
109
98
|
>
|
|
110
99
|
<svg class="flex-shrink-0 inline w-4 h-4 me-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
|
|
111
100
|
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"/>
|
|
112
101
|
</svg>
|
|
113
102
|
<span class="sr-only">{{ $t('Info') }}</span>
|
|
114
|
-
<div v-html="
|
|
103
|
+
<div v-html="loginPromptHTML"></div>
|
|
115
104
|
</div>
|
|
116
|
-
<Button @click="login" :loader="inProgress" :disabled="inProgress" class="w-full">
|
|
105
|
+
<Button @click="login" :loader="inProgress" :disabled="inProgress || disableLoginButton" class="w-full">
|
|
117
106
|
{{ $t('Login to your account') }}
|
|
118
107
|
</Button>
|
|
108
|
+
<component
|
|
109
|
+
v-for="c in coreStore?.config?.loginPageInjections?.underLoginButton || []"
|
|
110
|
+
:is="getCustomComponent(c)"
|
|
111
|
+
:meta="c.meta"
|
|
112
|
+
@update:disableLoginButton="setDisableLoginButton($event)"
|
|
113
|
+
/>
|
|
119
114
|
</form>
|
|
120
|
-
|
|
121
115
|
</div>
|
|
122
116
|
</div>
|
|
117
|
+
<ErrorMessage v-if="error" :error="error" class="absolute left-4 right-4 rounded-t-none mb-0 shadow px-9" />
|
|
123
118
|
</div>
|
|
124
119
|
</div>
|
|
125
120
|
|
|
@@ -127,7 +122,7 @@
|
|
|
127
122
|
</template>
|
|
128
123
|
|
|
129
124
|
|
|
130
|
-
<script setup>
|
|
125
|
+
<script setup lang="ts">
|
|
131
126
|
|
|
132
127
|
import { getCustomComponent } from '@/utils';
|
|
133
128
|
import { onBeforeMount, onMounted, ref, computed } from 'vue';
|
|
@@ -138,6 +133,7 @@ import { callAdminForthApi, loadFile } from '@/utils';
|
|
|
138
133
|
import { useRoute, useRouter } from 'vue-router';
|
|
139
134
|
import { Button, Checkbox, Input } from '@/afcl';
|
|
140
135
|
import { useI18n } from 'vue-i18n';
|
|
136
|
+
import ErrorMessage from '@/components/ErrorMessage.vue';
|
|
141
137
|
|
|
142
138
|
const { t } = useI18n();
|
|
143
139
|
|
|
@@ -150,18 +146,28 @@ const password = ref('');
|
|
|
150
146
|
const route = useRoute();
|
|
151
147
|
const router = useRouter();
|
|
152
148
|
const inProgress = ref(false);
|
|
153
|
-
|
|
149
|
+
const loginPromptHTML = ref()
|
|
154
150
|
const coreStore = useCoreStore();
|
|
155
151
|
const user = useUserStore();
|
|
156
152
|
|
|
157
153
|
const showPw = ref(false);
|
|
158
154
|
|
|
159
155
|
const error = ref(null);
|
|
156
|
+
const disableLoginButton = ref(false);
|
|
160
157
|
|
|
161
158
|
const backgroundPosition = computed(() => {
|
|
162
159
|
return coreStore.config?.loginBackgroundPosition || '1/2';
|
|
163
160
|
});
|
|
164
161
|
|
|
162
|
+
|
|
163
|
+
async function getLoginFormConfig() {
|
|
164
|
+
const response = await callAdminForthApi({
|
|
165
|
+
path: '/get_login_form_config',
|
|
166
|
+
method: 'GET',
|
|
167
|
+
});
|
|
168
|
+
loginPromptHTML.value = response.loginPromptHTML;
|
|
169
|
+
}
|
|
170
|
+
|
|
165
171
|
onBeforeMount(() => {
|
|
166
172
|
if (localStorage.getItem('isAuthorized') === 'true') {
|
|
167
173
|
// if route has next param, redirect
|
|
@@ -175,6 +181,7 @@ onBeforeMount(() => {
|
|
|
175
181
|
})
|
|
176
182
|
|
|
177
183
|
onMounted(async () => {
|
|
184
|
+
getLoginFormConfig();
|
|
178
185
|
if (coreStore.config?.demoCredentials) {
|
|
179
186
|
const [demoUsername, demoPassword] = coreStore.config.demoCredentials.split(':');
|
|
180
187
|
username.value = demoUsername;
|
|
@@ -185,16 +192,6 @@ onMounted(async () => {
|
|
|
185
192
|
|
|
186
193
|
|
|
187
194
|
async function login() {
|
|
188
|
-
|
|
189
|
-
if (!username.value) {
|
|
190
|
-
usernameInput.value.setCustomValidity(t('Please fill out this field.'));
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
if (!password.value) {
|
|
194
|
-
passwordInput.value.setCustomValidity(t('Please fill out this field.'));
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
195
|
if (inProgress.value) {
|
|
199
196
|
return;
|
|
200
197
|
}
|
|
@@ -220,5 +217,8 @@ async function login() {
|
|
|
220
217
|
|
|
221
218
|
}
|
|
222
219
|
|
|
220
|
+
function setDisableLoginButton(value: boolean) {
|
|
221
|
+
disableLoginButton.value = value;
|
|
222
|
+
}
|
|
223
223
|
|
|
224
224
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :key="`${$route?.params.resourceId}---${$route?.params.primaryKey}`" class="p-4 flex"
|
|
2
|
+
<div :key="`${$route?.params.resourceId}---${$route?.params.primaryKey}`" class="af-resource-parent p-4 flex"
|
|
3
3
|
:class="limitHeightToPage ? 'h-[calc(100dvh-3.5rem)]': undefined"
|
|
4
4
|
>
|
|
5
5
|
<RouterView/>
|
|
@@ -33,7 +33,7 @@ const limitHeightToPage = computed(() => {
|
|
|
33
33
|
}
|
|
34
34
|
const listPageInjects = coreStore.resource.options.pageInjections.list;
|
|
35
35
|
|
|
36
|
-
for (const pi of [listPageInjects.beforeBreadcrumbs, listPageInjects.afterBreadcrumbs, listPageInjects.bottom]) {
|
|
36
|
+
for (const pi of [listPageInjects.beforeBreadcrumbs, listPageInjects.beforeActionButtons, listPageInjects.afterBreadcrumbs, listPageInjects.bottom]) {
|
|
37
37
|
if (pi) {
|
|
38
38
|
for (const piItem of pi) {
|
|
39
39
|
if (!piItem.meta?.thinEnoughToShrinkTable) {
|