Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rex Dri
Rex Dri
Commits
81886f4f
Verified
Commit
81886f4f
authored
Apr 13, 2020
by
Florent Chehab
Browse files
refactor(frontend): moved buildParams
parent
e7ca842c
Changes
18
Hide whitespace changes
Inline
Side-by-side
frontend/src/components/edition/History.jsx
View file @
81886f4f
...
...
@@ -64,11 +64,6 @@ VersionInfo.propTypes = {
editFromVersion
:
PropTypes
.
func
.
isRequired
};
const
buildParams
=
modelInfo
=>
{
const
{
contentTypeId
,
id
}
=
modelInfo
;
return
RequestParams
.
Builder
.
withEndPointAttrs
([
contentTypeId
,
id
]).
build
();
};
function
History
({
versions
,
renderTitle
,
...
...
@@ -149,6 +144,11 @@ History.propTypes = {
rawModelDataEx
:
PropTypes
.
object
.
isRequired
};
const
buildParams
=
modelInfo
=>
{
const
{
contentTypeId
,
id
}
=
modelInfo
;
return
RequestParams
.
Builder
.
withEndPointAttrs
([
contentTypeId
,
id
]).
build
();
};
export
default
compose
(
withNetworkWrapper
([
new
NetWrapParam
(
"
versions
"
,
"
all
"
,
{
...
...
frontend/src/components/edition/PendingModeration.jsx
View file @
81886f4f
...
...
@@ -60,11 +60,6 @@ PendingModerationInfo.propTypes = {
editFromPending
:
PropTypes
.
func
.
isRequired
};
const
buildParams
=
modelInfo
=>
{
const
{
contentTypeId
,
id
}
=
modelInfo
;
return
RequestParams
.
Builder
.
withEndPointAttrs
([
contentTypeId
,
id
]).
build
();
};
function
PendingModeration
({
pendingModeration
,
editFromPendingModeration
,
...
...
@@ -124,6 +119,11 @@ PendingModeration.propTypes = {
renderCore
:
PropTypes
.
func
.
isRequired
};
const
buildParams
=
modelInfo
=>
{
const
{
contentTypeId
,
id
}
=
modelInfo
;
return
RequestParams
.
Builder
.
withEndPointAttrs
([
contentTypeId
,
id
]).
build
();
};
export
default
compose
(
withNetworkWrapper
([
new
NetWrapParam
(
"
pendingModerationObj
"
,
"
all
"
,
{
...
...
frontend/src/components/pages/PageEditExchangeFeedbacks.jsx
View file @
81886f4f
...
...
@@ -27,9 +27,6 @@ const useStyles = makeStyles(theme => ({
}
}));
const
buildParams
=
match
=>
RequestParams
.
Builder
.
withId
(
getExchangeId
(
match
)).
build
();
/**
* Page that handle the modification of exchange feedbacks.
*/
...
...
@@ -85,6 +82,9 @@ PageEditExchangeFeedbacks.propTypes = {
exchange
:
PropTypes
.
object
.
isRequired
};
const
buildParams
=
match
=>
RequestParams
.
Builder
.
withId
(
getExchangeId
(
match
)).
build
();
export
default
compose
(
withNetworkWrapper
([
new
NetWrapParam
(
"
exchanges
"
,
"
one
"
,
{
...
...
frontend/src/components/pages/PageFiles.jsx
View file @
81886f4f
...
...
@@ -16,18 +16,6 @@ function getUserIdFromUrl(match) {
return
match
.
params
.
userId
;
}
const
buildPictureParams
=
match
=>
RequestParams
.
Builder
.
withQueryParam
(
"
owner
"
,
getUserIdFromUrl
(
match
)
).
build
();
const
buildFilesParams
=
match
=>
RequestParams
.
Builder
.
withQueryParam
(
"
owner
"
,
getUserIdFromUrl
(
match
)
).
build
();
/**
* WARNING BETA files & padding
* Page that lists the files available
...
...
@@ -59,6 +47,18 @@ PageFiles.propTypes = {
files
:
PropTypes
.
array
.
isRequired
};
const
buildPictureParams
=
match
=>
RequestParams
.
Builder
.
withQueryParam
(
"
owner
"
,
getUserIdFromUrl
(
match
)
).
build
();
const
buildFilesParams
=
match
=>
RequestParams
.
Builder
.
withQueryParam
(
"
owner
"
,
getUserIdFromUrl
(
match
)
).
build
();
export
default
compose
(
withNetworkWrapper
([
new
NetWrapParam
(
"
pictures
"
,
"
all
"
,
{
...
...
frontend/src/components/recommendation/ViewListSubPage.jsx
View file @
81886f4f
...
...
@@ -8,8 +8,6 @@ import List from "./view/View";
import
withNetworkWrapper
,
{
NetWrapParam
}
from
"
../../hoc/withNetworkWrapper
"
;
import
NavigationService
from
"
../../services/NavigationService
"
;
const
buildParams
=
listId
=>
RequestParams
.
Builder
.
withId
(
listId
).
build
();
/**
* Component to display one recommendation list
*/
...
...
@@ -28,6 +26,8 @@ ViewListSubPage.propTypes = {
list
:
PropTypes
.
object
.
isRequired
};
const
buildParams
=
listId
=>
RequestParams
.
Builder
.
withId
(
listId
).
build
();
export
default
compose
(
withNetworkWrapper
([
new
NetWrapParam
(
"
recommendationLists
"
,
"
one
"
,
{
...
...
frontend/src/components/university/modules/CountryDri.jsx
View file @
81886f4f
...
...
@@ -29,9 +29,6 @@ CoreComponent.defaultProps = {
rawModelData
:
{
comment
:
""
}
};
const
buildParams
=
countryId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
countries
"
,
countryId
).
build
();
function
CountryDri
({
countryId
,
countryDriItems
})
{
const
defaultModelData
=
useMemo
(
()
=>
({
...
...
@@ -65,6 +62,9 @@ CountryDri.propTypes = {
countryDriItems
:
PropTypes
.
array
.
isRequired
};
const
buildParams
=
countryId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
countries
"
,
countryId
).
build
();
export
default
compose
(
withUnivInfo
([
"
countryId
"
]),
withNetworkWrapper
([
...
...
frontend/src/components/university/modules/CountryScholarships.jsx
View file @
81886f4f
...
...
@@ -24,9 +24,6 @@ const useStyles = makeStyles(theme => ({
}
}));
const
buildParams
=
countryId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
countries
"
,
countryId
).
build
();
function
CountryScholarships
({
countryScholarshipsItems
,
countryId
,
country
})
{
const
classes
=
useStyles
();
...
...
@@ -64,6 +61,9 @@ CountryScholarships.propTypes = {
countryScholarshipsItems
:
PropTypes
.
array
.
isRequired
};
const
buildParams
=
countryId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
countries
"
,
countryId
).
build
();
export
default
compose
(
withUnivInfo
([
"
countryId
"
,
"
country
"
]),
withNetworkWrapper
([
...
...
frontend/src/components/university/modules/SharedUnivFeedback.jsx
View file @
81886f4f
...
...
@@ -21,9 +21,6 @@ CoreComponent.propTypes = {
}).
isRequired
};
const
buildParams
=
univId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
university
"
,
univId
).
build
();
function
SharedUnivFeedback
({
feedback
})
{
return
(
<
ModuleWrapper
...
...
@@ -41,6 +38,9 @@ SharedUnivFeedback.propTypes = {
feedback
:
PropTypes
.
array
.
isRequired
};
const
buildParams
=
univId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
university
"
,
univId
).
build
();
export
default
compose
(
withUnivInfo
(),
withNetworkWrapper
([
...
...
frontend/src/components/university/modules/UniversityDri.jsx
View file @
81886f4f
...
...
@@ -26,9 +26,6 @@ CoreComponent.propTypes = {
}).
isRequired
};
const
buildParams
=
univId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
universities
"
,
univId
).
build
();
function
UniversityDri
({
univId
,
univDriItems
})
{
const
defaultModelData
=
useMemo
(
()
=>
({
...
...
@@ -62,6 +59,9 @@ UniversityDri.propTypes = {
univDriItems
:
PropTypes
.
array
.
isRequired
};
const
buildParams
=
univId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
universities
"
,
univId
).
build
();
export
default
compose
(
withUnivInfo
([
"
countryId
"
]),
withNetworkWrapper
([
...
...
frontend/src/components/university/modules/UniversityGeneral.jsx
View file @
81886f4f
...
...
@@ -79,8 +79,6 @@ CoreComponent.propTypes = {
}).
isRequired
};
const
buildParams
=
univId
=>
RequestParams
.
Builder
.
withId
(
univId
).
build
();
function
UniversityGeneral
({
university
,
city
,
country
})
{
return
(
<
ModuleWrapper
...
...
@@ -104,6 +102,8 @@ UniversityGeneral.propTypes = {
university
:
PropTypes
.
object
.
isRequired
};
const
buildParams
=
univId
=>
RequestParams
.
Builder
.
withId
(
univId
).
build
();
export
default
compose
(
withUnivInfo
([
"
city
"
,
"
country
"
]),
withNetworkWrapper
([
...
...
frontend/src/components/university/modules/UniversityOffers.jsx
View file @
81886f4f
...
...
@@ -142,12 +142,6 @@ function renderEl(dataEl) {
return
<
Item
key
=
{
p
.
id
}
{
...
p
}
/>;
}
const
buildParams
=
(
univId
,
page
)
=>
RequestParams
.
Builder
.
withQueryParam
(
"
university
"
,
univId
)
.
withQueryParam
(
"
page
"
,
page
)
.
withQueryParam
(
"
page_size
"
,
3
)
.
build
();
function
UniversityOffers
({
offers
,
goToPage
})
{
const
classes
=
useStyles
();
...
...
@@ -183,6 +177,12 @@ UniversityOffers.propTypes = {
goToPage
:
PropTypes
.
func
.
isRequired
};
const
buildParams
=
(
univId
,
page
)
=>
RequestParams
.
Builder
.
withQueryParam
(
"
university
"
,
univId
)
.
withQueryParam
(
"
page
"
,
page
)
.
withQueryParam
(
"
page_size
"
,
3
)
.
build
();
const
ConnectedComponent
=
compose
(
withUnivInfo
(),
withNetworkWrapper
([
...
...
frontend/src/components/university/modules/UniversityScholarships.jsx
View file @
81886f4f
...
...
@@ -23,9 +23,6 @@ const useStyles = makeStyles(theme => ({
}
}));
const
buildParams
=
univId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
universities
"
,
univId
).
build
();
function
UniversityScholarships
({
univId
,
univScholarshipsItems
})
{
const
classes
=
useStyles
();
...
...
@@ -62,6 +59,9 @@ UniversityScholarships.propTypes = {
univScholarshipsItems
:
PropTypes
.
array
.
isRequired
};
const
buildParams
=
univId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
universities
"
,
univId
).
build
();
export
default
compose
(
withUnivInfo
(),
withNetworkWrapper
([
...
...
frontend/src/components/university/modules/UniversitySemestersDates.jsx
View file @
81886f4f
...
...
@@ -123,8 +123,6 @@ CoreComponent.propTypes = {
}).
isRequired
};
const
buildParams
=
univId
=>
RequestParams
.
Builder
.
withId
(
univId
).
build
();
function
UniversitySemestersDates
({
semestersDates
})
{
return
(
<
ModuleWrapper
...
...
@@ -140,6 +138,8 @@ UniversitySemestersDates.propTypes = {
semestersDates
:
PropTypes
.
object
.
isRequired
};
const
buildParams
=
univId
=>
RequestParams
.
Builder
.
withId
(
univId
).
build
();
export
default
compose
(
withUnivInfo
(),
withNetworkWrapper
([
...
...
frontend/src/components/university/modules/previousExchangeFeedback/edit/EditModuleCoursesFeedback.jsx
View file @
81886f4f
...
...
@@ -53,9 +53,6 @@ const useStyles = makeStyles(theme => ({
}
}));
const
buildParams
=
exchangeId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
course__exchange
"
,
exchangeId
).
build
();
function
EditModuleCoursesFeedback
({
courseFeedbacks
})
{
const
classes
=
useStyles
();
...
...
@@ -124,6 +121,9 @@ EditModuleCoursesFeedback.propTypes = {
courseFeedbacks
:
PropTypes
.
array
.
isRequired
};
const
buildParams
=
exchangeId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
course__exchange
"
,
exchangeId
).
build
();
export
default
compose
(
withNetworkWrapper
([
new
NetWrapParam
(
"
courseFeedbacks
"
,
"
all
"
,
{
...
...
frontend/src/components/university/modules/previousExchangeFeedback/edit/EditModuleGeneralFeedback.jsx
View file @
81886f4f
...
...
@@ -39,9 +39,6 @@ CoreComponent.propTypes = {
}).
isRequired
};
const
buildParams
=
exchangeId
=>
RequestParams
.
Builder
.
withId
(
exchangeId
).
build
();
function
EditModuleGeneralFeedback
({
generalFeedback
})
{
return
(
<
ModuleWrapper
...
...
@@ -57,6 +54,9 @@ EditModuleGeneralFeedback.propTypes = {
generalFeedback
:
PropTypes
.
object
.
isRequired
};
const
buildParams
=
exchangeId
=>
RequestParams
.
Builder
.
withId
(
exchangeId
).
build
();
export
default
compose
(
withNetworkWrapper
([
new
NetWrapParam
(
"
exchangeFeedbacks
"
,
"
one
"
,
{
...
...
frontend/src/components/university/tabs/PreviousExchangesTab.jsx
View file @
81886f4f
...
...
@@ -30,26 +30,6 @@ const useStyles = makeStyles(theme => ({
}
}));
const
buildExchangesParams
=
(
univId
,
page
=
1
,
major
=
undefinedVal
,
minor
=
undefinedVal
)
=>
{
const
params
=
RequestParams
.
Builder
.
withQueryParam
(
"
university
"
,
univId
)
.
withQueryParam
(
"
page_size
"
,
8
)
.
withQueryParam
(
"
page
"
,
page
);
if
(
typeof
major
!==
"
undefined
"
&&
major
!==
undefinedVal
)
params
.
withQueryParam
(
"
exchange__student_major
"
,
major
);
if
(
typeof
minor
!==
"
undefined
"
&&
minor
!==
undefinedVal
)
params
.
withQueryParam
(
"
exchange__student_minor
"
,
minor
);
return
params
.
build
();
};
const
buildUnivMajorMinorsParams
=
univId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
university
"
,
univId
).
build
();
/**
* Tab on the university page containing information related to previous exchange
*/
...
...
@@ -159,6 +139,26 @@ PreviousExchangesTab.propTypes = {
setMajor
:
PropTypes
.
func
.
isRequired
};
const
buildExchangesParams
=
(
univId
,
page
=
1
,
major
=
undefinedVal
,
minor
=
undefinedVal
)
=>
{
const
params
=
RequestParams
.
Builder
.
withQueryParam
(
"
university
"
,
univId
)
.
withQueryParam
(
"
page_size
"
,
8
)
.
withQueryParam
(
"
page
"
,
page
);
if
(
typeof
major
!==
"
undefined
"
&&
major
!==
undefinedVal
)
params
.
withQueryParam
(
"
exchange__student_major
"
,
major
);
if
(
typeof
minor
!==
"
undefined
"
&&
minor
!==
undefinedVal
)
params
.
withQueryParam
(
"
exchange__student_minor
"
,
minor
);
return
params
.
build
();
};
const
buildUnivMajorMinorsParams
=
univId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
university
"
,
univId
).
build
();
const
ConnectedComp
=
compose
(
withUnivInfo
(),
withNetworkWrapper
([
...
...
frontend/src/components/university/tabs/TipsAndTricksTab.jsx
View file @
81886f4f
...
...
@@ -46,11 +46,6 @@ const useStyles = makeStyles(theme => ({
}
}));
const
buildParamsCountryTI
=
countryId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
country
"
,
countryId
).
build
();
const
buildParamsUniversityTI
=
univId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
university
"
,
univId
).
build
();
/**
* Tab containing tips and tricks about the university and the country
*
...
...
@@ -128,6 +123,12 @@ TipsAndTricksTab.propTypes = {
universityTI
:
PropTypes
.
array
.
isRequired
};
const
buildParamsCountryTI
=
countryId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
country
"
,
countryId
).
build
();
const
buildParamsUniversityTI
=
univId
=>
RequestParams
.
Builder
.
withQueryParam
(
"
university
"
,
univId
).
build
();
export
default
compose
(
withUnivInfo
([
"
countryId
"
,
"
univId
"
,
"
country
"
,
"
univ
"
]),
withNetworkWrapper
([
...
...
frontend/src/components/user/UserInfo.jsx
View file @
81886f4f
...
...
@@ -71,8 +71,6 @@ const useStyles = makeStyles(theme => ({
}
}));
const
buildParams
=
userId
=>
RequestParams
.
Builder
.
withId
(
userId
).
build
();
/**
* Component used to display the user information
*/
...
...
@@ -220,6 +218,8 @@ UserInfo.propTypes = {
user
:
PropTypes
.
object
.
isRequired
};
const
buildParams
=
userId
=>
RequestParams
.
Builder
.
withId
(
userId
).
build
();
export
default
withNetworkWrapper
([
new
NetWrapParam
(
"
users
"
,
"
one
"
,
{
propKey
:
"
user
"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment