BigW Consortium Gitlab

pipeline_actions.js.es6 3.15 KB
Newer Older
Regis committed
1
/* global Vue, Flash, gl */
Regis committed
2 3 4 5
/* eslint-disable no-param-reassign */

((gl) => {
  gl.VuePipelineActions = Vue.extend({
Regis committed
6
    props: ['pipeline', 'svgs'],
7 8 9 10 11 12 13 14
    computed: {
      actions() {
        return this.pipeline.details.manual_actions.length > 0;
      },
      artifacts() {
        return this.pipeline.details.artifacts.length > 0;
      },
    },
15 16 17 18 19
    methods: {
      download(name) {
        return `Download ${name} artifacts`;
      },
    },
Regis committed
20
    template: `
21
      <td class="pipeline-actions hidden-xs">
Regis committed
22
        <div class="controls pull-right">
Regis committed
23 24
          <div class="btn-group inline">
            <div class="btn-group">
25
              <a
26
                v-if='actions'
27
                class="dropdown-toggle btn btn-default js-pipeline-dropdown-manual-actions"
28 29
                data-toggle="dropdown"
                title="Manual build"
30
                alt="Manual Build"
31
              >
Regis committed
32
                <span v-html='svgs.iconPlay'></span>
33 34 35 36 37 38 39
                <i class="fa fa-caret-down"></i>
              </a>
              <ul class="dropdown-menu dropdown-menu-align-right">
                <li v-for='action in pipeline.details.manual_actions'>
                  <a
                    rel="nofollow"
                    data-method="post"
Regis committed
40
                    :href='action.path'
41 42
                    title="Manual build"
                  >
Regis committed
43
                    <span v-html='svgs.iconPlay'></span>
Regis committed
44
                    <span title="Manual build">{{action.name}}</span>
45 46 47
                  </a>
                </li>
              </ul>
Regis committed
48 49
            </div>
            <div class="btn-group">
50
              <a
51
                v-if='artifacts'
52
                class="dropdown-toggle btn btn-default build-artifacts js-pipeline-dropdown-download"
53 54 55
                data-toggle="dropdown"
                type="button"
              >
Regis committed
56 57 58 59
                <i class="fa fa-download"></i>
                <i class="fa fa-caret-down"></i>
              </a>
              <ul class="dropdown-menu dropdown-menu-align-right">
60 61 62
                <li v-for='artifact in pipeline.details.artifacts'>
                  <a
                    rel="nofollow"
Regis committed
63
                    :href='artifact.path'
64
                  >
Regis committed
65
                    <i class="fa fa-download"></i>
66
                    <span>{{download(artifact.name)}}</span>
Regis committed
67 68 69 70 71 72 73
                  </a>
                </li>
              </ul>
            </div>
          </div>
          <div class="cancel-retry-btns inline">
            <a
74
              v-if='pipeline.flags.retryable'
Regis committed
75 76 77 78
              class="btn has-tooltip"
              title="Retry"
              rel="nofollow"
              data-method="post"
79
              :href='pipeline.retry_path'
80
            >
Regis committed
81 82
              <i class="fa fa-repeat"></i>
            </a>
83
            <a
84
              v-if='pipeline.flags.cancelable'
85
              class="btn btn-remove has-tooltip"
86
              title="Cancel"
87 88
              rel="nofollow"
              data-method="post"
89
              :href='pipeline.cancel_path'
90 91 92 93
              data-original-title="Cancel"
            >
              <i class="fa fa-remove"></i>
            </a>
Regis committed
94
          </div>
Regis committed
95
        </div>
96
      </td>
Regis committed
97 98 99
    `,
  });
})(window.gl || (window.gl = {}));