Skip to content

Commit

Permalink
fix: bringing action names back inline with external model (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
alharris-at committed Feb 25, 2022
1 parent 6a682d4 commit 4c991e4
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 30 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions packages/codegen-ui-react/lib/workflow/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ import { ImportCollection, ImportSource, ImportValue } from '../imports';
import { getChildPropMappingForComponentName } from './utils';

enum Action {
'Amplify.Navigate' = 'Amplify.Navigate',
'Amplify.DataStoreCreateItem' = 'Amplify.DataStoreCreateItem',
'Amplify.DataStoreUpdateItem' = 'Amplify.DataStoreUpdateItem',
'Amplify.DataStoreDeleteItem' = 'Amplify.DataStoreDeleteItem',
'Amplify.Navigation' = 'Amplify.Navigation',
'Amplify.DataStoreCreateItemAction' = 'Amplify.DataStoreCreateItemAction',
'Amplify.DataStoreUpdateItemAction' = 'Amplify.DataStoreUpdateItemAction',
'Amplify.DataStoreDeleteItemAction' = 'Amplify.DataStoreDeleteItemAction',
'Amplify.AuthSignOut' = 'Amplify.AuthSignOut',
'Amplify.Mutation' = 'Amplify.Mutation',
}

export default Action;

export const ActionNameMapping: Partial<Record<Action, ImportValue>> = {
[Action['Amplify.Navigate']]: ImportValue.USE_NAVIGATE_ACTION,
[Action['Amplify.DataStoreCreateItem']]: ImportValue.USE_DATA_STORE_CREATE_ACTION,
[Action['Amplify.DataStoreUpdateItem']]: ImportValue.USE_DATA_STORE_UPDATE_ACTION,
[Action['Amplify.DataStoreDeleteItem']]: ImportValue.USE_DATA_STORE_DELETE_ACTION,
[Action['Amplify.Navigation']]: ImportValue.USE_NAVIGATE_ACTION,
[Action['Amplify.DataStoreCreateItemAction']]: ImportValue.USE_DATA_STORE_CREATE_ACTION,
[Action['Amplify.DataStoreUpdateItemAction']]: ImportValue.USE_DATA_STORE_UPDATE_ACTION,
[Action['Amplify.DataStoreDeleteItemAction']]: ImportValue.USE_DATA_STORE_DELETE_ACTION,
[Action['Amplify.AuthSignOut']]: ImportValue.USE_AUTH_SIGN_OUT_ACTION,
[Action['Amplify.Mutation']]: ImportValue.USE_STATE_MUTATION_ACTION,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"events": {
"click": {
"action": "Amplify.Navigate",
"action": "Amplify.Navigation",
"parameters": {
"type": {
"value": "anchor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "CreateCustomerButton",
"events": {
"click": {
"action": "Amplify.DataStoreCreateItem",
"action": "Amplify.DataStoreCreateItemAction",
"parameters": {
"model": "Customer",
"fields": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "DeleteCustomerButton",
"events": {
"click": {
"action": "Amplify.DataStoreDeleteItem",
"action": "Amplify.DataStoreDeleteItemAction",
"parameters": {
"model": "Customer",
"id": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "UpdateCustomerButton",
"events": {
"click": {
"action": "Amplify.DataStoreUpdateItem",
"action": "Amplify.DataStoreUpdateItemAction",
"parameters": {
"model": "Customer",
"id": {
Expand Down
2 changes: 1 addition & 1 deletion packages/codegen-ui/example-schemas/workflow/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"name": "SubmitButton",
"events": {
"click": {
"action": "Amplify.DataStoreUpdateItem",
"action": "Amplify.DataStoreUpdateItemAction",
"parameters": {
"model": "Customer",
"id": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"events": {
"click": {
"action": "Amplify.Navigate",
"action": "Amplify.Navigation",
"parameters": {
"type": {
"value": "url"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"events": {
"click": {
"action": "Amplify.Navigate",
"action": "Amplify.Navigation",
"parameters": {
"type": {
"value": "url"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"events": {
"click": {
"action": "Amplify.Navigate",
"action": "Amplify.Navigation",
"parameters": {
"type": {
"value": "reload"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"events": {
"click": {
"action": "Amplify.DataStoreCreateItem",
"action": "Amplify.DataStoreCreateItemAction",
"parameters": {
"model": "User",
"fields": {
Expand Down Expand Up @@ -52,7 +52,7 @@
},
"events": {
"click": {
"action": "Amplify.DataStoreUpdateItem",
"action": "Amplify.DataStoreUpdateItemAction",
"parameters": {
"model": "User",
"id": {
Expand Down Expand Up @@ -85,7 +85,7 @@
},
"events": {
"click": {
"action": "Amplify.DataStoreDeleteItem",
"action": "Amplify.DataStoreDeleteItemAction",
"parameters": {
"model": "User",
"id": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"name": "SubmitButton",
"events": {
"click": {
"action": "Amplify.DataStoreUpdateItem",
"action": "Amplify.DataStoreUpdateItemAction",
"parameters": {
"model": "User",
"id": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"events": {
"click": {
"action": "Amplify.Navigate",
"action": "Amplify.Navigation",
"parameters": {
"type": {
"value": "url"
Expand All @@ -41,7 +41,7 @@
},
"events": {
"click": {
"action": "Amplify.Navigate",
"action": "Amplify.Navigation",
"parameters": {
"type": {
"value": "anchor"
Expand All @@ -66,7 +66,7 @@
},
"events": {
"click": {
"action": "Amplify.Navigate",
"action": "Amplify.Navigation",
"parameters": {
"type": {
"value": "url"
Expand Down Expand Up @@ -94,7 +94,7 @@
},
"events": {
"click": {
"action": "Amplify.Navigate",
"action": "Amplify.Navigation",
"parameters": {
"type": {
"value": "reload"
Expand Down

0 comments on commit 4c991e4

Please sign in to comment.