Skip to content

Commit 5f91f41

Browse files
committed
Revert "fix: install vite 7 and resolve conflicts with new version"
This reverts commit 122606c.
1 parent 0d09071 commit 5f91f41

File tree

8 files changed

+164
-348
lines changed

8 files changed

+164
-348
lines changed

adminforth/spa/package-lock.json

Lines changed: 140 additions & 298 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

adminforth/spa/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"@rushstack/eslint-patch": "^1.14.1",
3737
"@tsconfig/node20": "^20.1.6",
3838
"@types/node": "^20.19.24",
39-
"@vitejs/plugin-vue": "^6.0.2",
39+
"@vitejs/plugin-vue": "^5.2.4",
4040
"@vue/eslint-config-typescript": "^13.0.0",
4141
"@vue/tsconfig": "^0.8.1",
4242
"autoprefixer": "^10.4.21",
@@ -51,7 +51,7 @@
5151
"sass": "^1.93.3",
5252
"tailwindcss": "^3.4.18",
5353
"typescript": "~5.9.3",
54-
"vite": "^7.2.4",
54+
"vite": "^5.4.21",
5555
"vue-i18n-extract": "^2.0.7",
5656
"vue-tsc": "^2.2.12",
5757
"vue3-json-viewer": "^2.4.1"

adminforth/spa/src/components/Sidebar.vue

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,13 @@
2222
}"
2323
>
2424
<img
25-
:src="imgUrl"
25+
:src="loadFile(coreStore.config?.brandLogo || '@/assets/logo.svg')"
2626
:alt="`${ coreStore.config?.brandName } Logo`"
2727
class="af-logo h-8 me-3"
2828
:class="{
29-
'hidden': !(coreStore.config?.showBrandLogoInSidebar !== false && (!iconOnlySidebarEnabled || !isSidebarIconOnly || (isSidebarIconOnly && isSidebarHovering)))
30-
}"
31-
/>
32-
<img
33-
:src="iconOnlySidebar"
34-
:alt="`${ coreStore.config?.brandName } Logo`"
35-
class="af-sidebar-icon-only-logo h-8"
36-
:class="{
37-
'hidden': !(coreStore.config?.showBrandLogoInSidebar !== false && coreStore.config?.iconOnlySidebar?.logo && iconOnlySidebarEnabled && isSidebarIconOnly && !isSidebarHovering)
38-
}"
29+
'hidden': !(coreStore.config?.showBrandLogoInSidebar !== false && (!iconOnlySidebarEnabled || !isSidebarIconOnly || (isSidebarIconOnly && isSidebarHovering))) }"
3930
/>
31+
<img :src="loadFile(coreStore.config?.iconOnlySidebar?.logo || '')" :alt="`${ coreStore.config?.brandName } Logo`" class="af-sidebar-icon-only-logo h-8" :class="{ 'hidden': !(coreStore.config?.showBrandLogoInSidebar !== false && coreStore.config?.iconOnlySidebar?.logo && iconOnlySidebarEnabled && isSidebarIconOnly && !isSidebarHovering) }" />
4032
<span
4133
v-if="coreStore.config?.showBrandNameInSidebar && (!iconOnlySidebarEnabled || !isSidebarIconOnly || (isSidebarIconOnly && isSidebarHovering))"
4234
class="af-title self-center text-lightNavbarText-size font-semibold sm:text-lightNavbarText-size whitespace-nowrap dark:text-darkSidebarText text-lightSidebarText"
@@ -328,14 +320,6 @@ const coreStore = useCoreStore();
328320
const opened = ref<(string|number)[]>([]);
329321
const sidebarAside = ref(null);
330322
331-
const imgUrl = ref<string>('');
332-
const iconOnlySidebar = ref<string>('');
333-
334-
onMounted(async () => {
335-
imgUrl.value = await loadFile(coreStore.config?.brandLogo || '@/assets/logo.svg') as string;
336-
iconOnlySidebar.value = await loadFile(coreStore.config?.iconOnlySidebar?.logo || '') as string;
337-
});
338-
339323
const smQuery = window.matchMedia('(min-width: 640px)');
340324
const isMobile = ref(!smQuery.matches);
341325
const iconOnlySidebarEnabled = computed(() => props.forceIconOnly === true || coreStore.config?.iconOnlySidebar?.enabled !== false);

adminforth/spa/src/utils.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,28 +82,27 @@ export function getIcon(icon: string) {
8282
return resolveComponent(compName);
8383
}
8484

85-
export const loadFile = async (file: string) => {
85+
export const loadFile = (file: string) => {
8686
if (file.startsWith('http')) {
8787
return file;
8888
}
89+
console.log('file', file);
8990
let path;
9091
let baseUrl = '';
91-
const files = import.meta.glob('/**/*', { import: 'default' });
92-
9392
if (file.startsWith('@/')) {
94-
path = file.replace('@/', '/src/');
93+
path = file.replace('@/', '');
94+
console.log('path', path);
95+
const fileModulePath = `./${path}`;
96+
console.log('imort.meta.url', import.meta.url);
97+
baseUrl = new URL(`./${path}` ,import.meta.url).href;
98+
console.log('baseUrl', baseUrl);
9599
} else if (file.startsWith('@@/')) {
96-
path = file.replace('@@/', '/src/custom/');
97-
} else {
98-
path = `./${file}`;
99-
}
100-
101-
const match = files[path];
102-
if (!match) {
103-
console.error(`File ${file} not found`);
100+
path = file.replace('@@/', '');
101+
const fileModulePath = `./${path}`;
102+
baseUrl = new URL(`./${path}`, new URL(import.meta.url).origin + new URL(import.meta.url).pathname).href;
104103
} else {
105-
const result = await match();
106-
baseUrl = typeof result === 'string' ? result : '';
104+
const fileModulePath = `./${file}`;
105+
baseUrl = new URL(`./${file}`, new URL(import.meta.url).origin + new URL(import.meta.url).pathname).href;
107106
}
108107
return baseUrl;
109108
}

adminforth/spa/src/views/LoginView.vue

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<template>
22
<div class="relative flex items-center justify-center min-h-screen bg-lightHtml dark:bg-darkHtml w-screen h-screen"
33
:style="coreStore.config?.loginBackgroundImage && backgroundPosition === 'over' ? {
4-
'background-image': 'url(' + backgroundImage + ')',
4+
'background-image': 'url(' + loadFile(coreStore.config?.loginBackgroundImage) + ')',
55
'background-size': 'cover',
66
'background-position': 'center',
77
'background-blend-mode': coreStore.config?.removeBackgroundBlendMode ? 'normal' : 'darken'
88
}: {}"
99
>
1010

1111
<img v-if="coreStore.config?.loginBackgroundImage && backgroundPosition !== 'over'"
12-
:src="backgroundImage"
12+
:src="loadFile(coreStore.config?.loginBackgroundImage)"
1313
class="position-absolute top-0 left-0 h-screen object-cover w-0"
1414
:class="{
1515
'1/2': 'md:w-1/2',
@@ -158,7 +158,6 @@ const backgroundPosition = computed(() => {
158158
return coreStore.config?.loginBackgroundPosition || '1/2';
159159
});
160160
161-
const backgroundImage = ref<string>('');
162161
163162
onBeforeMount(() => {
164163
if (localStorage.getItem('isAuthorized') === 'true') {
@@ -174,9 +173,6 @@ onBeforeMount(() => {
174173
175174
onMounted(async () => {
176175
coreStore.getLoginFormConfig();
177-
if (coreStore.config?.loginBackgroundImage) {
178-
backgroundImage.value = await loadFile(coreStore.config?.loginBackgroundImage) as string;
179-
}
180176
if (coreStore.config?.demoCredentials) {
181177
const [demoUsername, demoPassword] = coreStore.config.demoCredentials.split(':');
182178
username.value = demoUsername;

adminforth/spa/vite.config.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,4 @@ export default defineConfig({
9292
},
9393
},
9494
},
95-
optimizeDeps: {
96-
exclude: ['@vitejs/plugin-vue']
97-
}
9895
})

dev-demo/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,7 @@ export const admin = new AdminForth({
131131
customLayout: true,
132132
}}
133133
}],
134-
iconOnlySidebar: {
135-
logo: '@/assets/logo.svg',
136-
},
134+
137135
vueUsesFile: '@@/vueUses.ts', // @@ is alias to custom directory,
138136
brandName: 'New Reality',
139137
showBrandNameInSidebar: true,

dev-demo/resources/users.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ export default {
8282
// // return true;
8383
// return adminUser.dbUser.email !== "adminforth";
8484
// },
85-
usersFilterToAllowSkipSetup: (adminUser: AdminUser) => {
86-
return adminUser.dbUser.email === "adminforth";
87-
},
85+
// usersFilterToAllowSkipSetup: (adminUser: AdminUser) => {
86+
// return adminUser.dbUser.email === "adminforth";
87+
// },
8888
passkeys: {
8989
credentialResourceID: "passkeys",
9090
credentialIdFieldName: "credential_id",

0 commit comments

Comments
 (0)