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
9a3ebde1
Commit
9a3ebde1
authored
1 year ago
by
Alexander Madsen
Browse files
Options
Downloads
Patches
Plain Diff
CE-2072
: convert useJobLogById
parent
4892bca3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!407
CE-2141: 3.0.0
,
!361
CE-2072: convert useJobLogById
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/api/SwaggerApi.js
+0
-8
0 additions, 8 deletions
src/api/SwaggerApi.js
src/components/deployments/DeploymentJobOutput.js
+29
-4
29 additions, 4 deletions
src/components/deployments/DeploymentJobOutput.js
with
29 additions
and
12 deletions
src/api/SwaggerApi.js
+
0
−
8
View file @
9a3ebde1
...
@@ -272,14 +272,6 @@ export function useJobById() {
...
@@ -272,14 +272,6 @@ export function useJobById() {
return
useAsync
({
fcn
:
method
,
call
:
false
,
init
:
null
});
return
useAsync
({
fcn
:
method
,
call
:
false
,
init
:
null
});
}
}
export
function
useJobLogById
()
{
const
api
=
useContext
(
apiContext
);
const
method
=
useCallAndUnpack
((
awxJobId
)
=>
api
.
apis
.
Deployments
.
fetchDeploymentJobLog
({
awx_job_id
:
awxJobId
})
);
return
useAsync
({
fcn
:
method
,
call
:
false
,
init
:
null
});
}
export
function
useUpdateAndDeployIoc
(
id
,
onError
)
{
export
function
useUpdateAndDeployIoc
(
id
,
onError
)
{
const
api
=
useContext
(
apiContext
);
const
api
=
useContext
(
apiContext
);
const
method
=
useCallAndUnpack
(
const
method
=
useCallAndUnpack
(
...
...
This diff is collapsed.
Click to expand it.
src/components/deployments/DeploymentJobOutput.js
+
29
−
4
View file @
9a3ebde1
import
React
,
{
useCallback
,
useRef
,
useEffect
}
from
"
react
"
;
import
React
,
{
useCallback
,
useRef
,
useEffect
,
useContext
,
useMemo
}
from
"
react
"
;
import
{
LinearProgress
,
Typography
,
Container
,
Stack
}
from
"
@mui/material
"
;
import
{
LinearProgress
,
Typography
,
Container
,
Stack
}
from
"
@mui/material
"
;
import
{
useJobLogById
}
from
"
../../api/SwaggerApi
"
;
import
{
Console
}
from
"
../common/Console/Console
"
;
import
{
Console
}
from
"
../common/Console/Console
"
;
import
{
useSafePolling
}
from
"
../../hooks/Polling
"
;
import
{
useSafePolling
}
from
"
../../hooks/Polling
"
;
import
{
apiContext
}
from
"
../../api/DeployApi
"
;
import
{
useAPIMethod
}
from
"
@ess-ics/ce-ui-common
"
;
const
LOG_POLL_INTERVAL
=
5000
;
const
LOG_POLL_INTERVAL
=
5000
;
export
function
DeploymentJobOutput
({
deploymentJob
})
{
export
function
DeploymentJobOutput
({
deploymentJob
})
{
const
[
log
,
getLogById
/* reset*/
,
,
logLoading
]
=
useJobLogById
();
const
client
=
useContext
(
apiContext
);
const
params
=
useMemo
(
()
=>
({
awx_job_id
:
deploymentJob
?.
id
}),
[
deploymentJob
]
);
const
{
value
:
log
,
wrapper
:
getLogById
,
loading
:
logLoading
,
dataReady
:
logDataReady
}
=
useAPIMethod
({
fcn
:
client
.
apis
.
Deployments
.
fetchDeploymentJobLog
,
params
});
const
finalResultsNeeded
=
useRef
(
true
);
const
finalResultsNeeded
=
useRef
(
true
);
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -19,7 +44,7 @@ export function DeploymentJobOutput({ deploymentJob }) {
...
@@ -19,7 +44,7 @@ export function DeploymentJobOutput({ deploymentJob }) {
finalResultsNeeded
.
current
=
!
deploymentJob
.
finished
;
finalResultsNeeded
.
current
=
!
deploymentJob
.
finished
;
}
}
},
[
deploymentJob
.
finished
,
deploymentJob
.
id
,
getLogById
]);
},
[
deploymentJob
.
finished
,
deploymentJob
.
id
,
getLogById
]);
useSafePolling
(
getLog
,
logLoading
,
LOG_POLL_INTERVAL
);
useSafePolling
(
getLog
,
logLoading
||
!
logDataReady
,
LOG_POLL_INTERVAL
);
const
dataReady
=
useCallback
(()
=>
{
const
dataReady
=
useCallback
(()
=>
{
return
deploymentJob
?.
started
;
return
deploymentJob
?.
started
;
...
...
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