-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[RFR] Migrate ra-core actions to Typescript #2521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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,31 @@ | ||
| export const FETCH_START = 'RA/FETCH_START'; | ||
|
|
||
| export interface FetchStartAction { | ||
| readonly type: typeof FETCH_START; | ||
| } | ||
|
|
||
| export const fetchStart = (): FetchStartAction => ({ type: FETCH_START }); | ||
|
|
||
| export const FETCH_END = 'RA/FETCH_END'; | ||
|
|
||
| export interface FetchEndAction { | ||
| readonly type: typeof FETCH_END; | ||
| } | ||
|
|
||
| export const fetchEnd = (): FetchEndAction => ({ type: FETCH_END }); | ||
|
|
||
| export const FETCH_ERROR = 'RA/FETCH_ERROR'; | ||
|
|
||
| export interface FetchErrorAction { | ||
| readonly type: typeof FETCH_ERROR; | ||
| } | ||
|
|
||
| export const fetchError = (): FetchErrorAction => ({ type: FETCH_ERROR }); | ||
|
|
||
| export const FETCH_CANCEL = 'RA/FETCH_CANCEL'; | ||
|
|
||
| export interface FetchCancelAction { | ||
| readonly type: typeof FETCH_CANCEL; | ||
| } | ||
|
|
||
| export const fetchCancel = (): FetchCancelAction => ({ type: FETCH_CANCEL }); |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,51 @@ | ||
| export const CRUD_SHOW_FILTER = 'RA/CRUD_SHOW_FILTER'; | ||
|
|
||
| export interface ShowFilterAction { | ||
| readonly type: typeof CRUD_SHOW_FILTER; | ||
| readonly payload: { field: string }; | ||
| readonly meta: { resource: string }; | ||
| } | ||
|
|
||
| export const showFilter = ( | ||
| resource: string, | ||
| field: string | ||
| ): ShowFilterAction => ({ | ||
| type: CRUD_SHOW_FILTER, | ||
| payload: { field }, | ||
| meta: { resource }, | ||
| }); | ||
|
|
||
| export const CRUD_HIDE_FILTER = 'RA/CRUD_HIDE_FILTER'; | ||
|
|
||
| export interface HideFilterAction { | ||
| readonly type: typeof CRUD_HIDE_FILTER; | ||
| readonly payload: { field: string }; | ||
| readonly meta: { resource: string }; | ||
| } | ||
|
|
||
| export const hideFilter = ( | ||
| resource: string, | ||
| field: string | ||
| ): HideFilterAction => ({ | ||
| type: CRUD_HIDE_FILTER, | ||
| payload: { field }, | ||
| meta: { resource }, | ||
| }); | ||
|
|
||
| export const CRUD_SET_FILTER = 'RA/CRUD_SET_FILTER'; | ||
|
|
||
| export interface SetFilterAction { | ||
| readonly type: typeof CRUD_SET_FILTER; | ||
| readonly payload: { field: string; value: any }; | ||
| readonly meta: { resource: string }; | ||
| } | ||
|
|
||
| export const setFilter = ( | ||
| resource: string, | ||
| field: string, | ||
| value: any | ||
| ): SetFilterAction => ({ | ||
| type: CRUD_SET_FILTER, | ||
| payload: { field, value }, | ||
| meta: { resource }, | ||
| }); |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,38 @@ | ||
| export const INITIALIZE_FORM = 'RA/INITIALIZE_FORM'; | ||
|
|
||
| export interface InitializeFormAction { | ||
| readonly type: typeof INITIALIZE_FORM; | ||
| readonly payload: any; | ||
| } | ||
|
|
||
| export const initializeForm = (initialValues: any): InitializeFormAction => ({ | ||
| type: INITIALIZE_FORM, | ||
| payload: initialValues, | ||
| }); | ||
|
|
||
| export const RESET_FORM = 'RA/RESET_FORM'; | ||
|
|
||
| export interface ResetFormAction { | ||
| readonly type: typeof RESET_FORM; | ||
| } | ||
|
|
||
| export const resetForm = (): ResetFormAction => ({ type: RESET_FORM }); | ||
|
|
||
| export const BEFORE_LOCATION_CHANGE = 'RA/BEFORE_LOCATION_CHANGE'; | ||
|
|
||
| export interface BeforeLocationChangeAction { | ||
| readonly type: typeof BEFORE_LOCATION_CHANGE; | ||
| readonly payload: any; | ||
| readonly meta: any; | ||
| } | ||
| export const beforeLocationChange = ({ | ||
| payload, | ||
| meta, | ||
| }: { | ||
| payload: any; | ||
| meta: any; | ||
| }): BeforeLocationChangeAction => ({ | ||
| type: BEFORE_LOCATION_CHANGE, | ||
| payload, | ||
| meta, | ||
| }); |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,48 @@ | ||
| export const CRUD_CHANGE_LIST_PARAMS = 'RA/CRUD_CHANGE_LIST_PARAMS'; | ||
|
|
||
| export interface ChangeListParamsAction { | ||
| readonly type: typeof CRUD_CHANGE_LIST_PARAMS; | ||
| readonly payload: any; | ||
| readonly meta: { resource: string }; | ||
| } | ||
| export const changeListParams = ( | ||
| resource: string, | ||
| params: any | ||
| ): ChangeListParamsAction => ({ | ||
| type: CRUD_CHANGE_LIST_PARAMS, | ||
| payload: params, | ||
| meta: { resource }, | ||
| }); | ||
|
|
||
| export const SET_LIST_SELECTED_IDS = 'RA/SET_LIST_SELECTED_IDS'; | ||
|
|
||
| export interface SetListLelectedIdsAction { | ||
| readonly type: typeof SET_LIST_SELECTED_IDS; | ||
| readonly payload: []; | ||
| readonly meta: { resource: string }; | ||
| } | ||
| export const setListSelectedIds = ( | ||
| resource: string, | ||
| ids: [] | ||
| ): SetListLelectedIdsAction => ({ | ||
| type: SET_LIST_SELECTED_IDS, | ||
| payload: ids, | ||
| meta: { resource }, | ||
| }); | ||
|
|
||
| export const TOGGLE_LIST_ITEM = 'RA/TOGGLE_LIST_ITEM'; | ||
|
|
||
| export interface ToggleListItemAction { | ||
| readonly type: typeof TOGGLE_LIST_ITEM; | ||
| readonly payload: any; | ||
| readonly meta: { resource: string }; | ||
| } | ||
|
|
||
| export const toggleListItem = ( | ||
| resource: string, | ||
| id: any | ||
| ): ToggleListItemAction => ({ | ||
| type: TOGGLE_LIST_ITEM, | ||
| payload: id, | ||
| meta: { resource }, | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the metas, we need to be a bit smarter. As each meta has a special signification (and triggers a particular side effect), we probably need a subtype for
accumulate, to be reused everywhere theaccumulatemeta is present.