Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Rex Dri
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Julien Jerphanion
Rex Dri
Commits
8658d749
Commit
8658d749
authored
Sep 16, 2018
by
Florent Chehab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better POO in modules
parent
ff58b6fd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
55 deletions
+33
-55
frontend/src/components/university/modules/CountryDri.js
frontend/src/components/university/modules/CountryDri.js
+2
-14
frontend/src/components/university/modules/UniversityDri.js
frontend/src/components/university/modules/UniversityDri.js
+2
-14
frontend/src/components/university/modules/UniversityGeneral.js
...nd/src/components/university/modules/UniversityGeneral.js
+2
-6
frontend/src/components/university/modules/UniversityScholarships.js
...c/components/university/modules/UniversityScholarships.js
+2
-14
frontend/src/components/university/modules/UniversitySemestersDates.js
...components/university/modules/UniversitySemestersDates.js
+3
-7
frontend/src/components/university/shared/Module.js
frontend/src/components/university/shared/Module.js
+22
-0
No files found.
frontend/src/components/university/modules/CountryDri.js
View file @
8658d749
...
...
@@ -7,7 +7,7 @@ import __pick from 'lodash/pick';
import
Markdown
from
'
../../shared/Markdown
'
;
import
M
yComponent
from
'
../../MyComponent
'
;
import
M
odule
from
'
../shared/Module
'
;
import
GenericModule
from
'
../shared/GenericModule
'
;
import
GenericGroupModule
from
'
../shared/GenericGroupModule
'
;
...
...
@@ -47,19 +47,7 @@ function parseRawModelData(rawModelData) {
}
class
CountryDri
extends
MyComponent
{
ignoreInvalidation
=
true
;
componentWillUnmount
()
{
this
.
props
.
invalidateData
(
true
);
}
myComponentDidUpdate
()
{
if
(
this
.
props
.
countryDri
.
invalidated
&&
!
this
.
props
.
countryDri
.
isLoading
)
{
this
.
props
.
fetchData
.
countryDri
(
this
.
props
.
countryId
);
}
}
class
CountryDri
extends
Module
{
myRender
()
{
const
countryDriItems
=
this
.
getFetchedData
(
'
countryDri
'
);
const
{
countries
,
classes
}
=
this
.
props
;
...
...
frontend/src/components/university/modules/UniversityDri.js
View file @
8658d749
...
...
@@ -7,7 +7,7 @@ import __pick from 'lodash/pick';
import
Markdown
from
'
../../shared/Markdown
'
;
import
M
yComponent
from
'
../../MyComponent
'
;
import
M
odule
from
'
../shared/Module
'
;
import
GenericModule
from
'
../shared/GenericModule
'
;
import
GenericGroupModule
from
'
../shared/GenericGroupModule
'
;
...
...
@@ -50,19 +50,7 @@ function parseRawModelData(rawModelData) {
}
class
UniversityDri
extends
MyComponent
{
ignoreInvalidation
=
true
;
componentWillUnmount
()
{
this
.
props
.
invalidateData
(
true
);
}
myComponentDidUpdate
()
{
if
(
this
.
props
.
universityDri
.
invalidated
&&
!
this
.
props
.
universityDri
.
isLoading
)
{
this
.
props
.
fetchData
.
universityDri
(
this
.
props
.
univId
);
}
}
class
UniversityDri
extends
Module
{
myRender
()
{
const
univDriItems
=
this
.
getFetchedData
(
'
universityDri
'
);
const
{
universities
,
classes
}
=
this
.
props
;
...
...
frontend/src/components/university/modules/UniversityGeneral.js
View file @
8658d749
...
...
@@ -8,7 +8,7 @@ import __pick from 'lodash/pick';
import
Markdown
from
'
../../shared/Markdown
'
;
import
Typography
from
'
@material-ui/core/Typography
'
;
import
M
yComponent
from
'
../../MyComponent
'
;
import
M
odule
from
'
../shared/Module
'
;
import
TextLink
from
'
../../other/TextLink
'
;
import
Grid
from
'
@material-ui/core/Grid
'
;
import
Divider
from
'
@material-ui/core/Divider
'
;
...
...
@@ -84,11 +84,7 @@ function parseRawModelData(rawModelData) {
}
class
UniversityGeneral
extends
MyComponent
{
componentWillUnmount
()
{
this
.
props
.
invalidateData
();
}
class
UniversityGeneral
extends
Module
{
myRender
()
{
const
univInfos
=
this
.
getFetchedData
(
'
universitiesEl
'
);
const
{
classes
}
=
this
.
props
;
...
...
frontend/src/components/university/modules/UniversityScholarships.js
View file @
8658d749
...
...
@@ -5,7 +5,7 @@ import compose from 'recompose/compose';
import
{
connect
}
from
"
react-redux
"
;
import
__pick
from
'
lodash/pick
'
;
import
M
yComponent
from
'
../../MyComponent
'
;
import
M
odule
from
'
../shared/Module
'
;
import
GenericModule
from
'
../shared/GenericModule
'
;
import
GenericGroupModule
from
'
../shared/GenericGroupModule
'
;
...
...
@@ -65,19 +65,7 @@ function parseRawModelData(rawModelData) {
}
class
UniversityScholarships
extends
MyComponent
{
ignoreInvalidation
=
true
;
componentWillUnmount
()
{
this
.
props
.
invalidateData
(
true
);
}
myComponentDidUpdate
()
{
if
(
this
.
props
.
universityScholarships
.
invalidated
&&
!
this
.
props
.
universityScholarships
.
isLoading
)
{
this
.
props
.
fetchData
.
universityScholarships
(
this
.
props
.
univId
);
}
}
class
UniversityScholarships
extends
Module
{
myRender
()
{
const
univScholarshipsItems
=
this
.
getFetchedData
(
'
universityScholarships
'
);
const
{
universities
,
currencies
,
classes
}
=
this
.
props
;
...
...
frontend/src/components/university/modules/UniversitySemestersDates.js
View file @
8658d749
...
...
@@ -17,7 +17,7 @@ import LocalFloristIcon from '@material-ui/icons/LocalFlorist';
import
GenericModule
from
'
../shared/GenericModule
'
;
import
M
yComponent
from
'
../../MyComponent
'
;
import
M
odule
from
'
../shared/Module
'
;
import
dateStrToStr
from
'
../../../utils/dateStrToStr
'
;
...
...
@@ -126,12 +126,8 @@ function parseRawModelData(rawModelData) {
}
class
UniversitySemestersDates
extends
MyComponent
{
componentWillUnmount
()
{
this
.
props
.
invalidateData
();
}
class
UniversitySemestersDates
extends
Module
{
myRender
()
{
const
semestersDates
=
this
.
getFetchedData
(
'
universitiesSemestersDatesEl
'
);
const
{
classes
}
=
this
.
props
;
...
...
frontend/src/components/university/shared/Module.js
0 → 100644
View file @
8658d749
import
React
from
'
react
'
;
import
MyComponent
from
'
../../MyComponent
'
;
class
Module
extends
MyComponent
{
// prevent hard reset of module when refetching
ignoreInvalidation
=
true
;
componentWillUnmount
()
{
this
.
props
.
invalidateData
(
true
);
}
myComponentDidUpdate
()
{
this
.
fetchAbleProps
.
map
((
propKey
)
=>
{
if
(
this
.
props
[
propKey
].
invalidated
&&
!
this
.
props
[
propKey
].
isLoading
)
{
this
.
props
.
fetchData
[
propKey
](
this
.
props
.
univId
);
}
})
}
}
export
default
Module
;
\ No newline at end of file
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