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
0959dbff
Commit
0959dbff
authored
1 year ago
by
Alexander Madsen
Browse files
Options
Downloads
Patches
Plain Diff
CE-2075
: Convert useHostIOCList
parent
6a0f1f86
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!407
CE-2141: 3.0.0
,
!349
CE-2075: Convert useHostIOCList
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/api/SwaggerApi.js
+0
-29
0 additions, 29 deletions
src/api/SwaggerApi.js
src/views/host/HostDetailsView.js
+18
-7
18 additions, 7 deletions
src/views/host/HostDetailsView.js
with
18 additions
and
36 deletions
src/api/SwaggerApi.js
+
0
−
29
View file @
0959dbff
...
...
@@ -380,13 +380,6 @@ export function useCSEntrySearch() {
return
useAsync
({
fcn
:
method
,
call
:
false
,
init
:
emptyHostListResponse
});
}
const
emptyHostIocListResponse
=
{
totalCount
:
0
,
pageNumber
:
0
,
limit
:
0
,
deployedList
:
[]
};
export
function
unpackRecord
(
record
)
{
return
{
...
record
};
}
...
...
@@ -429,28 +422,6 @@ export function useRecord(name, onError) {
return
useAsync
({
fcn
:
boundMethod
,
onError
:
onError
});
}
export
function
unpackHostIOCList
(
iocs
)
{
const
deployedArr
=
iocs
.
deployedIocs
.
map
((
ioc
)
=>
unpackIocInfo
(
ioc
));
let
unpackedHostIocList
=
{
totalCount
:
iocs
.
totalCount
,
pageNumber
:
iocs
.
pageNumber
,
limit
:
iocs
.
limit
,
deployedList
:
deployedArr
};
return
unpackedHostIocList
;
}
export
function
useHostIOCList
()
{
const
api
=
useContext
(
apiContext
);
const
method
=
useCallAndUnpack
(
(
params
)
=>
api
.
apis
.
Hosts
.
findAssociatedIocsByHostId
(
params
),
unpackHostIOCList
);
return
useAsync
({
fcn
:
method
,
call
:
false
,
init
:
emptyHostIocListResponse
});
}
export
function
unpackLogin
(
loginResponse
)
{
return
{
...
loginResponse
};
}
...
...
This diff is collapsed.
Click to expand it.
src/views/host/HostDetailsView.js
+
18
−
7
View file @
0959dbff
...
...
@@ -10,13 +10,13 @@ import {
Stack
}
from
"
@mui/material
"
;
import
ArrowBackIcon
from
"
@mui/icons-material/ArrowBack
"
;
import
{
useHostIOCList
}
from
"
../../api/SwaggerApi
"
;
import
{
HostBadge
}
from
"
../../components/host/HostBadge
"
;
import
{
KeyValueTable
,
SimpleAccordion
,
GlobalAppBarContext
,
RootPaper
RootPaper
,
useAPIMethod
}
from
"
@ess-ics/ce-ui-common
"
;
import
{
LokiPanel
}
from
"
../../components/common/Loki/LokiPanel
"
;
import
{
useNavigate
,
Link
as
ReactRouterLink
}
from
"
react-router-dom
"
;
...
...
@@ -31,6 +31,7 @@ import {
serialize
,
deserialize
}
from
"
../../components/common/URLState/URLState
"
;
import
{
apiContext
}
from
"
../../api/DeployApi
"
;
import
{
usePagination
}
from
"
../../hooks/pagination
"
;
import
IOCTable
from
"
../../components/IOC/IOCTable
"
;
...
...
@@ -42,7 +43,17 @@ export function HostDetailsView({ id, host }) {
}
},
[
host
,
setTitle
]);
const
[
iocs
,
getIocs
/* reset*/
,
,
loading
]
=
useHostIOCList
();
const
client
=
useContext
(
apiContext
);
const
{
value
:
iocs
,
wrapper
:
getIocs
,
loading
,
dataReady
}
=
useAPIMethod
({
fcn
:
client
.
apis
.
Hosts
.
findAssociatedIocsByHostId
,
call
:
false
});
const
[
urlState
,
setUrlState
]
=
useUrlState
(
{
...
...
@@ -84,8 +95,8 @@ export function HostDetailsView({ id, host }) {
// update pagination whenever search result total pages change
useEffect
(()
=>
{
setPagination
({
totalCount
:
iocs
.
totalCount
??
0
});
},
[
setPagination
,
iocs
.
totalCount
]);
setPagination
({
totalCount
:
iocs
?
.
totalCount
??
0
});
},
[
setPagination
,
iocs
?
.
totalCount
]);
// whenever url state changes, update pagination
useEffect
(()
=>
{
...
...
@@ -193,8 +204,8 @@ export function HostDetailsView({ id, host }) {
}
>
<
IOCTable
iocs
=
{
iocs
?.
deployed
List
}
loading
=
{
loading
}
iocs
=
{
iocs
?.
deployed
Iocs
}
loading
=
{
loading
||
!
dataReady
}
rowType
=
"
host
"
pagination
=
{
pagination
}
onPage
=
{
onPage
}
...
...
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