Files
directus/docs/reference/system/settings.md
Brainslug f96dcc361f Translation string performance (#18097)
* broken migration

* fixed migration

* created new endpoints for translation strings

* updated to use core endpoint

* bad attempts at making the endpoints sensible

* merge changes

* implemented translation strings service

* re-integrating app logic part 1

* re-integrating app logic part 2

* fixed bad lodash import

* re-integrating app logic part 3

* removed obsolete tests

* make the linter happy

* Create tender-trees-buy.md

* added option to search-input

* implementing search

* fixed resizing and sidebar

* Fix linting

* Remove unused translations update into project settings

* Fix missing translations

* Require read permissions for app access

* Fetch translation strings only when authenticated

* Fix project default language not used when user has default language

* Remove commented line

* Rename variable as content has been changed

* Make the current user check more specific

* Remove translation_string from Settings type

* Remove settings reference in docs

* Update changeset

* Rename migration file to ensure date order

* Rename collection, route, service, controller

* Rename migration

* Adjust collection in settings route

* Fix translations service

* Use new `shouldClearCache` util

* Drop translation_strings column in migration

Co-authored-by: ian <licitdev@gmail.com>

* Added basic api docs

* updated dictionary

* updated dictionary

* Update app/src/interfaces/_system/system-input-translated-string/input-translated-string.vue

Co-authored-by: Nicola Krumschmidt <nicola.krumschmidt@freenet.de>

* Update app/src/modules/settings/routes/translation-strings/collection.vue

Co-authored-by: Nicola Krumschmidt <nicola.krumschmidt@freenet.de>

* extracted getCurrentLanguage utility

* Use regular collections/items

* Use regular controller

* Fix item view

* Set correct system field config for translations

* Tweaks

* Use UUID

* Finish placeholders

* Use drawer-item

* Add create to the store

* Remove composables

* Add new placeholder

* Fix saving behavior

* Remove previous take

* Rename migration after merge of live preview

* Generate uuid when migrating

* Remove unused showFilter

* Fix linting

* Fix type warnings

* Not needed as settings no longer contain translation_strings

* Remove leftover blank line

* Update getCurrentLanguage with server default and use in hydrate

* Shift getCurrentLanguage to lang folder to be alongside setLanguage

* add elipsis to placeholder

* Remove slug from key, so you can use dots etc in the key

* updated translation value to be type text again

* Rehydrate fields for updated translation values

* Add tooltip

* updated documentation

* enforce key/language uniqueness in the TranslationService

* updated error message

* updated docs menu item to "custom translations"

* Dynamically fetch translation keys for input-translated-string interface

* use get current language in refresh

* Update docs/reference/system/translations.md

* Update docs/reference/system/translations.md

* Update .changeset/tender-trees-buy.md

* Fetch translation keys when new key is created

* Update api/src/services/translations.ts

* Remove translation_strings remnant

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>

* mark key, language and value as required

* correctly mark fields as required

* Catch duplicate key error when creating from input

* Translate translations :-)

* Update tender-trees-buy.md

---------

Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Nicola Krumschmidt <nicola.krumschmidt@freenet.de>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2023-05-26 12:35:44 -04:00

208 lines
3.9 KiB
Markdown

---
description: REST and GraphQL API documentation on the Settings collection in Directus.
readTime: 3 min read
pageClass: page-reference
---
# Settings
> Settings are key-value pairs that are stored in the database, and control different aspects of the project. Only
> administrators have access to manage Settings.
---
## The Settings Object
`id` **uuid**\
Primary key of the setting.
`project_name` **string**\
Name of the project, shown in the Admin App.
`project_descriptor` **string**\
Descriptor of the project, shown in the Admin App.
`project_url` **string**\
Link to the (public) website that goes with this project.
`project_color` **string**\
Brand color for the current project.
`project_logo` **many-to-one**\
Primary logo for the current project. Many-to-one to [files](/reference/files).
`public_foreground` **many-to-one**\
Foreground image for the Admin App's public pages. Many-to-one to [files](/reference/files).
`public_background` **many-to-one**\
Background image for the Admin App's public pages. Many-to-one to [files](/reference/files).
`public_note` **string**\
Note shown on the Admin App's public pages. Supports Markdown.
`auth_login_attempts` **integer**\
How often a user is allowed to try to login. After which times the user will be suspended.
`auth_password_policy` **RegEx**\
What regex passwords must pass in order to be valid.
`storage_asset_transform` **string**\
If the transform endpoints are allowed to be used on [the assets endpoint](/reference/files#requesting-a-thumbnail). One
of `all`, `none` or `presets`.
`storage_asset_presets` **array**\
What preset keys exist in [the assets endpoint](/reference/files#requesting-a-thumbnail).
`custom_css` **string**\
CSS rules to override the App's default styling.
`storage_default_folder` **uuid**\
Folder for uploaded files. Does not affect existing files.
`basemaps` **array**\
Custom tiles to overriding the Mapbox defaults.
`mapbox_key` **string**\
[Mapbox Access Token](https://docs.mapbox.com/help/glossary/access-token).
`module_bar` **array**\
What modules are enabled/added globally.
`custom_aspect_ratios` **array**\
Custom aspect ratios in the [image editor](/app/file-library#edit-an-image).
```json
{
"data": {
"id": 1,
"project_name": "Directus",
"project_descriptor": "Application",
"project_url": null,
"project_color": null,
"project_logo": null,
"public_foreground": null,
"public_background": null,
"public_note": null,
"auth_login_attempts": 25,
"auth_password_policy": null,
"storage_asset_transform": "all",
"storage_asset_presets": [
{
"key": "small",
"fit": "cover",
"width": 200,
"height": 161,
"quality": 80,
"withoutEnlargement": false
}
],
"custom_css": null,
"storage_default_folder": null,
"basemaps": null,
"mapbox_key": null,
"module_bar": null,
"custom_aspect_ratios": [
{
"text": "16:10",
"value": 1.6
}
]
}
}
```
---
## Retrieve Settings
### Query Parameters
Supports all [global query parameters](/reference/query).
### Returns
Returns the [settings object](#the-settings-object).
### REST API
```
GET /settings
```
### GraphQL
```
POST /graphql/system
```
```graphql
type Query {
settings: directus_settings
}
```
##### Example
```graphql
query {
settings {
project_name
}
}
```
---
## Update Settings
### Query Parameters
Supports all [global query parameters](/reference/query).
### Request Body
A partial [settings object](#the-settings-object).
### Returns
Returns the [settings object](#the-setting-object).
### REST API
```
PATCH /settings
```
##### Example
```json
// PATCH /settings
{
"project_url": "https://example.com/"
}
```
### GraphQL
```
POST /graphql/system
```
```graphql
type Mutation {
update_settings(data: update_directus_settings_input!): directus_settings
}
```
##### Example
```graphql
mutation {
update_settings(data: { project_url: "https://example.com" }) {
project_name
project_url
}
}
```