diff options
author | André Luís <aluis@gitlab.com> | 2018-04-02 21:07:21 +0300 |
---|---|---|
committer | André Luís <aluis@gitlab.com> | 2018-04-06 13:42:35 +0300 |
commit | f297815b24560bc1e793d7529249eeaec4742e3f (patch) | |
tree | 2335d8b5436ec3716931a4f3ce0566eebb0f7694 /app | |
parent | 64475d0895b3e7212aee002799cac18e0807819e (diff) |
Make vue aware of whether use can retry build from ruby
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/jobs/components/sidebar_details_block.vue | 9 | ||||
-rw-r--r-- | app/assets/javascripts/jobs/job_details_bundle.js | 5 | ||||
-rw-r--r-- | app/views/projects/jobs/_sidebar.html.haml | 2 |
3 files changed, 12 insertions, 4 deletions
diff --git a/app/assets/javascripts/jobs/components/sidebar_details_block.vue b/app/assets/javascripts/jobs/components/sidebar_details_block.vue index 237aaf8c456..731c3bbfca1 100644 --- a/app/assets/javascripts/jobs/components/sidebar_details_block.vue +++ b/app/assets/javascripts/jobs/components/sidebar_details_block.vue @@ -22,6 +22,11 @@ type: Boolean, required: true, }, + canUserRetry: { + type: Boolean, + required: false, + default: false, + }, runnerHelpUrl: { type: String, required: false, @@ -88,7 +93,7 @@ {{ job.name }} </strong> <a - v-if="job.retry_path" + v-if="canUserRetry" :class="retryButtonClass" :href="job.retry_path" data-method="post" @@ -122,7 +127,7 @@ New issue </a> <a - v-if="job.retry_path" + v-if="canUserRetry" class="js-retry-job btn btn-inverted-secondary" :href="job.retry_path" data-method="post" diff --git a/app/assets/javascripts/jobs/job_details_bundle.js b/app/assets/javascripts/jobs/job_details_bundle.js index 656676ead91..7a32b572711 100644 --- a/app/assets/javascripts/jobs/job_details_bundle.js +++ b/app/assets/javascripts/jobs/job_details_bundle.js @@ -35,9 +35,11 @@ export default () => { }); // Sidebar information block + const detailsBlockId = 'js-details-block-vue'; + const detailsBlockDataset = document.getElementById(detailsBlockId).dataset; // eslint-disable-next-line new Vue({ - el: '#js-details-block-vue', + el: `#${detailsBlockId}`, components: { detailsBlock, }, @@ -50,6 +52,7 @@ export default () => { return createElement('details-block', { props: { isLoading: this.mediator.state.isLoading, + canUserRetry: !!('canUserRetry' in detailsBlockDataset), job: this.mediator.store.state.job, runnerHelpUrl: dataset.runnerHelpUrl, }, diff --git a/app/views/projects/jobs/_sidebar.html.haml b/app/views/projects/jobs/_sidebar.html.haml index 4394d2bd2ee..7f0bef5ede0 100644 --- a/app/views/projects/jobs/_sidebar.html.haml +++ b/app/views/projects/jobs/_sidebar.html.haml @@ -2,7 +2,7 @@ .sidebar-container .blocks-container - #js-details-block-vue + #js-details-block-vue{ data: { can_user_retry: can?(current_user, :update_build, @build) && @build.retryable? } } - if can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?) .block |