mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
chore: add google connector default prompt (#6734)
* chore: add google connector default prompt * fix: fix console integration tests
This commit is contained in:
parent
84af9ee2ba
commit
5bb9375055
4 changed files with 22 additions and 1 deletions
5
.changeset/light-clocks-retire.md
Normal file
5
.changeset/light-clocks-retire.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@logto/connector-google": minor
|
||||
---
|
||||
|
||||
update the default `prompts` to be `select_account`
|
5
.changeset/tricky-walls-add.md
Normal file
5
.changeset/tricky-walls-add.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@logto/console": patch
|
||||
---
|
||||
|
||||
Connector config default values should only show up when creating new connectors
|
|
@ -69,6 +69,7 @@ export const defaultMetadata: ConnectorMetadata = {
|
|||
.map((prompt) => ({
|
||||
value: prompt,
|
||||
})),
|
||||
defaultValue: [OidcPrompt.SelectAccount],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
@ -6,9 +6,19 @@ import { conditional } from '@silverhand/essentials';
|
|||
import { SyncProfileMode, type ConnectorFormType } from '@/types/connector';
|
||||
import { safeParseJson } from '@/utils/json';
|
||||
|
||||
/**
|
||||
* @remarks
|
||||
* - When creating a new connector, this function will be called in the `convertFactoryResponseToForm()` method. At this time, there is no `config` data, so the default values in `formItems` are used.
|
||||
* - When editing an existing connector, this function will be called in the `convertResponseToForm()` method. `config` data will always exist, and the `config` data is used, never using the default values.
|
||||
*/
|
||||
const initFormData = (formItems: ConnectorConfigFormItem[], config?: Record<string, unknown>) => {
|
||||
const data: Array<[string, unknown]> = formItems.map((item) => {
|
||||
const value = config?.[item.key] ?? item.defaultValue;
|
||||
const configValue =
|
||||
config?.[item.key] ??
|
||||
conditional(item.type === ConnectorConfigFormItemType.Json && {}) ??
|
||||
conditional(item.type === ConnectorConfigFormItemType.MultiSelect && []);
|
||||
const { defaultValue } = item;
|
||||
const value = config ? configValue : defaultValue;
|
||||
|
||||
if (item.type === ConnectorConfigFormItemType.Json) {
|
||||
return [item.key, JSON.stringify(value, null, 2)];
|
||||
|
|
Loading…
Reference in a new issue