diff --git a/.github/semantic.yml b/.github/semantic.yml new file mode 100644 index 0000000000..3b523527bf --- /dev/null +++ b/.github/semantic.yml @@ -0,0 +1,2 @@ +# Always validate the PR title, and ignore the commits +titleOnly: true \ No newline at end of file diff --git a/app/client/src/constants/messages.ts b/app/client/src/constants/messages.ts index ca0f85899d..0dfe4f4609 100644 --- a/app/client/src/constants/messages.ts +++ b/app/client/src/constants/messages.ts @@ -8,8 +8,6 @@ export function createMessage( export const ERROR_MESSAGE_SELECT_ACTION = () => `Please select an action`; export const ERROR_MESSAGE_SELECT_ACTION_TYPE = () => `Please select an action type`; -export const ACTION_CREATED_SUCCESS = (actionName: string) => - `${actionName} action created successfully`; export const ERROR_ADD_API_INVALID_URL = () => `Unable to create API. Try adding a URL to the datasource`; export const ERROR_MESSAGE_NAME_EMPTY = () => `Please select a name`; @@ -218,8 +216,6 @@ export const ERROR_FAIL_ON_PAGE_LOAD_ACTIONS = () => `Failed to execute actions during page load`; export const ERROR_ACTION_EXECUTE_FAIL = (actionName: string) => `${actionName} action returned an error response`; -export const ACTION_DELETE_SUCCESS = (actionName: string) => - `${actionName} action deleted successfully`; export const ACTION_MOVE_SUCCESS = (actionName: string, pageName: string) => `${actionName} action moved to page ${pageName} successfully`; export const ERROR_ACTION_MOVE_FAIL = (actionName: string) => diff --git a/app/client/src/sagas/ActionSagas.ts b/app/client/src/sagas/ActionSagas.ts index 472a159ff1..883f9af755 100644 --- a/app/client/src/sagas/ActionSagas.ts +++ b/app/client/src/sagas/ActionSagas.ts @@ -76,8 +76,6 @@ import PerformanceTracker, { } from "utils/PerformanceTracker"; import { ACTION_COPY_SUCCESS, - ACTION_CREATED_SUCCESS, - ACTION_DELETE_SUCCESS, ACTION_MOVE_SUCCESS, createMessage, ERROR_ACTION_COPY_FAIL, @@ -145,14 +143,6 @@ export function* createActionSaga( ); const isValidResponse = yield validateResponse(response); if (isValidResponse) { - const actionName = actionPayload.payload.name - ? actionPayload.payload.name - : ""; - Toaster.show({ - text: createMessage(ACTION_CREATED_SUCCESS, actionName), - variant: Variant.success, - }); - const pageName = yield select( getCurrentPageNameByActionId, response.data.id, @@ -379,59 +369,56 @@ export function* deleteActionSaga( id, ); const isValidResponse = yield validateResponse(response); - if (isValidResponse) { - Toaster.show({ - text: createMessage(ACTION_DELETE_SUCCESS, response.data.name), - variant: Variant.success, - }); - if (isApi) { - const pageName = yield select(getCurrentPageNameByActionId, id); - AnalyticsUtil.logEvent("DELETE_API", { - apiName: name, - pageName, - apiID: id, - }); - } - if (isSaas) { - const pageName = yield select(getCurrentPageNameByActionId, id); - AnalyticsUtil.logEvent("DELETE_SAAS", { - apiName: action.name, - pageName, - apiID: id, - }); - } - if (isQuery) { - AnalyticsUtil.logEvent("DELETE_QUERY", { - queryName: action.name, - }); - } - - if (!!actionPayload.payload.onSuccess) { - actionPayload.payload.onSuccess(); - } else { - const applicationId = yield select(getCurrentApplicationId); - const pageId = yield select(getCurrentPageId); - - history.push( - INTEGRATION_EDITOR_URL(applicationId, pageId, INTEGRATION_TABS.NEW), - ); - } - - AppsmithConsole.info({ - logType: LOG_TYPE.ENTITY_DELETED, - text: "Action was deleted", - source: { - type: ENTITY_TYPE.ACTION, - name: response.data.name, - id: response.data.id, - }, - analytics: { - pluginId: action.pluginId, - }, - }); - - yield put(deleteActionSuccess({ id })); + if (!isValidResponse) { + return; } + if (isApi) { + const pageName = yield select(getCurrentPageNameByActionId, id); + AnalyticsUtil.logEvent("DELETE_API", { + apiName: name, + pageName, + apiID: id, + }); + } + if (isSaas) { + const pageName = yield select(getCurrentPageNameByActionId, id); + AnalyticsUtil.logEvent("DELETE_SAAS", { + apiName: name, + pageName, + apiID: id, + }); + } + if (isQuery) { + AnalyticsUtil.logEvent("DELETE_QUERY", { + queryName: name, + }); + } + + if (!!actionPayload.payload.onSuccess) { + actionPayload.payload.onSuccess(); + } else { + const applicationId = yield select(getCurrentApplicationId); + const pageId = yield select(getCurrentPageId); + + history.push( + INTEGRATION_EDITOR_URL(applicationId, pageId, INTEGRATION_TABS.NEW), + ); + } + + AppsmithConsole.info({ + logType: LOG_TYPE.ENTITY_DELETED, + text: "Action was deleted", + source: { + type: ENTITY_TYPE.ACTION, + name: response.data.name, + id: response.data.id, + }, + analytics: { + pluginId: action.pluginId, + }, + }); + + yield put(deleteActionSuccess({ id })); } catch (error) { yield put({ type: ReduxActionErrorTypes.DELETE_ACTION_ERROR, diff --git a/app/client/src/sagas/ErrorSagas.tsx b/app/client/src/sagas/ErrorSagas.tsx index d4c9e2ab03..50983f4853 100644 --- a/app/client/src/sagas/ErrorSagas.tsx +++ b/app/client/src/sagas/ErrorSagas.tsx @@ -78,23 +78,22 @@ export function* validateResponse(response: ApiResponse | any, show = true) { } if (response.responseMeta.success) { return true; - } else { - if ( - response.responseMeta.error.code === - SERVER_ERROR_CODES.INCORRECT_BINDING_LIST_OF_WIDGET - ) { - throw new IncorrectBindingError(response.responseMeta.error.message); - } else { - yield put({ - type: ReduxActionErrorTypes.API_ERROR, - payload: { - error: response.responseMeta.error, - show, - }, - }); - throw Error(response.responseMeta.error.message); - } } + if ( + response.responseMeta.error.code === + SERVER_ERROR_CODES.INCORRECT_BINDING_LIST_OF_WIDGET + ) { + throw new IncorrectBindingError(response.responseMeta.error.message); + } + + yield put({ + type: ReduxActionErrorTypes.API_ERROR, + payload: { + error: response.responseMeta.error, + show, + }, + }); + throw Error(response.responseMeta.error.message); } export function getResponseErrorMessage(response: ApiResponse) {