diff --git a/app/src/controllers/administrate/projects/reducer.js b/app/src/controllers/administrate/projects/reducer.js index e8d2253083..cf3d345981 100644 --- a/app/src/controllers/administrate/projects/reducer.js +++ b/app/src/controllers/administrate/projects/reducer.js @@ -20,7 +20,7 @@ import { paginationReducer } from 'controllers/pagination'; import { loadingReducer } from 'controllers/loading'; import { PROJECTS_PAGE } from 'controllers/pages'; import { groupOperationsReducer } from 'controllers/groupOperations'; -import { ASSIGN_TO_RROJECT_SUCCESS, UNASSIGN_FROM_PROJECT_SUCCESS } from 'controllers/user'; +import { ASSIGN_TO_PROJECT_SUCCESS, UNASSIGN_FROM_PROJECT_SUCCESS } from 'controllers/user'; import { queueReducers } from 'common/utils/queueReducers'; import { createPageScopedReducer } from 'common/utils/createPageScopedReducer'; import { NAMESPACE, SET_PROJECTS_VIEW_MODE, GRID_VIEW } from './constants'; @@ -42,7 +42,7 @@ export const projectFetchReducer = fetchReducer(NAMESPACE, { export const assignProjectReducer = (state = [], { type, payload }) => { switch (type) { - case ASSIGN_TO_RROJECT_SUCCESS: + case ASSIGN_TO_PROJECT_SUCCESS: return state.map((project) => project.projectName === payload.projectName ? { ...project, usersQuantity: project.usersQuantity + 1 } diff --git a/app/src/controllers/administrate/projects/reducer.test.js b/app/src/controllers/administrate/projects/reducer.test.js index fb2b3d6486..c24be45e84 100644 --- a/app/src/controllers/administrate/projects/reducer.test.js +++ b/app/src/controllers/administrate/projects/reducer.test.js @@ -14,7 +14,7 @@ * limitations under the License. */ -import { ASSIGN_TO_RROJECT_SUCCESS, UNASSIGN_FROM_PROJECT_SUCCESS } from 'controllers/user'; +import { ASSIGN_TO_PROJECT_SUCCESS, UNASSIGN_FROM_PROJECT_SUCCESS } from 'controllers/user'; import { FETCH_SUCCESS } from 'controllers/fetch'; import { SET_PROJECTS_VIEW_MODE, TABLE_VIEW, GRID_VIEW, NAMESPACE } from './constants'; import { setViewModeReducer, assignProjectReducer, projectFetchReducer } from './reducer'; @@ -133,12 +133,12 @@ describe('projects reducer', () => { expect(assignProjectReducer(oldState, [{ id: 2 }])).toBe(oldState); }); - test('should handle ASSIGN_TO_RROJECT_SUCCESS', () => { + test('should handle ASSIGN_TO_PROJECT_SUCCESS', () => { const payload = { projectName: PROJECTS[0].projectName, }; const newState = assignProjectReducer(PROJECTS, { - type: ASSIGN_TO_RROJECT_SUCCESS, + type: ASSIGN_TO_PROJECT_SUCCESS, payload, }); expect(newState).toEqual(PROJECTS_AFTER_ASSIGN); diff --git a/app/src/controllers/appInfo/constants.js b/app/src/controllers/appInfo/constants.js index 440b82ccfc..d0a2b22f06 100644 --- a/app/src/controllers/appInfo/constants.js +++ b/app/src/controllers/appInfo/constants.js @@ -15,7 +15,7 @@ */ export const APP_INFO_NAMESPACE = 'appInfo'; -export const ANALYICS_INSTANCE_KEY = 'server.details.instance'; +export const ANALYTICS_INSTANCE_KEY = 'server.details.instance'; export const ANALYTICS_ALL_KEY = 'server.analytics.all'; export const OLD_HISTORY_KEY = 'history_old'; export const GA_MEASUREMENT_ID = 'ga_measurement_id'; diff --git a/app/src/controllers/appInfo/selectors.js b/app/src/controllers/appInfo/selectors.js index 1476810199..b2b1934b8a 100644 --- a/app/src/controllers/appInfo/selectors.js +++ b/app/src/controllers/appInfo/selectors.js @@ -15,7 +15,7 @@ */ import { - ANALYICS_INSTANCE_KEY, + ANALYTICS_INSTANCE_KEY, ANALYTICS_ALL_KEY, OLD_HISTORY_KEY, GA_MEASUREMENT_ID, @@ -43,7 +43,7 @@ const apiJobsSelector = (state) => apiInfoSelector(state).jobs || {}; const extensionsSelector = (state) => apiInfoSelector(state).extensions || {}; const extensionsConfigSelector = (state) => extensionsSelector(state).result || {}; export const instanceIdSelector = (state) => - extensionsConfigSelector(state)[ANALYICS_INSTANCE_KEY] || ''; + extensionsConfigSelector(state)[ANALYTICS_INSTANCE_KEY] || ''; export const analyticsEnabledSelector = (state) => extensionsConfigSelector(state)[ANALYTICS_ALL_KEY] === 'true'; export const analyzerExtensionsSelector = (state) => extensionsSelector(state).analyzers || []; diff --git a/app/src/controllers/user/actionCreators.js b/app/src/controllers/user/actionCreators.js index f6c54bd1aa..52fe2012e7 100644 --- a/app/src/controllers/user/actionCreators.js +++ b/app/src/controllers/user/actionCreators.js @@ -19,9 +19,9 @@ import { SET_START_TIME_FORMAT, SET_API_KEYS, SET_PHOTO_TIME_STAMP, - ASSIGN_TO_RROJECT, - ASSIGN_TO_RROJECT_SUCCESS, - ASSIGN_TO_RROJECT_ERROR, + ASSIGN_TO_PROJECT, + ASSIGN_TO_PROJECT_SUCCESS, + ASSIGN_TO_PROJECT_ERROR, UNASSIGN_FROM_PROJECT, UNASSIGN_FROM_PROJECT_SUCCESS, FETCH_API_KEYS, @@ -95,17 +95,17 @@ export const setStartTimeFormatAction = (format) => ({ }); export const assignToProjectAction = (project) => ({ - type: ASSIGN_TO_RROJECT, + type: ASSIGN_TO_PROJECT, payload: project, }); export const assignToProjectSuccessAction = (projectInfo) => ({ - type: ASSIGN_TO_RROJECT_SUCCESS, + type: ASSIGN_TO_PROJECT_SUCCESS, payload: projectInfo, }); export const assignToProjectErrorAction = (projectInfo) => ({ - type: ASSIGN_TO_RROJECT_ERROR, + type: ASSIGN_TO_PROJECT_ERROR, payload: projectInfo, }); diff --git a/app/src/controllers/user/constants.js b/app/src/controllers/user/constants.js index bc39ef9842..80ad9831d3 100644 --- a/app/src/controllers/user/constants.js +++ b/app/src/controllers/user/constants.js @@ -29,9 +29,9 @@ export const SETTINGS_INITIAL_STATE = { photoTimeStamp: Date.now(), }; -export const ASSIGN_TO_RROJECT = 'assignToProject'; -export const ASSIGN_TO_RROJECT_SUCCESS = 'assignToProjectSuccess'; -export const ASSIGN_TO_RROJECT_ERROR = 'assignToProjectError'; +export const ASSIGN_TO_PROJECT = 'assignToProject'; +export const ASSIGN_TO_PROJECT_SUCCESS = 'assignToProjectSuccess'; +export const ASSIGN_TO_PROJECT_ERROR = 'assignToProjectError'; export const UNASSIGN_FROM_PROJECT = 'unassignFromProject'; export const UNASSIGN_FROM_PROJECT_SUCCESS = 'unassignFromProjectSuccess'; diff --git a/app/src/controllers/user/index.js b/app/src/controllers/user/index.js index bb4b6da2a9..4608882069 100644 --- a/app/src/controllers/user/index.js +++ b/app/src/controllers/user/index.js @@ -17,9 +17,9 @@ export { START_TIME_FORMAT_ABSOLUTE, START_TIME_FORMAT_RELATIVE, - ASSIGN_TO_RROJECT, - ASSIGN_TO_RROJECT_SUCCESS, - ASSIGN_TO_RROJECT_ERROR, + ASSIGN_TO_PROJECT, + ASSIGN_TO_PROJECT_SUCCESS, + ASSIGN_TO_PROJECT_ERROR, UNASSIGN_FROM_PROJECT_SUCCESS, SET_ACTIVE_PROJECT, FETCH_USER_SUCCESS, diff --git a/app/src/controllers/user/reducer.js b/app/src/controllers/user/reducer.js index 827586c466..8e98af1694 100644 --- a/app/src/controllers/user/reducer.js +++ b/app/src/controllers/user/reducer.js @@ -20,7 +20,7 @@ import { SET_START_TIME_FORMAT, SETTINGS_INITIAL_STATE, SET_PHOTO_TIME_STAMP, - ASSIGN_TO_RROJECT_SUCCESS, + ASSIGN_TO_PROJECT_SUCCESS, UNASSIGN_FROM_PROJECT_SUCCESS, FETCH_USER_SUCCESS, SET_API_KEYS, @@ -41,7 +41,7 @@ export const settingsReducer = (state = SETTINGS_INITIAL_STATE, { type, payload export const userAssignedProjectReducer = (state = {}, { type, payload }) => { switch (type) { - case ASSIGN_TO_RROJECT_SUCCESS: { + case ASSIGN_TO_PROJECT_SUCCESS: { const { projectName, projectRole, entryType } = payload; return { ...state, @@ -73,7 +73,7 @@ export const userInfoReducer = (state = {}, { type, payload }) => { switch (type) { case FETCH_USER_SUCCESS: return payload; - case ASSIGN_TO_RROJECT_SUCCESS: + case ASSIGN_TO_PROJECT_SUCCESS: case UNASSIGN_FROM_PROJECT_SUCCESS: return { ...state, diff --git a/app/src/controllers/user/reducer.test.js b/app/src/controllers/user/reducer.test.js index 0e131a6561..a2dd665b37 100644 --- a/app/src/controllers/user/reducer.test.js +++ b/app/src/controllers/user/reducer.test.js @@ -22,7 +22,7 @@ import { SETTINGS_INITIAL_STATE, START_TIME_FORMAT_ABSOLUTE, SET_PHOTO_TIME_STAMP, - ASSIGN_TO_RROJECT_SUCCESS, + ASSIGN_TO_PROJECT_SUCCESS, UNASSIGN_FROM_PROJECT_SUCCESS, SET_API_KEYS, } from './constants'; @@ -145,7 +145,7 @@ describe('user reducer', () => { expect(userAssignedProjectReducer(oldState, { type: 'foo' })).toBe(oldState); }); - test('should handle ASSIGN_TO_RROJECT_SUCCESS', () => { + test('should handle ASSIGN_TO_PROJECT_SUCCESS', () => { const payloadProject = { projectName: 'superadmin_personal', entryType: 'INTERNAL', @@ -163,7 +163,7 @@ describe('user reducer', () => { }; expect( userAssignedProjectReducer(oldState, { - type: ASSIGN_TO_RROJECT_SUCCESS, + type: ASSIGN_TO_PROJECT_SUCCESS, payload: payloadProject, }), ).toEqual(assignResult); diff --git a/app/src/controllers/user/sagas.js b/app/src/controllers/user/sagas.js index b5aafa016e..a94a76b798 100644 --- a/app/src/controllers/user/sagas.js +++ b/app/src/controllers/user/sagas.js @@ -22,7 +22,7 @@ import { PROJECT_MANAGER } from 'common/constants/projectRoles'; import { getStorageItem, setStorageItem } from 'common/utils/storageUtils'; import { userIdSelector, userInfoSelector } from './selectors'; import { - ASSIGN_TO_RROJECT, + ASSIGN_TO_PROJECT, UNASSIGN_FROM_PROJECT, SET_ACTIVE_PROJECT, ADD_API_KEY, @@ -268,7 +268,7 @@ function* watchFetchUser() { } function* watchAssignToProject() { - yield takeLatest(ASSIGN_TO_RROJECT, assignToProject); + yield takeLatest(ASSIGN_TO_PROJECT, assignToProject); } function* watchUnassignFromProject() { diff --git a/app/src/pages/inside/profilePage/profilePage.jsx b/app/src/pages/inside/profilePage/profilePage.jsx index 1c0ce463a7..d3630acbde 100644 --- a/app/src/pages/inside/profilePage/profilePage.jsx +++ b/app/src/pages/inside/profilePage/profilePage.jsx @@ -23,6 +23,7 @@ import { connect } from 'react-redux'; import { PageLayout, PageHeader } from 'layouts/pageLayout'; import { PROFILE_PAGE } from 'components/main/analytics/events'; import { userProfileRouteSelector, USER_PROFILE_SUB_PAGE } from 'controllers/pages'; +import { allowDeleteAccountSelector } from 'controllers/appInfo/selectors'; import { NavigationTabs } from 'components/main/navigationTabs'; import { API_KEYS_ROUTE, @@ -85,6 +86,7 @@ const getNavigationTabsConfig = (formatMessage) => ({ @connect((state) => ({ activeTab: userProfileRouteSelector(state), + allowDeleteAccount: allowDeleteAccountSelector(state), })) @injectIntl @track({ page: PROFILE_PAGE }) @@ -93,11 +95,13 @@ export class ProfilePage extends Component { intl: PropTypes.object.isRequired, activeTab: PropTypes.string, dispatch: PropTypes.func, + allowDeleteAccount: PropTypes.bool, }; static defaultProps = { activeTab: PROJECT_ASSIGNMENT_ROUTE, dispatch: () => {}, + allowDeleteAccount: false, }; getBreadcrumbs = () => [{ title: this.props.intl.formatMessage(messages.profilePageTitle) }]; @@ -117,7 +121,7 @@ export class ProfilePage extends Component {
- + {this.props.allowDeleteAccount && }