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
92429e51
Commit
92429e51
authored
3 months ago
by
Max Frederiksen
Committed by
Max Frederiksen
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Add typing /components/deployments
parent
edcf64c0
No related branches found
No related tags found
2 merge requests
!612
Release 5.0.0
,
!590
CE-3429: Convert to typescript
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/deployments/DeploymentJobOutput.tsx
+28
-21
28 additions, 21 deletions
src/components/deployments/DeploymentJobOutput.tsx
src/components/deployments/index.ts
+1
-2
1 addition, 2 deletions
src/components/deployments/index.ts
with
29 additions
and
23 deletions
src/components/deployments/DeploymentJobOutput.tsx
+
28
−
21
View file @
92429e51
import
{
useState
,
useRef
,
useEffect
,
useMemo
}
from
"
react
"
;
import
{
useState
,
useRef
,
useEffect
}
from
"
react
"
;
import
{
Alert
,
LinearProgress
,
Stack
}
from
"
@mui/material
"
;
import
{
Alert
,
LinearProgress
,
Stack
}
from
"
@mui/material
"
;
import
{
LogStreamConsole
}
from
"
../common/LogStream/LogStreamConsole
"
;
import
{
LogStreamConsole
}
from
"
../common/LogStream/LogStreamConsole
"
;
import
{
LogStreamConsoleDialog
}
from
"
../common/LogStream/LogStreamConsoleDialog
"
;
import
{
LogStreamConsoleDialog
}
from
"
../common/LogStream/LogStreamConsoleDialog
"
;
import
{
PopoutButton
}
from
"
../common/Buttons/PopoutButton
"
;
import
{
PopoutButton
}
from
"
../common/Buttons/PopoutButton
"
;
import
{
getErrorMessage
,
isAbortError
}
from
"
../common/Helper
"
;
import
{
getErrorState
}
from
"
../common/Alerts/AlertsData
"
;
import
{
useLazyFetchDeploymentJobLogQuery
}
from
"
../../store/deployApi
"
;
import
{
JobDetails
,
useLazyFetchDeploymentJobLogQuery
}
from
"
../../store/deployApi
"
;
const
LOG_POLL_INTERVAL
=
5000
;
const
LOG_POLL_INTERVAL
=
5000
;
export
function
DeploymentJobOutput
({
job
,
isExpanded
})
{
interface
DeploymentJobOutputProps
{
job
:
JobDetails
;
isExpanded
:
boolean
;
}
export
function
DeploymentJobOutput
({
job
,
isExpanded
}:
DeploymentJobOutputProps
)
{
const
[
consoleDialogOpen
,
setConsoleDialogOpen
]
=
useState
(
false
);
const
[
consoleDialogOpen
,
setConsoleDialogOpen
]
=
useState
(
false
);
const
finalResultsNeeded
=
useRef
(
true
);
const
finalResultsNeeded
=
useRef
(
true
);
const
params
=
useMemo
(
()
=>
({
awxJobId
:
job
.
awxJobId
}),
[
job
]
);
const
[
getLogById
,
{
data
:
log
,
isSuccess
:
logDataReady
,
error
:
logError
}]
=
const
[
getLogById
,
{
data
:
log
,
isSuccess
:
logDataReady
,
error
:
logError
}]
=
useLazyFetchDeploymentJobLogQuery
({
useLazyFetchDeploymentJobLogQuery
({
pollingInterval
:
isExpanded
?
LOG_POLL_INTERVAL
:
0
pollingInterval
:
isExpanded
?
LOG_POLL_INTERVAL
:
0
});
});
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
isExpanded
)
{
if
(
if
(
!
job
.
finishedAt
||
finalResultsNeeded
.
current
)
{
!
isExpanded
||
getLogById
(
params
);
(
job
.
finishedAt
&&
!
finalResultsNeeded
.
current
)
||
finalResultsNeeded
.
current
=
!
job
.
finishedAt
;
!
job
.
awxJobId
}
)
{
return
;
}
}
},
[
job
.
finishedAt
,
job
.
jobId
,
isExpanded
,
getLogById
,
params
]);
const
hasAbortError
=
isAbortError
(
logError
);
getLogById
({
awxJobId
:
job
.
awxJobId
});
finalResultsNeeded
.
current
=
!
job
.
finishedAt
;
},
[
job
.
finishedAt
,
job
,
isExpanded
,
getLogById
,
job
.
awxJobId
]);
const
showLoading
=
!
log
||
!
job
.
startTime
;
const
showLoading
=
!
log
||
!
job
.
startTime
;
useEffect
(()
=>
{
useEffect
(()
=>
{
finalResultsNeeded
.
current
=
true
;
finalResultsNeeded
.
current
=
true
;
},
[
job
.
jobId
]);
},
[
job
]);
if
(
logError
&&
!
hasAbortError
)
{
if
(
logError
)
{
return
(
return
(
<
Stack
>
<
Stack
>
<
Alert
severity
=
"error"
>
{
getError
Messag
e
(
logError
)
}
</
Alert
>
<
Alert
severity
=
"error"
>
{
getError
Stat
e
(
logError
)
.
message
}
</
Alert
>
</
Stack
>
</
Stack
>
);
);
}
}
...
@@ -76,7 +83,7 @@ export function DeploymentJobOutput({ job, isExpanded }) {
...
@@ -76,7 +83,7 @@ export function DeploymentJobOutput({ job, isExpanded }) {
onDialogClose
=
{
()
=>
setConsoleDialogOpen
(
false
)
}
onDialogClose
=
{
()
=>
setConsoleDialogOpen
(
false
)
}
/>
/>
<
LogStreamConsole
<
LogStreamConsole
log
=
{
log
.
stdoutHtml
}
log
=
{
log
?
.
stdoutHtml
}
dataReady
=
{
logDataReady
}
dataReady
=
{
logDataReady
}
height
=
"500px"
height
=
"500px"
/>
/>
...
...
This diff is collapsed.
Click to expand it.
src/components/deployments/index.ts
+
1
−
2
View file @
92429e51
import
{
DeploymentStatusIcon
}
from
"
./DeploymentIcons
"
;
import
{
DeploymentJobOutput
}
from
"
./DeploymentJobOutput
"
;
import
{
DeploymentJobOutput
}
from
"
./DeploymentJobOutput
"
;
export
{
DeploymentStatusIcon
,
DeploymentJobOutput
};
export
{
DeploymentJobOutput
};
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