Fix jshint errors after conversion to JS
This commit is contained in:
parent
fafaf65043
commit
e60b0a0224
|
@ -5,7 +5,14 @@
|
|||
"-Promise",
|
||||
"jQuery",
|
||||
"Visibility",
|
||||
"$"
|
||||
"$",
|
||||
"Travis",
|
||||
"_cio",
|
||||
"_gaq",
|
||||
"Log",
|
||||
"moment",
|
||||
"Pusher",
|
||||
"md5"
|
||||
],
|
||||
"browser": true,
|
||||
"boss": true,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import DS from 'ember-data';
|
||||
import config from 'travis/config/environment';
|
||||
var Adapter;
|
||||
import Ember from 'ember';
|
||||
|
||||
Adapter = DS.ActiveModelAdapter.extend({
|
||||
export default DS.ActiveModelAdapter.extend({
|
||||
auth: Ember.inject.service(),
|
||||
host: config.apiEndpoint,
|
||||
coalesceFindRequests: true,
|
||||
|
@ -11,11 +11,13 @@ Adapter = DS.ActiveModelAdapter.extend({
|
|||
var base, hash, token;
|
||||
|
||||
hash = this._super(...arguments);
|
||||
hash.headers || (hash.headers = {});
|
||||
hash.headers = hash.headers || {};
|
||||
hash.headers['accept'] = 'application/json; version=2';
|
||||
|
||||
if (token = this.get('auth').token()) {
|
||||
(base = hash.headers)['Authorization'] || (base['Authorization'] = "token " + token);
|
||||
if(!hash.headers['Authorization']) {
|
||||
hash.headers['Authorization'] = "token " + token;
|
||||
}
|
||||
}
|
||||
|
||||
return hash;
|
||||
|
@ -37,5 +39,3 @@ Adapter = DS.ActiveModelAdapter.extend({
|
|||
return this._super(...arguments);
|
||||
}
|
||||
});
|
||||
|
||||
export default Adapter;
|
||||
|
|
|
@ -32,12 +32,12 @@ var App = Ember.Application.extend(Ember.Evented, {
|
|||
$('body').toggleClass('maximized');
|
||||
element = $('<span></span>');
|
||||
$('#top .profile').append(element);
|
||||
Em.run.later((function() {
|
||||
Ember.run.later((function() {
|
||||
return element.remove();
|
||||
}), 10);
|
||||
element = $('<span></span>');
|
||||
$('#repo').append(element);
|
||||
return Em.run.later((function() {
|
||||
return Ember.run.later((function() {
|
||||
return element.remove();
|
||||
}), 10);
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var AddSshKeyComponent;
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
classNames: ['form--sshkey'],
|
||||
|
@ -7,17 +7,18 @@ export default Ember.Component.extend({
|
|||
isSaving: false,
|
||||
|
||||
didInsertElement() {
|
||||
id = this.get('repo.id');
|
||||
model = this.get('store').recordForId('ssh_key', id);
|
||||
var id = this.get('repo.id');
|
||||
var model = this.get('store').recordForId('ssh_key', id);
|
||||
|
||||
if (model) {
|
||||
this.get('store').dematerializeRecord(model._internalModel);
|
||||
typeMap = this.get('store').typeMapFor(model.constructor);
|
||||
idToRecord = typeMap.idToRecord;
|
||||
var typeMap = this.get('store').typeMapFor(model.constructor);
|
||||
var idToRecord = typeMap.idToRecord;
|
||||
delete idToRecord[id];
|
||||
}
|
||||
model = this.get('store').createRecord('ssh_key', {
|
||||
id: id
|
||||
});
|
||||
|
||||
model = this.get('store').createRecord('ssh_key', { id: id });
|
||||
|
||||
return this.set('model', model);
|
||||
},
|
||||
|
||||
|
@ -42,8 +43,8 @@ export default Ember.Component.extend({
|
|||
}.observes('value'),
|
||||
|
||||
addErrorsFromResponse(errArr) {
|
||||
var error;
|
||||
error = errArr[0].detail;
|
||||
var error = errArr[0].detail;
|
||||
|
||||
if (error.code === 'not_a_private_key') {
|
||||
return this.set('valueError', 'This key is not a private key.');
|
||||
} else if (error.code === 'key_with_a_passphrase') {
|
||||
|
@ -54,6 +55,7 @@ export default Ember.Component.extend({
|
|||
actions: {
|
||||
save() {
|
||||
var ssh_key;
|
||||
|
||||
this.set('valueError', false);
|
||||
if (this.get('isSaving')) {
|
||||
return;
|
||||
|
@ -68,7 +70,7 @@ export default Ember.Component.extend({
|
|||
this.set('isSaving', false);
|
||||
this.reset();
|
||||
return this.sendAction('sshKeyAdded', ssh_key);
|
||||
}, () => {
|
||||
}, (error) => {
|
||||
this.set('isSaving', false);
|
||||
if (error.errors) {
|
||||
return this.addErrorsFromResponse(error.errors);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
import { colorForState } from 'travis/utils/helpers';
|
||||
import { languageConfigKeys } from 'travis/utils/keys-map';;
|
||||
import { languageConfigKeys } from 'travis/utils/keys-map';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
tagName: 'li',
|
||||
|
|
|
@ -9,12 +9,12 @@ Log.DEBUG = false;
|
|||
Log.LIMIT = 10000;
|
||||
|
||||
Log.Scroll = function(options) {
|
||||
options || (options = {});
|
||||
options = options || {};
|
||||
this.beforeScroll = options.beforeScroll;
|
||||
return this;
|
||||
};
|
||||
|
||||
Log.Scroll.prototype = $.extend(new Log.Listener, {
|
||||
Log.Scroll.prototype = $.extend(new Log.Listener(), {
|
||||
insert: function(log, data, pos) {
|
||||
if (this.numbers) {
|
||||
this.tryScroll();
|
||||
|
@ -39,7 +39,7 @@ Log.Limit = function(max_lines, limitedLogCallback) {
|
|||
return this;
|
||||
};
|
||||
|
||||
Log.Limit.prototype = Log.extend(new Log.Listener, {
|
||||
Log.Limit.prototype = Log.extend(new Log.Listener(), {
|
||||
count: 0,
|
||||
insert: function(log, node, pos) {
|
||||
if (node.type === 'paragraph' && !node.hidden) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var Controller;
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
sync() {
|
||||
|
@ -8,6 +8,7 @@ export default Ember.Controller.extend({
|
|||
model: Ember.computed.alias('auth.currentUser'),
|
||||
|
||||
syncingDidChange: function() {
|
||||
var user;
|
||||
if ((user = this.get('model')) && user.get('isSyncing') && !user.get('syncedAt')) {
|
||||
return Ember.run.scheduleOnce('routerTransitions', this, function() {
|
||||
return this.container.lookup('router:main').send('renderFirstSync');
|
||||
|
|
|
@ -52,7 +52,7 @@ export default Ember.Controller.extend({
|
|||
} else {
|
||||
seenBroadcasts = [];
|
||||
}
|
||||
$.ajax(apiEndpoint + "/v3/broadcasts", options).then(() => {
|
||||
$.ajax(apiEndpoint + "/v3/broadcasts", options).then((response) => {
|
||||
var receivedBroadcasts;
|
||||
if (response.broadcasts.length) {
|
||||
receivedBroadcasts = response.broadcasts.filter(function(broadcast) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
var TextField;
|
||||
|
||||
TextField = Ember.TextField.extend({
|
||||
var TextField = Ember.TextField.extend({
|
||||
keyUp(event) {
|
||||
return this.sendAction('action', this.get('_value'), event);
|
||||
},
|
||||
|
@ -18,4 +17,4 @@ export default function(params, hash, options, env) {
|
|||
delete hash.on;
|
||||
hash.onEvent = onEvent || 'enter';
|
||||
return env.helpers.view.helperFunction.call(this, [TextField], hash, options, env);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { safe, formatCommit as formatCommitHelper } from 'travis/utils/helpers';
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Helper.helper(function(params) {
|
||||
var commit;
|
||||
|
|
|
@ -2,4 +2,4 @@ import { safe, formatConfig as formatConfigHelper } from 'travis/utils/helpers';
|
|||
|
||||
export default function(config, options) {
|
||||
return safe(formatConfigHelper(config));
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { formatCommit, safe } from 'travis/utils/helpers';
|
||||
import { githubCommit as githubCommitUrl } from 'travis/utils/urls';
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Helper.helper(function(params) {
|
||||
var commitSha, sha, slug, url;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Generated by CoffeeScript 1.10.0
|
||||
import Ember from 'ember';
|
||||
|
||||
var StylesheetsManagerInitializer, initialize, stylesheetsManager;
|
||||
|
||||
stylesheetsManager = Ember.Object.create({
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { githubCommit, githubPullRequest } from 'travis/utils/urls';
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Mixin.create({
|
||||
urlGithubCommit: function() {
|
||||
|
|
|
@ -51,7 +51,7 @@ export default Ember.Mixin.create({
|
|||
if (!Ember.isArray(pollModels)) {
|
||||
pollModels = [pollModels];
|
||||
}
|
||||
pollModels.forEach(() => {
|
||||
pollModels.forEach( (property) => {
|
||||
this.pollModel(property);
|
||||
this.addObserver(property, this, 'pollModelDidChange');
|
||||
return Ember.addBeforeObserver(this, property, this, 'pollModelWillChange');
|
||||
|
@ -68,7 +68,7 @@ export default Ember.Mixin.create({
|
|||
if (!Ember.isArray(pollModels)) {
|
||||
pollModels = [pollModels];
|
||||
}
|
||||
pollModels.forEach(() => {
|
||||
pollModels.forEach( (property) => {
|
||||
this.stopPollingModel(property);
|
||||
this.removeObserver(property, this, 'pollModelDidChange');
|
||||
return Ember.removeBeforeObserver(this, property, this, 'pollModelWillChange');
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
import DS from 'ember-data';
|
||||
import Model from 'travis/models/model';
|
||||
|
||||
export default Model.extend({
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
import Model from 'travis/models/model';
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default Model.extend({
|
||||
name: DS.attr('string'),
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import Ember from 'ember';
|
||||
import DS from 'ember-data';
|
||||
import Model from 'travis/models/model';
|
||||
|
||||
var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
var indexOf = [].indexOf;
|
||||
|
||||
export default Model.extend({
|
||||
var Broadcast = Model.extend({
|
||||
message: DS.attr(),
|
||||
|
||||
toObject() {
|
||||
|
@ -36,3 +37,5 @@ Broadcast.reopenClass({
|
|||
return Ember.A(seenBroadcasts || []);
|
||||
}.property()
|
||||
});
|
||||
|
||||
export default Broadcast;
|
||||
|
|
|
@ -3,6 +3,7 @@ import configKeysMap from 'travis/utils/keys-map';
|
|||
import Ember from 'ember';
|
||||
import Model from 'travis/models/model';
|
||||
import DurationCalculations from 'travis/utils/duration-calculations';
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default Model.extend(DurationCalculations, {
|
||||
ajax: Ember.inject.service(),
|
||||
|
|
|
@ -2,6 +2,7 @@ import Ember from 'ember';
|
|||
import Model from 'travis/models/model';
|
||||
import Build from 'travis/models/build';
|
||||
import { gravatarImage } from 'travis/utils/urls';
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default Model.extend({
|
||||
sha: DS.attr(),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
import Model from 'travis/models/model';
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default Model.extend({
|
||||
name: DS.attr(),
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
import Model from 'travis/models/model';
|
||||
import config from 'travis/config/environment';
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default Model.extend({
|
||||
name: DS.attr(),
|
||||
|
|
|
@ -4,6 +4,7 @@ import Ember from 'ember';
|
|||
import Model from 'travis/models/model';
|
||||
import Log from 'travis/models/log';
|
||||
import DurationCalculations from 'travis/utils/duration-calculations';
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default Model.extend(DurationCalculations, {
|
||||
ajax: Ember.inject.service(),
|
||||
|
|
|
@ -12,7 +12,7 @@ var Request = Ember.Object.extend({
|
|||
return this.get('ajax').ajax("/jobs/" + this.id + "/log?cors_hax=true", 'GET', {
|
||||
dataType: 'text',
|
||||
headers: this.HEADERS,
|
||||
success: () => {
|
||||
success: (body, status, xhr) => {
|
||||
return Ember.run(this, function() {
|
||||
return this.handle(body, status, xhr);
|
||||
});
|
||||
|
@ -51,7 +51,7 @@ var Request = Ember.Object.extend({
|
|||
}
|
||||
});
|
||||
|
||||
var Log = Ember.Object.extend({
|
||||
var LogModel = Ember.Object.extend({
|
||||
version: 0,
|
||||
isLoaded: false,
|
||||
length: 0,
|
||||
|
@ -180,4 +180,4 @@ var Log = Ember.Object.extend({
|
|||
}
|
||||
});
|
||||
|
||||
export default Log;
|
||||
export default LogModel;
|
||||
|
|
|
@ -3,6 +3,9 @@ import Model from 'travis/models/model';
|
|||
import { durationFrom as durationFromHelper } from 'travis/utils/helpers';
|
||||
import Build from 'travis/models/build';
|
||||
import Config from 'travis/config/environment';
|
||||
import DS from 'ember-data';
|
||||
import Ember from 'ember';
|
||||
|
||||
var Repo;
|
||||
|
||||
if (Config.useV3API) {
|
||||
|
@ -153,7 +156,7 @@ Repo.reopen({
|
|||
|
||||
stats: function() {
|
||||
if (this.get('slug')) {
|
||||
return this.get('_stats') || $.get("https://api.github.com/repos/" + this.get('slug'), () => {
|
||||
return this.get('_stats') || $.get("https://api.github.com/repos/" + this.get('slug'), (data) => {
|
||||
this.set('_stats', data);
|
||||
return this.notifyPropertyChange('stats');
|
||||
}) && {};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
import Model from 'travis/models/model';
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default Model.extend({
|
||||
created_at: DS.attr(),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
import DS from 'ember-data';
|
||||
import Model from 'travis/models/model';
|
||||
|
||||
export default Model.extend({
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
import Model from 'travis/models/model';
|
||||
import config from 'travis/config/environment';
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default Model.extend({
|
||||
ajax: Ember.inject.service(),
|
||||
|
@ -42,11 +43,9 @@ export default Model.extend({
|
|||
permissions = Ember.ArrayProxy.create({
|
||||
content: []
|
||||
});
|
||||
this.get('_rawPermissions').then((function(_this) {
|
||||
return function(data) {
|
||||
return permissions.set('content', data.permissions);
|
||||
};
|
||||
})(this));
|
||||
this.get('_rawPermissions').then((data) => {
|
||||
return permissions.set('content', data.permissions);
|
||||
});
|
||||
return permissions;
|
||||
}.property(),
|
||||
|
||||
|
@ -55,7 +54,7 @@ export default Model.extend({
|
|||
permissions = Ember.ArrayProxy.create({
|
||||
content: []
|
||||
});
|
||||
this.get('_rawPermissions').then(() => {
|
||||
this.get('_rawPermissions').then((data) => {
|
||||
return permissions.set('content', data.admin);
|
||||
});
|
||||
return permissions;
|
||||
|
@ -66,7 +65,7 @@ export default Model.extend({
|
|||
permissions = Ember.ArrayProxy.create({
|
||||
content: []
|
||||
});
|
||||
this.get('_rawPermissions').then(() => {
|
||||
this.get('_rawPermissions').then((data) => {
|
||||
return permissions.set('content', data.pull);
|
||||
});
|
||||
return permissions;
|
||||
|
@ -77,14 +76,14 @@ export default Model.extend({
|
|||
permissions = Ember.ArrayProxy.create({
|
||||
content: []
|
||||
});
|
||||
this.get('_rawPermissions').then(() => {
|
||||
this.get('_rawPermissions').then((data) => {
|
||||
return permissions.set('content', data.push);
|
||||
});
|
||||
return permissions;
|
||||
}.property(),
|
||||
|
||||
pushPermissionsPromise: function() {
|
||||
return this.get('_rawPermissions').then(() => {
|
||||
return this.get('_rawPermissions').then((data) => {
|
||||
return data.pull;
|
||||
});
|
||||
}.property(),
|
||||
|
@ -110,7 +109,7 @@ export default Model.extend({
|
|||
},
|
||||
|
||||
poll() {
|
||||
return this.get('ajax').get('/users', () => {
|
||||
return this.get('ajax').get('/users', (data) => {
|
||||
var self;
|
||||
if (data.user.is_syncing) {
|
||||
self = this;
|
||||
|
|
|
@ -22,13 +22,5 @@ export default TravisRoute.extend({
|
|||
outlet: 'left',
|
||||
into: 'profile'
|
||||
});
|
||||
},
|
||||
|
||||
organizations() {
|
||||
return model.filterBy('type', 'organization');
|
||||
},
|
||||
|
||||
user() {
|
||||
return model.filterBy('type', 'user')[0];
|
||||
}
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@ export default TravisRoute.extend(BuildFaviconMixin, {
|
|||
this.get('stylesheetsManager').disable('dashboard');
|
||||
if (!config.pro) {
|
||||
repos = this.get('store').peekAll('repo');
|
||||
repos.forEach(() => {
|
||||
repos.forEach((repo) => {
|
||||
return this.subscribeToRepo(repo);
|
||||
});
|
||||
return repos.addArrayObserver(this, {
|
||||
|
@ -39,7 +39,7 @@ export default TravisRoute.extend(BuildFaviconMixin, {
|
|||
reposDidChange(array, start, removedCount, addedCount) {
|
||||
var addedRepos;
|
||||
addedRepos = array.slice(start, start + addedCount);
|
||||
return addedRepos.forEach(() => {
|
||||
return addedRepos.forEach((repo) => {
|
||||
return this.subscribeToRepo(repo);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import SimpleLayoutRoute from 'travis/routes/simple-layout';
|
||||
import Ember from 'ember';
|
||||
|
||||
export default SimpleLayoutRoute.extend({
|
||||
activate() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import BasicRoute from 'travis/routes/basic';
|
||||
import config from 'travis/config/environment';
|
||||
import limit from 'travis/utils/computed-limit';
|
||||
import Ember from 'ember';
|
||||
|
||||
export default BasicRoute.extend({
|
||||
init: function() {
|
||||
|
@ -23,7 +24,7 @@ export default BasicRoute.extend({
|
|||
},
|
||||
|
||||
loadMoreRepos() {
|
||||
return this.store.findAll('build').then(() => {
|
||||
return this.store.findAll('build').then( (builds) => {
|
||||
var repoIds, repos;
|
||||
repoIds = builds.mapBy('data.repo').uniq();
|
||||
repos = this.get('repos.repos');
|
||||
|
|
|
@ -25,7 +25,7 @@ export default TravisRoute.extend({
|
|||
buildController = this.controllerFor('build');
|
||||
model.get('repo');
|
||||
if (buildPromise = model.get('build')) {
|
||||
buildPromise.then(() => {
|
||||
buildPromise.then( (build) => {
|
||||
build = this.store.recordForId('build', build.get('id'));
|
||||
return buildController.set('build', build);
|
||||
});
|
||||
|
|
|
@ -26,7 +26,10 @@ export default TravisRoute.extend({
|
|||
serialize(repo) {
|
||||
var name, owner, ref, slug;
|
||||
slug = repo.get ? repo.get('slug') : repo.slug;
|
||||
ref = slug.split('/'), owner = ref[0], name = ref[1];
|
||||
ref = slug.split('/');
|
||||
owner = ref[0];
|
||||
name = ref[1];
|
||||
|
||||
return {
|
||||
owner: owner,
|
||||
name: name
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import TravisRoute from 'travis/routes/basic';
|
||||
import config from 'travis/config/environment';
|
||||
import Ember from 'ember';
|
||||
|
||||
export default TravisRoute.extend({
|
||||
ajax: Ember.inject.service(),
|
||||
|
@ -36,7 +37,7 @@ export default TravisRoute.extend({
|
|||
fetchSshKey() {
|
||||
var repo;
|
||||
repo = this.modelFor('repo');
|
||||
return this.get('ajax').get("/repos/" + (repo.get('id')) + "/key", () => {
|
||||
return this.get('ajax').get("/repos/" + (repo.get('id')) + "/key", (data) => {
|
||||
return Ember.Object.create({
|
||||
fingerprint: data.fingerprint
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Ember from 'ember';;
|
||||
import Ember from 'ember';
|
||||
import config from 'travis/config/environment';
|
||||
var default_options;
|
||||
|
||||
|
@ -61,8 +61,10 @@ export default Ember.Service.extend({
|
|||
options = options || {};
|
||||
token = Ember.get(this, 'auth').token();
|
||||
if (token && (this.needsAuth(method, url) || options.forceAuth)) {
|
||||
options.headers || (options.headers = {});
|
||||
(base = options.headers)['Authorization'] || (base['Authorization'] = "token " + token);
|
||||
options.headers = options.headers || {};
|
||||
if(!options.headers['Authorization']) {
|
||||
options.headers['Authorization'] = "token " + token;
|
||||
}
|
||||
}
|
||||
options.url = url = "" + endpoint + url;
|
||||
options.type = method;
|
||||
|
@ -97,30 +99,7 @@ export default Ember.Service.extend({
|
|||
};
|
||||
|
||||
options = $.extend(options, default_options);
|
||||
if (typeof testMode !== "undefined" && testMode !== null) {
|
||||
console.log('Running ajax with', options.url);
|
||||
return new Ember.RSVP.Promise(function(resolve, reject) {
|
||||
var oldError, oldSuccess;
|
||||
oldSuccess = options.success;
|
||||
options.success = function(json, status, xhr) {
|
||||
Ember.run(this, function() {
|
||||
return oldSuccess.call(this, json, status, xhr);
|
||||
});
|
||||
return Ember.run(null, resolve, json);
|
||||
};
|
||||
oldError = options.error;
|
||||
options.error = function(jqXHR) {
|
||||
if (jqXHR) {
|
||||
jqXHR.then = null;
|
||||
}
|
||||
return Ember.run(this, function() {
|
||||
oldError.call(this, jqXHR);
|
||||
return reject(jqXHR);
|
||||
});
|
||||
};
|
||||
return $.ajax(options);
|
||||
});
|
||||
}
|
||||
|
||||
if (options.data && (method === "GET" || method === "HEAD")) {
|
||||
params = jQuery.param(options.data);
|
||||
delimeter = url.indexOf('?') === -1 ? '?' : '&';
|
||||
|
@ -158,7 +137,6 @@ export default Ember.Service.extend({
|
|||
if (xhr.readyState === 4) {
|
||||
contentType = xhr.getResponseHeader('Content-Type');
|
||||
data = (function() {
|
||||
var error1;
|
||||
if (contentType && contentType.match(/application\/json/)) {
|
||||
try {
|
||||
return jQuery.parseJSON(xhr.responseText);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import config from 'travis/config/environment';
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Service.extend({
|
||||
store: Ember.inject.service(),
|
||||
|
@ -9,7 +10,7 @@ export default Ember.Service.extend({
|
|||
receivingEnd: location.protocol + "//" + location.host,
|
||||
|
||||
init: function() {
|
||||
return window.addEventListener('message', () => {
|
||||
return window.addEventListener('message', (e) => {
|
||||
return this.receiveMessage(e);
|
||||
});
|
||||
},
|
||||
|
@ -52,9 +53,13 @@ export default Ember.Service.extend({
|
|||
},
|
||||
|
||||
autoSignIn(data) {
|
||||
data || (data = this.userDataFrom(this.get('sessionStorage')) || this.userDataFrom(this.get('storage')));
|
||||
if(!data) {
|
||||
data = this.userDataFrom(this.get('sessionStorage')) ||
|
||||
this.userDataFrom(this.get('storage'));
|
||||
}
|
||||
|
||||
if (data) {
|
||||
return this.setData(data);
|
||||
this.setData(data);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -200,7 +205,7 @@ export default Ember.Service.extend({
|
|||
},
|
||||
|
||||
sendToApp(name) {
|
||||
var error, error1, router;
|
||||
var error, router;
|
||||
|
||||
// TODO: this is an ugly solution, we need to do one of 2 things:
|
||||
// * find a way to check if we can already send an event to remove try/catch
|
||||
|
@ -214,7 +219,7 @@ export default Ember.Service.extend({
|
|||
return router.send(name);
|
||||
} catch (error1) {
|
||||
error = error1;
|
||||
if (!(error.message = ~/Can't trigger action/)) {
|
||||
if (!(error.message.match(/Can't trigger action/))) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,10 @@ export default Ember.Service.extend({
|
|||
loadFlashes(msgs) {
|
||||
var i, len, msg, results, type;
|
||||
|
||||
var callback = function() {
|
||||
return this.get('flashes.content').removeObject(msg);
|
||||
};
|
||||
|
||||
results = [];
|
||||
for (i = 0, len = msgs.length; i < len; i++) {
|
||||
msg = msgs[i];
|
||||
|
@ -37,9 +41,7 @@ export default Ember.Service.extend({
|
|||
message: msg[type]
|
||||
};
|
||||
this.get('flashes').unshiftObject(msg);
|
||||
results.push(Ember.run.later(this, (function() {
|
||||
return this.get('flashes.content').removeObject(msg);
|
||||
}), 15000));
|
||||
results.push(Ember.run.later(this, callback, 15000));
|
||||
}
|
||||
return results;
|
||||
},
|
||||
|
|
|
@ -61,7 +61,7 @@ export default Ember.Service.extend({
|
|||
return model.reload();
|
||||
});
|
||||
|
||||
return this.get('sources').forEach( () => {
|
||||
return this.get('sources').forEach( (source) => {
|
||||
if (Ember.get(source, 'isDestroyed')) {
|
||||
return this.get('sources').removeObject(source);
|
||||
} else {
|
||||
|
|
|
@ -4,7 +4,7 @@ import Storage from 'travis/utils/hash-storage';
|
|||
|
||||
export default StorageService.extend({
|
||||
init: function() {
|
||||
var err, error, storage;
|
||||
var err, storage;
|
||||
storage = null;
|
||||
try {
|
||||
// firefox will not throw error on access for sessionStorage var,
|
||||
|
|
|
@ -3,7 +3,7 @@ import Storage from 'travis/utils/hash-storage';
|
|||
|
||||
export default Ember.Service.extend({
|
||||
init: function() {
|
||||
var err, error, storage;
|
||||
var err, storage;
|
||||
storage = null;
|
||||
try {
|
||||
storage = window.localStorage || (function() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import DS from 'ember-data';
|
||||
import Config from 'travis/config/environment';
|
||||
import Ember from 'ember';
|
||||
|
||||
export default DS.Store.extend({
|
||||
auth: Ember.inject.service(),
|
||||
|
@ -21,7 +22,9 @@ export default DS.Store.extend({
|
|||
|
||||
canHandleEvent(event, data) {
|
||||
var callback, name, ref, ref1, type;
|
||||
ref = event.split(':'), name = ref[0], type = ref[1];
|
||||
ref = event.split(':');
|
||||
name = ref[0];
|
||||
type = ref[1];
|
||||
ref1 = this.get('pusherEventHandlerGuards');
|
||||
for (name in ref1) {
|
||||
callback = ref1[name];
|
||||
|
@ -34,7 +37,10 @@ export default DS.Store.extend({
|
|||
|
||||
receivePusherEvent(event, data) {
|
||||
var build, commit, job, name, ref, ref1, ref2, type;
|
||||
ref = event.split(':'), name = ref[0], type = ref[1];
|
||||
ref = event.split(':');
|
||||
name = ref[0];
|
||||
type = ref[1];
|
||||
|
||||
if (!this.canHandleEvent(event, data)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
var configKeys, configKeysMap, languageConfigKeys;
|
||||
|
||||
languageConfigKeys = {
|
||||
|
|
|
@ -57,7 +57,7 @@ export default (function() {
|
|||
|
||||
LinesSelector.prototype.highlightLines = function(tries) {
|
||||
var elements, lines;
|
||||
tries || (tries = 0);
|
||||
tries = tries || 0;
|
||||
this.removeAllHighlights();
|
||||
if (lines = this.getSelectedLines()) {
|
||||
elements = this.element.find('p:visible').slice(lines.first - 1, lines.last);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import ENV from 'travis/config/environment';
|
||||
import Ember from 'ember';
|
||||
|
||||
var TravisPusher = function(config, ajaxService) {
|
||||
this.init(config, ajaxService);
|
||||
|
@ -165,7 +166,7 @@ if (ENV.pro) {
|
|||
Pusher.authorizers.bulk_ajax = function(socketId, _callback) {
|
||||
var channels, name, names;
|
||||
channels = Travis.pusher.pusher.channels;
|
||||
channels.callbacks || (channels.callbacks = []);
|
||||
channels.callbacks = channels.callbacks || [];
|
||||
name = this.channel.name;
|
||||
names = Object.keys(channels.channels);
|
||||
channels.callbacks.push(function(auths) {
|
||||
|
|
|
@ -6,12 +6,10 @@ export default (function() {
|
|||
this.tail_selector = tail_selector;
|
||||
this.log_selector = log_selector;
|
||||
this.position = this.window.scrollTop();
|
||||
this.window.scroll((function(_this) {
|
||||
return function() {
|
||||
return Ember.run.throttle(_this, _this.onScroll, [], 200, false);
|
||||
};
|
||||
})(this));
|
||||
this;
|
||||
this.window.scroll(() => {
|
||||
return Ember.run.throttle(this, this.onScroll, [], 200, false);
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
Tailing.prototype.options = {
|
||||
|
|
|
@ -12,12 +12,10 @@ export default (function() {
|
|||
this.element_selector = element_selector;
|
||||
this.container_selector = container_selector;
|
||||
this.position = this.window.scrollTop();
|
||||
this.window.scroll((function(_this) {
|
||||
return function() {
|
||||
return Ember.run.throttle(_this, _this.onScroll, [], 200, false);
|
||||
};
|
||||
})(this));
|
||||
this;
|
||||
this.window.scroll(() => {
|
||||
return Ember.run.throttle(this, this.onScroll, [], 200, false);
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
ToTop.prototype.element = function() {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import BasicView from 'travis/views/basic';
|
||||
import Ember from 'ember';
|
||||
|
||||
export default BasicView.extend({
|
||||
popup: Ember.inject.service(),
|
||||
|
|
|
@ -18,7 +18,7 @@ export default Ember.View.extend({
|
|||
}.property('tab'),
|
||||
|
||||
classBranches: function() {
|
||||
this.get('tab') === 'branches' ? 'active' : null;
|
||||
return this.get('tab') === 'branches' ? 'active' : null;
|
||||
}.property('tab'),
|
||||
|
||||
classBuild: function() {
|
||||
|
|
|
@ -3,6 +3,7 @@ import StatusImagesView from 'travis/views/status-images';
|
|||
import BasicView from 'travis/views/basic';
|
||||
import config from 'travis/config/environment';
|
||||
import Polling from 'travis/mixins/polling';
|
||||
import Ember from 'ember';
|
||||
|
||||
export default BasicView.extend(Polling, {
|
||||
popup: Ember.inject.service(),
|
||||
|
|
|
@ -46,7 +46,8 @@
|
|||
"currentPath",
|
||||
"currentRouteName",
|
||||
"jQuery",
|
||||
"Visibility"
|
||||
"Visibility",
|
||||
"Travis"
|
||||
],
|
||||
"node": false,
|
||||
"browser": false,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Generated by CoffeeScript 1.10.0
|
||||
import { test, moduleForComponent } from 'ember-qunit';
|
||||
import Ember from 'ember';
|
||||
moduleForComponent('build-repo-actions', 'BuildRepoActionsComponent', {});
|
||||
|
||||
test('it shows cancel button if canCancel is true', function() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Generated by CoffeeScript 1.10.0
|
||||
import { test, moduleForComponent } from 'ember-qunit';
|
||||
import Ember from 'ember';
|
||||
moduleForComponent('jobs-item', 'JobsItemComponent', {
|
||||
needs: ['helper:format-duration', 'helper:pretty-date', 'component:status-icon']
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user