Commit 312c504f authored by Regis's avatar Regis

can render all tabs for pipelines - remove uneeded properties - [ci skip]

parent cd111ffa
......@@ -17,30 +17,32 @@
//= require ./pipelines.js.es6
(() => {
const url = window.location.href;
if (~url.indexOf('scope') && !~url.indexOf('scope=pipelines')) return null;
const project = document.querySelector('.pipelines');
const entry = document.querySelector('.vue-pipelines-index');
Vue.use(VueResource);
return new Vue({
el: '.vue-pipelines-index',
data: {
scope: project.dataset.url,
store: new gl.PipelineStore(),
},
components: {
'vue-pipelines': gl.VuePipelines,
},
template: `
<div>
<vue-pipelines
:scope='scope'
:store='store'
>
</vue-pipelines>
</div>
`,
});
if (entry) {
return new Vue({
el: entry,
data: {
scope: project.dataset.url,
store: new gl.PipelineStore(),
},
components: {
'vue-pipelines': gl.VuePipelines,
},
template: `
<div>
<vue-pipelines
:scope='scope'
:store='store'
>
</vue-pipelines>
</div>
`,
});
}
return null;
})();
......@@ -8,6 +8,16 @@
const FIRST = '<< First';
const LAST = 'Last >>';
const getParameterByName = (name) => {
const url = window.location.href;
name = name.replace(/[[\]]/g, '\\$&');
const regex = new RegExp(`[?&]${name}(=([^&#]*)|&|#|$)`);
const results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
};
gl.VuePipelines = Vue.extend({
components: {
runningPipeline: gl.VueRunningPipeline,
......@@ -25,8 +35,8 @@
pipelines: [],
timeLoopInterval: '',
intervalId: '',
updatedAt: '',
pagenum: 1,
apiScope: 'all',
count: {
all: 0,
running_or_pending: 0,
......@@ -39,11 +49,19 @@
'store',
],
created() {
const url = window.location.toString();
if (~url.indexOf('?') && !~url.indexOf('scope=pipelines')) {
this.pagenum = url.split('?')[1].split('=')[1];
}
this.store.fetchDataLoop.call(this, Vue, this.pagenum, this.scope);
const pagenum = getParameterByName('p');
const scope = getParameterByName('scope');
if (pagenum) this.pagenum = pagenum;
if (scope) this.apiScope = scope;
this.store.fetchDataLoop.call(
this,
Vue,
this.pagenum,
this.scope,
this.apiScope,
);
},
methods: {
changepage(e, last) {
......
......@@ -3,7 +3,7 @@
((gl) => {
gl.PipelineStore = class {
fetchDataLoop(Vue, pageNum, url) {
fetchDataLoop(Vue, pageNum, url, apiScope) {
const setVueResources = () => { Vue.activeResources = 1; };
const resetVueResources = () => { Vue.activeResources = 0; };
const addToVueResources = () => { Vue.activeResources += 1; };
......@@ -27,10 +27,9 @@
};
const goFetch = () =>
this.$http.get(`${url}?page=${pageNum}`)
this.$http.get(`${url}?scope=${apiScope}&page=${pageNum}`)
.then((response) => {
const res = JSON.parse(response.body);
Vue.set(this, 'updatedAt', res.updated_at);
Vue.set(this, 'pipelines', res.pipelines);
Vue.set(this, 'count', res.count);
updatePipelineNums(this.count);
......
......@@ -39,19 +39,6 @@
- if @pipelines.blank?
%div
.nothing-here-block No pipelines to show
- elsif @scope == 'branches' || @scope == 'tags' || @scope == 'running'
.table-holder
%table.table.ci-table
%thead
%th Status
%th Pipeline
%th Commit
%th Stages
%th
%th.hidden-xs
= render @pipelines, commit_sha: true, stage: true, allow_retry: true
= paginate @pipelines, theme: 'gitlab'
- else
.commit-icon-svg.hidden
= custom_icon("icon_commit")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment