BigW Consortium Gitlab

Commit 312c504f by Regis

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

parent cd111ffa
...@@ -17,30 +17,32 @@ ...@@ -17,30 +17,32 @@
//= require ./pipelines.js.es6 //= 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 project = document.querySelector('.pipelines');
const entry = document.querySelector('.vue-pipelines-index');
Vue.use(VueResource); Vue.use(VueResource);
return new Vue({ if (entry) {
el: '.vue-pipelines-index', return new Vue({
data: { el: entry,
scope: project.dataset.url, data: {
store: new gl.PipelineStore(), scope: project.dataset.url,
}, store: new gl.PipelineStore(),
components: { },
'vue-pipelines': gl.VuePipelines, components: {
}, 'vue-pipelines': gl.VuePipelines,
template: ` },
<div> template: `
<vue-pipelines <div>
:scope='scope' <vue-pipelines
:store='store' :scope='scope'
> :store='store'
</vue-pipelines> >
</div> </vue-pipelines>
`, </div>
}); `,
});
}
return null;
})(); })();
...@@ -8,6 +8,16 @@ ...@@ -8,6 +8,16 @@
const FIRST = '<< First'; const FIRST = '<< First';
const LAST = 'Last >>'; 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({ gl.VuePipelines = Vue.extend({
components: { components: {
runningPipeline: gl.VueRunningPipeline, runningPipeline: gl.VueRunningPipeline,
...@@ -25,8 +35,8 @@ ...@@ -25,8 +35,8 @@
pipelines: [], pipelines: [],
timeLoopInterval: '', timeLoopInterval: '',
intervalId: '', intervalId: '',
updatedAt: '',
pagenum: 1, pagenum: 1,
apiScope: 'all',
count: { count: {
all: 0, all: 0,
running_or_pending: 0, running_or_pending: 0,
...@@ -39,11 +49,19 @@ ...@@ -39,11 +49,19 @@
'store', 'store',
], ],
created() { created() {
const url = window.location.toString(); const pagenum = getParameterByName('p');
if (~url.indexOf('?') && !~url.indexOf('scope=pipelines')) { const scope = getParameterByName('scope');
this.pagenum = url.split('?')[1].split('=')[1];
} if (pagenum) this.pagenum = pagenum;
this.store.fetchDataLoop.call(this, Vue, this.pagenum, this.scope); if (scope) this.apiScope = scope;
this.store.fetchDataLoop.call(
this,
Vue,
this.pagenum,
this.scope,
this.apiScope,
);
}, },
methods: { methods: {
changepage(e, last) { changepage(e, last) {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
((gl) => { ((gl) => {
gl.PipelineStore = class { gl.PipelineStore = class {
fetchDataLoop(Vue, pageNum, url) { fetchDataLoop(Vue, pageNum, url, apiScope) {
const setVueResources = () => { Vue.activeResources = 1; }; const setVueResources = () => { Vue.activeResources = 1; };
const resetVueResources = () => { Vue.activeResources = 0; }; const resetVueResources = () => { Vue.activeResources = 0; };
const addToVueResources = () => { Vue.activeResources += 1; }; const addToVueResources = () => { Vue.activeResources += 1; };
...@@ -27,10 +27,9 @@ ...@@ -27,10 +27,9 @@
}; };
const goFetch = () => const goFetch = () =>
this.$http.get(`${url}?page=${pageNum}`) this.$http.get(`${url}?scope=${apiScope}&page=${pageNum}`)
.then((response) => { .then((response) => {
const res = JSON.parse(response.body); const res = JSON.parse(response.body);
Vue.set(this, 'updatedAt', res.updated_at);
Vue.set(this, 'pipelines', res.pipelines); Vue.set(this, 'pipelines', res.pipelines);
Vue.set(this, 'count', res.count); Vue.set(this, 'count', res.count);
updatePipelineNums(this.count); updatePipelineNums(this.count);
......
...@@ -39,19 +39,6 @@ ...@@ -39,19 +39,6 @@
- if @pipelines.blank? - if @pipelines.blank?
%div %div
.nothing-here-block No pipelines to show .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 - else
.commit-icon-svg.hidden .commit-icon-svg.hidden
= custom_icon("icon_commit") = 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