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
ab8a1ef7
Commit
ab8a1ef7
authored
Mar 10, 2021
by
Sarah Groff Hennigh-Palermo
Committed by
Mark Florian
Mar 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address reviewr comments
Add times fn to spec, use internal method Fix spec broken in merge
parent
ba636cb7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
1 deletion
+77
-1
app/assets/javascripts/pipelines/components/graph/graph_component_wrapper.vue
...ts/pipelines/components/graph/graph_component_wrapper.vue
+21
-0
app/assets/javascripts/pipelines/components/graph/linked_pipelines_column.vue
...ts/pipelines/components/graph/linked_pipelines_column.vue
+11
-0
app/assets/javascripts/pipelines/components/graph/utils.js
app/assets/javascripts/pipelines/components/graph/utils.js
+1
-1
spec/frontend/pipelines/graph/graph_component_wrapper_spec.js
.../frontend/pipelines/graph/graph_component_wrapper_spec.js
+44
-0
No files found.
app/assets/javascripts/pipelines/components/graph/graph_component_wrapper.vue
View file @
ab8a1ef7
...
@@ -59,11 +59,31 @@ export default {
...
@@ -59,11 +59,31 @@ export default {
};
};
},
},
update
(
data
)
{
update
(
data
)
{
/*
This check prevents the pipeline from being overwritten
when a poll times out and the data returned is empty.
This can be removed once the timeout behavior is updated.
See: https://gitlab.com/gitlab-org/gitlab/-/issues/323213.
*/
if
(
!
data
?.
project
?.
pipeline
)
{
return
this
.
pipeline
;
}
return
unwrapPipelineData
(
this
.
pipelineProjectPath
,
data
);
return
unwrapPipelineData
(
this
.
pipelineProjectPath
,
data
);
},
},
error
(
err
)
{
error
(
err
)
{
this
.
reportFailure
(
LOAD_FAILURE
,
serializeLoadErrors
(
err
));
this
.
reportFailure
(
LOAD_FAILURE
,
serializeLoadErrors
(
err
));
},
},
result
({
error
})
{
/*
If there is a successful load after a failure, clear
the failure notification to avoid confusion.
*/
if
(
!
error
&&
this
.
alertType
===
LOAD_FAILURE
)
{
this
.
hideAlert
();
}
},
},
},
},
},
computed
:
{
computed
:
{
...
@@ -109,6 +129,7 @@ export default {
...
@@ -109,6 +129,7 @@ export default {
methods
:
{
methods
:
{
hideAlert
()
{
hideAlert
()
{
this
.
showAlert
=
false
;
this
.
showAlert
=
false
;
this
.
alertType
=
null
;
},
},
refreshPipelineGraph
()
{
refreshPipelineGraph
()
{
this
.
$apollo
.
queries
.
pipeline
.
refetch
();
this
.
$apollo
.
queries
.
pipeline
.
refetch
();
...
...
app/assets/javascripts/pipelines/components/graph/linked_pipelines_column.vue
View file @
ab8a1ef7
...
@@ -94,6 +94,17 @@ export default {
...
@@ -94,6 +94,17 @@ export default {
};
};
},
},
update
(
data
)
{
update
(
data
)
{
/*
This check prevents the pipeline from being overwritten
when a poll times out and the data returned is empty.
This can be removed once the timeout behavior is updated.
See: https://gitlab.com/gitlab-org/gitlab/-/issues/323213.
*/
if
(
!
data
?.
project
?.
pipeline
)
{
return
this
.
currentPipeline
;
}
return
unwrapPipelineData
(
projectPath
,
data
);
return
unwrapPipelineData
(
projectPath
,
data
);
},
},
result
()
{
result
()
{
...
...
app/assets/javascripts/pipelines/components/graph/utils.js
View file @
ab8a1ef7
...
@@ -32,7 +32,7 @@ const reportToSentry = (component, failureType) => {
...
@@ -32,7 +32,7 @@ const reportToSentry = (component, failureType) => {
};
};
const
serializeGqlErr
=
(
gqlError
)
=>
{
const
serializeGqlErr
=
(
gqlError
)
=>
{
const
{
locations
,
message
,
path
}
=
gqlError
;
const
{
locations
=
[],
message
=
''
,
path
=
[]
}
=
gqlError
;
return
`
return
`
${
message
}
.
${
message
}
.
...
...
spec/frontend/pipelines/graph/graph_component_wrapper_spec.js
View file @
ab8a1ef7
...
@@ -130,4 +130,48 @@ describe('Pipeline graph wrapper', () => {
...
@@ -130,4 +130,48 @@ describe('Pipeline graph wrapper', () => {
expect
(
wrapper
.
vm
.
$apollo
.
queries
.
pipeline
.
refetch
).
toHaveBeenCalled
();
expect
(
wrapper
.
vm
.
$apollo
.
queries
.
pipeline
.
refetch
).
toHaveBeenCalled
();
});
});
});
});
describe
(
'
when query times out
'
,
()
=>
{
const
advanceApolloTimers
=
async
()
=>
{
jest
.
runOnlyPendingTimers
();
await
wrapper
.
vm
.
$nextTick
();
await
wrapper
.
vm
.
$nextTick
();
};
beforeEach
(
async
()
=>
{
const
errorData
=
{
data
:
{
project
:
{
pipelines
:
null
,
},
},
errors
:
[{
message
:
'
timeout
'
}],
};
const
failSucceedFail
=
jest
.
fn
()
.
mockResolvedValueOnce
(
errorData
)
.
mockResolvedValueOnce
(
mockPipelineResponse
)
.
mockResolvedValueOnce
(
errorData
);
createComponentWithApollo
(
failSucceedFail
);
await
wrapper
.
vm
.
$nextTick
();
});
it
(
'
shows correct errors and does not overwrite populated data when data is empty
'
,
async
()
=>
{
/* fails at first, shows error, no data yet */
expect
(
getAlert
().
exists
()).
toBe
(
true
);
expect
(
getGraph
().
exists
()).
toBe
(
false
);
/* succeeds, clears error, shows graph */
await
advanceApolloTimers
();
expect
(
getAlert
().
exists
()).
toBe
(
false
);
expect
(
getGraph
().
exists
()).
toBe
(
true
);
/* fails again, alert returns but data persists */
await
advanceApolloTimers
();
expect
(
getAlert
().
exists
()).
toBe
(
true
);
expect
(
getGraph
().
exists
()).
toBe
(
true
);
});
});
});
});
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