Skip to content

Commit e13b879

Browse files
authored
Merge pull request #439 from devforth/new-dev-demo
New dev demo
2 parents 088d78e + 1d588d4 commit e13b879

File tree

116 files changed

+3539
-4324
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+3539
-4324
lines changed

README.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,44 +61,50 @@ npx adminforth create-app
6161

6262
The most convenient way to add new features or fixes is using `dev-demo`. It imports the source code of the repository and plugins so you can edit them and see changes on the fly.
6363

64-
Fork repo, pull it and do next:
64+
To run dev demo:
65+
```sh
66+
cd dev-demo
6567

68+
npm run setup-dev-demo
69+
npm run migrate:all
6670

67-
```sh
68-
cd adminforth
69-
npm ci
70-
npm run build
71+
npm start
7172
```
7273

73-
To run dev demo:
74-
```sh
75-
cd dev-demo
76-
cp .env.sample .env
74+
## Adding columns to a database in dev-demo
7775

78-
# this will install all official plugins and link adminforth package, if plugin installed it will git pull and npm ci
79-
npm run install-plugins
76+
Open `./migrations` folder. There is prisma migration folder for the sqlite, postgres and mysql and `clickhouse_migrations` folder for the clickhouse:
8077

81-
# same for official adapters
82-
npm run install-adapters
78+
### Migrations for the MySQL, SQLite and Postgres
79+
To make migration add to the .prisma file in folder with database you need and add new tables or columns. Then run:
8380

84-
npm ci
8581

86-
./run_inventory.sh
82+
```
83+
npm run makemigration:sqlite -- --name init
84+
```
85+
86+
and
8787

88-
npm run migrate:local
89-
npm start
88+
```
89+
npm run migrate:sqlite
9090
```
9191

92-
## Adding columns to a database in dev-demo
92+
to apply migration
93+
94+
> use :sqlite, :mysql or :postgres for you case
95+
96+
### Migrations for the clickhouse
9397

94-
Open `.prisma` file, modify it, and run:
98+
In order to make migration for the clickhouse, go to the `./migrations/clickhouse_migrations` folder and add migration file to the folder.
9599

100+
Then run
96101
```
97-
npm run namemigration -- --name desctiption_of_changes
102+
npm run migrate:clickhouse
98103
```
99104

105+
to apply the migration.
100106

101-
### Testing CLI commands during development
107+
## Testing CLI commands during development
102108

103109

104110
Make sure you have not `adminforth` globally installed. If you have it, remove it:

adminforth/spa/src/views/EditView.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ import SingleSkeletLoader from '@/components/SingleSkeletLoader.vue';
9494
import { useCoreStore } from '@/stores/core';
9595
import { callAdminForthApi, getCustomComponent,checkAcessByAllowedActions, initThreeDotsDropdown } from '@/utils';
9696
import { IconFloppyDiskSolid } from '@iconify-prerendered/vue-flowbite';
97-
import { computed, onMounted, ref, type Ref, nextTick } from 'vue';
97+
import { computed, onMounted, ref, type Ref, nextTick, watch } from 'vue';
9898
import { useRoute, useRouter } from 'vue-router';
9999
import { showErrorTost } from '@/composables/useFrontendApi';
100100
import ThreeDotsMenu from '@/components/ThreeDotsMenu.vue';
@@ -118,6 +118,10 @@ const saving = ref(false);
118118
119119
const record: Ref<Record<string, any>> = ref({});
120120
121+
watch(record, (newVal) => {
122+
console.log('Record updated:', newVal);
123+
}, { deep: true });
124+
121125
const resourceFormRef = ref<InstanceType<typeof ResourceForm> | null>(null);
122126
123127
const editSaveButtonInjection = computed<AdminForthComponentDeclarationFull | null>(() => {

adminforth/types/Back.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ export interface AdminForthInputConfig {
11021102
/**
11031103
* Add custom page to the settings page
11041104
*/
1105-
userMenuSettingsPages: {
1105+
userMenuSettingsPages?: {
11061106
icon?: string,
11071107
pageLabel: string,
11081108
slug?: string,

dev-demo/.db.sqlite-journal

512 Bytes
Binary file not shown.

dev-demo/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
.db.sqlite

dev-demo/.env.local

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
KEYCLOAK_URL=http://localhost:8080
2-
31
ADMINFORTH_SECRET=123
42
NODE_ENV=development
5-
DATABASE_URL=sqlite://./.db.sqlite
6-
DATABASE_FILE_URL=file:.db.sqlite
3+
SQLITE_URL=sqlite://migrations/prisma/sqlite/.db.sqlite
4+
SQLITE_FILE_URL=file:.db.sqlite
5+
6+
CH_MIGRATIONS_HOME=./migrations/clickhouse_migrations
7+
CH_MIGRATIONS_HOST=localhost:8124/demo
8+
CH_MIGRATIONS_USER=demo
9+
CH_MIGRATIONS_PASSWORD=demo
10+
11+
AWS_REGION=eu-central-1
12+
AWS_BUCKET_NAME=tmpbucket-adminforth
13+
AWS_ACCESS_KEY_ID=your_access_key_id
14+
AWS_SECRET_ACCESS_KEY=your_secret_access_key

dev-demo/.env.prod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
NODE_ENV=production
2+
DATABASE_URL=sqlite:////code/db/.db.sqlite
3+
PRISMA_DATABASE_URL=file:/code/db/.db.sqlite

dev-demo/.env.sample

Lines changed: 0 additions & 11 deletions
This file was deleted.

dev-demo/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
node_modules
22
*.sqlite
3+
.sqlite
34
.env
4-
db
5+
db
6+
images/*

dev-demo/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM node:20-slim
2+
WORKDIR /code/
3+
ADD package.json package-lock.json /code/
4+
RUN npm ci
5+
ADD . /code/
6+
RUN npx adminforth bundle
7+
CMD ["sh", "-c", "npm run migrate:prod && npm run prod"]

0 commit comments

Comments
 (0)