Skip to content
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

EPMRPP-87386 || Сorrect the display of the Delete account button #3640

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/src/controllers/administrate/projects/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 }
Expand Down
6 changes: 3 additions & 3 deletions app/src/controllers/administrate/projects/reducer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion app/src/controllers/appInfo/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions app/src/controllers/appInfo/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import {
ANALYICS_INSTANCE_KEY,
ANALYTICS_INSTANCE_KEY,
ANALYTICS_ALL_KEY,
OLD_HISTORY_KEY,
GA_MEASUREMENT_ID,
Expand Down Expand Up @@ -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 || [];
Expand Down
12 changes: 6 additions & 6 deletions app/src/controllers/user/actionCreators.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
});

Expand Down
6 changes: 3 additions & 3 deletions app/src/controllers/user/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
6 changes: 3 additions & 3 deletions app/src/controllers/user/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions app/src/controllers/user/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions app/src/controllers/user/reducer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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',
Expand All @@ -163,7 +163,7 @@ describe('user reducer', () => {
};
expect(
userAssignedProjectReducer(oldState, {
type: ASSIGN_TO_RROJECT_SUCCESS,
type: ASSIGN_TO_PROJECT_SUCCESS,
payload: payloadProject,
}),
).toEqual(assignResult);
Expand Down
4 changes: 2 additions & 2 deletions app/src/controllers/user/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -268,7 +268,7 @@ function* watchFetchUser() {
}

function* watchAssignToProject() {
yield takeLatest(ASSIGN_TO_RROJECT, assignToProject);
yield takeLatest(ASSIGN_TO_PROJECT, assignToProject);
}

function* watchUnassignFromProject() {
Expand Down
6 changes: 5 additions & 1 deletion app/src/pages/inside/profilePage/profilePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -85,6 +86,7 @@ const getNavigationTabsConfig = (formatMessage) => ({

@connect((state) => ({
activeTab: userProfileRouteSelector(state),
allowDeleteAccount: allowDeleteAccountSelector(state),
}))
@injectIntl
@track({ page: PROFILE_PAGE })
Expand All @@ -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) }];
Expand All @@ -117,7 +121,7 @@ export class ProfilePage extends Component {
</div>
<div className={cx('footer')}>
<LocalizationBlock />
<DeleteAccountBlock />
{this.props.allowDeleteAccount && <DeleteAccountBlock />}
</div>
</section>
</div>
Expand Down
Loading