BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
d6061b73
Commit
d6061b73
authored
Dec 02, 2016
by
Regis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
much simpler time logic - clean up - [ci skip]
parent
004a9c6b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
28 deletions
+26
-28
pipelines.js.es6
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
+2
-4
store.js.es6
app/assets/javascripts/vue_pipelines_index/store.js.es6
+22
-11
time_ago.js.es6
app/assets/javascripts/vue_pipelines_index/time_ago.js.es6
+2
-13
No files found.
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
View file @
d6061b73
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
/* eslint-disable no-param-reassign, no-bitwise*/
/* eslint-disable no-param-reassign, no-bitwise*/
((gl) => {
((gl) => {
const REALTIME = false;
const SPREAD = '...';
const SPREAD = '...';
const PREV = 'Prev';
const PREV = 'Prev';
const NEXT = 'Next';
const NEXT = 'Next';
...
@@ -24,7 +23,7 @@
...
@@ -24,7 +23,7 @@
data() {
data() {
return {
return {
pipelines: [],
pipelines: [],
allTimeIntervals: []
,
timeLoopInterval: ''
,
intervalId: '',
intervalId: '',
updatedAt: '',
updatedAt: '',
pagenum: 1,
pagenum: 1,
...
@@ -57,7 +56,7 @@
...
@@ -57,7 +56,7 @@
if (text === FIRST) this.pagenum = 1;
if (text === FIRST) this.pagenum = 1;
window.history.pushState({}, null, `?p=${this.pagenum}`);
window.history.pushState({}, null, `?p=${this.pagenum}`);
if (REALTIME) clearInterval(this.intervalId
);
clearInterval(this.timeLoopInterval
);
this.pageRequest = true;
this.pageRequest = true;
this.store.fetchDataLoop.call(this, Vue, this.pagenum, this.scope);
this.store.fetchDataLoop.call(this, Vue, this.pagenum, this.scope);
},
},
...
@@ -113,7 +112,6 @@
...
@@ -113,7 +112,6 @@
<stages :pipeline='pipeline'></stages>
<stages :pipeline='pipeline'></stages>
<time-ago
<time-ago
:pipeline='pipeline'
:pipeline='pipeline'
:addTimeInterval='addTimeInterval'
>
>
</time-ago>
</time-ago>
<pipeline-actions :pipeline='pipeline'></pipeline-actions>
<pipeline-actions :pipeline='pipeline'></pipeline-actions>
...
...
app/assets/javascripts/vue_pipelines_index/store.js.es6
View file @
d6061b73
/* global gl, Flash */
/* global gl, Flash */
/* eslint-disable no-param-reassign */
/* eslint-disable no-param-reassign
, no-underscore-dangle
*/
((gl) => {
((gl) => {
gl.PipelineStore = class {
gl.PipelineStore = class {
...
@@ -43,25 +43,36 @@
...
@@ -43,25 +43,36 @@
resourceChecker();
resourceChecker();
goFetch();
goFetch();
const removePipelineIntervals = () => {
const startTimeLoops = () => {
this.allTimeIntervals.forEach(e => clearInterval(e.id));
this.timeLoopInterval = setInterval(() => {
console.log('TIME LOOP');
this.$children
.filter(e => e.$options._componentTag === 'time-ago')
.forEach(e => e.changeTime());
}, 1000);
};
startTimeLoops();
const removeTimeIntervals = () => {
clearInterval(this.timeLoopInterval);
};
};
const startIntervalLoops = () => {
const startIntervalLoops = () => {
this.allTimeIntervals.forEach(e => e.start()
);
startTimeLoops(
);
};
};
const removeAll = () => {
const removeAll = () => {
remove
Pipelin
eIntervals();
remove
Tim
eIntervals();
window.removeEventListener('beforeunload',
() => {}
);
window.removeEventListener('beforeunload',
removeTimeIntervals
);
window.removeEventListener('focus',
() => {}
);
window.removeEventListener('focus',
startIntervalLoops
);
window.removeEventListener('blur',
() => {}
);
window.removeEventListener('blur',
removeTimeIntervals
);
document.removeEventListener('page:fetch',
() => {}
);
document.removeEventListener('page:fetch',
removeTimeIntervals
);
};
};
window.addEventListener('beforeunload', remove
Pipelin
eIntervals);
window.addEventListener('beforeunload', remove
Tim
eIntervals);
window.addEventListener('focus', startIntervalLoops);
window.addEventListener('focus', startIntervalLoops);
window.addEventListener('blur', remove
Pipelin
eIntervals);
window.addEventListener('blur', remove
Tim
eIntervals);
document.addEventListener('page:fetch', removeAll);
document.addEventListener('page:fetch', removeAll);
}
}
};
};
...
...
app/assets/javascripts/vue_pipelines_index/time_ago.js.es6
View file @
d6061b73
...
@@ -4,21 +4,12 @@
...
@@ -4,21 +4,12 @@
gl.VueTimeAgo = Vue.extend({
gl.VueTimeAgo = Vue.extend({
data() {
data() {
return {
return {
timeInterval: '',
currentTime: new Date(),
currentTime: new Date(),
};
};
},
},
props: [
props: [
'pipeline',
'pipeline',
'addTimeInterval',
],
],
created() {
this.timeInterval = setInterval(() => {
this.currentTime = new Date();
}, 1000);
this.addTimeInterval(this.timeInterval, this.startInterval);
},
computed: {
computed: {
localTimeFinished() {
localTimeFinished() {
return gl.utils.formatDate(this.pipeline.details.finished_at);
return gl.utils.formatDate(this.pipeline.details.finished_at);
...
@@ -44,10 +35,8 @@
...
@@ -44,10 +35,8 @@
if (duration !== null) return duration;
if (duration !== null) return duration;
return false;
return false;
},
},
startInterval() {
changeTime() {
this.timeInterval = setInterval(() => {
this.currentTime = new Date();
this.currentTime = new Date();
}, 1000);
},
},
},
},
template: `
template: `
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment