Skip to content

Commit 9f42b87

Browse files
author
yaroslav8765
committed
fix: update environment variables import in index.ts.hbs
1 parent 5286288 commit 9f42b87

File tree

10 files changed

+318
-18
lines changed

10 files changed

+318
-18
lines changed

adminforth/commands/createApp/templates/index.ts.hbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import usersResource from "./resources/adminuser.js";
44
import { fileURLToPath } from 'url';
55
import path from 'path';
66
import dotenv from "dotenv";
7-
dotenv.config({ path: '.env.local' });
7+
dotenv.config({ path: '.env.local', override: true });
8+
dotenv.config({ path: '.env', override: true });
89

910
const ADMIN_BASE_URL = '';
1011

dev-demo/.env.sample

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
AWS_ACCESS_KEY_ID=
22
AWS_SECRET_ACCESS_KEY=
3-
ADMINFORTH_SECRET=123
4-
NODE_ENV=development
53
OPENAI_API_KEY=1
64
HEAVY_DEBUG=
75
HEAVY_DEBUG_QUERY=
8-
PORT=3000
9-
10-
DATABASE_FILE=./db.sqlite
11-
DATABASE_FILE_URL=file:${DATABASE_FILE}

dev-demo/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
22
*.sqlite
3+
*.sqlite-journal
34
.env
45
db

dev-demo/custom/GroupTable.vue

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<template>
2+
<div class="p-4 space-y-4">
3+
<h2 class="text-xl font-bold">🧪 JsonCell Test Table</h2>
4+
5+
6+
7+
8+
9+
<JsonViewer
10+
:value="[
11+
{
12+
id: 1,
13+
name: 'Alice',
14+
meta: {
15+
age: 30,
16+
hobbies: ['reading', 'biking'],
17+
location: { city: 'Kyiv', country: 'Ukraine' }
18+
}
19+
},
20+
{
21+
id: 2,
22+
name: 'Bob',
23+
meta: {
24+
age: 25,
25+
active: true,
26+
scores: { math: 92, english: 88 }
27+
}
28+
}
29+
]"
30+
:expandDepth="4"
31+
/>
32+
33+
34+
35+
36+
37+
38+
39+
<h3 class="text-lg font-semibold">Table with Pagination</h3>
40+
<p class="text-gray-600">This table demonstrates pagination with a custom page size.</p>
41+
42+
</div>
43+
44+
45+
46+
47+
48+
49+
50+
51+
52+
53+
<Table
54+
:columns="[
55+
{ label: 'Name', fieldName: 'name' },
56+
{ label: 'Age', fieldName: 'age' },
57+
{ label: 'Country', fieldName: 'country' },
58+
]"
59+
:data="[
60+
{ name: 'John', age: 30, country: 'US' },
61+
{ name: 'Rick', age: 25, country: 'CA' },
62+
{ name: 'Alice', age: 35, country: 'UK' },
63+
{ name: 'Colin', age: 40, country: 'AU' },
64+
]"
65+
:pageSize="2"
66+
></Table>
67+
68+
</template>
69+
70+
<script setup lang="ts">
71+
import { JsonViewer } from '@/afcl'
72+
import { Table } from '@/afcl'
73+
74+
75+
// Фейковые данные
76+
const rows = [
77+
{
78+
id: 1,
79+
name: 'Alice',
80+
meta: {
81+
age: 30,
82+
hobbies: ['reading', 'biking'],
83+
location: { city: 'Kyiv', country: 'Ukraine' }
84+
}
85+
},
86+
{
87+
id: 2,
88+
name: 'Bob',
89+
meta: {
90+
age: 25,
91+
active: true,
92+
scores: { math: 92, english: 88 }
93+
}
94+
}
95+
]
96+
</script>

dev-demo/index.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import usersResource from './resources/users.js';
1111
// import gameResource from './resources/game.js';
1212
// import gamesUsersResource from './resources/games_users.js';
1313
// import gamesResource from './resources/games.js';
14+
// import groupTableResource from './resources/';
1415
import translationsResource from './resources/translation.js';
1516
import clinicsResource from './resources/clinics.js';
1617
import providersResource from './resources/providers.js';
@@ -78,7 +79,16 @@ export const admin = new AdminForth({
7879
loginBackgroundImage: 'https://images.unsplash.com/photo-1534239697798-120952b76f2b?q=80&w=3389&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
7980
loginBackgroundPosition: '1/2', // over, 3/4, 2/5, 3/5 (tailwind grid)
8081
demoCredentials: "adminforth:adminforth", // never use it for production
81-
loginPromptHTML: "Use email <b>adminforth</b> and password <b>adminforth</b> to login",
82+
loginPromptHTML: async () => { return "Nya"},
83+
// loginPromptHTML:"Nya without function",
84+
// async () =>{
85+
// const adminForthUserExists = await admin.resource('users').count() > 0;
86+
// if (adminForthUserExists) {
87+
// return `<p>Welcome to <b>AdminForth</b> demo!</p>`
88+
// } else {
89+
// return `<p>Welcome to <b>AdminForth</b> demo!</p>`
90+
// }
91+
// },
8292
// loginBackgroundImage: '@@/pho.jpg',
8393
rememberMeDays: 30,
8494
beforeLoginConfirmation: [async ({adminUser, adminforth, extra}) => {
@@ -190,7 +200,7 @@ export const admin = new AdminForth({
190200
dataSources: [
191201
{
192202
id: 'maindb',
193-
url: process.env.DATABASE_URL,
203+
url: process.env.DATABASE_URL as string,
194204
},
195205
{
196206
id: 'pg',
@@ -202,7 +212,7 @@ export const admin = new AdminForth({
202212
},
203213
{
204214
id: 'ch',
205-
url: 'clickhouse://demo:demo@localhost:8125/demo',
215+
url: 'clickhouse://demo:demo@localhost:8124/demo',
206216
},
207217
{
208218
id: 'mysql',
@@ -225,10 +235,17 @@ export const admin = new AdminForth({
225235
translationsResource,
226236
],
227237
menu: [
238+
{
239+
label: 'TablesGroup',
240+
path: '/overview',
241+
homepage: true,
242+
icon: 'flowbite:chart-pie-solid',
243+
component: '@@/GroupTable.vue',
244+
},
228245
{
229246
label: 'Dashboard',
230247
icon: 'flowbite:chart-pie-solid',
231-
component: '@@/Dash.vue',
248+
component: '@@/GroupTable.vue',
232249
path: '/dashboard',
233250
// homepage: true,
234251
isStaticRoute:false,
@@ -336,7 +353,7 @@ export const admin = new AdminForth({
336353

337354
const app = express()
338355
app.use(express.json());
339-
const port = process.env.PORT || 3000;
356+
const port = process.env.PORT || 3001;
340357

341358
(async () => {
342359
console.log('🅿️ Bundling AdminForth...');

0 commit comments

Comments
 (0)