-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release' of https://github.com/PrasadMadine/appsmith in…
…to fix/bug-alert-shows-twice-for-select-widget-26696
- Loading branch information
Showing
511 changed files
with
29,111 additions
and
1,700 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...r/components/PluginActionForm/components/CommonEditorForm/components/DatasourceConfig.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
...r/components/PluginActionForm/components/CommonEditorForm/hooks/useGetFormActionValues.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { getFormValues } from "redux-form"; | ||
import { API_EDITOR_FORM_NAME } from "ee/constants/forms"; | ||
import { getCurrentEnvironmentId } from "ee/selectors/environmentSelectors"; | ||
import get from "lodash/get"; | ||
import { useSelector } from "react-redux"; | ||
import { | ||
type Action, | ||
type ApiAction, | ||
isAPIAction, | ||
type Property, | ||
} from "entities/Action"; | ||
import { getDatasources } from "ee/selectors/entitiesSelector"; | ||
|
||
function useGetFormActionValues() { | ||
const formValues = useSelector(getFormValues(API_EDITOR_FORM_NAME)) as Action; | ||
const datasources = useSelector(getDatasources); | ||
const currentEnvironment = useSelector(getCurrentEnvironmentId); | ||
|
||
// In an unlikely scenario where form is not initialised, | ||
// return empty values to avoid form ui issues | ||
if (!isAPIAction(formValues)) { | ||
return { | ||
actionHeaders: [], | ||
actionParams: [], | ||
autoGeneratedHeaders: [], | ||
datasourceParams: [], | ||
datasourceHeaders: [], | ||
}; | ||
} | ||
|
||
const actionHeaders = get( | ||
formValues, | ||
"actionConfiguration.headers", | ||
[], | ||
) as Property[]; | ||
|
||
const autoGeneratedHeaders: ApiAction["actionConfiguration"]["autoGeneratedHeaders"] = | ||
get(formValues, "actionConfiguration.autoGeneratedHeaders", []); | ||
|
||
const actionParams = get( | ||
formValues, | ||
"actionConfiguration.queryParameters", | ||
[], | ||
) as Property[]; | ||
|
||
let datasourceFromAction: Action["datasource"] | undefined = get( | ||
formValues, | ||
"datasource", | ||
); | ||
|
||
if (datasourceFromAction && Object.hasOwn(datasourceFromAction, "id")) { | ||
datasourceFromAction = datasources.find( | ||
(d) => d.id === datasourceFromAction?.id, | ||
); | ||
} | ||
|
||
const datasourceHeaders = get( | ||
datasourceFromAction, | ||
`datasourceStorages.${currentEnvironment}.datasourceConfiguration.headers`, | ||
[], | ||
) as Property[]; | ||
|
||
const datasourceParams = get( | ||
datasourceFromAction, | ||
`datasourceStorages.${currentEnvironment}.datasourceConfiguration.queryParameters`, | ||
[], | ||
) as Property[]; | ||
|
||
return { | ||
actionHeaders, | ||
autoGeneratedHeaders, | ||
actionParams, | ||
datasourceHeaders, | ||
datasourceParams, | ||
}; | ||
} | ||
|
||
export default useGetFormActionValues; |
Oops, something went wrong.