Use gitlab-ci job name in environment dropdown

Use plain job name in the "Deploy to..." dropdown
Both in the old haml template and in the new vue component
This commit is contained in:
Miranda Fluharty 2019-03-07 09:38:39 +00:00 committed by Phil Hughes
parent 57b5413893
commit fcd2358530
5 changed files with 14 additions and 10 deletions

View File

@ -3,7 +3,6 @@ import Timeago from 'timeago.js';
import _ from 'underscore'; import _ from 'underscore';
import { GlTooltipDirective } from '@gitlab/ui'; import { GlTooltipDirective } from '@gitlab/ui';
import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue'; import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
import { humanize } from '~/lib/utils/text_utility';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import ActionsComponent from './environment_actions.vue'; import ActionsComponent from './environment_actions.vue';
import ExternalUrlComponent from './environment_external_url.vue'; import ExternalUrlComponent from './environment_external_url.vue';
@ -156,7 +155,7 @@ export default {
const combinedActions = (manualActions || []).concat(scheduledActions || []); const combinedActions = (manualActions || []).concat(scheduledActions || []);
return combinedActions.map(action => ({ return combinedActions.map(action => ({
...action, ...action,
name: humanize(action.name), name: action.name,
})); }));
}, },

View File

@ -11,4 +11,4 @@
- next unless can?(current_user, :update_build, action) - next unless can?(current_user, :update_build, action)
%li %li
= link_to [:play, @project.namespace.becomes(Namespace), @project, action], method: :post, rel: 'nofollow', class: 'btn' do = link_to [:play, @project.namespace.becomes(Namespace), @project, action], method: :post, rel: 'nofollow', class: 'btn' do
%span= action.name.humanize %span= action.name

View File

@ -0,0 +1,5 @@
---
title: Display job names consistently on pipelines and environments list
merge_request: 24984
author:
type: fixed

View File

@ -120,7 +120,7 @@ describe 'Environment' do
end end
it 'does show a play button' do it 'does show a play button' do
expect(page).to have_link(action.name.humanize) expect(page).to have_link(action.name)
end end
it 'does allow to play manual action', :js do it 'does allow to play manual action', :js do
@ -128,7 +128,7 @@ describe 'Environment' do
find('button.dropdown').click find('button.dropdown').click
expect { click_link(action.name.humanize) } expect { click_link(action.name) }
.not_to change { Ci::Pipeline.count } .not_to change { Ci::Pipeline.count }
wait_for_all_requests wait_for_all_requests
@ -140,7 +140,7 @@ describe 'Environment' do
context 'when user has no ability to trigger a deployment' do context 'when user has no ability to trigger a deployment' do
it 'does not show a play button' do it 'does not show a play button' do
expect(page).not_to have_link(action.name.humanize) expect(page).not_to have_link(action.name)
end end
end end

View File

@ -183,14 +183,14 @@ describe 'Environments page', :js do
it 'shows a play button' do it 'shows a play button' do
find('.js-environment-actions-dropdown').click find('.js-environment-actions-dropdown').click
expect(page).to have_content(action.name.humanize) expect(page).to have_content(action.name)
end end
it 'allows to play a manual action', :js do it 'allows to play a manual action', :js do
expect(action).to be_manual expect(action).to be_manual
find('.js-environment-actions-dropdown').click find('.js-environment-actions-dropdown').click
expect(page).to have_content(action.name.humanize) expect(page).to have_content(action.name)
expect { find('.js-manual-action-link').click } expect { find('.js-manual-action-link').click }
.not_to change { Ci::Pipeline.count } .not_to change { Ci::Pipeline.count }
@ -311,7 +311,7 @@ describe 'Environments page', :js do
it "has link to the delayed job's action" do it "has link to the delayed job's action" do
find('.js-environment-actions-dropdown').click find('.js-environment-actions-dropdown').click
expect(page).to have_button('Delayed job') expect(page).to have_button('delayed job')
expect(page).to have_content(/\d{2}:\d{2}:\d{2}/) expect(page).to have_content(/\d{2}:\d{2}:\d{2}/)
end end
@ -333,7 +333,7 @@ describe 'Environments page', :js do
context 'when user played a delayed job immediately' do context 'when user played a delayed job immediately' do
before do before do
find('.js-environment-actions-dropdown').click find('.js-environment-actions-dropdown').click
page.accept_confirm { click_button('Delayed job') } page.accept_confirm { click_button('delayed job') }
wait_for_requests wait_for_requests
end end