adminforth 1.1.75 → 1.1.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/utils.js +1 -1
- package/dist/plugins/S3UploadPlugin/custom/s3uploader.vue +1 -1
- package/dist/plugins/S3UploadPlugin/package.json +1 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/.package-lock.json +61 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/LICENSE +21 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/README.md +15 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/package.json +217 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/LICENSE +21 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/README.md +15 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/package.json +21 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/LICENSE +201 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/README.md +68 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/index.js +51 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/interfaces.js +2 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/package.json +58 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/.travis.yml +6 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/LICENSE +22 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/Readme.md +135 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/examples/TOTP-verify.js +33 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/examples/TOTP.js +15 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/index.js +221 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/package.json +22 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/test/mocha.opts +1 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/test/notp.js +217 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/LICENSE.txt +19 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/Makefile +24 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/README.md +15 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/index.js +23 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/lib/thirty-two/index.js +26 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/lib/thirty-two/thirty-two.js +128 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/package.json +15 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/spec/thirty-two_spec.js +63 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/CopyrightNotice.txt +15 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/LICENSE.txt +12 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/README.md +164 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/SECURITY.md +41 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/modules/index.js +68 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/modules/package.json +3 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/package.json +47 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.html +1 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.js +374 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.mjs +373 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.html +1 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.js +424 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/README.md +6 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/package.json +55 -0
- package/dist/plugins/TwoFactorsAuthPlugin/package-lock.json +69 -0
- package/dist/plugins/TwoFactorsAuthPlugin/package.json +15 -0
- package/dist/spa/spa/.eslintrc.cjs +14 -0
- package/dist/spa/spa/.vscode/extensions.json +6 -0
- package/dist/spa/spa/README.md +39 -0
- package/dist/spa/spa/env.d.ts +1 -0
- package/dist/spa/spa/index.html +23 -0
- package/dist/spa/spa/package-lock.json +4470 -0
- package/dist/spa/spa/package.json +48 -0
- package/dist/spa/spa/postcss.config.js +6 -0
- package/dist/spa/spa/public/assets/favicon.png +0 -0
- package/dist/spa/spa/src/App.vue +316 -0
- package/dist/spa/spa/src/assets/base.css +0 -0
- package/dist/spa/spa/src/assets/logo.svg +19 -0
- package/dist/spa/spa/src/components/AcceptModal.vue +45 -0
- package/dist/spa/spa/src/components/Breadcrumbs.vue +40 -0
- package/dist/spa/spa/src/components/BreadcrumbsWithButtons.vue +26 -0
- package/dist/spa/spa/src/components/CustomDatePicker.vue +174 -0
- package/dist/spa/spa/src/components/CustomDateRangePicker.vue +218 -0
- package/dist/spa/spa/src/components/CustomRangePicker.vue +148 -0
- package/dist/spa/spa/src/components/Dropdown.vue +168 -0
- package/dist/spa/spa/src/components/Filters.vue +211 -0
- package/dist/spa/spa/src/components/HelloWorld.vue +17 -0
- package/dist/spa/spa/src/components/MenuLink.vue +24 -0
- package/dist/spa/spa/src/components/ResourceForm.vue +265 -0
- package/dist/spa/spa/src/components/ResourceListTable.vue +404 -0
- package/dist/spa/spa/src/components/SingleSkeletLoader.vue +13 -0
- package/dist/spa/spa/src/components/SkeleteLoader.vue +23 -0
- package/dist/spa/spa/src/components/Toast.vue +66 -0
- package/dist/spa/spa/src/components/ValueRenderer.vue +59 -0
- package/dist/spa/spa/src/components/icons/IconCalendar.vue +5 -0
- package/dist/spa/spa/src/components/icons/IconCommunity.vue +7 -0
- package/dist/spa/spa/src/components/icons/IconDocumentation.vue +7 -0
- package/dist/spa/spa/src/components/icons/IconEcosystem.vue +7 -0
- package/dist/spa/spa/src/components/icons/IconSupport.vue +7 -0
- package/dist/spa/spa/src/components/icons/IconTime.vue +5 -0
- package/dist/spa/spa/src/components/icons/IconTooling.vue +19 -0
- package/dist/spa/spa/src/composables/useFrontendApi.ts +26 -0
- package/dist/spa/spa/src/composables/useStores.ts +126 -0
- package/dist/spa/spa/src/index.scss +26 -0
- package/dist/spa/spa/src/main.ts +18 -0
- package/dist/spa/spa/src/router/index.ts +63 -0
- package/dist/spa/spa/src/spa_types/core.ts +51 -0
- package/dist/spa/spa/src/stores/core.ts +144 -0
- package/dist/spa/spa/src/stores/filters.ts +22 -0
- package/dist/spa/spa/src/stores/modal.ts +48 -0
- package/dist/spa/spa/src/stores/toast.ts +15 -0
- package/dist/spa/spa/src/stores/user.ts +54 -0
- package/dist/spa/spa/src/utils.ts +101 -0
- package/dist/spa/spa/src/views/CreateView.vue +155 -0
- package/dist/spa/spa/src/views/EditView.vue +157 -0
- package/dist/spa/spa/src/views/ListView.vue +266 -0
- package/dist/spa/spa/src/views/LoginView.vue +139 -0
- package/dist/spa/spa/src/views/ResourceParent.vue +17 -0
- package/dist/spa/spa/src/views/ShowView.vue +180 -0
- package/dist/spa/spa/tailwind.config.js +17 -0
- package/dist/spa/spa/tsconfig.app.json +14 -0
- package/dist/spa/spa/tsconfig.json +11 -0
- package/dist/spa/spa/tsconfig.node.json +19 -0
- package/dist/spa/spa/vite.config.ts +49 -0
- package/modules/utils.ts +1 -1
- package/package.json +1 -3
- package/plugins/S3UploadPlugin/custom/s3uploader.vue +1 -1
- package/plugins/S3UploadPlugin/package.json +1 -0
- package/plugins/S3UploadPlugin/types.ts +1 -1
- package/plugins/TwoFactorsAuthPlugin/node_modules/.package-lock.json +61 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/LICENSE +21 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/README.md +15 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/assert.d.ts +1040 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/async_hooks.d.ts +541 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/buffer.d.ts +2363 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/child_process.d.ts +1544 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/cluster.d.ts +578 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/console.d.ts +452 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/constants.d.ts +19 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/crypto.d.ts +4523 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/dgram.d.ts +596 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/dns/promises.d.ts +476 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/dns.d.ts +864 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/dom-events.d.ts +124 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/domain.d.ts +170 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/events.d.ts +931 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/fs/promises.d.ts +1245 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/fs.d.ts +4317 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/globals.d.ts +412 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/globals.global.d.ts +1 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/http.d.ts +1908 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/http2.d.ts +2418 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/https.d.ts +550 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/index.d.ts +89 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/inspector.d.ts +2746 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/module.d.ts +315 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/net.d.ts +999 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/os.d.ts +495 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/package.json +217 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/path.d.ts +191 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/perf_hooks.d.ts +905 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/process.d.ts +1754 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/punycode.d.ts +117 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/querystring.d.ts +153 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/readline.d.ts +540 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/repl.d.ts +430 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/sea.d.ts +153 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/stream/web.d.ts +367 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/stream.d.ts +1707 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/test.d.ts +1718 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/timers/promises.d.ts +97 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/timers.d.ts +240 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/tls.d.ts +1217 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/trace_events.d.ts +197 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/tty.d.ts +208 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/url.d.ts +952 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/util.d.ts +2292 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/v8.d.ts +808 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/vm.d.ts +924 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/wasi.d.ts +181 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/worker_threads.d.ts +694 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/zlib.d.ts +530 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/LICENSE +21 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/README.md +15 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/index.d.ts +127 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/package.json +21 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/LICENSE +201 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/README.md +68 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/index.d.ts +11 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/index.js +51 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/interfaces.d.ts +4 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/interfaces.js +2 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/package.json +58 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/.travis.yml +6 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/LICENSE +22 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/Readme.md +135 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/examples/TOTP-verify.js +33 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/examples/TOTP.js +15 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/index.js +221 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/package.json +22 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/test/mocha.opts +1 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/test/notp.js +217 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/LICENSE.txt +19 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/Makefile +24 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/README.md +15 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/index.js +23 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/lib/thirty-two/index.js +26 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/lib/thirty-two/thirty-two.js +128 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/package.json +15 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/spec/thirty-two_spec.js +63 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/CopyrightNotice.txt +15 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/LICENSE.txt +12 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/README.md +164 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/SECURITY.md +41 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/modules/index.d.ts +37 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/modules/index.js +68 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/modules/package.json +3 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/package.json +47 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.d.ts +453 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.html +1 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.js +374 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.mjs +373 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.html +1 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.js +424 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/README.md +6 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/agent.d.ts +31 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/api.d.ts +43 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/balanced-pool.d.ts +18 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/cache.d.ts +36 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/client.d.ts +97 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/connector.d.ts +34 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/content-type.d.ts +21 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/cookies.d.ts +28 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/dispatcher.d.ts +241 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/errors.d.ts +128 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/fetch.d.ts +209 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/file.d.ts +39 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/filereader.d.ts +54 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/formdata.d.ts +108 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/global-origin.d.ts +7 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/handlers.d.ts +9 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/header.d.ts +4 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/index.d.ts +63 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/interceptors.d.ts +5 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/mock-client.d.ts +25 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/package.json +55 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/patch.d.ts +71 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/pool.d.ts +28 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/proxy-agent.d.ts +30 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/readable.d.ts +61 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/webidl.d.ts +220 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/websocket.d.ts +131 -0
- package/plugins/TwoFactorsAuthPlugin/package-lock.json +69 -0
- package/plugins/TwoFactorsAuthPlugin/package.json +15 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function showSuccesTost(message: string) {
|
|
2
|
+
window.adminforth.alert({ message, variant: 'success' });
|
|
3
|
+
return message;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function showWarningTost(message: string) {
|
|
7
|
+
window.adminforth.alert({ message, variant: 'warning' });
|
|
8
|
+
return message;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function showErrorTost(message: string, timeout?: number) {
|
|
12
|
+
window.adminforth.alert({ message, variant: 'danger', timeout: timeout || 'unlimited'});
|
|
13
|
+
return message;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const useFrontendApi = () => {
|
|
18
|
+
return {
|
|
19
|
+
showSuccesTost,
|
|
20
|
+
showWarningTost,
|
|
21
|
+
showErrorTost
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
export default useFrontendApi;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { FrontendAPIInterface, ConfirmParams, AlertParams, } from '../types/FrontendAPI';
|
|
2
|
+
import type { AdminForthFilterOperators } from '@/types/AdminForthConfig';
|
|
3
|
+
import { useToastStore } from '../stores/toast';
|
|
4
|
+
import { useModalStore } from '../stores/modal';
|
|
5
|
+
import { useCoreStore } from '@/stores/core';
|
|
6
|
+
import { useFiltersStore } from '@/stores/filters';
|
|
7
|
+
import router from '@/router'
|
|
8
|
+
import type { AdminForthResourceColumn } from '@/types/AdminForthConfig';
|
|
9
|
+
|
|
10
|
+
type FilterParams = {
|
|
11
|
+
/**
|
|
12
|
+
* Field of resource to filter
|
|
13
|
+
*/
|
|
14
|
+
field: string;
|
|
15
|
+
/**
|
|
16
|
+
* Operator of filter
|
|
17
|
+
*/
|
|
18
|
+
operator: AdminForthFilterOperators;
|
|
19
|
+
/**
|
|
20
|
+
* Value of filter
|
|
21
|
+
*/
|
|
22
|
+
value: string | number | boolean ;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare global {
|
|
26
|
+
interface Window {
|
|
27
|
+
adminforth: {
|
|
28
|
+
confirm: (params: ConfirmParams) => Promise<void>;
|
|
29
|
+
alert: (params: AlertParams) => void;
|
|
30
|
+
setListFilter: (filter: any) => void;
|
|
31
|
+
updateListFilter: (filter: any) => void;
|
|
32
|
+
clearListFilters: () => void;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class FrontendAPI implements FrontendAPIInterface {
|
|
38
|
+
private toastStore:any
|
|
39
|
+
private modalStore:any
|
|
40
|
+
private filtersStore:any
|
|
41
|
+
private coreStore:any
|
|
42
|
+
init() {
|
|
43
|
+
if (window.adminforth) {
|
|
44
|
+
throw new Error('adminforth already initialized');
|
|
45
|
+
}
|
|
46
|
+
this.toastStore = useToastStore();
|
|
47
|
+
this.modalStore = useModalStore();
|
|
48
|
+
console.log(this.toastStore, this.modalStore,'init of adminforth frontend api')
|
|
49
|
+
window.adminforth = {
|
|
50
|
+
confirm: this.confirm.bind(this),
|
|
51
|
+
alert: this.alert.bind(this),
|
|
52
|
+
setListFilter: this.setListFilter.bind(this),
|
|
53
|
+
updateListFilter: this.updateListFilter.bind(this),
|
|
54
|
+
clearListFilters: this.clearListFilters.bind(this),
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
confirm(params: ConfirmParams): Promise<void> {
|
|
59
|
+
return new Promise((resolve, reject) => {
|
|
60
|
+
this.modalStore.setModalContent({ content: params.message, acceptText: params.yes, cancelText: params.no })
|
|
61
|
+
this.modalStore.onAcceptFunction = resolve
|
|
62
|
+
this.modalStore.onCancelFunction = reject
|
|
63
|
+
this.modalStore.togleModal()
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
alert(params: AlertParams): void {
|
|
68
|
+
this.toastStore.addToast({
|
|
69
|
+
message: params.message,
|
|
70
|
+
variant: params.variant,
|
|
71
|
+
timeout: params.timeout
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
listFilterValidation(filter: FilterParams): boolean {
|
|
76
|
+
if(router.currentRoute.value.meta.type !== 'list'){
|
|
77
|
+
throw new Error(`Cannot use ${this.setListFilter.name} filter on a list page`)
|
|
78
|
+
} else {
|
|
79
|
+
if(!this.coreStore) this.coreStore = useCoreStore()
|
|
80
|
+
console.log(this.coreStore.resourceColumnsWithFilters,'core store')
|
|
81
|
+
const filterField = this.coreStore.resourceColumnsWithFilters.find((col: AdminForthResourceColumn) => col.name === filter.field)
|
|
82
|
+
if(!filterField){
|
|
83
|
+
throw new Error(`Field ${filter.field} is not available for filtering`)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
return true
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
setListFilter(filter: FilterParams): void {
|
|
91
|
+
if(this.listFilterValidation(filter)){
|
|
92
|
+
this.filtersStore = useFiltersStore()
|
|
93
|
+
if(this.filtersStore.filters.some((f) => {return f.field === filter.field && f.operator === filter.operator})){
|
|
94
|
+
throw new Error(`Filter ${filter.field} with operator ${filter.operator} already exists`)
|
|
95
|
+
} else {
|
|
96
|
+
this.filtersStore.setFilter(filter)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
clearListFilters(): void {
|
|
102
|
+
this.filtersStore = useFiltersStore()
|
|
103
|
+
this.filtersStore.clearFilters()
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
updateListFilter(filter: FilterParams): void {
|
|
107
|
+
if(this.listFilterValidation(filter)){
|
|
108
|
+
this.filtersStore = useFiltersStore()
|
|
109
|
+
const index = this.filtersStore.filters.findIndex((f: FilterParams) => f.field === filter.field)
|
|
110
|
+
if(index === -1) {
|
|
111
|
+
this.filtersStore.setFilter(filter)
|
|
112
|
+
} else {
|
|
113
|
+
const filters = [...this.filtersStore.filters];
|
|
114
|
+
if (filter.value === undefined) {
|
|
115
|
+
filters.splice(index, 1);
|
|
116
|
+
} else {
|
|
117
|
+
filters[index] = filter;
|
|
118
|
+
}
|
|
119
|
+
this.filtersStore.setFilters(filters);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
@tailwind base;
|
|
2
|
+
@tailwind components;
|
|
3
|
+
@tailwind utilities;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// @layer base {
|
|
7
|
+
// /* width */
|
|
8
|
+
// ::-webkit-scrollbar {
|
|
9
|
+
// @apply w-2 p-2
|
|
10
|
+
// }
|
|
11
|
+
|
|
12
|
+
// /* Track */
|
|
13
|
+
// ::-webkit-scrollbar-track {
|
|
14
|
+
// @apply bg-inherit
|
|
15
|
+
// }
|
|
16
|
+
|
|
17
|
+
// /* Handle */
|
|
18
|
+
// ::-webkit-scrollbar-thumb {
|
|
19
|
+
// @apply bg-gray-200 dark:bg-gray-600 rounded-xl
|
|
20
|
+
// }
|
|
21
|
+
|
|
22
|
+
// /* Handle on hover */
|
|
23
|
+
// ::-webkit-scrollbar-thumb:hover {
|
|
24
|
+
// @apply bg-gray-700
|
|
25
|
+
// }
|
|
26
|
+
// }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createApp } from 'vue'
|
|
2
|
+
import { createPinia } from 'pinia'
|
|
3
|
+
/* IMPORTANT:ADMINFORTH IMPORTS */
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
import App from './App.vue'
|
|
7
|
+
import router from './router'
|
|
8
|
+
|
|
9
|
+
export const app = createApp(App)
|
|
10
|
+
/* IMPORTANT:ADMINFORTH COMPONENT REGISTRATIONS */
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
app.use(createPinia())
|
|
14
|
+
app.use(router)
|
|
15
|
+
|
|
16
|
+
/* IMPORTANT:ADMINFORTH CUSTOM USES */
|
|
17
|
+
|
|
18
|
+
app.mount('#app')
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createRouter, createWebHistory } from 'vue-router'
|
|
2
|
+
import ResourceParent from '@/views/ResourceParent.vue'
|
|
3
|
+
import { useUserStore } from '@/stores/user'
|
|
4
|
+
/* IMPORTANT:ADMINFORTH ROUTES IMPORTS */
|
|
5
|
+
|
|
6
|
+
const router = createRouter({
|
|
7
|
+
history: createWebHistory(import.meta.env.BASE_URL),
|
|
8
|
+
routes: [
|
|
9
|
+
{
|
|
10
|
+
path: '/login',
|
|
11
|
+
name: 'login',
|
|
12
|
+
component: () => import('@/views/LoginView.vue'),
|
|
13
|
+
meta: { title: 'login' },
|
|
14
|
+
beforeEnter: async (to, from, next) => {
|
|
15
|
+
if(localStorage.getItem('isAuthorized') === 'true'){
|
|
16
|
+
next({name: 'home'})
|
|
17
|
+
} else {
|
|
18
|
+
next()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
path: '/resource/:resourceId',
|
|
24
|
+
component: ResourceParent,
|
|
25
|
+
name: 'resource',
|
|
26
|
+
children: [
|
|
27
|
+
{
|
|
28
|
+
path: '',
|
|
29
|
+
component: () => import('@/views/ListView.vue'),
|
|
30
|
+
name: 'resource-list',
|
|
31
|
+
meta: { title: 'list',type: 'list' }
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
path: 'show/:primaryKey',
|
|
35
|
+
component: () => import('@/views/ShowView.vue'),
|
|
36
|
+
name: 'resource-show',
|
|
37
|
+
meta: { title: 'show', type: 'show'}
|
|
38
|
+
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
path: 'edit/:primaryKey',
|
|
42
|
+
component: () => import('@/views/EditView.vue'),
|
|
43
|
+
name: 'resource-edit',
|
|
44
|
+
meta: { title: 'edit', type: 'edit'}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
path: 'create',
|
|
48
|
+
component: () => import('@/views/CreateView.vue'),
|
|
49
|
+
name: 'resource-create',
|
|
50
|
+
meta: { title: 'create', type: 'create'}
|
|
51
|
+
|
|
52
|
+
},
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
/* IMPORTANT:ADMINFORTH ROUTES */
|
|
56
|
+
]
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
export default router
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AdminForthResource, AdminForthResourceColumn } from '../types/AdminForthConfig';
|
|
2
|
+
|
|
3
|
+
export type resourceById = {
|
|
4
|
+
[key: string]: AdminForthResource;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type Menu = {
|
|
8
|
+
label: string,
|
|
9
|
+
icon: string,
|
|
10
|
+
resourceId: string,
|
|
11
|
+
children?: Array<Menu>,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type Record = {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type ResourceColumns = {
|
|
19
|
+
[key: string]: Array<AdminForthResourceColumn>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type CoreConfig = {
|
|
23
|
+
brandName: string,
|
|
24
|
+
brandLogo: string,
|
|
25
|
+
title: string,
|
|
26
|
+
datesFormat: string,
|
|
27
|
+
usernameField: string,
|
|
28
|
+
usernameFieldName?: string,
|
|
29
|
+
deleteConfirmation?: boolean,
|
|
30
|
+
auth?: {
|
|
31
|
+
resourceId: string,
|
|
32
|
+
usernameField: string,
|
|
33
|
+
passwordHashField: string,
|
|
34
|
+
loginBackgroundImage: string,
|
|
35
|
+
userFullnameField: string,
|
|
36
|
+
},
|
|
37
|
+
emptyFieldPlaceholder?: {
|
|
38
|
+
show: string,
|
|
39
|
+
list: string,
|
|
40
|
+
|
|
41
|
+
} | string,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
export type AllowedActions = {
|
|
46
|
+
show: boolean,
|
|
47
|
+
create: boolean,
|
|
48
|
+
edit: boolean,
|
|
49
|
+
delete: boolean,
|
|
50
|
+
}
|
|
51
|
+
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { ref, computed } from 'vue'
|
|
2
|
+
import { defineStore } from 'pinia'
|
|
3
|
+
import { callAdminForthApi } from '@/utils';
|
|
4
|
+
import type { AdminForthResource, AdminForthResourceColumn } from '@/types/AdminForthConfig';
|
|
5
|
+
import type { Ref } from 'vue'
|
|
6
|
+
|
|
7
|
+
export const useCoreStore = defineStore('core', () => {
|
|
8
|
+
const resourceById: Ref<Object> = ref({});
|
|
9
|
+
const menu = ref([]);
|
|
10
|
+
const config = ref({});
|
|
11
|
+
const record: Ref<any | null> = ref({});
|
|
12
|
+
const resource: Ref<AdminForthResource | null> = ref(null);
|
|
13
|
+
|
|
14
|
+
const resourceColumnsWithFilters = computed(() => {
|
|
15
|
+
if (!resource.value) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
return resource.value.columns.filter((col: AdminForthResourceColumn) => col.showIn?.includes('filter'));
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const resourceOptions = ref(null);
|
|
22
|
+
const resourceColumnsError = ref('');
|
|
23
|
+
const resourceColumnsId = ref(null);
|
|
24
|
+
const adminUser = ref(null);
|
|
25
|
+
|
|
26
|
+
async function fetchMenuAndResource() {
|
|
27
|
+
const resp = await callAdminForthApi({
|
|
28
|
+
path: '/get_base_config',
|
|
29
|
+
method: 'GET',
|
|
30
|
+
});
|
|
31
|
+
if(!resp){
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
menu.value = resp.menu;
|
|
35
|
+
resourceById.value = resp.resources.reduce((acc: Object, resource: AdminForthResource) => {
|
|
36
|
+
acc[resource.resourceId] = resource;
|
|
37
|
+
return acc;
|
|
38
|
+
}, {});
|
|
39
|
+
config.value = resp.config;
|
|
40
|
+
adminUser.value = resp.user;
|
|
41
|
+
console.log('🌍 AdminForth v', resp.version);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function fetchRecord({ resourceId, primaryKey }) {
|
|
45
|
+
record.value = null;
|
|
46
|
+
|
|
47
|
+
if (!resource.value) {
|
|
48
|
+
throw new Error('Columns not fetched yet');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const respData = await callAdminForthApi({
|
|
52
|
+
path: '/get_resource_data',
|
|
53
|
+
method: 'POST',
|
|
54
|
+
body: {
|
|
55
|
+
source: 'show',
|
|
56
|
+
resourceId: resourceId,
|
|
57
|
+
filters: [
|
|
58
|
+
{
|
|
59
|
+
field: resource.value.columns.find((col: AdminForthResourceColumn) => col.primaryKey).name,
|
|
60
|
+
operator: 'eq',
|
|
61
|
+
value: primaryKey
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
sort: [],
|
|
65
|
+
limit: 1,
|
|
66
|
+
offset: 0
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
if (respData.error) {
|
|
71
|
+
window.adminforth.alert({
|
|
72
|
+
message: respData.error,
|
|
73
|
+
variant: 'danger',
|
|
74
|
+
timeout: 'unlimited'
|
|
75
|
+
});
|
|
76
|
+
record.value = {};
|
|
77
|
+
} else {
|
|
78
|
+
record.value = respData.data[0];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function fetchResourceFull({ resourceId }: { resourceId: string }) {
|
|
84
|
+
if (resourceColumnsId.value === resourceId && resource.value) {
|
|
85
|
+
// already fetched
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
resourceColumnsId.value = resourceId;
|
|
89
|
+
resourceColumnsError.value = '';
|
|
90
|
+
const res = await callAdminForthApi({
|
|
91
|
+
path: '/get_resource',
|
|
92
|
+
method: 'POST',
|
|
93
|
+
body: {
|
|
94
|
+
resourceId,
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
if (res.error) {
|
|
98
|
+
resourceColumnsError.value = res.error;
|
|
99
|
+
} else {
|
|
100
|
+
resourceById.value[resourceId] = res.resource;
|
|
101
|
+
resource.value = res.resource;
|
|
102
|
+
resourceOptions.value = res.resource.options;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async function getPublicConfig() {
|
|
107
|
+
const res = await callAdminForthApi({
|
|
108
|
+
path: '/get_public_config',
|
|
109
|
+
method: 'GET',
|
|
110
|
+
});
|
|
111
|
+
config.value = {...config.value, ...res};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
const username = computed(() => {
|
|
117
|
+
const usernameField = config.value.usernameField;
|
|
118
|
+
return adminUser.value && adminUser.value[usernameField];
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const userFullname = computed(() => {
|
|
122
|
+
const userFullnameField = config.value.userFullnameField;
|
|
123
|
+
return adminUser.value && adminUser.value[userFullnameField];
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
config,
|
|
129
|
+
resourceById,
|
|
130
|
+
menu,
|
|
131
|
+
username,
|
|
132
|
+
userFullname,
|
|
133
|
+
getPublicConfig,
|
|
134
|
+
fetchMenuAndResource,
|
|
135
|
+
fetchRecord,
|
|
136
|
+
record,
|
|
137
|
+
fetchResourceFull,
|
|
138
|
+
resourceColumnsError,
|
|
139
|
+
resourceOptions,
|
|
140
|
+
resource,
|
|
141
|
+
adminUser,
|
|
142
|
+
resourceColumnsWithFilters
|
|
143
|
+
}
|
|
144
|
+
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ref } from 'vue'
|
|
2
|
+
import { defineStore } from 'pinia'
|
|
3
|
+
import { callAdminForthApi } from '@/utils';
|
|
4
|
+
|
|
5
|
+
export const useFiltersStore = defineStore('filters', () => {
|
|
6
|
+
const filters = ref([]);
|
|
7
|
+
const setFilter = (filter: any) => {
|
|
8
|
+
filters.value = [...filters.value, filter];
|
|
9
|
+
}
|
|
10
|
+
const setFilters = (f: any) => {
|
|
11
|
+
filters.value = [...f];
|
|
12
|
+
}
|
|
13
|
+
const getFilters = () => {
|
|
14
|
+
return filters.value;
|
|
15
|
+
}
|
|
16
|
+
const clearFilters = () => {
|
|
17
|
+
filters.value = [];
|
|
18
|
+
}
|
|
19
|
+
return {setFilter, getFilters,clearFilters, filters,setFilters}
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ref } from 'vue'
|
|
2
|
+
import { defineStore } from 'pinia'
|
|
3
|
+
|
|
4
|
+
type ModalContentType = {
|
|
5
|
+
title?: string;
|
|
6
|
+
content?: string;
|
|
7
|
+
acceptText?: string;
|
|
8
|
+
cancelText?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export const useModalStore = defineStore('modal', () => {
|
|
13
|
+
const modalContent = ref({
|
|
14
|
+
title: 'title',
|
|
15
|
+
content: 'content',
|
|
16
|
+
acceptText: 'acceptText',
|
|
17
|
+
cancelText: 'cancelText',
|
|
18
|
+
});
|
|
19
|
+
const isOpened = ref(false);
|
|
20
|
+
const onAcceptFunction: any = ref(()=>{});
|
|
21
|
+
const onCancelFunction: any = ref(()=>{});
|
|
22
|
+
function togleModal() {
|
|
23
|
+
isOpened.value = !isOpened.value;
|
|
24
|
+
}
|
|
25
|
+
function setOnAcceptFunction(func: Function) {
|
|
26
|
+
onAcceptFunction.value = func;
|
|
27
|
+
}
|
|
28
|
+
function setOnCancelFunction(func: Function) {
|
|
29
|
+
onCancelFunction.value = func;
|
|
30
|
+
}
|
|
31
|
+
function setModalContent(content: ModalContentType) {
|
|
32
|
+
modalContent.value = content;
|
|
33
|
+
}
|
|
34
|
+
function resetmodalState() {
|
|
35
|
+
isOpened.value = false;
|
|
36
|
+
modalContent.value = {
|
|
37
|
+
title: 'title',
|
|
38
|
+
content: 'content',
|
|
39
|
+
acceptText: 'acceptText',
|
|
40
|
+
cancelText: 'cancelText',
|
|
41
|
+
};
|
|
42
|
+
setOnAcceptFunction(()=>{});
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {isOpened, setModalContent,onCancelFunction, togleModal,modalContent, setOnAcceptFunction, onAcceptFunction,resetmodalState,setOnCancelFunction}
|
|
47
|
+
|
|
48
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ref, computed } from 'vue'
|
|
2
|
+
import { defineStore } from 'pinia'
|
|
3
|
+
import { callAdminForthApi } from '@/utils';
|
|
4
|
+
import { v1 as uuid } from 'uuid';
|
|
5
|
+
|
|
6
|
+
export const useToastStore = defineStore('toast', () => {
|
|
7
|
+
const toasts = ref([]);
|
|
8
|
+
const addToast = (toast) => {
|
|
9
|
+
toasts.value.push({...toast, id: uuid()});
|
|
10
|
+
};
|
|
11
|
+
const removeToast = (toast) => {
|
|
12
|
+
toasts.value = toasts.value.filter((t) => t.id !== toast.id);
|
|
13
|
+
};
|
|
14
|
+
return { toasts, addToast, removeToast };
|
|
15
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {ref} from 'vue';
|
|
2
|
+
import {defineStore} from 'pinia';
|
|
3
|
+
import { callAdminForthApi } from '@/utils';
|
|
4
|
+
|
|
5
|
+
export const useUserStore = defineStore('user', () => {
|
|
6
|
+
const isAuthorized = ref(false);
|
|
7
|
+
|
|
8
|
+
function authorize() {
|
|
9
|
+
isAuthorized.value = true;
|
|
10
|
+
localStorage.setItem('isAuthorized', 'true');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function unauthorize() {
|
|
14
|
+
isAuthorized.value = false;
|
|
15
|
+
localStorage.setItem('isAuthorized', 'false');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async function logout() {
|
|
19
|
+
await callAdminForthApi({
|
|
20
|
+
path: '/logout',
|
|
21
|
+
method: 'POST',
|
|
22
|
+
});
|
|
23
|
+
unauthorize();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// async function checkAuth( skipApiCall = false){
|
|
27
|
+
// console.log('checkAuth', isAuthorized.value, skipApiCall)
|
|
28
|
+
// if(isAuthorized.value) {
|
|
29
|
+
// return true}
|
|
30
|
+
// else {
|
|
31
|
+
// if(skipApiCall) return false;
|
|
32
|
+
// const resp = await callAdminForthApi({
|
|
33
|
+
// path: '/check_auth',
|
|
34
|
+
// method: 'POST',
|
|
35
|
+
// });
|
|
36
|
+
// if (resp.status !== 401) {
|
|
37
|
+
// authorize();
|
|
38
|
+
// return true;
|
|
39
|
+
// }
|
|
40
|
+
// else {
|
|
41
|
+
// unauthorize();
|
|
42
|
+
// return false;}
|
|
43
|
+
// }
|
|
44
|
+
|
|
45
|
+
// }
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
isAuthorized,
|
|
49
|
+
authorize,
|
|
50
|
+
unauthorize,
|
|
51
|
+
logout
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
});
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { onMounted, ref, resolveComponent } from 'vue';
|
|
2
|
+
import type { CoreConfig } from './spa_types/core';
|
|
3
|
+
|
|
4
|
+
import router from "./router";
|
|
5
|
+
import { useRouter } from 'vue-router';
|
|
6
|
+
import { useCoreStore } from './stores/core';
|
|
7
|
+
import { useUserStore } from './stores/user';
|
|
8
|
+
|
|
9
|
+
export async function callApi({path, method, body=undefined} ) {
|
|
10
|
+
const options = {
|
|
11
|
+
method,
|
|
12
|
+
headers: {
|
|
13
|
+
'Content-Type': 'application/json',
|
|
14
|
+
},
|
|
15
|
+
body: JSON.stringify(body),
|
|
16
|
+
};
|
|
17
|
+
const fullPath = `${import.meta.env.VITE_ADMINFORTH_PUBLIC_PATH || ''}${path}`;
|
|
18
|
+
const r = await fetch(fullPath, options);
|
|
19
|
+
if (r.status == 401 ) {
|
|
20
|
+
useUserStore().unauthorize();
|
|
21
|
+
router.push({ name: 'login' });
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return await r.json();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function callAdminForthApi({ path, method, body=undefined }: {
|
|
28
|
+
path: string,
|
|
29
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE',
|
|
30
|
+
body?: any
|
|
31
|
+
}) {
|
|
32
|
+
try {
|
|
33
|
+
return callApi({path: `/adminapi/v1${path}`, method, body} );
|
|
34
|
+
} catch (e) {
|
|
35
|
+
console.error('error', e);
|
|
36
|
+
return { error: `Unexpected error: ${e}` };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function getCustomComponent({ file, meta }: { file: string, meta: any }) {
|
|
41
|
+
const name = file.replace(/@/g, '').replace(/\./g, '').replace(/\//g, '');
|
|
42
|
+
console.log('resolving name', name);
|
|
43
|
+
return resolveComponent(name);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function getIcon(icon: string) {
|
|
47
|
+
// icon format is "feather:icon-name". We need to get IconName in pascal case
|
|
48
|
+
if (!icon.includes(':')) {
|
|
49
|
+
throw new Error('Icon name should be in format "icon-set:icon-name"');
|
|
50
|
+
}
|
|
51
|
+
const [iconSet, iconName] = icon.split(':');
|
|
52
|
+
const compName = 'Icon' + iconName.split('-').map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
53
|
+
return resolveComponent(compName);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const loadFile = (file: string) => {
|
|
57
|
+
if (file.startsWith('http')) {
|
|
58
|
+
return file;
|
|
59
|
+
}
|
|
60
|
+
let path;
|
|
61
|
+
let baseUrl = '';
|
|
62
|
+
if (file.startsWith('@/')) {
|
|
63
|
+
path = file.replace('@/', '');
|
|
64
|
+
baseUrl = new URL(`./${path}`, import.meta.url).href;
|
|
65
|
+
} else if (file.startsWith('@@/')) {
|
|
66
|
+
path = file.replace('@@/', '');
|
|
67
|
+
baseUrl = new URL(`./custom/${path}`, import.meta.url).href;
|
|
68
|
+
} else {
|
|
69
|
+
baseUrl = new URL(`./${file}`, import.meta.url).href;
|
|
70
|
+
}
|
|
71
|
+
return baseUrl;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function checkEmptyValues(value: any, viewType:'show' | 'list' ) {
|
|
75
|
+
const config: CoreConfig | {} = useCoreStore().config;
|
|
76
|
+
let emptyFieldPlaceholder = '';
|
|
77
|
+
if (config.emptyFieldPlaceholder) {
|
|
78
|
+
if(typeof config.emptyFieldPlaceholder === 'string') {
|
|
79
|
+
emptyFieldPlaceholder = config.emptyFieldPlaceholder;
|
|
80
|
+
} else {
|
|
81
|
+
emptyFieldPlaceholder = config.emptyFieldPlaceholder?.[viewType] || '';
|
|
82
|
+
}
|
|
83
|
+
if (value === null || value === undefined || value === '') {
|
|
84
|
+
return emptyFieldPlaceholder;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function checkAcessByAllowedActions(allowedActions:any, action:any ) {
|
|
91
|
+
if (!allowedActions) {
|
|
92
|
+
console.warn('allowedActions not set');
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if(allowedActions[action] === false) {
|
|
96
|
+
console.warn(`Action ${action} is not allowed`);
|
|
97
|
+
router.back();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
|