fix(xo-web/logs): displays the correct calls state when the job is interrupted (#2734)
Fixes #2732
This commit is contained in:
parent
fc421428fd
commit
93e987982c
@ -61,7 +61,7 @@ class JobReturn extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const JobCallStateInfos = ({ end, error }) => {
|
const JobCallStateInfos = ({ end, error, isJobInterrupted }) => {
|
||||||
const [icon, tooltip] =
|
const [icon, tooltip] =
|
||||||
error !== undefined
|
error !== undefined
|
||||||
? isSkippedError(error)
|
? isSkippedError(error)
|
||||||
@ -69,7 +69,9 @@ const JobCallStateInfos = ({ end, error }) => {
|
|||||||
: ['halted', 'failedJobCall']
|
: ['halted', 'failedJobCall']
|
||||||
: end !== undefined
|
: end !== undefined
|
||||||
? ['running', 'successfulJobCall']
|
? ['running', 'successfulJobCall']
|
||||||
: ['busy', 'jobCallInProgess']
|
: isJobInterrupted
|
||||||
|
? ['halted', 'jobInterrupted']
|
||||||
|
: ['busy', 'jobCallInProgess']
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip content={_(tooltip)}>
|
<Tooltip content={_(tooltip)}>
|
||||||
@ -115,14 +117,18 @@ const CALL_FILTER_OPTIONS = [
|
|||||||
{ label: 'jobCallInProgess', value: 'running' },
|
{ label: 'jobCallInProgess', value: 'running' },
|
||||||
{ label: 'jobCallSkipped', value: 'skipped' },
|
{ label: 'jobCallSkipped', value: 'skipped' },
|
||||||
{ label: 'successfulJobCall', value: 'success' },
|
{ label: 'successfulJobCall', value: 'success' },
|
||||||
|
{ label: 'jobInterrupted', value: 'interrupted' },
|
||||||
]
|
]
|
||||||
|
|
||||||
const PREDICATES = {
|
const PREDICATES = {
|
||||||
all: () => true,
|
all: () => () => true,
|
||||||
skipped: call => call.error !== undefined && isSkippedError(call.error),
|
error: () => call => call.error !== undefined && !isSkippedError(call.error),
|
||||||
error: call => call.error !== undefined && !isSkippedError(call.error),
|
interrupted: isInterrupted => call =>
|
||||||
running: call => call.end === undefined && call.error === undefined,
|
call.end === undefined && call.error === undefined && isInterrupted,
|
||||||
success: call => call.end !== undefined && call.error === undefined,
|
running: isInterrupted => call =>
|
||||||
|
call.end === undefined && call.error === undefined && !isInterrupted,
|
||||||
|
skipped: () => call => call.error !== undefined && isSkippedError(call.error),
|
||||||
|
success: () => call => call.end !== undefined && call.error === undefined,
|
||||||
}
|
}
|
||||||
|
|
||||||
const UNHEALTHY_VDI_CHAIN_ERROR = 'unhealthy VDI chain'
|
const UNHEALTHY_VDI_CHAIN_ERROR = 'unhealthy VDI chain'
|
||||||
@ -141,9 +147,19 @@ class Log extends BaseComponent {
|
|||||||
filter: DEFAULT_CALL_FILTER,
|
filter: DEFAULT_CALL_FILTER,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_getIsJobInterrupted = createSelector(
|
||||||
|
() => this.props.log.id,
|
||||||
|
() => get(() => this.props.job.runId),
|
||||||
|
(logId, runId) => logId !== runId
|
||||||
|
)
|
||||||
|
|
||||||
_getFilteredCalls = createFilter(
|
_getFilteredCalls = createFilter(
|
||||||
() => this.props.log.calls,
|
() => this.props.log.calls,
|
||||||
createSelector(() => this.state.filter.value, value => PREDICATES[value])
|
createSelector(
|
||||||
|
() => this.state.filter.value,
|
||||||
|
this._getIsJobInterrupted,
|
||||||
|
(value, isInterrupted) => PREDICATES[value](isInterrupted)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
_filterValueRenderer = createSelector(
|
_filterValueRenderer = createSelector(
|
||||||
@ -187,7 +203,11 @@ class Log extends BaseComponent {
|
|||||||
return (
|
return (
|
||||||
<li key={call.callKey} className='list-group-item'>
|
<li key={call.callKey} className='list-group-item'>
|
||||||
<strong className='text-info'>{call.method}: </strong>
|
<strong className='text-info'>{call.method}: </strong>
|
||||||
<JobCallStateInfos end={end} error={error} />
|
<JobCallStateInfos
|
||||||
|
end={end}
|
||||||
|
error={error}
|
||||||
|
isJobInterrupted={this._getIsJobInterrupted()}
|
||||||
|
/>
|
||||||
<br />
|
<br />
|
||||||
{map(call.params, (value, key) => [
|
{map(call.params, (value, key) => [
|
||||||
<JobParam id={value} paramKey={key} key={key} />,
|
<JobParam id={value} paramKey={key} key={key} />,
|
||||||
@ -271,8 +291,11 @@ class Log extends BaseComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const showCalls = log =>
|
const showCalls = (log, { jobs }) =>
|
||||||
alert(_('jobModalTitle', { job: log.jobId }), <Log log={log} />)
|
alert(
|
||||||
|
_('jobModalTitle', { job: log.jobId }),
|
||||||
|
<Log log={log} job={jobs[log.jobId]} />
|
||||||
|
)
|
||||||
|
|
||||||
const LOG_ACTIONS = [
|
const LOG_ACTIONS = [
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user