Skip to content

Commit 16a4050

Browse files
committed
reset dev-demo and live-dom
1 parent 3c00b63 commit 16a4050

File tree

8 files changed

+47
-77
lines changed

8 files changed

+47
-77
lines changed

adminforth/types/Common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ export interface AdminForthResourceInputCommon {
445445
bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
446446
threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
447447
customActionIcons?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
448+
tableBodyStart?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
448449
},
449450

450451
/**

dev-demo/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import apartmentBuyersResource from './resources/apartment_buyers.js';
99
import auditLogResource from './resources/audit_log.js';
1010
import descriptionImageResource from './resources/description_image.js';
1111
import usersResource from './resources/users.js';
12-
import userSubResource from './resources/user_sub.js';
1312
// import gameResource from './resources/game.js';
1413
// import gamesUsersResource from './resources/games_users.js';
1514
// import gamesResource from './resources/games.js';
@@ -212,7 +211,6 @@ export const admin = new AdminForth({
212211
clinicsResource,
213212
providersResource,
214213
apiKeysResource,
215-
userSubResource,
216214
// gamesResource,
217215
// gamesUsersResource,
218216
// gameResource,
@@ -298,7 +296,7 @@ export const admin = new AdminForth({
298296
label: 'Translations',
299297
icon: 'material-symbols:translate',
300298
resourceId: 'translations',
301-
},
299+
}
302300
]
303301
},
304302
{
@@ -454,7 +452,7 @@ app.get(`${ADMIN_BASE_URL}/api/dashboard/`,
454452
app.get(`${ADMIN_BASE_URL}/api/aparts-by-room-percentages/`,
455453
admin.express.authorize(
456454
async (req, res) => {
457-
const roomPercentages = await admin.resource('aparts').dataConnector.db.prepare(
455+
const roomPercentages = await admin.resource('aparts').dataConnector.client.prepare(
458456
`SELECT
459457
number_of_rooms,
460458
COUNT(*) as count

dev-demo/inventory.yml

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,22 @@ services:
5656
- mysql-data:/var/lib/mysql
5757

5858
keycloak:
59-
image: quay.io/keycloak/keycloak:latest
60-
command: start-dev --import-realm
61-
environment:
62-
- KEYCLOAK_ADMIN=admin
63-
- KEYCLOAK_ADMIN_PASSWORD=admin
64-
- DB_VENDOR=postgres
65-
- DB_ADDR=pg
66-
- DB_DATABASE=demo
67-
- DB_USER=demo
68-
- DB_PASSWORD=demo
69-
- KEYCLOAK_IMPORT=/opt/keycloak/data/import/keycloak-realm.json
70-
- KEYCLOAK_CLIENT_ID=${KEYCLOAK_CLIENT_ID}
71-
- KEYCLOAK_CLIENT_SECRET=${KEYCLOAK_CLIENT_SECRET}
72-
- KEYCLOAK_URL=${KEYCLOAK_URL}
73-
- KEYCLOAK_REALM=${KEYCLOAK_REALM}
74-
ports:
75-
- "8080:8080"
76-
depends_on:
77-
- pg
78-
volumes:
79-
- keycloak-data:/opt/keycloak/data
80-
- ./keycloak-realm.json:/opt/keycloak/data/import/keycloak-realm.json
59+
image: quay.io/keycloak/keycloak:latest
60+
command: start-dev
61+
environment:
62+
- KEYCLOAK_ADMIN=admin
63+
- KEYCLOAK_ADMIN_PASSWORD=admin
64+
- DB_VENDOR=postgres
65+
- DB_ADDR=pg
66+
- DB_DATABASE=demo
67+
- DB_USER=demo
68+
- DB_PASSWORD=demo
69+
ports:
70+
- "8080:8080"
71+
depends_on:
72+
- pg
73+
volumes:
74+
- keycloak-data:/opt/keycloak/data
8175

8276

8377
volumes:

dev-demo/resources/apartments.ts

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ import UploadPlugin from "../../plugins/adminforth-upload";
1010
import ImportExportPlugin from "../../plugins/adminforth-import-export/index.js";
1111
import { v1 as uuid } from "uuid";
1212
import RichEditorPlugin from "../../plugins/adminforth-rich-editor";
13-
import ListInPlaceEditPlugin from "../../plugins/adminforth-list-in-place-edit";
1413
import { AdminForthResourceInput } from "../../adminforth";
1514
import CompletionAdapterOpenAIChatGPT from "../../adapters/adminforth-completion-adapter-open-ai-chat-gpt/index.js";
16-
import InlineCreatePlugin from "../../plugins/adminforth-inline-create";
15+
1716
const demoChecker = async ({ record, adminUser, resource }) => {
1817
if (adminUser.dbUser.role !== "superadmin") {
1918
return { ok: false, error: "You can't do this on demo.adminforth.dev" };
@@ -191,8 +190,7 @@ export default {
191190
showIn: {create: true, edit: true, filter: true, show: true},
192191
allowMinMaxQuery: true, // use better experience for filtering e.g. date range, set it only if you have index on this column or if there will be low number of rows
193192
editingNote: "Price is in USD", // you can appear note on editing or creating page
194-
// editReadonly: true, // you can set field to be readonly on edit page
195-
type: AdminForthDataTypes.DECIMAL,
193+
editReadonly: true, // you can set field to be readonly on edit page
196194

197195
},
198196
{
@@ -300,32 +298,21 @@ export default {
300298
preview: {
301299
// Used to display preview (if it is image) in list and show views
302300
// previewUrl: ({s3Path}) => `https://tmpbucket-adminforth.s3.eu-central-1.amazonaws.com/${s3Path}`,
303-
// showInList: true,
304-
// maxWidth: "200px",
305-
maxWidth: "40px",
306-
maxListWidth: "300px",
307-
minWidth: "200px",
308-
// minListWidth: "100px",
309-
// minShowWidth: "200px",
310-
301+
showInList: true,
302+
maxWidth: "200px",
311303
},
312304
}),
313305
]
314306
: []),
315307
new ImportExportPlugin({}),
316-
// new TextCompletePlugin({
317-
// fieldName: "title",
318-
// expert: {
319-
// debounceTime: 250,
320-
// },
321-
// adapter: new CompletionAdapterOpenAIChatGPT({
322-
// openAiApiKey: process.env.OPENAI_API_KEY as string,
323-
// }),
324-
// }),
325-
new InlineCreatePlugin({
326-
}),
327-
new ListInPlaceEditPlugin({
328-
columns: ["title", "price", "number_of_rooms", "description", "listed", "room_sizes"]
308+
new TextCompletePlugin({
309+
fieldName: "title",
310+
expert: {
311+
debounceTime: 250,
312+
},
313+
adapter: new CompletionAdapterOpenAIChatGPT({
314+
openAiApiKey: process.env.OPENAI_API_KEY as string,
315+
}),
329316
}),
330317
// new TextCompletePlugin({
331318
// openAiApiKey: process.env.OPENAI_API_KEY as string,

dev-demo/resources/api_keys.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ export default {
3030
{
3131
name: 'owner',
3232
type: AdminForthDataTypes.STRING,
33-
// enum: [
34-
// {
35-
// value: 'clinic',
36-
// label: 'Clinic',
37-
// },
38-
// {
39-
// value: 'provider',
40-
// label: 'Provider',
41-
// },
42-
// ],
33+
enum: [
34+
{
35+
value: 'clinic',
36+
label: 'Clinic',
37+
},
38+
{
39+
value: 'provider',
40+
label: 'Provider',
41+
},
42+
],
4343
showIn: { create: false, edit: false },
4444
},
4545
{

dev-demo/resources/clinics.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { AdminForthDataTypes, AdminForthResourceInput } from "../../adminforth";
22
import { v1 as uuid } from "uuid";
3-
import ImportExport from "../../plugins/adminforth-import-export";
4-
53

64
export default {
75
dataSource: 'pg',
@@ -25,16 +23,12 @@ export default {
2523
},
2624
{
2725
name: 'name',
28-
type: AdminForthDataTypes.TEXT,
26+
type: AdminForthDataTypes.STRING,
2927
required: true,
3028
maxLength: 255,
31-
3229
},
3330

3431
],
35-
plugins: [
36-
new ImportExport({
37-
}),
38-
],
32+
plugins: [],
3933
options: {},
4034
} as AdminForthResourceInput;

dev-demo/resources/users.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import EmailAdapterAwsSes from "../../adapters/adminforth-email-adapter-aws-ses/
1515
import OAuthPlugin from "../../plugins/adminforth-oauth";
1616
import AdminForthAdapterGoogleOauth2 from "../../adapters/adminforth-google-oauth-adapter";
1717
import AdminForthAdapterGithubOauth2 from "../../adapters/adminforth-github-oauth-adapter";
18-
import ListInPlaceEditPlugin from "../../plugins/adminforth-list-in-place-edit";
1918

2019
import AdminForthAdapterFacebookOauth2 from "../../adapters/adminforth-facebook-oauth-adapter";
2120
import AdminForthAdapterKeycloakOauth2 from "../../adapters/adminforth-keycloak-oauth-adapter";
@@ -43,7 +42,7 @@ export default {
4342
foreignResourceId: "audit_log",
4443
}),
4544
new ForeignInlineListPlugin({
46-
foreignResourceId: "user_sub",
45+
foreignResourceId: "users",
4746
}),
4847
new TwoFactorsAuthPlugin({
4948
twoFaSecretFieldName: "secret2fa",
@@ -121,9 +120,6 @@ export default {
121120
emailField: 'email',
122121
emailConfirmedField: 'email_confirmed'
123122
}),
124-
// new ListInPlaceEditPlugin({
125-
// columns: ["role"]
126-
// })
127123
],
128124
options: {
129125
allowedActions: {
@@ -186,7 +182,7 @@ export default {
186182
{
187183
name: "role",
188184
enum: [
189-
{ value: 'superadmin', label: 'Super Admin' },
185+
// { value: 'superadmin', label: 'Super Admin' },
190186
{ value: "user", label: "User" },
191187
],
192188
},
@@ -211,7 +207,7 @@ export default {
211207
foreignResource: {
212208
resourceId: "users",
213209
}
214-
},
210+
}
215211
// {
216212
// name: "email_confirmed",
217213
// },

live-demo/app/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ if (import.meta.url === `file://${process.argv[1]}`) {
141141
app.get(`${ADMIN_BASE_URL}/api/dashboard/`,
142142
admin.express.authorize(
143143
async (req, res) => {
144-
const db = admin.resource('aparts').dataConnector.db;
144+
const db = admin.resource('aparts').dataConnector.client;
145145
const days = req.body.days || 7;
146146
const apartsByDays = await db.prepare(
147147
`SELECT

0 commit comments

Comments
 (0)