blob: d2547f0b4a81e867169999d35652b90d4f9398a8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/* eslint-disable no-new */
/* global Vue, VueResource */
//= require vue
//= require vue-resource
//= require ./pipelines_store
//= require ./pipelines_service
//= require vue_shared/components/commit
//= require vue_shared/vue_resource_interceptor
//= require vue_shared/components/pipelines_table
/**
* Commits View > Pipelines Tab > Pipelines Table.
*
* Renders Pipelines table in pipelines tab in the commits show view.
*
* Uses `pipelines-table-component` to render Pipelines table with an API call.
* Endpoint is provided in HTML and passed as scope.
* We need a store to make the request and store the received environemnts.
*
* Necessary SVG in the table are provided as props. This should be refactored
* as soon as we have Webpack and can load them directly into JS files.
*/
(() => {
window.gl = window.gl || {};
gl.Commits = gl.Commits || {};
if (gl.Commits.PipelinesTableView) {
gl.Commits.PipelinesTableView.$destroy(true);
}
gl.Commits.PipelinesTableView = new Vue({
el: document.querySelector('#commit-pipeline-table-view'),
/**
* Accesses the DOM to provide the needed data.
* Returns the necessary props to render `pipelines-table-component` component.
*
* @return {Object} Props for `pipelines-table-component`
*/
data() {
const pipelinesTableData = document.querySelector('#commit-pipeline-table-view').dataset;
return {
scope: pipelinesTableData.pipelinesData,
store: new CommitsPipelineStore(),
service: new PipelinesService(),
svgs: pipelinesTableData,
};
},
components: {
'pipelines-table-component': gl.pipelines.PipelinesTableComponent,
},
template: `
<pipelines-table-component :scope='scope' :store='store' :svgs='svgs'></pipelines-table-component>
`,
});
});
|