Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ce-deploy-ui
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ccce
dev
ce-deploy-ui
Commits
72eb095e
Commit
72eb095e
authored
3 years ago
by
Zoltan Runyo
Browse files
Options
Downloads
Patches
Plain Diff
ICSHWI-8665
: Personal statistics on Home view
parent
9f50cbb5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!139
Merge before release
,
!124
Icshwi 8665 refine landing page
,
!119
Icshwi 8665 refine landing page
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/api/SwaggerApi.js
+12
-3
12 additions, 3 deletions
src/api/SwaggerApi.js
src/views/home/HomeView.js
+9
-2
9 additions, 2 deletions
src/views/home/HomeView.js
with
21 additions
and
5 deletions
src/api/SwaggerApi.js
+
12
−
3
View file @
72eb095e
...
@@ -805,7 +805,16 @@ export function useAnnouncements() {
...
@@ -805,7 +805,16 @@ export function useAnnouncements() {
}
}
export
function
unpackAnnouncement
(
announcements
)
{
export
function
unpackAnnouncement
(
announcements
)
{
const
a
=
{
...
announcements
};
return
{
...
announcements
};
console
.
log
(
a
);
return
a
;
}
}
export
function
usePersonalStatistics
()
{
const
api
=
useContext
(
apiContext
);
const
method
=
useCallAndUnpack
(
api
.
apis
.
Statistics
.
personalStatistics
,
unpackPersonalStatistics
)
return
useAsync
({
fcn
:
method
,
call
:
true
});
}
export
function
unpackPersonalStatistics
(
statistics
)
{
return
{
...
statistics
};
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/views/home/HomeView.js
+
9
−
2
View file @
72eb095e
...
@@ -2,8 +2,9 @@ import { Container, Grid, Paper, Button, Box, Typography } from "@material-ui/co
...
@@ -2,8 +2,9 @@ import { Container, Grid, Paper, Button, Box, Typography } from "@material-ui/co
import
React
,
{
useState
}
from
"
react
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
useGlobalAppBar
}
from
"
../../components/navigation/GlobalAppBar/GlobalAppBar
"
;
import
{
useGlobalAppBar
}
from
"
../../components/navigation/GlobalAppBar/GlobalAppBar
"
;
import
{
CreateIOC
}
from
"
../../components/IOC/CreateIOC
"
;
import
{
CreateIOC
}
from
"
../../components/IOC/CreateIOC
"
;
import
{
KeyValueTable
}
from
"
../../components/common/KeyValueTable/KeyValueTable
"
;
import
{
SimpleModal
}
from
"
../../components/common/SimpleModal/SimpleModal
"
;
import
{
SimpleModal
}
from
"
../../components/common/SimpleModal/SimpleModal
"
;
import
{
useCreateIOC
,
useAnnouncements
}
from
"
../../api/SwaggerApi
"
;
import
{
useCreateIOC
,
useAnnouncements
,
usePersonalStatistics
}
from
"
../../api/SwaggerApi
"
;
import
ReactMarkdown
from
'
react-markdown
'
import
ReactMarkdown
from
'
react-markdown
'
import
remarkGfm
from
'
remark-gfm
'
import
remarkGfm
from
'
remark-gfm
'
import
{
makeStyles
}
from
'
@material-ui/core/styles
'
;
import
{
makeStyles
}
from
'
@material-ui/core/styles
'
;
...
@@ -21,6 +22,7 @@ const useStyles = makeStyles((theme) => ({
...
@@ -21,6 +22,7 @@ const useStyles = makeStyles((theme) => ({
export
function
HomeView
()
{
export
function
HomeView
()
{
const
[
iocFormOpen
,
setIOCFormOpen
]
=
useState
(
false
);
const
[
iocFormOpen
,
setIOCFormOpen
]
=
useState
(
false
);
const
[
announcements
]
=
useAnnouncements
();
const
[
announcements
]
=
useAnnouncements
();
const
[
statistics
]
=
usePersonalStatistics
();
const
classes
=
useStyles
();
const
classes
=
useStyles
();
console
.
log
(
"
rendering Own IOCs
"
)
console
.
log
(
"
rendering Own IOCs
"
)
...
@@ -38,7 +40,7 @@ export function HomeView() {
...
@@ -38,7 +40,7 @@ export function HomeView() {
<
Grid
item
xs
=
{
10
}
>
<
Grid
item
xs
=
{
10
}
>
<
Box
display
=
"
flex
"
flexDirection
=
"
row
"
p
=
{
2
}
m
=
{
1
}
>
<
Box
display
=
"
flex
"
flexDirection
=
"
row
"
p
=
{
2
}
m
=
{
1
}
>
<
Typography
variant
=
"
h2
"
>
<
Typography
variant
=
"
h2
"
>
Home
My
statistics
<
/Typography
>
<
/Typography
>
<
/Box
>
<
/Box
>
<
/Grid
>
<
/Grid
>
...
@@ -47,6 +49,11 @@ export function HomeView() {
...
@@ -47,6 +49,11 @@ export function HomeView() {
<
Button
variant
=
"
contained
"
color
=
"
secondary
"
onClick
=
{()
=>
{
setIOCFormOpen
(
true
)
}}
>
New
IOC
<
/Button
>
<
Button
variant
=
"
contained
"
color
=
"
secondary
"
onClick
=
{()
=>
{
setIOCFormOpen
(
true
)
}}
>
New
IOC
<
/Button
>
<
/Box
>
<
/Box
>
<
/Grid
>
<
/Grid
>
{
statistics
&&
<
Grid
item
xs
=
{
12
}
>
<
KeyValueTable
obj
=
{{
"
Number of my IOCs
"
:
statistics
.
numberOfActiveIocs
}}
variant
=
"
table
"
/>
<
/Grid
>
}
<
/Grid
>
<
/Grid
>
{
announcements
?.
announcementsText
&&
{
announcements
?.
announcementsText
&&
<
Grid
container
justify
=
"
flex-start
"
className
=
{
classes
.
announcements
}
>
<
Grid
container
justify
=
"
flex-start
"
className
=
{
classes
.
announcements
}
>
...
...
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