Skip to content

Commit f7e35b6

Browse files
author
vikasrohit
authored
Merge pull request #3830 from appirio-tech/dev
Prod release 2.8
2 parents db556d1 + c1b2f4f commit f7e35b6

File tree

79 files changed

+1583
-809
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1583
-809
lines changed

package-lock.json

Lines changed: 431 additions & 326 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/actions/loadUser.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,14 @@ export function loadUserFailure(dispatch) {
146146
function loadGroups(dispatch, userId) {
147147
if (userId) {
148148
getUserGroups(userId, 'user').then((groups) => {
149-
const groupIds = _.map(groups, group => group.id)
150-
loadOrganizationConfigSuccess(dispatch, _.join(groupIds, ','))
149+
const groupIds = _.compact(_.uniq([
150+
// get old and new ids as organizations may refer to any of them
151+
..._.map(groups, 'oldId'),
152+
..._.map(groups, 'id')
153+
]))
154+
if (groupIds.length > 0) {
155+
loadOrganizationConfigSuccess(dispatch, _.join(groupIds, ','))
156+
}
151157
})
152158
.catch((err) => {
153159
// if we fail to load groups

src/api/groups.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import _ from 'lodash'
21
import { axiosInstance as axios } from './requestInterceptor'
32
import { TC_API_URL } from '../config/constants'
43

@@ -12,8 +11,6 @@ import { TC_API_URL } from '../config/constants'
1211
* @returns {Promise<Object>} user groups data
1312
*/
1413
export function getUserGroups(memberId, membershipType) {
15-
return axios.get(`${TC_API_URL}/v3/groups?memberId=${memberId}&membershipType=${membershipType}`)
16-
.then(resp => {
17-
return _.get(resp.data, 'result.content', {})
18-
})
14+
return axios.get(`${TC_API_URL}/v5/groups?memberId=${memberId}&membershipType=${membershipType}`)
15+
.then(resp => resp.data)
1916
}

src/api/projectAttachments.js

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
import { axiosInstance as axios } from './requestInterceptor'
2-
import { PROJECTS_API_URL, FILE_PICKER_SUBMISSION_CONTAINER_NAME } from '../config/constants'
2+
import { PROJECTS_API_URL, FILE_PICKER_SUBMISSION_CONTAINER_NAME, ATTACHMENT_TYPE_FILE } from '../config/constants'
33

4-
export function addProjectAttachment(projectId, fileData) {
5-
// add s3 bucket prop
6-
fileData.s3Bucket = FILE_PICKER_SUBMISSION_CONTAINER_NAME
7-
return axios.post(`${PROJECTS_API_URL}/v5/projects/${projectId}/attachments`, fileData)
4+
export function addProjectAttachment(projectId, attachment) {
5+
6+
if (attachment.type === ATTACHMENT_TYPE_FILE) {
7+
// add s3 bucket prop
8+
attachment.s3Bucket = FILE_PICKER_SUBMISSION_CONTAINER_NAME
9+
}
10+
11+
// The api takes only arrays
12+
if (!attachment.tags) {
13+
attachment.tags = []
14+
}
15+
16+
return axios.post(`${PROJECTS_API_URL}/v5/projects/${projectId}/attachments`, attachment)
817
.then( resp => {
918
resp.data.downloadUrl = `/projects/${projectId}/attachments/${resp.data.id}`
1019
return resp.data
@@ -19,6 +28,14 @@ export function updateProjectAttachment(projectId, attachmentId, attachment) {
1928
}
2029
}
2130

31+
// The api takes only arrays
32+
if (attachment && !attachment.tags) {
33+
attachment = {
34+
...attachment,
35+
tags: []
36+
}
37+
}
38+
2239
return axios.patch(
2340
`${PROJECTS_API_URL}/v5/projects/${projectId}/attachments/${attachmentId}`, attachment)
2441
.then ( resp => {

src/api/projectMemberInvites.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,27 @@ import { PROJECTS_API_URL } from '../config/constants'
44
/**
55
* Update project member invite based on project's id & given member
66
* @param {integer} projectId unique identifier of the project
7-
* @param {object} member invite to update
7+
* @param {integer} inviteId unique identifier of the invite
8+
* @param {string} status the new status for invitation
89
* @return {object} project member invite returned by api
910
*/
10-
export function updateProjectMemberInvite(projectId, member) {
11-
const url = `${PROJECTS_API_URL}/v5/projects/${projectId}/members/invite/`
12-
return axios.put(url, member)
11+
export function updateProjectMemberInvite(projectId, inviteId, status) {
12+
const url = `${PROJECTS_API_URL}/v5/projects/${projectId}/invites/${inviteId}`
13+
return axios.patch(url, { status })
1314
.then(resp => resp.data)
1415
}
1516

17+
/**
18+
* Delete project member invite based on project's id & given invite's id
19+
* @param {integer} projectId unique identifier of the project
20+
* @param {integer} inviteId unique identifier of the invite
21+
* @return {object} project member invite returned by api
22+
*/
23+
export function deleteProjectMemberInvite(projectId, inviteId) {
24+
const url = `${PROJECTS_API_URL}/v5/projects/${projectId}/invites/${inviteId}`
25+
return axios.delete(url)
26+
}
27+
1628
/**
1729
* Create a project member invite based on project's id & given member
1830
* @param {integer} projectId unique identifier of the project
@@ -21,7 +33,7 @@ export function updateProjectMemberInvite(projectId, member) {
2133
*/
2234
export function createProjectMemberInvite(projectId, member) {
2335
const fields = 'id,projectId,userId,email,role,status,createdAt,updatedAt,createdBy,updatedBy,handle'
24-
const url = `${PROJECTS_API_URL}/v5/projects/${projectId}/members/invite/?fields=` + encodeURIComponent(fields)
36+
const url = `${PROJECTS_API_URL}/v5/projects/${projectId}/invites/?fields=` + encodeURIComponent(fields)
2537
return axios({
2638
method: 'post',
2739
url,
@@ -35,7 +47,7 @@ export function createProjectMemberInvite(projectId, member) {
3547

3648
export function getProjectMemberInvites(projectId) {
3749
const fields = 'id,projectId,userId,email,role,status,createdAt,updatedAt,createdBy,updatedBy,handle'
38-
const url = `${PROJECTS_API_URL}/v5/projects/${projectId}/members/invites/?fields=`
50+
const url = `${PROJECTS_API_URL}/v5/projects/${projectId}/invites/?fields=`
3951
+ encodeURIComponent(fields)
4052
return axios.get(url)
4153
.then( resp => {
@@ -49,6 +61,6 @@ export function getProjectMemberInvites(projectId) {
4961
* @return {object} project member invite returned by api
5062
*/
5163
export function getProjectInviteById(projectId) {
52-
return axios.get(`${PROJECTS_API_URL}/v5/projects/${projectId}/members/invite/`)
64+
return axios.get(`${PROJECTS_API_URL}/v5/projects/${projectId}/invites`)
5365
.then(resp => resp.data)
5466
}

src/assets/icons/v.2.5/curve-mask-horizontal.svg

Lines changed: 1 addition & 1 deletion
Loading

src/assets/icons/v.2.5/curve-mask-vertical.svg

Lines changed: 1 addition & 1 deletion
Loading

src/assets/icons/v.2.5/project-type-solutions.svg

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/assets/icons/v.2.5/project-type-talent-as-a-service.svg

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)