Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
41d44191
Commit
41d44191
authored
Sep 15, 2021
by
pburdette
Committed by
Payton Burdette
Sep 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename job trace to job log
Rename job trace to job log to align with docs.
parent
b523ca57
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
235 additions
and
229 deletions
+235
-229
app/assets/javascripts/ide/stores/modules/pipelines/actions.js
...ssets/javascripts/ide/stores/modules/pipelines/actions.js
+1
-0
app/assets/javascripts/jobs/components/job_app.vue
app/assets/javascripts/jobs/components/job_app.vue
+14
-14
app/assets/javascripts/jobs/components/job_log_controllers.vue
...ssets/javascripts/jobs/components/job_log_controllers.vue
+2
-2
app/assets/javascripts/jobs/components/log/collapsible_section.vue
...s/javascripts/jobs/components/log/collapsible_section.vue
+5
-5
app/assets/javascripts/jobs/components/log/log.vue
app/assets/javascripts/jobs/components/log/log.vue
+9
-9
app/assets/javascripts/jobs/store/actions.js
app/assets/javascripts/jobs/store/actions.js
+33
-29
app/assets/javascripts/jobs/store/getters.js
app/assets/javascripts/jobs/store/getters.js
+4
-3
app/assets/javascripts/jobs/store/mutation_types.js
app/assets/javascripts/jobs/store/mutation_types.js
+7
-7
app/assets/javascripts/jobs/store/mutations.js
app/assets/javascripts/jobs/store/mutations.js
+28
-28
app/assets/javascripts/jobs/store/state.js
app/assets/javascripts/jobs/store/state.js
+10
-10
app/assets/javascripts/jobs/store/utils.js
app/assets/javascripts/jobs/store/utils.js
+9
-9
spec/frontend/jobs/components/job_log_controllers_spec.js
spec/frontend/jobs/components/job_log_controllers_spec.js
+2
-2
spec/frontend/jobs/components/log/collapsible_section_spec.js
.../frontend/jobs/components/log/collapsible_section_spec.js
+4
-4
spec/frontend/jobs/components/log/log_spec.js
spec/frontend/jobs/components/log/log_spec.js
+6
-6
spec/frontend/jobs/store/actions_spec.js
spec/frontend/jobs/store/actions_spec.js
+52
-52
spec/frontend/jobs/store/getters_spec.js
spec/frontend/jobs/store/getters_spec.js
+4
-4
spec/frontend/jobs/store/mutations_spec.js
spec/frontend/jobs/store/mutations_spec.js
+39
-39
spec/frontend/jobs/store/utils_spec.js
spec/frontend/jobs/store/utils_spec.js
+6
-6
No files found.
app/assets/javascripts/ide/stores/modules/pipelines/actions.js
View file @
41d44191
...
@@ -139,6 +139,7 @@ export const receiveJobLogsSuccess = ({ commit }, data) =>
...
@@ -139,6 +139,7 @@ export const receiveJobLogsSuccess = ({ commit }, data) =>
export
const
fetchJobLogs
=
({
dispatch
,
state
})
=>
{
export
const
fetchJobLogs
=
({
dispatch
,
state
})
=>
{
dispatch
(
'
requestJobLogs
'
);
dispatch
(
'
requestJobLogs
'
);
// update trace endpoint once BE compeletes trace re-naming in #340626
return
axios
return
axios
.
get
(
`
${
state
.
detailJob
.
path
}
/trace`
,
{
params
:
{
format
:
'
json
'
}
})
.
get
(
`
${
state
.
detailJob
.
path
}
/trace`
,
{
params
:
{
format
:
'
json
'
}
})
.
then
(({
data
})
=>
dispatch
(
'
receiveJobLogsSuccess
'
,
data
))
.
then
(({
data
})
=>
dispatch
(
'
receiveJobLogsSuccess
'
,
data
))
...
...
app/assets/javascripts/jobs/components/job_app.vue
View file @
41d44191
...
@@ -80,13 +80,13 @@ export default {
...
@@ -80,13 +80,13 @@ export default {
'
isLoading
'
,
'
isLoading
'
,
'
job
'
,
'
job
'
,
'
isSidebarOpen
'
,
'
isSidebarOpen
'
,
'
trace
'
,
'
jobLog
'
,
'
is
Trace
Complete
'
,
'
is
JobLog
Complete
'
,
'
trace
Size
'
,
'
jobLog
Size
'
,
'
is
Trace
SizeVisible
'
,
'
is
JobLog
SizeVisible
'
,
'
isScrollBottomDisabled
'
,
'
isScrollBottomDisabled
'
,
'
isScrollTopDisabled
'
,
'
isScrollTopDisabled
'
,
'
isScrolledToBottomBeforeReceiving
Trace
'
,
'
isScrolledToBottomBeforeReceiving
JobLog
'
,
'
hasError
'
,
'
hasError
'
,
'
selectedStage
'
,
'
selectedStage
'
,
]),
]),
...
@@ -97,7 +97,7 @@ export default {
...
@@ -97,7 +97,7 @@ export default {
'
shouldRenderTriggeredLabel
'
,
'
shouldRenderTriggeredLabel
'
,
'
hasEnvironment
'
,
'
hasEnvironment
'
,
'
shouldRenderSharedRunnerLimitWarning
'
,
'
shouldRenderSharedRunnerLimitWarning
'
,
'
has
Trace
'
,
'
has
JobLog
'
,
'
emptyStateIllustration
'
,
'
emptyStateIllustration
'
,
'
isScrollingDown
'
,
'
isScrollingDown
'
,
'
emptyStateAction
'
,
'
emptyStateAction
'
,
...
@@ -155,7 +155,7 @@ export default {
...
@@ -155,7 +155,7 @@ export default {
this
.
updateSidebar
();
this
.
updateSidebar
();
},
},
beforeDestroy
()
{
beforeDestroy
()
{
this
.
stopPolling
Trace
();
this
.
stopPolling
JobLog
();
this
.
stopPolling
();
this
.
stopPolling
();
window
.
removeEventListener
(
'
resize
'
,
this
.
onResize
);
window
.
removeEventListener
(
'
resize
'
,
this
.
onResize
);
window
.
removeEventListener
(
'
scroll
'
,
this
.
updateScroll
);
window
.
removeEventListener
(
'
scroll
'
,
this
.
updateScroll
);
...
@@ -168,7 +168,7 @@ export default {
...
@@ -168,7 +168,7 @@ export default {
'
toggleSidebar
'
,
'
toggleSidebar
'
,
'
scrollBottom
'
,
'
scrollBottom
'
,
'
scrollTop
'
,
'
scrollTop
'
,
'
stopPolling
Trace
'
,
'
stopPolling
JobLog
'
,
'
stopPolling
'
,
'
stopPolling
'
,
'
toggleScrollButtons
'
,
'
toggleScrollButtons
'
,
'
toggleScrollAnimation
'
,
'
toggleScrollAnimation
'
,
...
@@ -270,7 +270,7 @@ export default {
...
@@ -270,7 +270,7 @@ export default {
<div
<div
v-if=
"job.archived"
v-if=
"job.archived"
class=
"gl-mt-3 gl-py-2 gl-px-3 gl-align-items-center gl-z-index-1 gl-m-auto archived-job"
class=
"gl-mt-3 gl-py-2 gl-px-3 gl-align-items-center gl-z-index-1 gl-m-auto archived-job"
:class=
"
{ 'sticky-top gl-border-bottom-0': has
Trace
}"
:class=
"
{ 'sticky-top gl-border-bottom-0': has
JobLog
}"
data-testid="archived-job"
data-testid="archived-job"
>
>
<gl-icon
name=
"lock"
class=
"gl-vertical-align-bottom"
/>
<gl-icon
name=
"lock"
class=
"gl-vertical-align-bottom"
/>
...
@@ -278,7 +278,7 @@ export default {
...
@@ -278,7 +278,7 @@ export default {
</div>
</div>
<!-- job log -->
<!-- job log -->
<div
<div
v-if=
"has
Trace
"
v-if=
"has
JobLog
"
class=
"build-trace-container gl-relative"
class=
"build-trace-container gl-relative"
:class=
"
{ 'gl-mt-3': !job.archived }"
:class=
"
{ 'gl-mt-3': !job.archived }"
>
>
...
@@ -289,22 +289,22 @@ export default {
...
@@ -289,22 +289,22 @@ export default {
'has-archived-block': job.archived,
'has-archived-block': job.archived,
}"
}"
:erase-path="job.erase_path"
:erase-path="job.erase_path"
:size="
trace
Size"
:size="
jobLog
Size"
:raw-path="job.raw_path"
:raw-path="job.raw_path"
:is-scroll-bottom-disabled="isScrollBottomDisabled"
:is-scroll-bottom-disabled="isScrollBottomDisabled"
:is-scroll-top-disabled="isScrollTopDisabled"
:is-scroll-top-disabled="isScrollTopDisabled"
:is-
trace-size-visible="isTrace
SizeVisible"
:is-
job-log-size-visible="isJobLog
SizeVisible"
:is-scrolling-down="isScrollingDown"
:is-scrolling-down="isScrollingDown"
@scrollJobLogTop="scrollTop"
@scrollJobLogTop="scrollTop"
@scrollJobLogBottom="scrollBottom"
@scrollJobLogBottom="scrollBottom"
/>
/>
<log
:
trace=
"trace"
:is-complete=
"isTrace
Complete"
/>
<log
:
job-log=
"jobLog"
:is-complete=
"isJobLog
Complete"
/>
</div>
</div>
<!-- EO job log -->
<!-- EO job log -->
<!-- empty state -->
<!-- empty state -->
<empty-state
<empty-state
v-if=
"!has
Trace
"
v-if=
"!has
JobLog
"
:illustration-path=
"emptyStateIllustration.image"
:illustration-path=
"emptyStateIllustration.image"
:illustration-size-class=
"emptyStateIllustration.size"
:illustration-size-class=
"emptyStateIllustration.size"
:title=
"emptyStateTitle"
:title=
"emptyStateTitle"
...
...
app/assets/javascripts/jobs/components/job_log_controllers.vue
View file @
41d44191
...
@@ -44,7 +44,7 @@ export default {
...
@@ -44,7 +44,7 @@ export default {
type
:
Boolean
,
type
:
Boolean
,
required
:
true
,
required
:
true
,
},
},
is
Trace
SizeVisible
:
{
is
JobLog
SizeVisible
:
{
type
:
Boolean
,
type
:
Boolean
,
required
:
true
,
required
:
true
,
},
},
...
@@ -73,7 +73,7 @@ export default {
...
@@ -73,7 +73,7 @@ export default {
class=
"truncated-info gl-display-none gl-sm-display-block gl-float-left"
class=
"truncated-info gl-display-none gl-sm-display-block gl-float-left"
data-testid=
"log-truncated-info"
data-testid=
"log-truncated-info"
>
>
<template
v-if=
"is
Trace
SizeVisible"
>
<template
v-if=
"is
JobLog
SizeVisible"
>
{{
jobLogSize
}}
{{
jobLogSize
}}
<gl-link
<gl-link
v-if=
"rawPath"
v-if=
"rawPath"
...
...
app/assets/javascripts/jobs/components/log/collapsible_section.vue
View file @
41d44191
...
@@ -17,7 +17,7 @@ export default {
...
@@ -17,7 +17,7 @@ export default {
type
:
Object
,
type
:
Object
,
required
:
true
,
required
:
true
,
},
},
trace
Endpoint
:
{
jobLog
Endpoint
:
{
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
},
},
...
@@ -42,7 +42,7 @@ export default {
...
@@ -42,7 +42,7 @@ export default {
<log-line-header
<log-line-header
:line=
"section.line"
:line=
"section.line"
:duration=
"badgeDuration"
:duration=
"badgeDuration"
:path=
"
trace
Endpoint"
:path=
"
jobLog
Endpoint"
:is-closed=
"section.isClosed"
:is-closed=
"section.isClosed"
@
toggleLine=
"handleOnClickCollapsibleLine(section)"
@
toggleLine=
"handleOnClickCollapsibleLine(section)"
/>
/>
...
@@ -53,10 +53,10 @@ export default {
...
@@ -53,10 +53,10 @@ export default {
v-if=
"line.isHeader"
v-if=
"line.isHeader"
:key=
"line.line.offset"
:key=
"line.line.offset"
:section=
"line"
:section=
"line"
:
trace-endpoint=
"trace
Endpoint"
:
job-log-endpoint=
"jobLog
Endpoint"
@
onClickCollapsibleLine=
"handleOnClickCollapsibleLine"
@
onClickCollapsibleLine=
"handleOnClickCollapsibleLine"
/>
/>
<log-line
v-else
:key=
"line.offset"
:line=
"line"
:path=
"
trace
Endpoint"
/>
<log-line
v-else
:key=
"line.offset"
:line=
"line"
:path=
"
jobLog
Endpoint"
/>
</
template
>
</
template
>
</template>
</template>
<
template
v-else
>
<
template
v-else
>
...
@@ -64,7 +64,7 @@ export default {
...
@@ -64,7 +64,7 @@ export default {
v-for=
"line in section.lines"
v-for=
"line in section.lines"
:key=
"line.offset"
:key=
"line.offset"
:line=
"line"
:line=
"line"
:path=
"
trace
Endpoint"
:path=
"
jobLog
Endpoint"
/>
/>
</
template
>
</
template
>
</template>
</template>
...
...
app/assets/javascripts/jobs/components/log/log.vue
View file @
41d44191
...
@@ -10,10 +10,10 @@ export default {
...
@@ -10,10 +10,10 @@ export default {
},
},
computed
:
{
computed
:
{
...
mapState
([
...
mapState
([
'
trace
Endpoint
'
,
'
jobLog
Endpoint
'
,
'
trace
'
,
'
jobLog
'
,
'
is
Trace
Complete
'
,
'
is
JobLog
Complete
'
,
'
isScrolledToBottomBeforeReceiving
Trace
'
,
'
isScrolledToBottomBeforeReceiving
JobLog
'
,
]),
]),
},
},
updated
()
{
updated
()
{
...
@@ -39,7 +39,7 @@ export default {
...
@@ -39,7 +39,7 @@ export default {
* In order to scroll the page down after `v-html` has finished, we need to use setTimeout
* In order to scroll the page down after `v-html` has finished, we need to use setTimeout
*/
*/
handleScrollDown
()
{
handleScrollDown
()
{
if
(
this
.
isScrolledToBottomBeforeReceiving
Trace
)
{
if
(
this
.
isScrolledToBottomBeforeReceiving
JobLog
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
scrollBottom
();
this
.
scrollBottom
();
},
0
);
},
0
);
...
@@ -50,18 +50,18 @@ export default {
...
@@ -50,18 +50,18 @@ export default {
</
script
>
</
script
>
<
template
>
<
template
>
<code
class=
"job-log d-block"
data-qa-selector=
"job_log_content"
>
<code
class=
"job-log d-block"
data-qa-selector=
"job_log_content"
>
<template
v-for=
"(section, index) in
trace
"
>
<template
v-for=
"(section, index) in
jobLog
"
>
<collapsible-log-section
<collapsible-log-section
v-if=
"section.isHeader"
v-if=
"section.isHeader"
:key=
"`collapsible-$
{index}`"
:key=
"`collapsible-$
{index}`"
:section="section"
:section="section"
:
trace-endpoint="trace
Endpoint"
:
job-log-endpoint="jobLog
Endpoint"
@onClickCollapsibleLine="handleOnClickCollapsibleLine"
@onClickCollapsibleLine="handleOnClickCollapsibleLine"
/>
/>
<log-line
v-else
:key=
"section.offset"
:line=
"section"
:path=
"
trace
Endpoint"
/>
<log-line
v-else
:key=
"section.offset"
:line=
"section"
:path=
"
jobLog
Endpoint"
/>
</
template
>
</
template
>
<div
v-if=
"!is
Trace
Complete"
class=
"js-log-animation loader-animation pt-3 pl-3"
>
<div
v-if=
"!is
JobLog
Complete"
class=
"js-log-animation loader-animation pt-3 pl-3"
>
<div
class=
"dot"
></div>
<div
class=
"dot"
></div>
<div
class=
"dot"
></div>
<div
class=
"dot"
></div>
<div
class=
"dot"
></div>
<div
class=
"dot"
></div>
...
...
app/assets/javascripts/jobs/store/actions.js
View file @
41d44191
...
@@ -18,16 +18,16 @@ import * as types from './mutation_types';
...
@@ -18,16 +18,16 @@ import * as types from './mutation_types';
export
const
init
=
({
dispatch
},
{
endpoint
,
logState
,
pagePath
})
=>
{
export
const
init
=
({
dispatch
},
{
endpoint
,
logState
,
pagePath
})
=>
{
dispatch
(
'
setJobEndpoint
'
,
endpoint
);
dispatch
(
'
setJobEndpoint
'
,
endpoint
);
dispatch
(
'
set
Trace
Options
'
,
{
dispatch
(
'
set
JobLog
Options
'
,
{
logState
,
logState
,
pagePath
,
pagePath
,
});
});
return
Promise
.
all
([
dispatch
(
'
fetchJob
'
),
dispatch
(
'
fetch
Trace
'
)]);
return
Promise
.
all
([
dispatch
(
'
fetchJob
'
),
dispatch
(
'
fetch
JobLog
'
)]);
};
};
export
const
setJobEndpoint
=
({
commit
},
endpoint
)
=>
commit
(
types
.
SET_JOB_ENDPOINT
,
endpoint
);
export
const
setJobEndpoint
=
({
commit
},
endpoint
)
=>
commit
(
types
.
SET_JOB_ENDPOINT
,
endpoint
);
export
const
set
TraceOptions
=
({
commit
},
options
)
=>
commit
(
types
.
SET_TRACE
_OPTIONS
,
options
);
export
const
set
JobLogOptions
=
({
commit
},
options
)
=>
commit
(
types
.
SET_JOB_LOG
_OPTIONS
,
options
);
export
const
hideSidebar
=
({
commit
})
=>
commit
(
types
.
HIDE_SIDEBAR
);
export
const
hideSidebar
=
({
commit
})
=>
commit
(
types
.
HIDE_SIDEBAR
);
export
const
showSidebar
=
({
commit
})
=>
commit
(
types
.
SHOW_SIDEBAR
);
export
const
showSidebar
=
({
commit
})
=>
commit
(
types
.
SHOW_SIDEBAR
);
...
@@ -107,7 +107,7 @@ export const receiveJobError = ({ commit }) => {
...
@@ -107,7 +107,7 @@ export const receiveJobError = ({ commit }) => {
};
};
/**
/**
* Job
's Trace
* Job
Log
*/
*/
export
const
scrollTop
=
({
dispatch
})
=>
{
export
const
scrollTop
=
({
dispatch
})
=>
{
scrollUp
();
scrollUp
();
...
@@ -156,59 +156,62 @@ export const toggleScrollAnimation = ({ commit }, toggle) =>
...
@@ -156,59 +156,62 @@ export const toggleScrollAnimation = ({ commit }, toggle) =>
* Responsible to handle automatic scroll
* Responsible to handle automatic scroll
*/
*/
export
const
toggleScrollisInBottom
=
({
commit
},
toggle
)
=>
{
export
const
toggleScrollisInBottom
=
({
commit
},
toggle
)
=>
{
commit
(
types
.
TOGGLE_IS_SCROLL_IN_BOTTOM_BEFORE_UPDATING_
TRACE
,
toggle
);
commit
(
types
.
TOGGLE_IS_SCROLL_IN_BOTTOM_BEFORE_UPDATING_
JOB_LOG
,
toggle
);
};
};
export
const
request
Trace
=
({
commit
})
=>
commit
(
types
.
REQUEST_TRACE
);
export
const
request
JobLog
=
({
commit
})
=>
commit
(
types
.
REQUEST_JOB_LOG
);
export
const
fetchTrace
=
({
dispatch
,
state
})
=>
export
const
fetchJobLog
=
({
dispatch
,
state
})
=>
// update trace endpoint once BE compeletes trace re-naming in #340626
axios
axios
.
get
(
`
${
state
.
trace
Endpoint
}
/trace.json`
,
{
.
get
(
`
${
state
.
jobLog
Endpoint
}
/trace.json`
,
{
params
:
{
state
:
state
.
trace
State
},
params
:
{
state
:
state
.
jobLog
State
},
})
})
.
then
(({
data
})
=>
{
.
then
(({
data
})
=>
{
dispatch
(
'
toggleScrollisInBottom
'
,
isScrolledToBottom
());
dispatch
(
'
toggleScrollisInBottom
'
,
isScrolledToBottom
());
dispatch
(
'
receive
Trace
Success
'
,
data
);
dispatch
(
'
receive
JobLog
Success
'
,
data
);
if
(
data
.
complete
)
{
if
(
data
.
complete
)
{
dispatch
(
'
stopPolling
Trace
'
);
dispatch
(
'
stopPolling
JobLog
'
);
}
else
if
(
!
state
.
trace
Timeout
)
{
}
else
if
(
!
state
.
jobLog
Timeout
)
{
dispatch
(
'
startPolling
Trace
'
);
dispatch
(
'
startPolling
JobLog
'
);
}
}
})
})
.
catch
((
e
)
=>
{
.
catch
((
e
)
=>
{
if
(
e
.
response
.
status
===
httpStatusCodes
.
FORBIDDEN
)
{
if
(
e
.
response
.
status
===
httpStatusCodes
.
FORBIDDEN
)
{
dispatch
(
'
receive
Trace
UnauthorizedError
'
);
dispatch
(
'
receive
JobLog
UnauthorizedError
'
);
}
else
{
}
else
{
reportToSentry
(
'
job_actions
'
,
e
);
reportToSentry
(
'
job_actions
'
,
e
);
dispatch
(
'
receive
Trace
Error
'
);
dispatch
(
'
receive
JobLog
Error
'
);
}
}
});
});
export
const
startPolling
Trace
=
({
dispatch
,
commit
})
=>
{
export
const
startPolling
JobLog
=
({
dispatch
,
commit
})
=>
{
const
trace
Timeout
=
setTimeout
(()
=>
{
const
jobLog
Timeout
=
setTimeout
(()
=>
{
commit
(
types
.
SET_
TRACE
_TIMEOUT
,
0
);
commit
(
types
.
SET_
JOB_LOG
_TIMEOUT
,
0
);
dispatch
(
'
fetch
Trace
'
);
dispatch
(
'
fetch
JobLog
'
);
},
4000
);
},
4000
);
commit
(
types
.
SET_
TRACE_TIMEOUT
,
trace
Timeout
);
commit
(
types
.
SET_
JOB_LOG_TIMEOUT
,
jobLog
Timeout
);
};
};
export
const
stopPolling
Trace
=
({
state
,
commit
})
=>
{
export
const
stopPolling
JobLog
=
({
state
,
commit
})
=>
{
clearTimeout
(
state
.
trace
Timeout
);
clearTimeout
(
state
.
jobLog
Timeout
);
commit
(
types
.
SET_
TRACE
_TIMEOUT
,
0
);
commit
(
types
.
SET_
JOB_LOG
_TIMEOUT
,
0
);
commit
(
types
.
STOP_POLLING_
TRACE
);
commit
(
types
.
STOP_POLLING_
JOB_LOG
);
};
};
export
const
receiveTraceSuccess
=
({
commit
},
log
)
=>
commit
(
types
.
RECEIVE_TRACE_SUCCESS
,
log
);
export
const
receiveJobLogSuccess
=
({
commit
},
log
)
=>
commit
(
types
.
RECEIVE_JOB_LOG_SUCCESS
,
log
);
export
const
receiveTraceError
=
({
dispatch
})
=>
{
dispatch
(
'
stopPollingTrace
'
);
export
const
receiveJobLogError
=
({
dispatch
})
=>
{
dispatch
(
'
stopPollingJobLog
'
);
createFlash
({
createFlash
({
message
:
__
(
'
An error occurred while fetching the job log.
'
),
message
:
__
(
'
An error occurred while fetching the job log.
'
),
});
});
};
};
export
const
receiveTraceUnauthorizedError
=
({
dispatch
})
=>
{
dispatch
(
'
stopPollingTrace
'
);
export
const
receiveJobLogUnauthorizedError
=
({
dispatch
})
=>
{
dispatch
(
'
stopPollingJobLog
'
);
createFlash
({
createFlash
({
message
:
__
(
'
The current user is not authorized to access the job log.
'
),
message
:
__
(
'
The current user is not authorized to access the job log.
'
),
});
});
...
@@ -248,6 +251,7 @@ export const fetchJobsForStage = ({ dispatch }, stage = {}) => {
...
@@ -248,6 +251,7 @@ export const fetchJobsForStage = ({ dispatch }, stage = {}) => {
};
};
export
const
receiveJobsForStageSuccess
=
({
commit
},
data
)
=>
export
const
receiveJobsForStageSuccess
=
({
commit
},
data
)
=>
commit
(
types
.
RECEIVE_JOBS_FOR_STAGE_SUCCESS
,
data
);
commit
(
types
.
RECEIVE_JOBS_FOR_STAGE_SUCCESS
,
data
);
export
const
receiveJobsForStageError
=
({
commit
})
=>
{
export
const
receiveJobsForStageError
=
({
commit
})
=>
{
commit
(
types
.
RECEIVE_JOBS_FOR_STAGE_ERROR
);
commit
(
types
.
RECEIVE_JOBS_FOR_STAGE_ERROR
);
createFlash
({
createFlash
({
...
...
app/assets/javascripts/jobs/store/getters.js
View file @
41d44191
...
@@ -21,11 +21,12 @@ export const shouldRenderTriggeredLabel = (state) => isString(state.job.started)
...
@@ -21,11 +21,12 @@ export const shouldRenderTriggeredLabel = (state) => isString(state.job.started)
export
const
hasEnvironment
=
(
state
)
=>
!
isEmpty
(
state
.
job
.
deployment_status
);
export
const
hasEnvironment
=
(
state
)
=>
!
isEmpty
(
state
.
job
.
deployment_status
);
/**
/**
* Checks if it the job has
trace
.
* Checks if it the job has
a log
.
* Used to check if it should render the job log or the empty state
* Used to check if it should render the job log or the empty state
* @returns {Boolean}
* @returns {Boolean}
*/
*/
export
const
hasTrace
=
(
state
)
=>
export
const
hasJobLog
=
(
state
)
=>
// update has_trace once BE compeletes trace re-naming in #340626
state
.
job
.
has_trace
||
(
!
isEmpty
(
state
.
job
.
status
)
&&
state
.
job
.
status
.
group
===
'
running
'
);
state
.
job
.
has_trace
||
(
!
isEmpty
(
state
.
job
.
status
)
&&
state
.
job
.
status
.
group
===
'
running
'
);
export
const
emptyStateIllustration
=
(
state
)
=>
state
?.
job
?.
status
?.
illustration
||
{};
export
const
emptyStateIllustration
=
(
state
)
=>
state
?.
job
?.
status
?.
illustration
||
{};
...
@@ -43,7 +44,7 @@ export const shouldRenderSharedRunnerLimitWarning = (state) =>
...
@@ -43,7 +44,7 @@ export const shouldRenderSharedRunnerLimitWarning = (state) =>
!
isEmpty
(
state
.
job
.
runners
.
quota
)
&&
!
isEmpty
(
state
.
job
.
runners
.
quota
)
&&
state
.
job
.
runners
.
quota
.
used
>=
state
.
job
.
runners
.
quota
.
limit
;
state
.
job
.
runners
.
quota
.
used
>=
state
.
job
.
runners
.
quota
.
limit
;
export
const
isScrollingDown
=
(
state
)
=>
isScrolledToBottom
()
&&
!
state
.
is
Trace
Complete
;
export
const
isScrollingDown
=
(
state
)
=>
isScrolledToBottom
()
&&
!
state
.
is
JobLog
Complete
;
export
const
hasRunnersForProject
=
(
state
)
=>
export
const
hasRunnersForProject
=
(
state
)
=>
state
?.
job
?.
runners
?.
available
&&
!
state
?.
job
?.
runners
?.
online
;
state
?.
job
?.
runners
?.
available
&&
!
state
?.
job
?.
runners
?.
online
;
app/assets/javascripts/jobs/store/mutation_types.js
View file @
41d44191
export
const
SET_JOB_ENDPOINT
=
'
SET_JOB_ENDPOINT
'
;
export
const
SET_JOB_ENDPOINT
=
'
SET_JOB_ENDPOINT
'
;
export
const
SET_
TRACE_OPTIONS
=
'
SET_TRACE
_OPTIONS
'
;
export
const
SET_
JOB_LOG_OPTIONS
=
'
SET_JOB_LOG
_OPTIONS
'
;
export
const
HIDE_SIDEBAR
=
'
HIDE_SIDEBAR
'
;
export
const
HIDE_SIDEBAR
=
'
HIDE_SIDEBAR
'
;
export
const
SHOW_SIDEBAR
=
'
SHOW_SIDEBAR
'
;
export
const
SHOW_SIDEBAR
=
'
SHOW_SIDEBAR
'
;
...
@@ -12,17 +12,17 @@ export const ENABLE_SCROLL_BOTTOM = 'ENABLE_SCROLL_BOTTOM';
...
@@ -12,17 +12,17 @@ export const ENABLE_SCROLL_BOTTOM = 'ENABLE_SCROLL_BOTTOM';
export
const
ENABLE_SCROLL_TOP
=
'
ENABLE_SCROLL_TOP
'
;
export
const
ENABLE_SCROLL_TOP
=
'
ENABLE_SCROLL_TOP
'
;
export
const
TOGGLE_SCROLL_ANIMATION
=
'
TOGGLE_SCROLL_ANIMATION
'
;
export
const
TOGGLE_SCROLL_ANIMATION
=
'
TOGGLE_SCROLL_ANIMATION
'
;
export
const
TOGGLE_IS_SCROLL_IN_BOTTOM_BEFORE_UPDATING_
TRACE
=
'
TOGGLE_IS_SCROLL_IN_BOTTOM
'
;
export
const
TOGGLE_IS_SCROLL_IN_BOTTOM_BEFORE_UPDATING_
JOB_LOG
=
'
TOGGLE_IS_SCROLL_IN_BOTTOM
'
;
export
const
REQUEST_JOB
=
'
REQUEST_JOB
'
;
export
const
REQUEST_JOB
=
'
REQUEST_JOB
'
;
export
const
RECEIVE_JOB_SUCCESS
=
'
RECEIVE_JOB_SUCCESS
'
;
export
const
RECEIVE_JOB_SUCCESS
=
'
RECEIVE_JOB_SUCCESS
'
;
export
const
RECEIVE_JOB_ERROR
=
'
RECEIVE_JOB_ERROR
'
;
export
const
RECEIVE_JOB_ERROR
=
'
RECEIVE_JOB_ERROR
'
;
export
const
REQUEST_
TRACE
=
'
REQUEST_TRACE
'
;
export
const
REQUEST_
JOB_LOG
=
'
REQUEST_JOB_LOG
'
;
export
const
SET_
TRACE_TIMEOUT
=
'
SET_TRACE
_TIMEOUT
'
;
export
const
SET_
JOB_LOG_TIMEOUT
=
'
SET_JOB_LOG
_TIMEOUT
'
;
export
const
STOP_POLLING_
TRACE
=
'
STOP_POLLING_TRACE
'
;
export
const
STOP_POLLING_
JOB_LOG
=
'
STOP_POLLING_JOB_LOG
'
;
export
const
RECEIVE_
TRACE_SUCCESS
=
'
RECEIVE_TRACE
_SUCCESS
'
;
export
const
RECEIVE_
JOB_LOG_SUCCESS
=
'
RECEIVE_JOB_LOG
_SUCCESS
'
;
export
const
RECEIVE_
TRACE_ERROR
=
'
RECEIVE_TRACE
_ERROR
'
;
export
const
RECEIVE_
JOB_LOG_ERROR
=
'
RECEIVE_JOB_LOG
_ERROR
'
;
export
const
TOGGLE_COLLAPSIBLE_LINE
=
'
TOGGLE_COLLAPSIBLE_LINE
'
;
export
const
TOGGLE_COLLAPSIBLE_LINE
=
'
TOGGLE_COLLAPSIBLE_LINE
'
;
export
const
SET_SELECTED_STAGE
=
'
SET_SELECTED_STAGE
'
;
export
const
SET_SELECTED_STAGE
=
'
SET_SELECTED_STAGE
'
;
...
...
app/assets/javascripts/jobs/store/mutations.js
View file @
41d44191
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
{
INFINITELY_NESTED_COLLAPSIBLE_SECTIONS_FF
}
from
'
../constants
'
;
import
{
INFINITELY_NESTED_COLLAPSIBLE_SECTIONS_FF
}
from
'
../constants
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
{
logLinesParser
,
logLinesParserLegacy
,
updateIncremental
Trace
}
from
'
./utils
'
;
import
{
logLinesParser
,
logLinesParserLegacy
,
updateIncremental
JobLog
}
from
'
./utils
'
;
export
default
{
export
default
{
[
types
.
SET_JOB_ENDPOINT
](
state
,
endpoint
)
{
[
types
.
SET_JOB_ENDPOINT
](
state
,
endpoint
)
{
state
.
jobEndpoint
=
endpoint
;
state
.
jobEndpoint
=
endpoint
;
},
},
[
types
.
SET_
TRACE
_OPTIONS
](
state
,
options
=
{})
{
[
types
.
SET_
JOB_LOG
_OPTIONS
](
state
,
options
=
{})
{
state
.
trace
Endpoint
=
options
.
pagePath
;
state
.
jobLog
Endpoint
=
options
.
pagePath
;
state
.
trace
State
=
options
.
logState
;
state
.
jobLog
State
=
options
.
logState
;
},
},
[
types
.
HIDE_SIDEBAR
](
state
)
{
[
types
.
HIDE_SIDEBAR
](
state
)
{
...
@@ -20,11 +20,11 @@ export default {
...
@@ -20,11 +20,11 @@ export default {
state
.
isSidebarOpen
=
true
;
state
.
isSidebarOpen
=
true
;
},
},
[
types
.
RECEIVE_
TRACE
_SUCCESS
](
state
,
log
=
{})
{
[
types
.
RECEIVE_
JOB_LOG
_SUCCESS
](
state
,
log
=
{})
{
const
infinitelyCollapsibleSectionsFlag
=
const
infinitelyCollapsibleSectionsFlag
=
gon
.
features
?.[
INFINITELY_NESTED_COLLAPSIBLE_SECTIONS_FF
];
gon
.
features
?.[
INFINITELY_NESTED_COLLAPSIBLE_SECTIONS_FF
];
if
(
log
.
state
)
{
if
(
log
.
state
)
{
state
.
trace
State
=
log
.
state
;
state
.
jobLog
State
=
log
.
state
;
}
}
if
(
log
.
append
)
{
if
(
log
.
append
)
{
...
@@ -32,52 +32,52 @@ export default {
...
@@ -32,52 +32,52 @@ export default {
if
(
log
.
lines
)
{
if
(
log
.
lines
)
{
const
parsedResult
=
logLinesParser
(
const
parsedResult
=
logLinesParser
(
log
.
lines
,
log
.
lines
,
state
.
auxiliaryPartial
Trace
Helpers
,
state
.
auxiliaryPartial
JobLog
Helpers
,
state
.
trace
,
state
.
jobLog
,
);
);
state
.
trace
=
parsedResult
.
parsedLines
;
state
.
jobLog
=
parsedResult
.
parsedLines
;
state
.
auxiliaryPartial
TraceHelpers
=
parsedResult
.
auxiliaryPartialTrace
Helpers
;
state
.
auxiliaryPartial
JobLogHelpers
=
parsedResult
.
auxiliaryPartialJobLog
Helpers
;
}
}
}
else
{
}
else
{
state
.
trace
=
log
.
lines
?
updateIncrementalTrace
(
log
.
lines
,
state
.
trace
)
:
state
.
trace
;
state
.
jobLog
=
log
.
lines
?
updateIncrementalJobLog
(
log
.
lines
,
state
.
jobLog
)
:
state
.
jobLog
;
}
}
state
.
trace
Size
+=
log
.
size
;
state
.
jobLog
Size
+=
log
.
size
;
}
else
{
}
else
{
// When the job still does not have a
trace
// When the job still does not have a
log
// the
trace
response will not have a defined
// the
job log
response will not have a defined
// html or size. We keep the old value otherwise these
// html or size. We keep the old value otherwise these
// will be set to `null`
// will be set to `null`
if
(
infinitelyCollapsibleSectionsFlag
)
{
if
(
infinitelyCollapsibleSectionsFlag
)
{
const
parsedResult
=
logLinesParser
(
log
.
lines
);
const
parsedResult
=
logLinesParser
(
log
.
lines
);
state
.
trace
=
parsedResult
.
parsedLines
;
state
.
jobLog
=
parsedResult
.
parsedLines
;
state
.
auxiliaryPartial
TraceHelpers
=
parsedResult
.
auxiliaryPartialTrace
Helpers
;
state
.
auxiliaryPartial
JobLogHelpers
=
parsedResult
.
auxiliaryPartialJobLog
Helpers
;
}
else
{
}
else
{
state
.
trace
=
log
.
lines
?
logLinesParserLegacy
(
log
.
lines
)
:
state
.
trace
;
state
.
jobLog
=
log
.
lines
?
logLinesParserLegacy
(
log
.
lines
)
:
state
.
jobLog
;
}
}
state
.
traceSize
=
log
.
size
||
state
.
trace
Size
;
state
.
jobLogSize
=
log
.
size
||
state
.
jobLog
Size
;
}
}
if
(
state
.
trace
Size
<
log
.
total
)
{
if
(
state
.
jobLog
Size
<
log
.
total
)
{
state
.
is
Trace
SizeVisible
=
true
;
state
.
is
JobLog
SizeVisible
=
true
;
}
else
{
}
else
{
state
.
is
Trace
SizeVisible
=
false
;
state
.
is
JobLog
SizeVisible
=
false
;
}
}
state
.
is
TraceComplete
=
log
.
complete
||
state
.
isTrace
Complete
;
state
.
is
JobLogComplete
=
log
.
complete
||
state
.
isJobLog
Complete
;
},
},
[
types
.
SET_
TRACE
_TIMEOUT
](
state
,
id
)
{
[
types
.
SET_
JOB_LOG
_TIMEOUT
](
state
,
id
)
{
state
.
trace
Timeout
=
id
;
state
.
jobLog
Timeout
=
id
;
},
},
/**
/**
* Will remove loading animation
* Will remove loading animation
*/
*/
[
types
.
STOP_POLLING_
TRACE
](
state
)
{
[
types
.
STOP_POLLING_
JOB_LOG
](
state
)
{
state
.
is
Trace
Complete
=
true
;
state
.
is
JobLog
Complete
=
true
;
},
},
/**
/**
...
@@ -137,8 +137,8 @@ export default {
...
@@ -137,8 +137,8 @@ export default {
state
.
isScrollingDown
=
toggle
;
state
.
isScrollingDown
=
toggle
;
},
},
[
types
.
TOGGLE_IS_SCROLL_IN_BOTTOM_BEFORE_UPDATING_
TRACE
](
state
,
toggle
)
{
[
types
.
TOGGLE_IS_SCROLL_IN_BOTTOM_BEFORE_UPDATING_
JOB_LOG
](
state
,
toggle
)
{
state
.
isScrolledToBottomBeforeReceiving
Trace
=
toggle
;
state
.
isScrolledToBottomBeforeReceiving
JobLog
=
toggle
;
},
},
[
types
.
REQUEST_JOBS_FOR_STAGE
](
state
,
stage
=
{})
{
[
types
.
REQUEST_JOBS_FOR_STAGE
](
state
,
stage
=
{})
{
...
...
app/assets/javascripts/jobs/store/state.js
View file @
41d44191
export
default
()
=>
({
export
default
()
=>
({
jobEndpoint
:
null
,
jobEndpoint
:
null
,
trace
Endpoint
:
null
,
jobLog
Endpoint
:
null
,
// sidebar
// sidebar
isSidebarOpen
:
true
,
isSidebarOpen
:
true
,
...
@@ -14,16 +14,16 @@ export default () => ({
...
@@ -14,16 +14,16 @@ export default () => ({
isScrollTopDisabled
:
true
,
isScrollTopDisabled
:
true
,
// Used to check if we should keep the automatic scroll
// Used to check if we should keep the automatic scroll
isScrolledToBottomBeforeReceiving
Trace
:
true
,
isScrolledToBottomBeforeReceiving
JobLog
:
true
,
trace
:
[],
jobLog
:
[],
is
Trace
Complete
:
false
,
is
JobLog
Complete
:
false
,
trace
Size
:
0
,
jobLog
Size
:
0
,
is
Trace
SizeVisible
:
false
,
is
JobLog
SizeVisible
:
false
,
trace
Timeout
:
0
,
jobLog
Timeout
:
0
,
// used as a query parameter to fetch the
trace
// used as a query parameter to fetch the
job log
trace
State
:
null
,
jobLog
State
:
null
,
// sidebar dropdown & list of jobs
// sidebar dropdown & list of jobs
isLoadingJobs
:
false
,
isLoadingJobs
:
false
,
...
@@ -32,5 +32,5 @@ export default () => ({
...
@@ -32,5 +32,5 @@ export default () => ({
jobs
:
[],
jobs
:
[],
// to parse partial logs
// to parse partial logs
auxiliaryPartial
Trace
Helpers
:
{},
auxiliaryPartial
JobLog
Helpers
:
{},
});
});
app/assets/javascripts/jobs/store/utils.js
View file @
41d44191
...
@@ -131,17 +131,17 @@ export const logLinesParserLegacy = (lines = [], accumulator = []) =>
...
@@ -131,17 +131,17 @@ export const logLinesParserLegacy = (lines = [], accumulator = []) =>
[...
accumulator
],
[...
accumulator
],
);
);
export
const
logLinesParser
=
(
lines
=
[],
previous
Trace
State
=
{},
prevParsedLines
=
[])
=>
{
export
const
logLinesParser
=
(
lines
=
[],
previous
JobLog
State
=
{},
prevParsedLines
=
[])
=>
{
let
currentLineCount
=
previous
Trace
State
?.
prevLineCount
??
0
;
let
currentLineCount
=
previous
JobLog
State
?.
prevLineCount
??
0
;
let
currentHeader
=
previous
Trace
State
?.
currentHeader
;
let
currentHeader
=
previous
JobLog
State
?.
currentHeader
;
let
isPreviousLineHeader
=
previous
Trace
State
?.
isPreviousLineHeader
??
false
;
let
isPreviousLineHeader
=
previous
JobLog
State
?.
isPreviousLineHeader
??
false
;
const
parsedLines
=
prevParsedLines
.
length
>
0
?
prevParsedLines
:
[];
const
parsedLines
=
prevParsedLines
.
length
>
0
?
prevParsedLines
:
[];
const
sectionsQueue
=
previous
Trace
State
?.
sectionsQueue
??
[];
const
sectionsQueue
=
previous
JobLog
State
?.
sectionsQueue
??
[];
for
(
let
i
=
0
;
i
<
lines
.
length
;
i
+=
1
)
{
for
(
let
i
=
0
;
i
<
lines
.
length
;
i
+=
1
)
{
const
line
=
lines
[
i
];
const
line
=
lines
[
i
];
// First run we can use the current index, later runs we have to retrieve the last number of lines
// First run we can use the current index, later runs we have to retrieve the last number of lines
currentLineCount
=
previous
Trace
State
?.
prevLineCount
?
currentLineCount
+
1
:
i
+
1
;
currentLineCount
=
previous
JobLog
State
?.
prevLineCount
?
currentLineCount
+
1
:
i
+
1
;
if
(
line
.
section_header
&&
!
isPreviousLineHeader
)
{
if
(
line
.
section_header
&&
!
isPreviousLineHeader
)
{
// If there's no previous line header that means we're at the root of the log
// If there's no previous line header that means we're at the root of the log
...
@@ -198,7 +198,7 @@ export const logLinesParser = (lines = [], previousTraceState = {}, prevParsedLi
...
@@ -198,7 +198,7 @@ export const logLinesParser = (lines = [], previousTraceState = {}, prevParsedLi
return
{
return
{
parsedLines
,
parsedLines
,
auxiliaryPartial
Trace
Helpers
:
{
auxiliaryPartial
JobLog
Helpers
:
{
isPreviousLineHeader
,
isPreviousLineHeader
,
currentHeader
,
currentHeader
,
sectionsQueue
,
sectionsQueue
,
...
@@ -241,7 +241,7 @@ export const findOffsetAndRemove = (newLog = [], oldParsed = []) => {
...
@@ -241,7 +241,7 @@ export const findOffsetAndRemove = (newLog = [], oldParsed = []) => {
};
};
/**
/**
* When the
trace
is not complete, backend may send the last received line
* When the
job log
is not complete, backend may send the last received line
* in the new response.
* in the new response.
*
*
* We need to check if that is the case by looking for the offset property
* We need to check if that is the case by looking for the offset property
...
@@ -250,7 +250,7 @@ export const findOffsetAndRemove = (newLog = [], oldParsed = []) => {
...
@@ -250,7 +250,7 @@ export const findOffsetAndRemove = (newLog = [], oldParsed = []) => {
* @param array oldLog
* @param array oldLog
* @param array newLog
* @param array newLog
*/
*/
export
const
updateIncremental
Trace
=
(
newLog
=
[],
oldParsed
=
[])
=>
{
export
const
updateIncremental
JobLog
=
(
newLog
=
[],
oldParsed
=
[])
=>
{
const
parsedLog
=
findOffsetAndRemove
(
newLog
,
oldParsed
);
const
parsedLog
=
findOffsetAndRemove
(
newLog
,
oldParsed
);
return
logLinesParserLegacy
(
newLog
,
parsedLog
);
return
logLinesParserLegacy
(
newLog
,
parsedLog
);
...
...
spec/frontend/jobs/components/job_log_controllers_spec.js
View file @
41d44191
...
@@ -18,7 +18,7 @@ describe('Job log controllers', () => {
...
@@ -18,7 +18,7 @@ describe('Job log controllers', () => {
isScrollTopDisabled
:
false
,
isScrollTopDisabled
:
false
,
isScrollBottomDisabled
:
false
,
isScrollBottomDisabled
:
false
,
isScrollingDown
:
true
,
isScrollingDown
:
true
,
is
Trace
SizeVisible
:
true
,
is
JobLog
SizeVisible
:
true
,
};
};
const
createWrapper
=
(
props
)
=>
{
const
createWrapper
=
(
props
)
=>
{
...
@@ -38,7 +38,7 @@ describe('Job log controllers', () => {
...
@@ -38,7 +38,7 @@ describe('Job log controllers', () => {
const
findScrollBottom
=
()
=>
wrapper
.
find
(
'
[data-testid="job-controller-scroll-bottom"]
'
);
const
findScrollBottom
=
()
=>
wrapper
.
find
(
'
[data-testid="job-controller-scroll-bottom"]
'
);
describe
(
'
Truncate information
'
,
()
=>
{
describe
(
'
Truncate information
'
,
()
=>
{
describe
(
'
with is
Trace
SizeVisible
'
,
()
=>
{
describe
(
'
with is
JobLog
SizeVisible
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
createWrapper
();
createWrapper
();
});
});
...
...
spec/frontend/jobs/components/log/collapsible_section_spec.js
View file @
41d44191
...
@@ -6,7 +6,7 @@ describe('Job Log Collapsible Section', () => {
...
@@ -6,7 +6,7 @@ describe('Job Log Collapsible Section', () => {
let
wrapper
;
let
wrapper
;
let
origGon
;
let
origGon
;
const
trace
Endpoint
=
'
jobs/335
'
;
const
jobLog
Endpoint
=
'
jobs/335
'
;
const
findCollapsibleLine
=
()
=>
wrapper
.
find
(
'
.collapsible-line
'
);
const
findCollapsibleLine
=
()
=>
wrapper
.
find
(
'
.collapsible-line
'
);
const
findCollapsibleLineSvg
=
()
=>
wrapper
.
find
(
'
.collapsible-line svg
'
);
const
findCollapsibleLineSvg
=
()
=>
wrapper
.
find
(
'
.collapsible-line svg
'
);
...
@@ -35,7 +35,7 @@ describe('Job Log Collapsible Section', () => {
...
@@ -35,7 +35,7 @@ describe('Job Log Collapsible Section', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
createComponent
({
createComponent
({
section
:
collapsibleSectionClosed
,
section
:
collapsibleSectionClosed
,
trace
Endpoint
,
jobLog
Endpoint
,
});
});
});
});
...
@@ -52,7 +52,7 @@ describe('Job Log Collapsible Section', () => {
...
@@ -52,7 +52,7 @@ describe('Job Log Collapsible Section', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
createComponent
({
createComponent
({
section
:
collapsibleSectionOpened
,
section
:
collapsibleSectionOpened
,
trace
Endpoint
,
jobLog
Endpoint
,
});
});
});
});
...
@@ -72,7 +72,7 @@ describe('Job Log Collapsible Section', () => {
...
@@ -72,7 +72,7 @@ describe('Job Log Collapsible Section', () => {
it
(
'
emits onClickCollapsibleLine on click
'
,
()
=>
{
it
(
'
emits onClickCollapsibleLine on click
'
,
()
=>
{
createComponent
({
createComponent
({
section
:
collapsibleSectionOpened
,
section
:
collapsibleSectionOpened
,
trace
Endpoint
,
jobLog
Endpoint
,
});
});
findCollapsibleLine
().
trigger
(
'
click
'
);
findCollapsibleLine
().
trigger
(
'
click
'
);
...
...
spec/frontend/jobs/components/log/log_spec.js
View file @
41d44191
...
@@ -31,8 +31,8 @@ describe('Job Log', () => {
...
@@ -31,8 +31,8 @@ describe('Job Log', () => {
window
.
gon
=
{
features
:
{
infinitelyCollapsibleSections
:
false
}
};
window
.
gon
=
{
features
:
{
infinitelyCollapsibleSections
:
false
}
};
state
=
{
state
=
{
trace
:
logLinesParserLegacy
(
jobLog
),
jobLog
:
logLinesParserLegacy
(
jobLog
),
trace
Endpoint
:
'
jobs/id
'
,
jobLog
Endpoint
:
'
jobs/id
'
,
};
};
store
=
new
Vuex
.
Store
({
store
=
new
Vuex
.
Store
({
...
@@ -59,7 +59,7 @@ describe('Job Log', () => {
...
@@ -59,7 +59,7 @@ describe('Job Log', () => {
});
});
it
(
'
links to the provided path and correct line number
'
,
()
=>
{
it
(
'
links to the provided path and correct line number
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
#L1
'
).
attributes
(
'
href
'
)).
toBe
(
`
${
state
.
trace
Endpoint
}
#L1`
);
expect
(
wrapper
.
find
(
'
#L1
'
).
attributes
(
'
href
'
)).
toBe
(
`
${
state
.
jobLog
Endpoint
}
#L1`
);
});
});
});
});
...
@@ -111,8 +111,8 @@ describe('Job Log, infinitelyCollapsibleSections feature flag enabled', () => {
...
@@ -111,8 +111,8 @@ describe('Job Log, infinitelyCollapsibleSections feature flag enabled', () => {
window
.
gon
=
{
features
:
{
infinitelyCollapsibleSections
:
true
}
};
window
.
gon
=
{
features
:
{
infinitelyCollapsibleSections
:
true
}
};
state
=
{
state
=
{
trace
:
logLinesParser
(
jobLog
).
parsedLines
,
jobLog
:
logLinesParser
(
jobLog
).
parsedLines
,
trace
Endpoint
:
'
jobs/id
'
,
jobLog
Endpoint
:
'
jobs/id
'
,
};
};
store
=
new
Vuex
.
Store
({
store
=
new
Vuex
.
Store
({
...
@@ -139,7 +139,7 @@ describe('Job Log, infinitelyCollapsibleSections feature flag enabled', () => {
...
@@ -139,7 +139,7 @@ describe('Job Log, infinitelyCollapsibleSections feature flag enabled', () => {
});
});
it
(
'
links to the provided path and correct line number
'
,
()
=>
{
it
(
'
links to the provided path and correct line number
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
#L1
'
).
attributes
(
'
href
'
)).
toBe
(
`
${
state
.
trace
Endpoint
}
#L1`
);
expect
(
wrapper
.
find
(
'
#L1
'
).
attributes
(
'
href
'
)).
toBe
(
`
${
state
.
jobLog
Endpoint
}
#L1`
);
});
});
});
});
...
...
spec/frontend/jobs/store/actions_spec.js
View file @
41d44191
...
@@ -3,7 +3,7 @@ import { TEST_HOST } from 'helpers/test_constants';
...
@@ -3,7 +3,7 @@ import { TEST_HOST } from 'helpers/test_constants';
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
{
import
{
setJobEndpoint
,
setJobEndpoint
,
set
Trace
Options
,
set
JobLog
Options
,
clearEtagPoll
,
clearEtagPoll
,
stopPolling
,
stopPolling
,
requestJob
,
requestJob
,
...
@@ -12,12 +12,12 @@ import {
...
@@ -12,12 +12,12 @@ import {
receiveJobError
,
receiveJobError
,
scrollTop
,
scrollTop
,
scrollBottom
,
scrollBottom
,
request
Trace
,
request
JobLog
,
fetch
Trace
,
fetch
JobLog
,
startPolling
Trace
,
startPolling
JobLog
,
stopPolling
Trace
,
stopPolling
JobLog
,
receive
Trace
Success
,
receive
JobLog
Success
,
receive
Trace
Error
,
receive
JobLog
Error
,
toggleCollapsibleLine
,
toggleCollapsibleLine
,
requestJobsForStage
,
requestJobsForStage
,
fetchJobsForStage
,
fetchJobsForStage
,
...
@@ -51,13 +51,13 @@ describe('Job State actions', () => {
...
@@ -51,13 +51,13 @@ describe('Job State actions', () => {
});
});
});
});
describe
(
'
set
Trace
Options
'
,
()
=>
{
describe
(
'
set
JobLog
Options
'
,
()
=>
{
it
(
'
should commit SET_
TRACE
_OPTIONS mutation
'
,
(
done
)
=>
{
it
(
'
should commit SET_
JOB_LOG
_OPTIONS mutation
'
,
(
done
)
=>
{
testAction
(
testAction
(
set
Trace
Options
,
set
JobLog
Options
,
{
pagePath
:
'
job/872324/trace.json
'
},
{
pagePath
:
'
job/872324/trace.json
'
},
mockedState
,
mockedState
,
[{
type
:
types
.
SET_
TRACE
_OPTIONS
,
payload
:
{
pagePath
:
'
job/872324/trace.json
'
}
}],
[{
type
:
types
.
SET_
JOB_LOG
_OPTIONS
,
payload
:
{
pagePath
:
'
job/872324/trace.json
'
}
}],
[],
[],
done
,
done
,
);
);
...
@@ -191,17 +191,17 @@ describe('Job State actions', () => {
...
@@ -191,17 +191,17 @@ describe('Job State actions', () => {
});
});
});
});
describe
(
'
request
Trace
'
,
()
=>
{
describe
(
'
request
JobLog
'
,
()
=>
{
it
(
'
should commit REQUEST_
TRACE
mutation
'
,
(
done
)
=>
{
it
(
'
should commit REQUEST_
JOB_LOG
mutation
'
,
(
done
)
=>
{
testAction
(
request
Trace
,
null
,
mockedState
,
[{
type
:
types
.
REQUEST_TRACE
}],
[],
done
);
testAction
(
request
JobLog
,
null
,
mockedState
,
[{
type
:
types
.
REQUEST_JOB_LOG
}],
[],
done
);
});
});
});
});
describe
(
'
fetch
Trace
'
,
()
=>
{
describe
(
'
fetch
JobLog
'
,
()
=>
{
let
mock
;
let
mock
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
mockedState
.
trace
Endpoint
=
`
${
TEST_HOST
}
/endpoint`
;
mockedState
.
jobLog
Endpoint
=
`
${
TEST_HOST
}
/endpoint`
;
mock
=
new
MockAdapter
(
axios
);
mock
=
new
MockAdapter
(
axios
);
});
});
...
@@ -212,14 +212,14 @@ describe('Job State actions', () => {
...
@@ -212,14 +212,14 @@ describe('Job State actions', () => {
});
});
describe
(
'
success
'
,
()
=>
{
describe
(
'
success
'
,
()
=>
{
it
(
'
dispatches request
Trace, receiveTraceSuccess and stopPollingTrace
when job is complete
'
,
(
done
)
=>
{
it
(
'
dispatches request
JobLog, receiveJobLogSuccess and stopPollingJobLog
when job is complete
'
,
(
done
)
=>
{
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint/trace.json`
).
replyOnce
(
200
,
{
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint/trace.json`
).
replyOnce
(
200
,
{
html
:
'
I, [2018-08-17T22:57:45.707325 #1841] INFO -- :
'
,
html
:
'
I, [2018-08-17T22:57:45.707325 #1841] INFO -- :
'
,
complete
:
true
,
complete
:
true
,
});
});
testAction
(
testAction
(
fetch
Trace
,
fetch
JobLog
,
null
,
null
,
mockedState
,
mockedState
,
[],
[],
...
@@ -233,10 +233,10 @@ describe('Job State actions', () => {
...
@@ -233,10 +233,10 @@ describe('Job State actions', () => {
html
:
'
I, [2018-08-17T22:57:45.707325 #1841] INFO -- :
'
,
html
:
'
I, [2018-08-17T22:57:45.707325 #1841] INFO -- :
'
,
complete
:
true
,
complete
:
true
,
},
},
type
:
'
receive
Trace
Success
'
,
type
:
'
receive
JobLog
Success
'
,
},
},
{
{
type
:
'
stopPolling
Trace
'
,
type
:
'
stopPolling
JobLog
'
,
},
},
],
],
done
,
done
,
...
@@ -255,32 +255,32 @@ describe('Job State actions', () => {
...
@@ -255,32 +255,32 @@ describe('Job State actions', () => {
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint/trace.json`
).
replyOnce
(
200
,
tracePayload
);
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint/trace.json`
).
replyOnce
(
200
,
tracePayload
);
});
});
it
(
'
dispatches startPolling
Trace
'
,
(
done
)
=>
{
it
(
'
dispatches startPolling
JobLog
'
,
(
done
)
=>
{
testAction
(
testAction
(
fetch
Trace
,
fetch
JobLog
,
null
,
null
,
mockedState
,
mockedState
,
[],
[],
[
[
{
type
:
'
toggleScrollisInBottom
'
,
payload
:
true
},
{
type
:
'
toggleScrollisInBottom
'
,
payload
:
true
},
{
type
:
'
receive
Trace
Success
'
,
payload
:
tracePayload
},
{
type
:
'
receive
JobLog
Success
'
,
payload
:
tracePayload
},
{
type
:
'
startPolling
Trace
'
},
{
type
:
'
startPolling
JobLog
'
},
],
],
done
,
done
,
);
);
});
});
it
(
'
does not dispatch startPolling
Trace
when timeout is non-empty
'
,
(
done
)
=>
{
it
(
'
does not dispatch startPolling
JobLog
when timeout is non-empty
'
,
(
done
)
=>
{
mockedState
.
trace
Timeout
=
1
;
mockedState
.
jobLog
Timeout
=
1
;
testAction
(
testAction
(
fetch
Trace
,
fetch
JobLog
,
null
,
null
,
mockedState
,
mockedState
,
[],
[],
[
[
{
type
:
'
toggleScrollisInBottom
'
,
payload
:
true
},
{
type
:
'
toggleScrollisInBottom
'
,
payload
:
true
},
{
type
:
'
receive
Trace
Success
'
,
payload
:
tracePayload
},
{
type
:
'
receive
JobLog
Success
'
,
payload
:
tracePayload
},
],
],
done
,
done
,
);
);
...
@@ -293,15 +293,15 @@ describe('Job State actions', () => {
...
@@ -293,15 +293,15 @@ describe('Job State actions', () => {
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint/trace.json`
).
reply
(
500
);
mock
.
onGet
(
`
${
TEST_HOST
}
/endpoint/trace.json`
).
reply
(
500
);
});
});
it
(
'
dispatches request
Trace and receiveTrace
Error
'
,
(
done
)
=>
{
it
(
'
dispatches request
JobLog and receiveJobLog
Error
'
,
(
done
)
=>
{
testAction
(
testAction
(
fetch
Trace
,
fetch
JobLog
,
null
,
null
,
mockedState
,
mockedState
,
[],
[],
[
[
{
{
type
:
'
receive
Trace
Error
'
,
type
:
'
receive
JobLog
Error
'
,
},
},
],
],
done
,
done
,
...
@@ -310,7 +310,7 @@ describe('Job State actions', () => {
...
@@ -310,7 +310,7 @@ describe('Job State actions', () => {
});
});
});
});
describe
(
'
startPolling
Trace
'
,
()
=>
{
describe
(
'
startPolling
JobLog
'
,
()
=>
{
let
dispatch
;
let
dispatch
;
let
commit
;
let
commit
;
...
@@ -318,18 +318,18 @@ describe('Job State actions', () => {
...
@@ -318,18 +318,18 @@ describe('Job State actions', () => {
dispatch
=
jest
.
fn
();
dispatch
=
jest
.
fn
();
commit
=
jest
.
fn
();
commit
=
jest
.
fn
();
startPolling
Trace
({
dispatch
,
commit
});
startPolling
JobLog
({
dispatch
,
commit
});
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
jest
.
clearAllTimers
();
jest
.
clearAllTimers
();
});
});
it
(
'
should save the timeout id but not call fetch
Trace
'
,
()
=>
{
it
(
'
should save the timeout id but not call fetch
JobLog
'
,
()
=>
{
expect
(
commit
).
toHaveBeenCalledWith
(
types
.
SET_
TRACE
_TIMEOUT
,
expect
.
any
(
Number
));
expect
(
commit
).
toHaveBeenCalledWith
(
types
.
SET_
JOB_LOG
_TIMEOUT
,
expect
.
any
(
Number
));
expect
(
commit
.
mock
.
calls
[
0
][
1
]).
toBeGreaterThan
(
0
);
expect
(
commit
.
mock
.
calls
[
0
][
1
]).
toBeGreaterThan
(
0
);
expect
(
dispatch
).
not
.
toHaveBeenCalledWith
(
'
fetch
Trace
'
);
expect
(
dispatch
).
not
.
toHaveBeenCalledWith
(
'
fetch
JobLog
'
);
});
});
describe
(
'
after timeout has passed
'
,
()
=>
{
describe
(
'
after timeout has passed
'
,
()
=>
{
...
@@ -337,14 +337,14 @@ describe('Job State actions', () => {
...
@@ -337,14 +337,14 @@ describe('Job State actions', () => {
jest
.
advanceTimersByTime
(
4000
);
jest
.
advanceTimersByTime
(
4000
);
});
});
it
(
'
should clear the timeout id and fetch
Trace
'
,
()
=>
{
it
(
'
should clear the timeout id and fetch
JobLog
'
,
()
=>
{
expect
(
commit
).
toHaveBeenCalledWith
(
types
.
SET_
TRACE
_TIMEOUT
,
0
);
expect
(
commit
).
toHaveBeenCalledWith
(
types
.
SET_
JOB_LOG
_TIMEOUT
,
0
);
expect
(
dispatch
).
toHaveBeenCalledWith
(
'
fetch
Trace
'
);
expect
(
dispatch
).
toHaveBeenCalledWith
(
'
fetch
JobLog
'
);
});
});
});
});
});
});
describe
(
'
stopPolling
Trace
'
,
()
=>
{
describe
(
'
stopPolling
JobLog
'
,
()
=>
{
let
origTimeout
;
let
origTimeout
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
@@ -358,40 +358,40 @@ describe('Job State actions', () => {
...
@@ -358,40 +358,40 @@ describe('Job State actions', () => {
window
.
clearTimeout
=
origTimeout
;
window
.
clearTimeout
=
origTimeout
;
});
});
it
(
'
should commit STOP_POLLING_
TRACE
mutation
'
,
(
done
)
=>
{
it
(
'
should commit STOP_POLLING_
JOB_LOG
mutation
'
,
(
done
)
=>
{
const
trace
Timeout
=
7
;
const
jobLog
Timeout
=
7
;
testAction
(
testAction
(
stopPolling
Trace
,
stopPolling
JobLog
,
null
,
null
,
{
...
mockedState
,
trace
Timeout
},
{
...
mockedState
,
jobLog
Timeout
},
[{
type
:
types
.
SET_
TRACE_TIMEOUT
,
payload
:
0
},
{
type
:
types
.
STOP_POLLING_TRACE
}],
[{
type
:
types
.
SET_
JOB_LOG_TIMEOUT
,
payload
:
0
},
{
type
:
types
.
STOP_POLLING_JOB_LOG
}],
[],
[],
)
)
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
window
.
clearTimeout
).
toHaveBeenCalledWith
(
trace
Timeout
);
expect
(
window
.
clearTimeout
).
toHaveBeenCalledWith
(
jobLog
Timeout
);
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
});
});
});
});
describe
(
'
receive
Trace
Success
'
,
()
=>
{
describe
(
'
receive
JobLog
Success
'
,
()
=>
{
it
(
'
should commit RECEIVE_
TRACE
_SUCCESS mutation
'
,
(
done
)
=>
{
it
(
'
should commit RECEIVE_
JOB_LOG
_SUCCESS mutation
'
,
(
done
)
=>
{
testAction
(
testAction
(
receive
Trace
Success
,
receive
JobLog
Success
,
'
hello world
'
,
'
hello world
'
,
mockedState
,
mockedState
,
[{
type
:
types
.
RECEIVE_
TRACE
_SUCCESS
,
payload
:
'
hello world
'
}],
[{
type
:
types
.
RECEIVE_
JOB_LOG
_SUCCESS
,
payload
:
'
hello world
'
}],
[],
[],
done
,
done
,
);
);
});
});
});
});
describe
(
'
receive
Trace
Error
'
,
()
=>
{
describe
(
'
receive
JobLog
Error
'
,
()
=>
{
it
(
'
should commit stop polling trace
'
,
(
done
)
=>
{
it
(
'
should commit stop polling trace
'
,
(
done
)
=>
{
testAction
(
receive
TraceError
,
null
,
mockedState
,
[],
[{
type
:
'
stopPollingTrace
'
}],
done
);
testAction
(
receive
JobLogError
,
null
,
mockedState
,
[],
[{
type
:
'
stopPollingJobLog
'
}],
done
);
});
});
});
});
...
...
spec/frontend/jobs/store/getters_spec.js
View file @
41d44191
...
@@ -102,13 +102,13 @@ describe('Job Store Getters', () => {
...
@@ -102,13 +102,13 @@ describe('Job Store Getters', () => {
});
});
});
});
describe
(
'
has
Trace
'
,
()
=>
{
describe
(
'
has
JobLog
'
,
()
=>
{
describe
(
'
when has_trace is true
'
,
()
=>
{
describe
(
'
when has_trace is true
'
,
()
=>
{
it
(
'
returns true
'
,
()
=>
{
it
(
'
returns true
'
,
()
=>
{
localState
.
job
.
has_trace
=
true
;
localState
.
job
.
has_trace
=
true
;
localState
.
job
.
status
=
{};
localState
.
job
.
status
=
{};
expect
(
getters
.
has
Trace
(
localState
)).
toEqual
(
true
);
expect
(
getters
.
has
JobLog
(
localState
)).
toEqual
(
true
);
});
});
});
});
...
@@ -117,7 +117,7 @@ describe('Job Store Getters', () => {
...
@@ -117,7 +117,7 @@ describe('Job Store Getters', () => {
localState
.
job
.
has_trace
=
false
;
localState
.
job
.
has_trace
=
false
;
localState
.
job
.
status
=
{
group
:
'
running
'
};
localState
.
job
.
status
=
{
group
:
'
running
'
};
expect
(
getters
.
has
Trace
(
localState
)).
toEqual
(
true
);
expect
(
getters
.
has
JobLog
(
localState
)).
toEqual
(
true
);
});
});
});
});
...
@@ -126,7 +126,7 @@ describe('Job Store Getters', () => {
...
@@ -126,7 +126,7 @@ describe('Job Store Getters', () => {
localState
.
job
.
has_trace
=
false
;
localState
.
job
.
has_trace
=
false
;
localState
.
job
.
status
=
{
group
:
'
pending
'
};
localState
.
job
.
status
=
{
group
:
'
pending
'
};
expect
(
getters
.
has
Trace
(
localState
)).
toEqual
(
false
);
expect
(
getters
.
has
JobLog
(
localState
)).
toEqual
(
false
);
});
});
});
});
});
});
...
...
spec/frontend/jobs/store/mutations_spec.js
View file @
41d44191
...
@@ -45,39 +45,39 @@ describe('Jobs Store Mutations', () => {
...
@@ -45,39 +45,39 @@ describe('Jobs Store Mutations', () => {
});
});
});
});
describe
(
'
RECEIVE_
TRACE
_SUCCESS
'
,
()
=>
{
describe
(
'
RECEIVE_
JOB_LOG
_SUCCESS
'
,
()
=>
{
describe
(
'
when trace has state
'
,
()
=>
{
describe
(
'
when trace has state
'
,
()
=>
{
it
(
'
sets
trace
State
'
,
()
=>
{
it
(
'
sets
jobLog
State
'
,
()
=>
{
const
stateLog
=
const
stateLog
=
'
eyJvZmZzZXQiOjczNDQ1MSwibl9vcGVuX3RhZ3MiOjAsImZnX2NvbG9yIjpudWxsLCJiZ19jb2xvciI6bnVsbCwic3R5bGVfbWFzayI6MH0=
'
;
'
eyJvZmZzZXQiOjczNDQ1MSwibl9vcGVuX3RhZ3MiOjAsImZnX2NvbG9yIjpudWxsLCJiZ19jb2xvciI6bnVsbCwic3R5bGVfbWFzayI6MH0=
'
;
mutations
[
types
.
RECEIVE_
TRACE
_SUCCESS
](
stateCopy
,
{
mutations
[
types
.
RECEIVE_
JOB_LOG
_SUCCESS
](
stateCopy
,
{
state
:
stateLog
,
state
:
stateLog
,
});
});
expect
(
stateCopy
.
trace
State
).
toEqual
(
stateLog
);
expect
(
stateCopy
.
jobLog
State
).
toEqual
(
stateLog
);
});
});
});
});
describe
(
'
when
trace
Size is smaller than the total size
'
,
()
=>
{
describe
(
'
when
jobLog
Size is smaller than the total size
'
,
()
=>
{
it
(
'
sets is
Trace
SizeVisible to true
'
,
()
=>
{
it
(
'
sets is
JobLog
SizeVisible to true
'
,
()
=>
{
mutations
[
types
.
RECEIVE_
TRACE
_SUCCESS
](
stateCopy
,
{
total
:
51184600
,
size
:
1231
});
mutations
[
types
.
RECEIVE_
JOB_LOG
_SUCCESS
](
stateCopy
,
{
total
:
51184600
,
size
:
1231
});
expect
(
stateCopy
.
is
Trace
SizeVisible
).
toEqual
(
true
);
expect
(
stateCopy
.
is
JobLog
SizeVisible
).
toEqual
(
true
);
});
});
});
});
describe
(
'
when
trace
Size is bigger than the total size
'
,
()
=>
{
describe
(
'
when
jobLog
Size is bigger than the total size
'
,
()
=>
{
it
(
'
sets is
Trace
SizeVisible to false
'
,
()
=>
{
it
(
'
sets is
JobLog
SizeVisible to false
'
,
()
=>
{
const
copy
=
{
...
stateCopy
,
trace
Size
:
5118460
,
size
:
2321312
};
const
copy
=
{
...
stateCopy
,
jobLog
Size
:
5118460
,
size
:
2321312
};
mutations
[
types
.
RECEIVE_
TRACE
_SUCCESS
](
copy
,
{
total
:
511846
});
mutations
[
types
.
RECEIVE_
JOB_LOG
_SUCCESS
](
copy
,
{
total
:
511846
});
expect
(
copy
.
is
Trace
SizeVisible
).
toEqual
(
false
);
expect
(
copy
.
is
JobLog
SizeVisible
).
toEqual
(
false
);
});
});
});
});
it
(
'
sets trace, trace size and is
Trace
Complete
'
,
()
=>
{
it
(
'
sets trace, trace size and is
JobLog
Complete
'
,
()
=>
{
mutations
[
types
.
RECEIVE_
TRACE
_SUCCESS
](
stateCopy
,
{
mutations
[
types
.
RECEIVE_
JOB_LOG
_SUCCESS
](
stateCopy
,
{
append
:
true
,
append
:
true
,
html
,
html
,
size
:
511846
,
size
:
511846
,
...
@@ -85,15 +85,15 @@ describe('Jobs Store Mutations', () => {
...
@@ -85,15 +85,15 @@ describe('Jobs Store Mutations', () => {
lines
:
[],
lines
:
[],
});
});
expect
(
stateCopy
.
trace
Size
).
toEqual
(
511846
);
expect
(
stateCopy
.
jobLog
Size
).
toEqual
(
511846
);
expect
(
stateCopy
.
is
Trace
Complete
).
toEqual
(
true
);
expect
(
stateCopy
.
is
JobLog
Complete
).
toEqual
(
true
);
});
});
describe
(
'
with new job log
'
,
()
=>
{
describe
(
'
with new job log
'
,
()
=>
{
describe
(
'
log.lines
'
,
()
=>
{
describe
(
'
log.lines
'
,
()
=>
{
describe
(
'
when append is true
'
,
()
=>
{
describe
(
'
when append is true
'
,
()
=>
{
it
(
'
sets the parsed log
'
,
()
=>
{
it
(
'
sets the parsed log
'
,
()
=>
{
mutations
[
types
.
RECEIVE_
TRACE
_SUCCESS
](
stateCopy
,
{
mutations
[
types
.
RECEIVE_
JOB_LOG
_SUCCESS
](
stateCopy
,
{
append
:
true
,
append
:
true
,
size
:
511846
,
size
:
511846
,
complete
:
true
,
complete
:
true
,
...
@@ -105,7 +105,7 @@ describe('Jobs Store Mutations', () => {
...
@@ -105,7 +105,7 @@ describe('Jobs Store Mutations', () => {
],
],
});
});
expect
(
stateCopy
.
trace
).
toEqual
([
expect
(
stateCopy
.
jobLog
).
toEqual
([
{
{
offset
:
1
,
offset
:
1
,
content
:
[{
text
:
'
Running with gitlab-runner 11.12.1 (5a147c92)
'
}],
content
:
[{
text
:
'
Running with gitlab-runner 11.12.1 (5a147c92)
'
}],
...
@@ -117,7 +117,7 @@ describe('Jobs Store Mutations', () => {
...
@@ -117,7 +117,7 @@ describe('Jobs Store Mutations', () => {
describe
(
'
when it is defined
'
,
()
=>
{
describe
(
'
when it is defined
'
,
()
=>
{
it
(
'
sets the parsed log
'
,
()
=>
{
it
(
'
sets the parsed log
'
,
()
=>
{
mutations
[
types
.
RECEIVE_
TRACE
_SUCCESS
](
stateCopy
,
{
mutations
[
types
.
RECEIVE_
JOB_LOG
_SUCCESS
](
stateCopy
,
{
append
:
false
,
append
:
false
,
size
:
511846
,
size
:
511846
,
complete
:
true
,
complete
:
true
,
...
@@ -126,7 +126,7 @@ describe('Jobs Store Mutations', () => {
...
@@ -126,7 +126,7 @@ describe('Jobs Store Mutations', () => {
],
],
});
});
expect
(
stateCopy
.
trace
).
toEqual
([
expect
(
stateCopy
.
jobLog
).
toEqual
([
{
{
offset
:
0
,
offset
:
0
,
content
:
[{
text
:
'
Running with gitlab-runner 11.11.1 (5a147c92)
'
}],
content
:
[{
text
:
'
Running with gitlab-runner 11.11.1 (5a147c92)
'
}],
...
@@ -138,7 +138,7 @@ describe('Jobs Store Mutations', () => {
...
@@ -138,7 +138,7 @@ describe('Jobs Store Mutations', () => {
describe
(
'
when it is null
'
,
()
=>
{
describe
(
'
when it is null
'
,
()
=>
{
it
(
'
sets the default value
'
,
()
=>
{
it
(
'
sets the default value
'
,
()
=>
{
mutations
[
types
.
RECEIVE_
TRACE
_SUCCESS
](
stateCopy
,
{
mutations
[
types
.
RECEIVE_
JOB_LOG
_SUCCESS
](
stateCopy
,
{
append
:
true
,
append
:
true
,
html
,
html
,
size
:
511846
,
size
:
511846
,
...
@@ -146,30 +146,30 @@ describe('Jobs Store Mutations', () => {
...
@@ -146,30 +146,30 @@ describe('Jobs Store Mutations', () => {
lines
:
null
,
lines
:
null
,
});
});
expect
(
stateCopy
.
trace
).
toEqual
([]);
expect
(
stateCopy
.
jobLog
).
toEqual
([]);
});
});
});
});
});
});
});
});
});
});
describe
(
'
SET_
TRACE
_TIMEOUT
'
,
()
=>
{
describe
(
'
SET_
JOB_LOG
_TIMEOUT
'
,
()
=>
{
it
(
'
sets the
trace
Timeout id
'
,
()
=>
{
it
(
'
sets the
jobLog
Timeout id
'
,
()
=>
{
const
id
=
7
;
const
id
=
7
;
expect
(
stateCopy
.
trace
Timeout
).
not
.
toEqual
(
id
);
expect
(
stateCopy
.
jobLog
Timeout
).
not
.
toEqual
(
id
);
mutations
[
types
.
SET_
TRACE
_TIMEOUT
](
stateCopy
,
id
);
mutations
[
types
.
SET_
JOB_LOG
_TIMEOUT
](
stateCopy
,
id
);
expect
(
stateCopy
.
trace
Timeout
).
toEqual
(
id
);
expect
(
stateCopy
.
jobLog
Timeout
).
toEqual
(
id
);
});
});
});
});
describe
(
'
STOP_POLLING_
TRACE
'
,
()
=>
{
describe
(
'
STOP_POLLING_
JOB_LOG
'
,
()
=>
{
it
(
'
sets is
Trace
Complete to true
'
,
()
=>
{
it
(
'
sets is
JobLog
Complete to true
'
,
()
=>
{
mutations
[
types
.
STOP_POLLING_
TRACE
](
stateCopy
);
mutations
[
types
.
STOP_POLLING_
JOB_LOG
](
stateCopy
);
expect
(
stateCopy
.
is
Trace
Complete
).
toEqual
(
true
);
expect
(
stateCopy
.
is
JobLog
Complete
).
toEqual
(
true
);
});
});
});
});
...
@@ -296,12 +296,12 @@ describe('Job Store mutations, feature flag ON', () => {
...
@@ -296,12 +296,12 @@ describe('Job Store mutations, feature flag ON', () => {
window
.
gon
=
origGon
;
window
.
gon
=
origGon
;
});
});
describe
(
'
RECEIVE_
TRACE
_SUCCESS
'
,
()
=>
{
describe
(
'
RECEIVE_
JOB_LOG
_SUCCESS
'
,
()
=>
{
describe
(
'
with new job log
'
,
()
=>
{
describe
(
'
with new job log
'
,
()
=>
{
describe
(
'
log.lines
'
,
()
=>
{
describe
(
'
log.lines
'
,
()
=>
{
describe
(
'
when append is true
'
,
()
=>
{
describe
(
'
when append is true
'
,
()
=>
{
it
(
'
sets the parsed log
'
,
()
=>
{
it
(
'
sets the parsed log
'
,
()
=>
{
mutations
[
types
.
RECEIVE_
TRACE
_SUCCESS
](
stateCopy
,
{
mutations
[
types
.
RECEIVE_
JOB_LOG
_SUCCESS
](
stateCopy
,
{
append
:
true
,
append
:
true
,
size
:
511846
,
size
:
511846
,
complete
:
true
,
complete
:
true
,
...
@@ -313,7 +313,7 @@ describe('Job Store mutations, feature flag ON', () => {
...
@@ -313,7 +313,7 @@ describe('Job Store mutations, feature flag ON', () => {
],
],
});
});
expect
(
stateCopy
.
trace
).
toEqual
([
expect
(
stateCopy
.
jobLog
).
toEqual
([
{
{
offset
:
1
,
offset
:
1
,
content
:
[{
text
:
'
Running with gitlab-runner 11.12.1 (5a147c92)
'
}],
content
:
[{
text
:
'
Running with gitlab-runner 11.12.1 (5a147c92)
'
}],
...
@@ -325,7 +325,7 @@ describe('Job Store mutations, feature flag ON', () => {
...
@@ -325,7 +325,7 @@ describe('Job Store mutations, feature flag ON', () => {
describe
(
'
when lines are defined
'
,
()
=>
{
describe
(
'
when lines are defined
'
,
()
=>
{
it
(
'
sets the parsed log
'
,
()
=>
{
it
(
'
sets the parsed log
'
,
()
=>
{
mutations
[
types
.
RECEIVE_
TRACE
_SUCCESS
](
stateCopy
,
{
mutations
[
types
.
RECEIVE_
JOB_LOG
_SUCCESS
](
stateCopy
,
{
append
:
false
,
append
:
false
,
size
:
511846
,
size
:
511846
,
complete
:
true
,
complete
:
true
,
...
@@ -334,7 +334,7 @@ describe('Job Store mutations, feature flag ON', () => {
...
@@ -334,7 +334,7 @@ describe('Job Store mutations, feature flag ON', () => {
],
],
});
});
expect
(
stateCopy
.
trace
).
toEqual
([
expect
(
stateCopy
.
jobLog
).
toEqual
([
{
{
offset
:
0
,
offset
:
0
,
content
:
[{
text
:
'
Running with gitlab-runner 11.11.1 (5a147c92)
'
}],
content
:
[{
text
:
'
Running with gitlab-runner 11.11.1 (5a147c92)
'
}],
...
@@ -346,7 +346,7 @@ describe('Job Store mutations, feature flag ON', () => {
...
@@ -346,7 +346,7 @@ describe('Job Store mutations, feature flag ON', () => {
describe
(
'
when lines are null
'
,
()
=>
{
describe
(
'
when lines are null
'
,
()
=>
{
it
(
'
sets the default value
'
,
()
=>
{
it
(
'
sets the default value
'
,
()
=>
{
mutations
[
types
.
RECEIVE_
TRACE
_SUCCESS
](
stateCopy
,
{
mutations
[
types
.
RECEIVE_
JOB_LOG
_SUCCESS
](
stateCopy
,
{
append
:
true
,
append
:
true
,
html
,
html
,
size
:
511846
,
size
:
511846
,
...
@@ -354,7 +354,7 @@ describe('Job Store mutations, feature flag ON', () => {
...
@@ -354,7 +354,7 @@ describe('Job Store mutations, feature flag ON', () => {
lines
:
null
,
lines
:
null
,
});
});
expect
(
stateCopy
.
trace
).
toEqual
([]);
expect
(
stateCopy
.
jobLog
).
toEqual
([]);
});
});
});
});
});
});
...
...
spec/frontend/jobs/store/utils_spec.js
View file @
41d44191
import
{
import
{
logLinesParser
,
logLinesParser
,
logLinesParserLegacy
,
logLinesParserLegacy
,
updateIncremental
Trace
,
updateIncremental
JobLog
,
parseHeaderLine
,
parseHeaderLine
,
parseLine
,
parseLine
,
addDurationToHeader
,
addDurationToHeader
,
...
@@ -487,11 +487,11 @@ describe('Jobs Store Utils', () => {
...
@@ -487,11 +487,11 @@ describe('Jobs Store Utils', () => {
});
});
});
});
describe
(
'
updateIncremental
Trace
'
,
()
=>
{
describe
(
'
updateIncremental
JobLog
'
,
()
=>
{
describe
(
'
without repeated section
'
,
()
=>
{
describe
(
'
without repeated section
'
,
()
=>
{
it
(
'
concats and parses both arrays
'
,
()
=>
{
it
(
'
concats and parses both arrays
'
,
()
=>
{
const
oldLog
=
logLinesParserLegacy
(
originalTrace
);
const
oldLog
=
logLinesParserLegacy
(
originalTrace
);
const
result
=
updateIncremental
Trace
(
regularIncremental
,
oldLog
);
const
result
=
updateIncremental
JobLog
(
regularIncremental
,
oldLog
);
expect
(
result
).
toEqual
([
expect
(
result
).
toEqual
([
{
{
...
@@ -519,7 +519,7 @@ describe('Jobs Store Utils', () => {
...
@@ -519,7 +519,7 @@ describe('Jobs Store Utils', () => {
describe
(
'
with regular line repeated offset
'
,
()
=>
{
describe
(
'
with regular line repeated offset
'
,
()
=>
{
it
(
'
updates the last line and formats with the incremental part
'
,
()
=>
{
it
(
'
updates the last line and formats with the incremental part
'
,
()
=>
{
const
oldLog
=
logLinesParserLegacy
(
originalTrace
);
const
oldLog
=
logLinesParserLegacy
(
originalTrace
);
const
result
=
updateIncremental
Trace
(
regularIncrementalRepeated
,
oldLog
);
const
result
=
updateIncremental
JobLog
(
regularIncrementalRepeated
,
oldLog
);
expect
(
result
).
toEqual
([
expect
(
result
).
toEqual
([
{
{
...
@@ -538,7 +538,7 @@ describe('Jobs Store Utils', () => {
...
@@ -538,7 +538,7 @@ describe('Jobs Store Utils', () => {
describe
(
'
with header line repeated
'
,
()
=>
{
describe
(
'
with header line repeated
'
,
()
=>
{
it
(
'
updates the header line and formats with the incremental part
'
,
()
=>
{
it
(
'
updates the header line and formats with the incremental part
'
,
()
=>
{
const
oldLog
=
logLinesParserLegacy
(
headerTrace
);
const
oldLog
=
logLinesParserLegacy
(
headerTrace
);
const
result
=
updateIncremental
Trace
(
headerTraceIncremental
,
oldLog
);
const
result
=
updateIncremental
JobLog
(
headerTraceIncremental
,
oldLog
);
expect
(
result
).
toEqual
([
expect
(
result
).
toEqual
([
{
{
...
@@ -564,7 +564,7 @@ describe('Jobs Store Utils', () => {
...
@@ -564,7 +564,7 @@ describe('Jobs Store Utils', () => {
describe
(
'
with collapsible line repeated
'
,
()
=>
{
describe
(
'
with collapsible line repeated
'
,
()
=>
{
it
(
'
updates the collapsible line and formats with the incremental part
'
,
()
=>
{
it
(
'
updates the collapsible line and formats with the incremental part
'
,
()
=>
{
const
oldLog
=
logLinesParserLegacy
(
collapsibleTrace
);
const
oldLog
=
logLinesParserLegacy
(
collapsibleTrace
);
const
result
=
updateIncremental
Trace
(
collapsibleTraceIncremental
,
oldLog
);
const
result
=
updateIncremental
JobLog
(
collapsibleTraceIncremental
,
oldLog
);
expect
(
result
).
toEqual
([
expect
(
result
).
toEqual
([
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment