mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Co-authored-by: Jan Arends <jan.arends@mailbox.org> Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
21 lines
688 B
TypeScript
21 lines
688 B
TypeScript
import type { FieldMeta } from '@directus/types';
|
|
import { systemFieldRows } from '@directus/system-data';
|
|
import formatTitle from '@directus/format-title';
|
|
import { getAuthProviders } from './get-auth-providers.js';
|
|
|
|
// Dynamically populate auth providers field
|
|
export function getSystemFieldRowsWithAuthProviders(): FieldMeta[] {
|
|
return systemFieldRows.map((systemField) => {
|
|
if (systemField.collection === 'directus_users' && systemField.field === 'provider') {
|
|
if (!systemField.options) systemField.options = {};
|
|
|
|
systemField.options['choices'] = getAuthProviders().map(({ name }) => ({
|
|
text: formatTitle(name),
|
|
value: name,
|
|
}));
|
|
}
|
|
|
|
return systemField;
|
|
});
|
|
}
|