Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
2518af49
Commit
2518af49
authored
Nov 16, 2016
by
Bryce Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shush eslint.
parent
50b16e78
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
39 deletions
+33
-39
app/assets/javascripts/directives/tooltip_title.js.es6
app/assets/javascripts/directives/tooltip_title.js.es6
+1
-3
app/assets/javascripts/issuable_time_tracker.js.es6
app/assets/javascripts/issuable_time_tracker.js.es6
+15
-16
app/assets/javascripts/smart_interval.js.es6
app/assets/javascripts/smart_interval.js.es6
+1
-5
app/assets/javascripts/subbable_resource.js.es6
app/assets/javascripts/subbable_resource.js.es6
+10
-9
app/assets/javascripts/time_tracking_display.js.es6
app/assets/javascripts/time_tracking_display.js.es6
+6
-6
No files found.
app/assets/javascripts/directives/tooltip_title.js.es6
View file @
2518af49
//= require vue
((global) => {
(() => {
/**
* This directive ensures the text used to populate a Bootstrap tooltip is
* updated dynamically. The tooltip's `title` is not stored or accessed
...
...
@@ -16,5 +15,4 @@
el.setAttribute('data-original-title', updatedValue);
},
});
})(window.gl || (window.gl = {}));
app/assets/javascripts/issuable_time_tracker.js.es6
View file @
2518af49
//= vue
((
global
) => {
(() => {
gl.IssuableTimeTracker = Vue.component('issuable-time-tracker', {
name: 'issuable-time-tracker',
props: [
'time_estimate', 'time_spent', 'human_time_estimate', 'human_time_spent'
],
data
: function
() {
props: [
'time_estimate', 'time_spent', 'human_time_estimate', 'human_time_spent'
],
data() {
return {
displayHelp: false,
}
}
;
},
computed: {
/* Select panels to show */
...
...
@@ -55,33 +55,32 @@
},
/* Diff values for comparison meter */
diffMinutes () {
const time_estimate = this.time_estimate;
const time_spent = this.time_spent;
return time_estimate - time_spent;
diffMinutes() {
return this.time_estimate - this.time_spent;
},
diffPercent() {
const estimate = this.time_estimate;
return Math.floor((this.time_spent / this.time_estimate * 100)) + '%';
return `${Math.floor(((this.time_spent / this.time_estimate) * 100))}%`;
},
diffStatusClass() {
return this.time_estimate >= this.time_spent ? 'within_estimate' : 'over_estimate';
}
}
,
},
methods: {
secondsToMinutes(seconds) {
return Math.abs(seconds / 60);
},
parseSeconds (seconds) {
const DAYS_PER_WEEK = 5, HOURS_PER_DAY = 8, MINUTES_PER_HOUR = 60;
const MINUTES_PER_WEEK = DAYS_PER_WEEK * HOURS_PER_DAY * MINUTES_PER_HOUR;
parseSeconds(seconds) {
const DAYS_PER_WEEK = 5;
const HOURS_PER_DAY = 8;
const MINUTES_PER_HOUR = 60;
const MINUTES_PER_WEEK = DAYS_PER_WEEK * HOURS_PER_DAY * MINUTES_PER_HOUR;
const MINUTES_PER_DAY = HOURS_PER_DAY * MINUTES_PER_HOUR;
const timePeriodConstraints = {
weeks: MINUTES_PER_WEEK,
days: MINUTES_PER_DAY,
hours: MINUTES_PER_HOUR,
minutes: 1
minutes: 1
,
};
let unorderedMinutes = this.secondsToMinutes(seconds);
...
...
@@ -104,7 +103,7 @@
stringifyTime(obj) {
const reducedTime = _.reduce(obj, (memo, unitValue, unitName) => {
const isNonZero = !!unitValue;
return isNonZero ?
(memo + `${unitValue}${unitName.charAt(0)} `)
: memo;
return isNonZero ?
`${memo} ${unitValue}${unitName.charAt(0)} `
: memo;
}, '').trim();
return reducedTime.length ? reducedTime : '0m';
},
...
...
app/assets/javascripts/smart_interval.js.es6
View file @
2518af49
...
...
@@ -13,7 +13,7 @@
* @param { integer } incrementByFactorOf `currentInterval` is incremented by this factor
* @param { boolean } lazyStart Configure if timer is initialized on instantiation or lazily
*/
constructor({ callback, startingInterval, maxInterval, incrementByFactorOf, lazyStart
= false
}) {
constructor({ callback, startingInterval, maxInterval, incrementByFactorOf, lazyStart }) {
this.cfg = {
callback,
startingInterval,
...
...
@@ -84,8 +84,6 @@
}
initVisibilityChangeHandling() {
const cfg = this.cfg;
// cancel interval when tab no longer shown (prevents cached pages from polling)
$(document)
.off('visibilitychange').on('visibilitychange', (e) => {
...
...
@@ -95,8 +93,6 @@
}
initPageUnloadHandling() {
const cfg = this.cfg;
// prevent interval continuing after page change, when kept in cache by Turbolinks
$(document).on('page:before-unload', () => this.cancel());
}
...
...
app/assets/javascripts/subbable_resource.js.es6
View file @
2518af49
//= require vue
//= require vue-resource
((
global
) => {
(() => {
/*
* SubbableResource can be extended to provide a pubsub-style service for one-off REST
* calls. Subscribe by passing a callback or render method you will use to handle responses.
...
...
@@ -11,6 +11,7 @@
class SubbableResource {
constructor(resourcePath) {
this.endpoint = resourcePath;
// TODO: Switch to axios.create
this.resource = $.ajax;
this.subscribers = [];
...
...
@@ -28,23 +29,23 @@
return newResponse;
}
get(
data
) {
return this.resource(
data
)
get(
payload
) {
return this.resource(
payload
)
.then(data => this.publish(data));
}
post(
data
) {
return this.resource(
data
)
post(
payload
) {
return this.resource(
payload
)
.then(data => this.publish(data));
}
put(
data
) {
return this.resource(
data
)
put(
payload
) {
return this.resource(
payload
)
.then(data => this.publish(data));
}
delete(
data
) {
return this.resource(
data
)
delete(
payload
) {
return this.resource(
payload
)
.then(data => this.publish(data));
}
}
...
...
app/assets/javascripts/time_tracking_display.js.es6
View file @
2518af49
...
...
@@ -3,7 +3,7 @@
//= smart_interval
//= subbable_resource
((
global
) => {
(() => {
/* This Vue instance represents what will become the parent instance for the
* sidebar. It will be responsible for managing `issuable` state and propagating
* changes to sidebar components.
...
...
@@ -16,17 +16,17 @@
}
initComponent(parsedIssuable) {
return
new Vue({
this.parentInstance =
new Vue({
el: '#issuable-time-tracker',
data: {
issuable: parsedIssuable,
},
methods: {
fetchIssuable() {
return gl.IssuableResource.get.call(gl.IssuableResource, { type: 'GET', url: gl.IssuableResource.endpoint });
return gl.IssuableResource.get.call(gl.IssuableResource, { type: 'GET', url: gl.IssuableResource.endpoint });
},
initPolling() {
new gl.SmartInterval({
return
new gl.SmartInterval({
callback: this.fetchIssuable,
startingInterval: 5000,
maxInterval: 20000,
...
...
@@ -41,7 +41,7 @@
gl.IssuableResource.subscribe(data => this.updateState(data));
},
listenForSlashCommands() {
$(document).on('ajax:success', '.gfm-form', (
e
) => {
$(document).on('ajax:success', '.gfm-form', () => {
// TODO: check for slash command
this.fetchIssuable();
});
...
...
@@ -54,7 +54,7 @@
this.initPolling();
this.subscribeToUpdates();
this.listenForSlashCommands();
}
}
,
});
}
}
...
...
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