Commit 5a5d928d authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch '196254-update-label-text' into 'master'

Update button label in MR widget pipeline footer

See merge request gitlab-org/gitlab!22900
parents a49ffdd5 a3e19cdd
<script> <script>
import { GlTooltipDirective } from '@gitlab/ui'; import { __, s__ } from '~/locale';
import DeploymentInfo from './deployment_info.vue'; import DeploymentInfo from './deployment_info.vue';
import DeploymentViewButton from './deployment_view_button.vue'; import DeploymentViewButton from './deployment_view_button.vue';
import DeploymentStopButton from './deployment_stop_button.vue'; import DeploymentStopButton from './deployment_stop_button.vue';
...@@ -14,9 +14,6 @@ export default { ...@@ -14,9 +14,6 @@ export default {
DeploymentStopButton, DeploymentStopButton,
DeploymentViewButton, DeploymentViewButton,
}, },
directives: {
GlTooltip: GlTooltipDirective,
},
props: { props: {
deployment: { deployment: {
type: Object, type: Object,
...@@ -43,6 +40,14 @@ export default { ...@@ -43,6 +40,14 @@ export default {
}, },
}, },
computed: { computed: {
appButtonText() {
return {
text: this.isCurrent ? s__('Review App|View app') : s__('Review App|View latest app'),
tooltip: this.isCurrent
? ''
: __('View the latest successful deployment to this environment'),
};
},
canBeManuallyDeployed() { canBeManuallyDeployed() {
return this.computedDeploymentStatus === MANUAL_DEPLOY; return this.computedDeploymentStatus === MANUAL_DEPLOY;
}, },
...@@ -55,9 +60,6 @@ export default { ...@@ -55,9 +60,6 @@ export default {
hasExternalUrls() { hasExternalUrls() {
return Boolean(this.deployment.external_url && this.deployment.external_url_formatted); return Boolean(this.deployment.external_url && this.deployment.external_url_formatted);
}, },
hasPreviousDeployment() {
return Boolean(!this.isCurrent && this.deployment.deployed_at);
},
isCurrent() { isCurrent() {
return this.computedDeploymentStatus === SUCCESS; return this.computedDeploymentStatus === SUCCESS;
}, },
...@@ -89,7 +91,7 @@ export default { ...@@ -89,7 +91,7 @@ export default {
<!-- show appropriate version of review app button --> <!-- show appropriate version of review app button -->
<deployment-view-button <deployment-view-button
v-if="hasExternalUrls" v-if="hasExternalUrls"
:is-current="isCurrent" :app-button-text="appButtonText"
:deployment="deployment" :deployment="deployment"
:show-visual-review-app="showVisualReviewApp" :show-visual-review-app="showVisualReviewApp"
:visual-review-app-metadata="visualReviewAppMeta" :visual-review-app-metadata="visualReviewAppMeta"
......
...@@ -11,12 +11,12 @@ export default { ...@@ -11,12 +11,12 @@ export default {
import('ee_component/vue_merge_request_widget/components/visual_review_app_link.vue'), import('ee_component/vue_merge_request_widget/components/visual_review_app_link.vue'),
}, },
props: { props: {
deployment: { appButtonText: {
type: Object, type: Object,
required: true, required: true,
}, },
isCurrent: { deployment: {
type: Boolean, type: Object,
required: true, required: true,
}, },
showVisualReviewApp: { showVisualReviewApp: {
...@@ -60,7 +60,7 @@ export default { ...@@ -60,7 +60,7 @@ export default {
> >
<template slot="mainAction" slot-scope="slotProps"> <template slot="mainAction" slot-scope="slotProps">
<review-app-link <review-app-link
:is-current="isCurrent" :display="appButtonText"
:link="deploymentExternalUrl" :link="deploymentExternalUrl"
:css-class="`deploy-link js-deploy-url inline ${slotProps.className}`" :css-class="`deploy-link js-deploy-url inline ${slotProps.className}`"
/> />
...@@ -85,7 +85,7 @@ export default { ...@@ -85,7 +85,7 @@ export default {
</filtered-search-dropdown> </filtered-search-dropdown>
<template v-else> <template v-else>
<review-app-link <review-app-link
:is-current="isCurrent" :display="appButtonText"
:link="deploymentExternalUrl" :link="deploymentExternalUrl"
css-class="js-deploy-url deploy-link btn btn-default btn-sm inline" css-class="js-deploy-url deploy-link btn btn-default btn-sm inline"
/> />
......
<script> <script>
import { __ } from '~/locale'; import { GlTooltipDirective } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
export default { export default {
components: { components: {
Icon, Icon,
}, },
directives: {
GlTooltip: GlTooltipDirective,
},
props: { props: {
cssClass: { cssClass: {
type: String, type: String,
required: true, required: true,
}, },
isCurrent: { display: {
type: Boolean, type: Object,
required: true, required: true,
}, },
link: { link: {
...@@ -20,15 +23,12 @@ export default { ...@@ -20,15 +23,12 @@ export default {
required: true, required: true,
}, },
}, },
computed: {
linkText() {
return this.isCurrent ? __('View app') : __('View previous app');
},
},
}; };
</script> </script>
<template> <template>
<a <a
v-gl-tooltip
:title="display.tooltip"
:href="link" :href="link"
target="_blank" target="_blank"
rel="noopener noreferrer nofollow" rel="noopener noreferrer nofollow"
...@@ -36,6 +36,6 @@ export default { ...@@ -36,6 +36,6 @@ export default {
data-track-event="open_review_app" data-track-event="open_review_app"
data-track-label="review_app" data-track-label="review_app"
> >
{{ linkText }} <icon class="fgray" name="external-link" /> {{ display.text }} <icon class="fgray" name="external-link" />
</a> </a>
</template> </template>
---
title: Update button label in MR widget pipeline footer
merge_request: 22900
author:
type: changed
...@@ -30,9 +30,6 @@ export default { ...@@ -30,9 +30,6 @@ export default {
default: false, default: false,
}, },
}, },
tooltips: {
information: s__('EnviornmentDashboard|You are looking at the last updated environment'),
},
computed: { computed: {
headerClasses() { headerClasses() {
return { return {
...@@ -42,6 +39,13 @@ export default { ...@@ -42,6 +39,13 @@ export default {
}; };
}, },
}, },
reviewButtonText: {
text: s__('Review App|View app'),
tooltip: '',
},
tooltips: {
information: s__('EnvironmentDashboard|You are looking at the last updated environment'),
},
}; };
</script> </script>
...@@ -70,7 +74,7 @@ export default { ...@@ -70,7 +74,7 @@ export default {
<review-app-link <review-app-link
v-else-if="environment.external_url" v-else-if="environment.external_url"
:link="environment.external_url" :link="environment.external_url"
:is-current="true" :display="$options.reviewButtonText"
css-class="btn btn-default btn-sm" css-class="btn btn-default btn-sm"
/> />
</div> </div>
......
...@@ -24,7 +24,7 @@ exports[`Environment Header has a failed pipeline matches the snapshot 1`] = ` ...@@ -24,7 +24,7 @@ exports[`Environment Header has a failed pipeline matches the snapshot 1`] = `
<review-app-link-stub <review-app-link-stub
cssclass="btn btn-default btn-sm" cssclass="btn btn-default btn-sm"
iscurrent="true" display="[object Object]"
link="http://example.com" link="http://example.com"
/> />
</div> </div>
...@@ -54,7 +54,7 @@ exports[`Environment Header has errors matches the snapshot 1`] = ` ...@@ -54,7 +54,7 @@ exports[`Environment Header has errors matches the snapshot 1`] = `
<review-app-link-stub <review-app-link-stub
cssclass="btn btn-default btn-sm" cssclass="btn btn-default btn-sm"
iscurrent="true" display="[object Object]"
link="http://example.com" link="http://example.com"
/> />
</div> </div>
...@@ -67,8 +67,8 @@ exports[`Environment Header renders name and link to app matches the snapshot 1` ...@@ -67,8 +67,8 @@ exports[`Environment Header renders name and link to app matches the snapshot 1`
<div <div
class="flex-grow-1 block-truncated" class="flex-grow-1 block-truncated"
> >
<gl-link-stub <a
class="js-environment-link cgray" class="gl-link js-environment-link cgray"
href="/enivronment/1" href="/enivronment/1"
title="staging" title="staging"
> >
...@@ -77,16 +77,31 @@ exports[`Environment Header renders name and link to app matches the snapshot 1` ...@@ -77,16 +77,31 @@ exports[`Environment Header renders name and link to app matches the snapshot 1`
> >
staging staging
</span> </span>
</gl-link-stub> </a>
<!----> <!---->
</div> </div>
<review-app-link-stub <a
cssclass="btn btn-default btn-sm" class="btn btn-default btn-sm"
iscurrent="true" data-track-event="open_review_app"
link="http://example.com" data-track-label="review_app"
href="http://example.com"
rel="noopener noreferrer nofollow"
target="_blank"
title=""
>
View app
<svg
aria-hidden="true"
class="fgray s16 ic-external-link"
>
<use
xlink:href="#external-link"
/> />
</svg>
</a>
</div> </div>
`; `;
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount, mount } from '@vue/test-utils';
import { GlLink, GlBadge } from '@gitlab/ui'; import { GlLink, GlBadge } from '@gitlab/ui';
import component from 'ee/environments_dashboard/components/dashboard/environment_header.vue'; import component from 'ee/environments_dashboard/components/dashboard/environment_header.vue';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
...@@ -24,7 +24,7 @@ describe('Environment Header', () => { ...@@ -24,7 +24,7 @@ describe('Environment Header', () => {
describe('renders name and link to app', () => { describe('renders name and link to app', () => {
beforeEach(() => { beforeEach(() => {
wrapper = shallowMount(component, { wrapper = mount(component, {
attachToDocument: true, attachToDocument: true,
propsData, propsData,
}); });
...@@ -43,7 +43,7 @@ describe('Environment Header', () => { ...@@ -43,7 +43,7 @@ describe('Environment Header', () => {
}); });
it('renders a link to the external app', () => { it('renders a link to the external app', () => {
expect(wrapper.find(ReviewAppLink).attributes('link')).toBe( expect(wrapper.find(ReviewAppLink).attributes('href')).toBe(
propsData.environment.external_url, propsData.environment.external_url,
); );
}); });
......
...@@ -6930,9 +6930,6 @@ msgstr "" ...@@ -6930,9 +6930,6 @@ msgstr ""
msgid "Enter zen mode" msgid "Enter zen mode"
msgstr "" msgstr ""
msgid "EnviornmentDashboard|You are looking at the last updated environment"
msgstr ""
msgid "Environment" msgid "Environment"
msgstr "" msgstr ""
...@@ -6951,6 +6948,9 @@ msgstr "" ...@@ -6951,6 +6948,9 @@ msgstr ""
msgid "EnvironmentDashboard|Created through the Deployment API" msgid "EnvironmentDashboard|Created through the Deployment API"
msgstr "" msgstr ""
msgid "EnvironmentDashboard|You are looking at the last updated environment"
msgstr ""
msgid "Environments" msgid "Environments"
msgstr "" msgstr ""
...@@ -15728,6 +15728,12 @@ msgstr "" ...@@ -15728,6 +15728,12 @@ msgstr ""
msgid "Review" msgid "Review"
msgstr "" msgstr ""
msgid "Review App|View app"
msgstr ""
msgid "Review App|View latest app"
msgstr ""
msgid "Review the process for configuring service providers in your identity provider — in this case, GitLab is the \"service provider\" or \"relying party\"." msgid "Review the process for configuring service providers in your identity provider — in this case, GitLab is the \"service provider\" or \"relying party\"."
msgstr "" msgstr ""
...@@ -20485,9 +20491,6 @@ msgstr "" ...@@ -20485,9 +20491,6 @@ msgstr ""
msgid "View Documentation" msgid "View Documentation"
msgstr "" msgstr ""
msgid "View app"
msgstr ""
msgid "View blame prior to this change" msgid "View blame prior to this change"
msgstr "" msgstr ""
...@@ -20547,9 +20550,6 @@ msgstr "" ...@@ -20547,9 +20550,6 @@ msgstr ""
msgid "View open merge request" msgid "View open merge request"
msgstr "" msgstr ""
msgid "View previous app"
msgstr ""
msgid "View project" msgid "View project"
msgstr "" msgstr ""
...@@ -20562,6 +20562,9 @@ msgstr "" ...@@ -20562,6 +20562,9 @@ msgstr ""
msgid "View the documentation" msgid "View the documentation"
msgstr "" msgstr ""
msgid "View the latest successful deployment to this environment"
msgstr ""
msgid "Viewing commit" msgid "Viewing commit"
msgstr "" msgstr ""
......
...@@ -134,7 +134,7 @@ describe('Deployment component', () => { ...@@ -134,7 +134,7 @@ describe('Deployment component', () => {
if (status === SUCCESS) { if (status === SUCCESS) {
expect(wrapper.find(DeploymentViewButton).text()).toContain('View app'); expect(wrapper.find(DeploymentViewButton).text()).toContain('View app');
} else { } else {
expect(wrapper.find(DeploymentViewButton).text()).toContain('View previous app'); expect(wrapper.find(DeploymentViewButton).text()).toContain('View latest app');
} }
}); });
} }
......
...@@ -3,6 +3,11 @@ import DeploymentViewButton from '~/vue_merge_request_widget/components/deployme ...@@ -3,6 +3,11 @@ import DeploymentViewButton from '~/vue_merge_request_widget/components/deployme
import ReviewAppLink from '~/vue_merge_request_widget/components/review_app_link.vue'; import ReviewAppLink from '~/vue_merge_request_widget/components/review_app_link.vue';
import deploymentMockData from './deployment_mock_data'; import deploymentMockData from './deployment_mock_data';
const appButtonText = {
text: 'View app',
tooltip: 'View the latest successful deployment to this environment',
};
describe('Deployment View App button', () => { describe('Deployment View App button', () => {
let wrapper; let wrapper;
...@@ -16,7 +21,7 @@ describe('Deployment View App button', () => { ...@@ -16,7 +21,7 @@ describe('Deployment View App button', () => {
factory({ factory({
propsData: { propsData: {
deployment: deploymentMockData, deployment: deploymentMockData,
isCurrent: true, appButtonText,
}, },
}); });
}); });
...@@ -26,25 +31,8 @@ describe('Deployment View App button', () => { ...@@ -26,25 +31,8 @@ describe('Deployment View App button', () => {
}); });
describe('text', () => { describe('text', () => {
describe('when app is current', () => { it('renders text as passed', () => {
it('shows View app', () => { expect(wrapper.find(ReviewAppLink).text()).toContain(appButtonText.text);
expect(wrapper.find(ReviewAppLink).text()).toContain('View app');
});
});
describe('when app is not current', () => {
beforeEach(() => {
factory({
propsData: {
deployment: deploymentMockData,
isCurrent: false,
},
});
});
it('shows View Previous app', () => {
expect(wrapper.find(ReviewAppLink).text()).toContain('View previous app');
});
}); });
}); });
...@@ -53,7 +41,7 @@ describe('Deployment View App button', () => { ...@@ -53,7 +41,7 @@ describe('Deployment View App button', () => {
factory({ factory({
propsData: { propsData: {
deployment: { ...deploymentMockData, changes: null }, deployment: { ...deploymentMockData, changes: null },
isCurrent: false, appButtonText,
}, },
}); });
}); });
...@@ -68,7 +56,7 @@ describe('Deployment View App button', () => { ...@@ -68,7 +56,7 @@ describe('Deployment View App button', () => {
factory({ factory({
propsData: { propsData: {
deployment: { ...deploymentMockData, changes: [deploymentMockData.changes[0]] }, deployment: { ...deploymentMockData, changes: [deploymentMockData.changes[0]] },
isCurrent: false, appButtonText,
}, },
}); });
}); });
...@@ -91,7 +79,7 @@ describe('Deployment View App button', () => { ...@@ -91,7 +79,7 @@ describe('Deployment View App button', () => {
factory({ factory({
propsData: { propsData: {
deployment: deploymentMockData, deployment: deploymentMockData,
isCurrent: false, appButtonText,
}, },
}); });
}); });
......
...@@ -8,7 +8,10 @@ describe('review app link', () => { ...@@ -8,7 +8,10 @@ describe('review app link', () => {
const props = { const props = {
link: '/review', link: '/review',
cssClass: 'js-link', cssClass: 'js-link',
isCurrent: true, display: {
text: 'View app',
tooltip: '',
},
}; };
let vm; let vm;
let el; let el;
......
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