diff --git a/app/assets/javascripts/environments/components/environment_actions.js b/app/assets/javascripts/environments/components/environment_actions.js index 49b3ae683d0..b88b1c6556e 100644 --- a/app/assets/javascripts/environments/components/environment_actions.js +++ b/app/assets/javascripts/environments/components/environment_actions.js @@ -69,7 +69,7 @@ export default { type="button" @click="onClickAction(action.play_path)" class="js-manual-action-link no-btn btn" - :class="{ 'disabled': !actions.playable }" + :class="{ 'disabled': !action.playable }" :disabled="!action.playable"> ${playIconSvg} diff --git a/app/assets/javascripts/vue_pipelines_index/components/pipelines_actions.js b/app/assets/javascripts/vue_pipelines_index/components/pipelines_actions.js index 8e9850233ab..5eebda93b39 100644 --- a/app/assets/javascripts/vue_pipelines_index/components/pipelines_actions.js +++ b/app/assets/javascripts/vue_pipelines_index/components/pipelines_actions.js @@ -49,7 +49,7 @@ export default { data-toggle="dropdown" data-placement="top" aria-label="Manual job" - :disabled="isDisabled"> + :disabled="isLoading"> ${playIconSvg} @@ -60,9 +60,9 @@ export default { diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index f78086211f7..87a0c95c4dc 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -192,5 +192,10 @@ FactoryGirl.define do trait :no_options do options { {} } end + + trait :non_playable do + status 'created' + self.when 'manual' + end end end diff --git a/spec/factories/environments.rb b/spec/factories/environments.rb index 0852dda6b29..3fbf24b5c7d 100644 --- a/spec/factories/environments.rb +++ b/spec/factories/environments.rb @@ -32,5 +32,10 @@ FactoryGirl.define do environment.update_attribute(:deployments, [deployment]) end end + + trait :non_playable do + status 'created' + self.when 'manual' + end end end diff --git a/spec/features/projects/environments/environments_spec.rb b/spec/features/projects/environments/environments_spec.rb index 641e2cf7402..4f78105cae1 100644 --- a/spec/features/projects/environments/environments_spec.rb +++ b/spec/features/projects/environments/environments_spec.rb @@ -115,6 +115,21 @@ feature 'Environments page', :feature, :js do .not_to change { Ci::Pipeline.count } end + scenario 'when action is non playable', js: true do + given(:action) do + create(:ci_build, :manual, :non_playable, + pipeline: pipeline, + name: 'close_app') + end + + it 'has disabled button to the manual action' do + find('.js-dropdown-play-icon-container').click + + expect(page).to have_button('close_app', disabled: true) + end + + end + scenario 'does show build name and id' do expect(page).to have_link("#{build.name} ##{build.id}") end diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index 2272b19bc8f..b0f6a4235e5 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -197,6 +197,24 @@ describe 'Pipelines', :feature, :js do end end + context 'with non playable manual action' do + let!(:manual) do + create(:ci_build, :manual, :non_playable, + pipeline: pipeline, + name: 'manual build', + stage: 'test', + commands: 'test') + end + + before { visit_project_pipelines } + + it 'has disabled button to the manual action' do + find('.js-pipeline-dropdown-manual-actions').click + + expect(page).to have_button('manual build', disabled: true) + end + end + context 'for generic statuses' do context 'when running' do let!(:running) do