Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
compendium-v2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
compendium-v2
Commits
bad01cae
Commit
bad01cae
authored
2 years ago
by
Remco Tukker
Browse files
Options
Downloads
Patches
Plain Diff
fix some linter warnings
parent
c9fa71e4
No related branches found
No related tags found
1 merge request
!2
Feature/comp 116 initial filter mechanism
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
compendium_v2/static/bundle.js
+1
-1
1 addition, 1 deletion
compendium_v2/static/bundle.js
webapp/src/pages/FundingSource.tsx
+9
-8
9 additions, 8 deletions
webapp/src/pages/FundingSource.tsx
with
10 additions
and
9 deletions
compendium_v2/static/bundle.js
+
1
−
1
View file @
bad01cae
This diff is collapsed.
Click to expand it.
webapp/src/pages/FundingSource.tsx
+
9
−
8
View file @
bad01cae
...
...
@@ -119,16 +119,17 @@ function FundingSourcePage({ filterSelection, setFilterSelection }: inputProps)
setFundingSourceData
(
_fundingData
)
// filter fallback for when nothing is selected (only last year for all nrens)
const
visibleYears
=
filterSelection
.
selectedYears
.
filter
(
year
=>
years
.
has
(
year
));
const
newSelectedYears
=
visibleYears
.
length
?
filterSelection
.
selectedYears
:
[
Math
.
max
(...
years
)];
const
visibleNrens
=
filterSelection
.
selectedNrens
.
filter
(
nren
=>
nrens
.
has
(
nren
));
const
newSelectedNrens
=
visibleNrens
.
length
?
filterSelection
.
selectedNrens
:
[...
nrens
];
// this will also cause the selected data to be rendered:
setFilterSelection
({
selectedYears
:
newSelectedYears
,
selectedNrens
:
newSelectedNrens
});
setFilterSelection
(
previous
=>
{
const
visibleYears
=
previous
.
selectedYears
.
filter
(
year
=>
years
.
has
(
year
));
const
newSelectedYears
=
visibleYears
.
length
?
previous
.
selectedYears
:
[
Math
.
max
(...
years
)];
const
visibleNrens
=
previous
.
selectedNrens
.
filter
(
nren
=>
nrens
.
has
(
nren
));
const
newSelectedNrens
=
visibleNrens
.
length
?
previous
.
selectedNrens
:
[...
nrens
];
return
{
selectedYears
:
newSelectedYears
,
selectedNrens
:
newSelectedNrens
};
});
}
loadData
()
},
[])
},
[
setFilterSelection
])
useEffect
(()
=>
{
if
(
fundingSourceData
===
undefined
)
{
...
...
@@ -152,7 +153,7 @@ function FundingSourcePage({ filterSelection, setFilterSelection }: inputProps)
freshDataset
.
labels
=
freshDataset
.
labels
.
filter
((
e
)
=>
filterSelection
.
selectedNrens
.
includes
(
e
));
setDataset
(
freshDataset
);
},
[
filterSelection
])
},
[
fundingSourceData
,
filterSelection
])
return
(
<
Container
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment