Commit 37b00a88 authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch '324100-monitor' into 'master'

Update master to default branch inside env copy

See merge request gitlab-org/gitlab!56264
parents 90195fc6 d01c8d04
...@@ -10,6 +10,7 @@ export default { ...@@ -10,6 +10,7 @@ export default {
GlSprintf, GlSprintf,
ModalCopyButton, ModalCopyButton,
}, },
inject: ['defaultBranchName'],
props: { props: {
modalId: { modalId: {
type: String, type: String,
...@@ -28,7 +29,11 @@ export default { ...@@ -28,7 +29,11 @@ export default {
modalInfo: { modalInfo: {
closeText: s__('EnableReviewApp|Close'), closeText: s__('EnableReviewApp|Close'),
copyToClipboardText: s__('EnableReviewApp|Copy snippet text'), copyToClipboardText: s__('EnableReviewApp|Copy snippet text'),
copyString: `deploy_review: title: s__('ReviewApp|Enable Review App'),
},
computed: {
modalInfoCopyStr() {
return `deploy_review:
stage: deploy stage: deploy
script: script:
- echo "Deploy a review app" - echo "Deploy a review app"
...@@ -38,8 +43,8 @@ export default { ...@@ -38,8 +43,8 @@ export default {
only: only:
- branches - branches
except: except:
- master`, - ${this.defaultBranchName}`;
title: s__('ReviewApp|Enable Review App'), },
}, },
}; };
</script> </script>
...@@ -75,7 +80,9 @@ export default { ...@@ -75,7 +80,9 @@ export default {
</gl-sprintf> </gl-sprintf>
</p> </p>
<div class="gl-display-flex align-items-start"> <div class="gl-display-flex align-items-start">
<pre class="gl-w-full"> {{ $options.modalInfo.copyString }} </pre> <pre class="gl-w-full" data-testid="enable-review-app-copy-string">
{{ modalInfoCopyStr }} </pre
>
<modal-copy-button <modal-copy-button
:title="$options.modalInfo.copyToClipboardText" :title="$options.modalInfo.copyToClipboardText"
:text="$options.modalInfo.copyString" :text="$options.modalInfo.copyString"
...@@ -90,7 +97,9 @@ export default { ...@@ -90,7 +97,9 @@ export default {
<strong>{{ content }}</strong> <strong>{{ content }}</strong>
</template> </template>
<template #link="{ content }"> <template #link="{ content }">
<gl-link href="blob/master/.gitlab-ci.yml" target="_blank">{{ content }}</gl-link> <gl-link :href="`blob/${defaultBranchName}/.gitlab-ci.yml`" target="_blank">{{
content
}}</gl-link>
</template> </template>
</gl-sprintf> </gl-sprintf>
</p> </p>
......
...@@ -22,6 +22,7 @@ export default () => { ...@@ -22,6 +22,7 @@ export default () => {
apolloProvider, apolloProvider,
provide: { provide: {
projectPath: el.dataset.projectPath, projectPath: el.dataset.projectPath,
defaultBranchName: el.dataset.defaultBranchName,
}, },
data() { data() {
const environmentsData = el.dataset; const environmentsData = el.dataset;
......
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
}, },
}, },
radioVals: { radioVals: {
/* Use the default branch (e.g. master) */ /* Use the default branch (e.g. main) */
DEFAULT: 'DEFAULT', DEFAULT: 'DEFAULT',
/* Create a new branch */ /* Create a new branch */
NEW: 'NEW', NEW: 'NEW',
......
...@@ -6,4 +6,5 @@ ...@@ -6,4 +6,5 @@
"can-create-environment" => can?(current_user, :create_environment, @project).to_s, "can-create-environment" => can?(current_user, :create_environment, @project).to_s,
"new-environment-path" => new_project_environment_path(@project), "new-environment-path" => new_project_environment_path(@project),
"help-page-path" => help_page_path("ci/environments/index.md"), "help-page-path" => help_page_path("ci/environments/index.md"),
"project-path" => @project.full_path } } "project-path" => @project.full_path,
"default-branch-name" => @project.default_branch_or_master } }
---
title: Update master to main inside monitor copy
merge_request: 56264
author:
type: changed
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import EnableReviewAppButton from '~/environments/components/enable_review_app_modal.vue'; import EnableReviewAppButton from '~/environments/components/enable_review_app_modal.vue';
import ModalCopyButton from '~/vue_shared/components/modal_copy_button.vue'; import ModalCopyButton from '~/vue_shared/components/modal_copy_button.vue';
...@@ -11,15 +12,25 @@ describe('Enable Review App Button', () => { ...@@ -11,15 +12,25 @@ describe('Enable Review App Button', () => {
describe('renders the modal', () => { describe('renders the modal', () => {
beforeEach(() => { beforeEach(() => {
wrapper = shallowMount(EnableReviewAppButton, { wrapper = extendedWrapper(
propsData: { shallowMount(EnableReviewAppButton, {
modalId: 'fake-id', propsData: {
}, modalId: 'fake-id',
}); },
provide: {
defaultBranchName: 'main',
},
}),
);
});
it('renders the defaultBranchName copy', () => {
const findCopyString = () => wrapper.findByTestId('enable-review-app-copy-string');
expect(findCopyString().text()).toContain('- main');
}); });
it('renders the copyToClipboard button', () => { it('renders the copyToClipboard button', () => {
expect(wrapper.find(ModalCopyButton).exists()).toBe(true); expect(wrapper.findComponent(ModalCopyButton).exists()).toBe(true);
}); });
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment