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
911c18b0
Commit
911c18b0
authored
2 years ago
by
Bjarke Madsen
Browse files
Options
Downloads
Patches
Plain Diff
Follow API documentation for budget
parent
bf85bab3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
compendium_v2/routes/budget.py
+1
-2
1 addition, 2 deletions
compendium_v2/routes/budget.py
webapp/src/Schema.tsx
+0
-4
0 additions, 4 deletions
webapp/src/Schema.tsx
webapp/src/pages/DataAnalysis.tsx
+6
-9
6 additions, 9 deletions
webapp/src/pages/DataAnalysis.tsx
with
7 additions
and
15 deletions
compendium_v2/routes/budget.py
+
1
−
2
View file @
911c18b0
...
@@ -78,8 +78,7 @@ def budget_view() -> Any:
...
@@ -78,8 +78,7 @@ def budget_view() -> Any:
entries
=
sorted
([
_extract_data
(
entry
)
entries
=
sorted
([
_extract_data
(
entry
)
for
entry
in
session
.
query
(
model
.
BudgetEntry
)],
for
entry
in
session
.
query
(
model
.
BudgetEntry
)],
key
=
lambda
d
:
(
d
[
'
BUDGET_YEAR
'
],
d
[
'
NREN
'
]))
key
=
lambda
d
:
(
d
[
'
BUDGET_YEAR
'
],
d
[
'
NREN
'
]))
dict_obj
=
{
"
data
"
:
entries
}
return
jsonify
(
entries
)
return
jsonify
(
dict_obj
)
@routes.route
(
'
/migration
'
,
methods
=
[
'
GET
'
])
@routes.route
(
'
/migration
'
,
methods
=
[
'
GET
'
])
...
...
This diff is collapsed.
Click to expand it.
webapp/src/Schema.tsx
+
0
−
4
View file @
911c18b0
...
@@ -26,10 +26,6 @@ export interface BudgetMatrix {
...
@@ -26,10 +26,6 @@ export interface BudgetMatrix {
title
:
string
title
:
string
}
}
export
interface
BudgetAPI
{
data
:
[
Budget
]
}
export
interface
Budget
{
export
interface
Budget
{
BUDGET
:
string
,
BUDGET
:
string
,
BUDGET_YEAR
:
number
,
BUDGET_YEAR
:
number
,
...
...
This diff is collapsed.
Click to expand it.
webapp/src/pages/DataAnalysis.tsx
+
6
−
9
View file @
911c18b0
import
React
,
{
ReactElement
,
useEffect
,
useState
}
from
'
react
'
;
import
React
,
{
ReactElement
,
useEffect
,
useState
}
from
'
react
'
;
import
{
Accordion
,
Col
,
Container
,
ListGroup
,
Row
}
from
"
react-bootstrap
"
;
import
{
Accordion
,
Col
,
Container
,
ListGroup
,
Row
}
from
"
react-bootstrap
"
;
import
BarGraph
from
"
../components/graphing/BarGraph
"
;
import
LineGraph
from
"
../components/graphing/LineGraph
"
;
import
LineGraph
from
"
../components/graphing/LineGraph
"
;
import
{
BudgetMatrix
,
DataEntrySection
,
Budget
,
BudgetAPI
}
from
"
../Schema
"
;
import
{
BudgetMatrix
,
DataEntrySection
,
Budget
}
from
"
../Schema
"
;
// import {evaluateInteractionItems} from "chart.js/dist/core/core.interaction";
import
barGraph
from
"
../components/graphing/BarGraph
"
;
export
const
options
=
{
export
const
options
=
{
...
@@ -67,17 +64,17 @@ function DataAnalysis(): ReactElement {
...
@@ -67,17 +64,17 @@ function DataAnalysis(): ReactElement {
const
loadData
=
async
()
=>
{
const
loadData
=
async
()
=>
{
console
.
log
(
"
budgetResponse
"
+
budgetResponse
)
console
.
log
(
"
budgetResponse
"
+
budgetResponse
)
if
(
budgetResponse
==
undefined
)
{
if
(
budgetResponse
==
undefined
)
{
api
<
Budget
API
>
(
'
/api/budget/
'
,
{})
api
<
Budget
[]
>
(
'
/api/budget/
'
,
{})
.
then
((
budget
:
Budget
API
)
=>
{
.
then
((
budget
:
Budget
[]
)
=>
{
console
.
log
(
'
budget.data :
'
,
budget
.
data
)
console
.
log
(
'
budget.data :
'
,
budget
)
console
.
log
(
'
budget :
'
,
budget
)
console
.
log
(
'
budget :
'
,
budget
)
const
entry
=
dataEntrySection
?.
items
.
find
(
i
=>
i
.
id
==
selectedDataEntry
)
const
entry
=
dataEntrySection
?.
items
.
find
(
i
=>
i
.
id
==
selectedDataEntry
)
console
.
log
(
selectedDataEntry
,
dataEntrySection
,
entry
)
console
.
log
(
selectedDataEntry
,
dataEntrySection
,
entry
)
if
(
entry
)
if
(
entry
)
options
.
plugins
.
title
.
text
=
entry
.
title
;
options
.
plugins
.
title
.
text
=
entry
.
title
;
setBudget
(
budget
.
data
)
setBudget
(
budget
)
console
.
log
(
"
budgetResponse after api
"
+
budgetResponse
)
console
.
log
(
"
budgetResponse after api
"
+
budgetResponse
)
convertToBudgetPerYearDataResponse
(
budget
.
data
)
convertToBudgetPerYearDataResponse
(
budget
)
})
})
.
catch
(
error
=>
{
.
catch
(
error
=>
{
console
.
log
(
`Error fetching from API:
${
error
}
`
);
console
.
log
(
`Error fetching from API:
${
error
}
`
);
...
...
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