diff --git a/config/constants/development.js b/config/constants/development.js index e1bb7da1..f4d30341 100644 --- a/config/constants/development.js +++ b/config/constants/development.js @@ -10,7 +10,6 @@ module.exports = { ACCOUNTS_APP_LOGIN_URL: `https://accounts-auth0.${DOMAIN}`, COMMUNITY_APP_URL: `https://www.${DOMAIN}`, MEMBER_API_URL: `${DEV_API_HOSTNAME}/v5/members`, - MEMBER_API_V3_URL: `${DEV_API_HOSTNAME}/v3/members`, CHALLENGE_API_URL: `${DEV_API_HOSTNAME}/v5/challenges`, CHALLENGE_TIMELINE_TEMPLATES_URL: `${DEV_API_HOSTNAME}/v5/timeline-templates`, CHALLENGE_TYPES_URL: `${DEV_API_HOSTNAME}/v5/challenge-types`, diff --git a/config/constants/production.js b/config/constants/production.js index f3f8af81..29c73f3e 100644 --- a/config/constants/production.js +++ b/config/constants/production.js @@ -10,7 +10,6 @@ module.exports = { ACCOUNTS_APP_LOGIN_URL: `https://accounts-auth0.${DOMAIN}`, COMMUNITY_APP_URL: `https://www.${DOMAIN}`, MEMBER_API_URL: `${PROD_API_HOSTNAME}/v5/members`, - MEMBER_API_V3_URL: `${PROD_API_HOSTNAME}/v3/members`, CHALLENGE_API_URL: `${PROD_API_HOSTNAME}/v5/challenges`, CHALLENGE_TIMELINE_TEMPLATES_URL: `${PROD_API_HOSTNAME}/v5/timeline-templates`, CHALLENGE_TYPES_URL: `${PROD_API_HOSTNAME}/v5/challenge-types`, diff --git a/src/actions/challenges.js b/src/actions/challenges.js index 17a6bcb3..58050ea4 100644 --- a/src/actions/challenges.js +++ b/src/actions/challenges.js @@ -62,6 +62,7 @@ import { removeChallengeFromPhaseProduct, saveChallengeAsPhaseProduct } from '.. * @param {number} page * @param {string} projectId * @param {string} status + * @param {boolean} dashboard is in dashboard or not * @param {string} filterChallengeName * @param {bool} selfService * @param {string} userHandle this will be null for admin user(we will return all datas for admin user) @@ -77,6 +78,7 @@ export function loadChallengesByPage ( page, projectId, status, + dashboard, filterChallengeName = null, selfService = false, userHandle = null, @@ -156,16 +158,21 @@ export function loadChallengesByPage ( filters['memberId'] = userId } - if (status === 'all') { - delete filters['status'] - } else if (!_.isEmpty(status)) { - filters['status'] = status === '' ? undefined : _.startCase(status.toLowerCase()) - } else if (!(_.isInteger(projectId) && projectId > 0)) { + if (status !== 'all') { + filters['status'] = !status ? undefined : _.startCase(status.toLowerCase()) + } + + if (!dashboard && !filters['status'] && !(_.isInteger(projectId) && projectId > 0)) { filters['status'] = 'Active' } if (selfService) { filters.selfService = true - if (userHandle && filters.status.toUpperCase() !== CHALLENGE_STATUS.DRAFT && filters.status.toUpperCase() !== CHALLENGE_STATUS.NEW) { + const filtersStatus = filters.status ? filters.status.toUpperCase() : filters.status + if ( + userHandle && + filtersStatus !== CHALLENGE_STATUS.DRAFT && + filtersStatus !== CHALLENGE_STATUS.NEW + ) { filters.selfServiceCopilot = userHandle } } diff --git a/src/components/ChallengesComponent/ChallengeList/index.js b/src/components/ChallengesComponent/ChallengeList/index.js index 2dc5754a..57b63282 100644 --- a/src/components/ChallengesComponent/ChallengeList/index.js +++ b/src/components/ChallengesComponent/ChallengeList/index.js @@ -31,7 +31,7 @@ require('bootstrap/scss/bootstrap.scss') const defaultSearchParam = { searchText: '', challengeProjectOption: null, - challengeStatus: '', + challengeStatus: 'all', challengeType: null, sortBy: 'startDate', sortOrder: 'desc', @@ -112,7 +112,8 @@ class ChallengeList extends Component { loadChallengesByPage( 1, projectId, - !projectStatus ? 'all' : projectStatus, + projectStatus, + dashboard, searchText, selfService, this.getHandle(), @@ -150,6 +151,7 @@ class ChallengeList extends Component { pageNumber, projectId, status, + dashboard, searchText, selfService, this.getHandle(), @@ -188,6 +190,7 @@ class ChallengeList extends Component { 1, projectId, status, + dashboard, searchText, selfService, this.getHandle(), @@ -211,12 +214,14 @@ class ChallengeList extends Component { loadChallengesByPage, activeProjectId, status, - selfService + selfService, + dashboard } = this.props loadChallengesByPage( page, activeProjectId, status, + dashboard, searchText, selfService, this.getHandle(), @@ -301,6 +306,7 @@ class ChallengeList extends Component { page, projectId, status, + dashboard, searchText, selfService, this.getHandle(), @@ -346,15 +352,16 @@ class ChallengeList extends Component { loadChallengesByPage( 1, projectId, - 'all', - '', + defaultSearchParam.challengeStatus, + dashboard, + defaultSearchParam.searchText, selfService, this.getHandle(), this.getLoginUserId(), - null, - {}, - null, - null, + defaultSearchParam.challengeType, + defaultSearchParam.challengeDate, + defaultSearchParam.sortBy, + defaultSearchParam.sortOrder, PAGE_SIZE ) } diff --git a/src/components/SelectUserAutocomplete/index.js b/src/components/SelectUserAutocomplete/index.js index 7c87f729..ccadc5c3 100644 --- a/src/components/SelectUserAutocomplete/index.js +++ b/src/components/SelectUserAutocomplete/index.js @@ -7,7 +7,7 @@ import React, { useState, useCallback } from 'react' import PropTypes from 'prop-types' import Select from '../Select' -import { suggestProfilesV5, fetchProfileV5 } from '../../services/user' +import { suggestProfiles, fetchProfile } from '../../services/user' import _ from 'lodash' import { AUTOCOMPLETE_MIN_LENGTH, AUTOCOMPLETE_DEBOUNCE_TIME_MS } from '../../config/constants' @@ -27,7 +27,7 @@ export default function SelectUserAutocomplete (props) { return } - Promise.all([suggestProfilesV5(inputValue), fetchProfileV5(inputValue)]).then( + Promise.all([suggestProfiles(inputValue), fetchProfile(inputValue)]).then( ([suggestions, user]) => { const suggestedOptions = suggestions.map((u) => ({ label: u.handle, diff --git a/src/components/Tab/index.js b/src/components/Tab/index.js index 01649259..0a8c9bf9 100644 --- a/src/components/Tab/index.js +++ b/src/components/Tab/index.js @@ -28,6 +28,13 @@ const Tab = ({ selectTab(3) } + const onSelfServiceClick = () => { + if (currentTab === 4) { + return + } + selectTab(4) + } + const tabComponent = (