Skip to content
代码片段 群组 项目
未验证 提交 b83a4db0 编辑于 作者: Briley  Sandlin's avatar Briley Sandlin 提交者: GitLab
浏览文件

Merge branch 'fix/manual-pipeline-ui-unable-to-load-predefined-variables' into 'master'

fix: Use short ref name as fallback in pipeline UI

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/184052



Merged-by: default avatarBriley Sandlin <bsandlin@gitlab.com>
Approved-by: default avatarBriley Sandlin <bsandlin@gitlab.com>
Co-authored-by: default avatarAnna Vovchenko <avovchenko@gitlab.com>
No related branches found
No related tags found
2 合并请求!3031Merge per-main-jh to main-jh by luzhiyuan,!3030Merge per-main-jh to main-jh
...@@ -116,6 +116,10 @@ export default { ...@@ -116,6 +116,10 @@ export default {
refShortName() { refShortName() {
return this.refValue.shortName; return this.refValue.shortName;
}, },
refQueryParam() {
return this.refFullName || this.refShortName;
},
shouldShowWarning() { shouldShowWarning() {
return this.warnings.length > 0 && !this.isWarningDismissed; return this.warnings.length > 0 && !this.isWarningDismissed;
}, },
...@@ -256,7 +260,7 @@ export default { ...@@ -256,7 +260,7 @@ export default {
:file-params="fileParams" :file-params="fileParams"
:is-maintainer="isMaintainer" :is-maintainer="isMaintainer"
:project-path="projectPath" :project-path="projectPath"
:ref-param="refFullName" :ref-param="refQueryParam"
:settings-link="settingsLink" :settings-link="settingsLink"
:variable-params="variableParams" :variable-params="variableParams"
@variables-updated="handleVariablesUpdated" @variables-updated="handleVariablesUpdated"
......
...@@ -159,12 +159,10 @@ describe('Pipeline New Form', () => { ...@@ -159,12 +159,10 @@ describe('Pipeline New Form', () => {
describe('Pipeline variables form', () => { describe('Pipeline variables form', () => {
describe('when user has permission to view variables', () => { describe('when user has permission to view variables', () => {
beforeEach(async () => { it('renders the pipeline variables form component', async () => {
pipelineCreateMutationHandler.mockResolvedValue(mockPipelineCreateMutationResponse); pipelineCreateMutationHandler.mockResolvedValue(mockPipelineCreateMutationResponse);
await createComponentWithApollo(); await createComponentWithApollo();
});
it('renders the pipeline variables form component', () => {
expect(findPipelineVariablesForm().exists()).toBe(true); expect(findPipelineVariablesForm().exists()).toBe(true);
expect(findPipelineVariablesForm().props()).toMatchObject({ expect(findPipelineVariablesForm().props()).toMatchObject({
isMaintainer: true, isMaintainer: true,
...@@ -174,6 +172,9 @@ describe('Pipeline New Form', () => { ...@@ -174,6 +172,9 @@ describe('Pipeline New Form', () => {
}); });
it('passes variables to the create mutation', async () => { it('passes variables to the create mutation', async () => {
pipelineCreateMutationHandler.mockResolvedValue(mockPipelineCreateMutationResponse);
await createComponentWithApollo();
const variables = [{ key: 'TEST_VAR', value: 'test_value' }]; const variables = [{ key: 'TEST_VAR', value: 'test_value' }];
findPipelineVariablesForm().vm.$emit('variables-updated', variables); findPipelineVariablesForm().vm.$emit('variables-updated', variables);
findForm().vm.$emit('submit', dummySubmitEvent); findForm().vm.$emit('submit', dummySubmitEvent);
...@@ -187,6 +188,24 @@ describe('Pipeline New Form', () => { ...@@ -187,6 +188,24 @@ describe('Pipeline New Form', () => {
}, },
}); });
}); });
describe('ref param', () => {
it('provides refParam as ref.fullName when available', async () => {
pipelineCreateMutationHandler.mockResolvedValue(mockPipelineCreateMutationResponse);
await createComponentWithApollo();
expect(findPipelineVariablesForm().props('refParam')).toBe(
`refs/heads/${defaultProps.refParam}`,
);
});
it('provides refParam as ref.shortName when available', async () => {
pipelineCreateMutationHandler.mockResolvedValue(mockPipelineCreateMutationResponse);
await createComponentWithApollo({ props: { refParam: 'another-branch' } });
expect(findPipelineVariablesForm().props('refParam')).toBe('another-branch');
});
});
}); });
describe('when user does not have permission to view variables', () => { describe('when user does not have permission to view variables', () => {
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册