diff --git a/app/assets/javascripts/environments/components/environment_actions.js b/app/assets/javascripts/environments/components/environment_actions.js index 49b3ae683d0d84b202ccd43d04dc08ae36ff54bc..b88b1c6556e99e544a6734a7fe2bbd5e15c6b225 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 8e9850233abaabf0311908a894f9c7919728314e..5eebda93b39aff274ca7cb1321db7969c0071c8b 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 f78086211f786ef359a15bbd24b0428e91795863..87a0c95c4dc13a8558438a479f41fabc35515dcf 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -192,5 +192,10 @@ 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 0852dda6b299eff63de0e5249226c7c374b0fec5..3fbf24b5c7d2977aae87db27b92ffd4143e973ae 100644 --- a/spec/factories/environments.rb +++ b/spec/factories/environments.rb @@ -32,5 +32,10 @@ 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 641e2cf7402fbc6b33fae1551d0fbbead4de0e0e..4f78105cae128181a1bf08ecf4bd0647032efd9c 100644 --- a/spec/features/projects/environments/environments_spec.rb +++ b/spec/features/projects/environments/environments_spec.rb @@ -115,6 +115,21 @@ .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 2272b19bc8f17a35561588c246239b18a00f1903..b0f6a4235e5c5b0b9316ae637bf4ac0d6e0f4a38 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -197,6 +197,24 @@ 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