Skip to content

Commit

Permalink
feat: folder docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mle-moni committed Aug 14, 2024
1 parent 9097896 commit 00cf008
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 3 deletions.
3 changes: 3 additions & 0 deletions adomin.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
"source.organizeImports": "explicit",
"source.fixAll": "explicit",
},
"files.associations": {
"*.mdx": "markdown"
}
},
}
4 changes: 3 additions & 1 deletion app/adomin/config/adomin_config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AdominConfig } from '#adomin/adomin_config.types'
import { ADOMIN_TEST_CONFIG } from '../../test_adomin_config.js'

/**
* This file will contain your Adomin Config
Expand All @@ -18,5 +19,6 @@ import { AdominConfig } from '#adomin/adomin_config.types'

export const ADOMIN_CONFIG: AdominConfig = {
title: 'Your Backoffice Title',
views: [],
views: [...ADOMIN_TEST_CONFIG],
// plugins: ['cms'],
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/assets/images/reference/stats/kpi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions docs/src/content/docs/reference/views/folders/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
title: Folder views
sidebar:
order: 1001
description: Adomin folder views reference
---

Folder views allows to organize your other views in a tree structure.

![Folder view](~/assets/images/reference/folders/folder_view.png)

## Config

To declare a folder view, you will need to add a `FolderViewConfig` object inside the `views` array of the `app/adomin/config/adomin_config.ts` file.

```ts
export const ADOMIN_CONFIG: AdominConfig = {
title: 'Adomin',
views: [MY_FOLDER_CONFIG],
}
```

Use the `createFolderViewConfig` function to create your `FolderViewConfig` object:

```ts
export const MY_FOLDER_CONFIG = createFolderViewConfig({
label: 'My folder',
name: 'my-folder',
views: [STATS_CONFIG, USER_CONFIG],
icon: 'folder',
})
```

You can pass the following options inside the config object:

### label

Title of the folder, displayed in the sidebar

### name
Used to determine the path in the frontend

e.g. if name = 'test', full path on the frontend will be `/adomin/folders/test`

### views

The folder children views, each object should be a `ModelConfig`, `StatsViewConfig` or `FolderViewConfig`

### visibilityCheck

Check if logged in user can see this folder

### isHidden

Use this if you want to hide this folder on the frontend.
Frontend routes will still be created and available, but the navbar won't show them.

:::caution
Do not see this as a protection, but rather a cosmetic feature.

If you want to protect things, use [visibilityCheck](#visibilityCheck)
:::

### icon

Icon name, by default this uses Tabler icons
You can browse the list of available icons at: https://tabler.io/icons
7 changes: 6 additions & 1 deletion docs/src/content/docs/reference/views/models/index.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Model views
sidebar:
order: 1001
order: 1002
description: Adomin model views reference
---

Expand Down Expand Up @@ -139,6 +139,11 @@ Do not see this as a protection, but rather a cosmetic feature.
If you want to protect things, use [staticRights](#staticrights), [visibilityCheck](#visibilitycheck) and [crudlRights](#crudlrights)
:::

### icon

Icon name, by default this uses Tabler icons
You can browse the list of available icons at: https://tabler.io/icons

### queryBuilderCallback

You can use this callback to customize the query built for this model in order to do custom things on the frontend, or if you use computed fields who needs query customizations or preloads
Expand Down
12 changes: 11 additions & 1 deletion docs/src/content/docs/reference/views/stats/index.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Stat views
sidebar:
order: 1002
order: 1003
description: Adomin stats views reference
---

Expand Down Expand Up @@ -31,6 +31,10 @@ For this, you will need to write some backend configuration, and then the adomin

![Area chart](~/assets/images/reference/stats/area.png)

### Kpi chart

![Kpi chart](~/assets/images/reference/stats/kpi.png)

## Config

To declare a stat view page, you will need to add a `StatViewConfig` object inside the `views` array of the `app/adomin/config/adomin_config.ts` file.
Expand Down Expand Up @@ -94,6 +98,11 @@ Do not see this as a protection, but rather a cosmetic feature.
If you want to protect things, use [visibilityCheck](#visibilitycheck)
:::

### icon

Icon name, by default this uses Tabler icons
You can browse the list of available icons at: https://tabler.io/icons

### stats

An array of `AdominStat` objects, each `AdominStat` represent a chart
Expand All @@ -113,6 +122,7 @@ Type of the chart to display, can be one of:
- column
- line
- area
- kpi

### label

Expand Down

0 comments on commit 00cf008

Please sign in to comment.