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
492c77b6
Commit
492c77b6
authored
8 months ago
by
Johanna Szepanski
Committed by
EREBUS_DMN\jsz
8 months ago
Browse files
Options
Downloads
Patches
Plain Diff
updated host status listview to use separated status endpoints
parent
f93bccac
No related branches found
No related tags found
2 merge requests
!542
Prepare 4.1.0
,
!524
Fetch alert and status separate
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/host/HostStatus/HostStatus.js
+29
-24
29 additions, 24 deletions
src/components/host/HostStatus/HostStatus.js
src/components/host/HostStatus/HostStatusIcon.js
+2
-2
2 additions, 2 deletions
src/components/host/HostStatus/HostStatusIcon.js
with
31 additions
and
26 deletions
src/components/host/HostStatus/HostStatus.js
+
29
−
24
View file @
492c77b6
import
{
useContext
,
useMemo
}
from
"
react
"
;
import
{
useContext
,
useMemo
,
useEffect
}
from
"
react
"
;
import
{
Grid
,
Skeleton
}
from
"
@mui/material
"
;
import
{
apiContext
}
from
"
../../../api/DeployApi
"
;
import
{
apiContext
}
from
"
../../../api/DeployApi
"
;
import
{
useAPIMethod
}
from
"
@ess-ics/ce-ui-common
"
;
import
{
useAPIMethod
}
from
"
@ess-ics/ce-ui-common
"
;
import
{
HostStatusIcon
}
from
"
./HostStatusIcon
"
;
import
{
getHostStatus
}
from
"
./HostStatusData
"
;
import
{
Status
}
from
"
../../common/Status
"
;
function
createRequest
(
hostId
)
{
function
createRequest
(
hostId
)
{
return
{
return
{
...
@@ -10,36 +10,41 @@ function createRequest(hostId) {
...
@@ -10,36 +10,41 @@ function createRequest(hostId) {
};
};
}
}
export
const
HostStatus
=
({
hostId
})
=>
{
export
const
HostStatus
=
({
hostId
,
hideAlerts
})
=>
{
const
client
=
useContext
(
apiContext
);
const
client
=
useContext
(
apiContext
);
const
params
=
useMemo
(()
=>
createRequest
(
hostId
),
[
hostId
]);
const
params
=
useMemo
(()
=>
createRequest
(
hostId
),
[
hostId
]);
const
{
const
{
value
:
hostStatu
s
,
wrapper
:
callFetchHostAlert
s
,
loading
,
value
:
hostAlert
,
dataReady
abort
:
abortCallFetchHostAlerts
}
=
useAPIMethod
({
}
=
useAPIMethod
({
fcn
:
client
.
apis
.
Hosts
.
findHostAlerts
,
params
,
call
:
false
});
const
{
value
:
hostStateStatus
}
=
useAPIMethod
({
fcn
:
client
.
apis
.
Hosts
.
findHostStatus
,
fcn
:
client
.
apis
.
Hosts
.
findHostStatus
,
params
params
});
});
useEffect
(()
=>
{
if
(
!
hideAlerts
)
{
callFetchHostAlerts
();
}
return
()
=>
{
abortCallFetchHostAlerts
();
};
},
[
hostStateStatus
,
hideAlerts
]);
return
(
return
(
<
Grid
<
Status
container
state
=
{
hostStateStatus
}
direction
=
"
column
"
alert
=
{
hostAlert
}
justifyContent
=
"
center
"
hideAlerts
=
{
hideAlerts
}
alignItems
=
"
center
"
getStatusFcn
=
{
getHostStatus
}
>
/
>
{
loading
||
!
dataReady
?
(
<
Skeleton
variant
=
"
circular
"
height
=
{
20
}
width
=
{
20
}
/
>
)
:
(
<
HostStatusIcon
hostStatus
=
{
hostStatus
}
/
>
)}
<
/Grid
>
);
);
};
};
This diff is collapsed.
Click to expand it.
src/components/host/HostStatus/HostStatusIcon.js
+
2
−
2
View file @
492c77b6
...
@@ -7,13 +7,13 @@ import {
...
@@ -7,13 +7,13 @@ import {
StatusPopoverContent
,
StatusPopoverContent
,
statusConfig
statusConfig
}
from
"
../../common/Status
"
;
}
from
"
../../common/Status
"
;
import
{
getHostStatus
Info
}
from
"
./HostStatusData
"
;
import
{
getHostStatus
}
from
"
./HostStatusData
"
;
export
function
HostStatusIcon
({
hostStatus
,
hideAlerts
=
false
})
{
export
function
HostStatusIcon
({
hostStatus
,
hideAlerts
=
false
})
{
const
theme
=
useTheme
();
const
theme
=
useTheme
();
let
{
alerts
}
=
hostStatus
;
let
{
alerts
}
=
hostStatus
;
let
hostStatusStatus
=
getHostStatus
Info
(
hostStatus
);
let
hostStatusStatus
=
getHostStatus
(
hostStatus
);
const
displayBadge
=
const
displayBadge
=
!
hideAlerts
&&
!
hideAlerts
&&
...
...
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