Commit Graph

127 Commits

Author SHA1 Message Date
Piotr Sarnacki
5b771aafcc Use XMLHttpRequest directly
jQuery uses getAllResponseHeaders function for getting response headers,
even for getResponseHeader. As far as I know, there is no easy way to
get original xhr object and call getResponseHeader on such object.
Because of that getResponseHeader is broken on firefox with CORS.

I rewrote Travis.ajax to use XMLHttpRequest directly in order to fix
this, the compatibility with jQuery.ajax is mostly handled.
2013-05-15 17:23:47 +02:00
Piotr Sarnacki
e2d92c2ffb POST requests should always require auth 2013-05-02 19:56:48 +02:00
Piotr Sarnacki
595393f273 Don't send Authorization header when it's not needed
CORS specification specifies "simple request", which does not need a
preflight OPTIONS request. The only thing, which we send and is
forbidding to send simple requests is Authorization header, which is not
needed for public endpoints.
2013-05-02 17:59:43 +02:00
Sven Fuchs
300e91133c Merge branch 'master' into sf-log
Conflicts:
	assets/scripts/app/views/log.coffee
2013-03-22 02:14:55 +01:00
Piotr Sarnacki
f1adbf8f20 Improve log handling
* don't fetch log content on Travis.Log init
* use timeout in ChunkBuffer instead of Ember.run.later
* remove timeout when log is finalized
2013-03-22 01:25:23 +01:00
Piotr Sarnacki
65254b70da Fix cutting too long logs 2013-03-19 16:07:21 +01:00
Sven Fuchs
83943232db change fetchLineNumber to use the actual document location, controller url does not seem to be updated 2013-03-14 17:35:12 +01:00
Piotr Sarnacki
2eab278736 Add ChunkBuffer to log 2013-03-13 00:13:51 +01:00
Piotr Sarnacki
b1edd8e510 Bring back log engine from master 2013-03-12 22:52:39 +01:00
Piotr Sarnacki
e02ece9424 Merge branch 'master' into ps-ember-update
Conflicts:
	assets/scripts/app/models/artifact.coffee
	assets/scripts/app/store.coffee
	assets/scripts/app/views/job.coffee
	assets/scripts/spec/spec_helper.coffee
2013-03-12 13:47:20 +01:00
Piotr Sarnacki
f46e6f96a0 More debug output 2013-03-09 22:01:06 +01:00
Piotr Sarnacki
ade203df7a Add some debug info 2013-03-09 22:01:06 +01:00
Piotr Sarnacki
b289d3966b Finish ChunkBuffer implementation and integrate it with Artifact 2013-03-09 22:01:06 +01:00
Piotr Sarnacki
b4022f5f67 A few improvements for ChunkBuffer
* insert available items at once
* allow to use pushObject on buffer itself
* add a test using arrayObserver to make sure that it fires only when
  elements are added to arrangedContent
2013-03-09 22:01:05 +01:00
Piotr Sarnacki
d549831c22 Add chunk buffer 2013-03-09 22:01:05 +01:00
Piotr Sarnacki
b57596c447 Data can be null in ajax request 2013-03-06 14:51:05 +01:00
Piotr Sarnacki
4337949dd4 Fix the rest of the specs 2013-03-04 13:29:00 +01:00
Piotr Sarnacki
712389efdb Fix more specs 2013-03-04 03:46:04 +01:00
Piotr Sarnacki
65eb4e15fb Don't try to delete flash if there is no data from server 2013-02-26 05:05:36 +01:00
Piotr Sarnacki
1bccb5d177 Fix line numbers when loading an url 2013-02-25 15:18:59 +01:00
Piotr Sarnacki
f0ea65b114 Keep the hash in the location so we can scroll to line in logs 2013-02-23 00:21:01 +01:00
Piotr Sarnacki
553495c56c Add @svenfuchs' log reimplementation 2013-02-22 17:00:50 +01:00
Piotr Sarnacki
83fb0ebb2c Fix incomplete implementation 2013-02-21 23:22:54 +01:00
Piotr Sarnacki
4cdd4df515 Tabs and basic views are mostly working 2013-02-21 23:22:51 +01:00
Piotr Sarnacki
f0e95ddd3f Main view mostly works on new router 2013-02-21 23:22:51 +01:00
Piotr Sarnacki
fd08feb992 Add 'Your build has been stopped' to texts which expand folds 2013-02-13 14:32:58 +01:00
Piotr Sarnacki
3862dd163d Limit log to 5000 lines 2013-02-13 04:03:02 +01:00
Piotr Sarnacki
c1674e9d76 Fix fold expansion when script exits before fold finishes 2013-02-13 03:30:41 +01:00
Piotr Sarnacki
8202eaa452 Add error callback to Travis.ajax, pass all args to callbacks 2013-01-29 04:16:46 +01:00
Piotr Sarnacki
ba2f691ae6 No need to set content type for requests without body 2013-01-29 04:16:19 +01:00
Piotr Sarnacki
a8fb681bfc Always convert method passed to Travis.ajax to upper case 2013-01-29 04:15:47 +01:00
Piotr Sarnacki
eb2feca02a Set proper content type for logs requests 2013-01-28 18:18:16 +01:00
Piotr Sarnacki
5fbf153ed9 Use /jobs/:id/log.txt endpoint for fetching logs 2013-01-27 02:46:18 +01:00
Piotr Sarnacki
42e93c9f94 Sometimes empty value is passed to lines, abort in such cases 2013-01-10 13:44:24 +01:00
Piotr Sarnacki
938aaafc71 Merge pull request #84 from randym/instrumentation
WIP! Added first level instrumentation for travis-web
2013-01-03 07:13:34 -08:00
Piotr Sarnacki
2daed5f36f Replace *all* unsupported ansi escape chars. 2012-12-19 17:13:22 +01:00
Randy Morgan
fa7f8b9332 Added first level instrumentation for travis-web
This is not enabled by default. You need to run:

Travis.Instrumentation.subscribe('render.view')

To start capturing info
2012-12-14 19:31:05 +09:00
Piotr Sarnacki
23a58866bd Fix LimitedArray to work properly with SortableMixin 2012-12-14 04:31:28 +01:00
Piotr Sarnacki
de9d695c5e Remove console.log 2012-12-11 15:53:09 +01:00
Piotr Sarnacki
fd82bf3791 Use contentArrayWillChange for deleting records from LimitedArray
Using contentArrayDidChange is usless for deletion, because the records
were already deleted, so we can't fetch them from the content array.
2012-12-11 15:51:11 +01:00
Piotr Sarnacki
e36fb0d7a2 Properly hide 'show more job' link in the queues 2012-12-11 15:03:47 +01:00
Piotr Sarnacki
79e6f5e037 Allow to change the place of insertion for limited array 2012-12-11 14:41:21 +01:00
Piotr Sarnacki
8e97b68313 Make the app work with disabled cookies
Browsers disable local storage and session storage when cookies are
disabled - any call to one of those will cause an error. This commit
provides fallback storage, which will store items in memory.
2012-12-10 17:37:09 +01:00
Piotr Sarnacki
0a635c8b39 Quick hack for </span> landing in the wrong place in logs
We change ansi terminal instructions into HTML tags before splitting the
log into lines, which sometimes may end up with </span> in the beginning
of the line. This is a quick hack to fix that problem, but we need
better solution.
2012-12-08 01:02:04 +01:00
Piotr Sarnacki
e9077f1a04 Fix initial setting in logs - it should be set to null after 1st line 2012-12-05 01:53:25 +01:00
Piotr Sarnacki
e431e30420 Fix small problem with duplicated first log line 2012-12-05 01:14:25 +01:00
Piotr Sarnacki
4e7329f638 Open fold if folded command returns an error 2012-12-05 00:33:26 +01:00
Piotr Sarnacki
fc40190c29 Optimize log viewer
Till now, log viewer was rendered in handlebars, which was the simplest
solution, but it had a major drawback - every append to log caused it to
rerender which was not efficient and memory consuming.

The new approach is to make Travis.Log interpret the log and send lines
with instructions to the view, so for example if view should add a line,
it gets something like:

    { number: 1, content: '$ bundle install' }

Such approach is required to handle cases where data coming from pusher
is not actually a new line. For example output containing dots from
tests needs to be appended:

    $ rake
    ....

Such output could be sent to client in 2 chunks: "$ rake\n.." and "..".
In such situation we would need to send 3 instructions:

  { number: 1, content: '$ rake' }
  { number: 2, content: '..'     }
  { number: 2, content: '..', append: true }

The third instruction can come much later, because tests can take a
while to run, so we can't assume that each line will come in one piece.

The other scenario is \r, for example when showing progress:

    \rDownloading: 10%
    \rDownloading: 50%
    \rDownloading: 100%

Such input should be changed into such instructions:

  { number: 1, content: 'Downloading: 10%' }
  { number: 1, content: 'Downloading: 50%',  replace: true }
  { number: 1, content: 'Downloading: 100%', replace: true }

Travis.Log also supports folds, for example on bundle install, the code
was rewritten to make folds management simpler.
2012-12-04 22:57:57 +01:00
Piotr Sarnacki
27dee49a8e Swallow ansi control sequences, which we don't support 2012-11-30 22:44:58 +01:00
Piotr Sarnacki
52e6959c9c Do not refresh entire LimitedArray if there is not such need 2012-11-28 01:00:44 +01:00
Piotr Sarnacki
d1633e796a Slightly better implementation of showAll for jobs in queues 2012-11-28 00:26:37 +01:00
Piotr Sarnacki
afa1d07fbe Show only first 15 elements from each queue for now
With shitloads of jobs in queues app becomes unusable, this is a quick
solution to make it better.
2012-11-28 00:04:23 +01:00
Sven Fuchs
d94b001e81 restore isLoaded for repos controller 2012-11-10 04:21:49 +01:00
Piotr Sarnacki
49f1c74a12 Extend message on loaded models and fix undefined ke problem 2012-11-06 11:47:12 +01:00
Piotr Sarnacki
eef8e55cfe Check if key is defined in incomplete checks 2012-10-31 14:56:17 +01:00
Piotr Sarnacki
6bf5bd3356 Needed to move part of incomplete impl. to store
When using get with path (eg. get('foo.bar.baz')), get method is called
only on the current object and computed property will be called. Because
there is no easy way to overwrite the computed property, I moved
incomplete record loading to ember-data. It's not DRY and it should be
rewritten, but I don't want to do it at this point as we will need to
completely rewrite it when upgrading ember-data.
2012-10-31 00:46:13 +01:00
Piotr Sarnacki
d1ab28abcc Remove console.log entry 2012-10-30 02:23:41 +01:00
Piotr Sarnacki
5ae7e1d046 Check also associations for incomplete records 2012-10-28 23:43:17 +01:00
Piotr Sarnacki
3f0babcf55 Fix adding builds to a build list on pusher event 2012-10-28 23:43:15 +01:00
Piotr Sarnacki
939212302a Fix loading page with #L<line-number>
Ember changed a way HistoryLocation works and it no longer calls
getURL(). I'm monkey patching it, but I will submit a pull request to
fix it.
2012-10-22 21:45:43 +02:00
Piotr Sarnacki
300ad58516 Fix incomplete implementation
While testing in the wild I spotted a few problems with it:

* it didn't work for camel case names.
* it was sometimes setting loaded data too late - it needed to use find
  and then save data on the record. Instead it should save data in
  special array saved on store, indexed by clientId
* there is already method to get attributes in ember-data, it just
  doesn't work with Travis.Foo.get('attributes'), it needs
  Ember.get(Travis.Foo, 'attributes') - it makes implementation much
  shorter
2012-10-22 02:54:48 +02:00
Sven Fuchs
90fb2c3b78 add broadcasts 2012-10-18 03:53:19 +02:00
Piotr Sarnacki
9d07ef79ac Fix bug with undefined loadedAttributes 2012-10-16 17:47:03 +02:00
Piotr Sarnacki
c05ce673bf Load incomplete records when trying to get unknown attribute
In order to minimize ajax requests, I implemented isComplete property,
which can be used to check if record is fetched from the API or if it
was just partially loaded (for example by pusher event). This is nice in
terms of requests reduction, but caries risk of showing incomplete data.

This commit fixes this situation by saving which attributes were
provided on "incomplete" load and triggering refresh when any unknown
attribute is tried to be fetched.

The implementation is really simple and will probably need refactoring,
but I would like to test it in the wild before putting much more time
into it.
2012-10-16 03:05:38 +02:00
Sven Fuchs
ed94cb7329 Merge branch 'master' of github.com:travis-ci/travis-web
Conflicts:
	assets/scripts/lib/travis/model.coffee
	public/scripts/app.js
	public/scripts/min/app.js
	public/version
2012-10-13 21:22:42 +02:00
Sven Fuchs
e7a26524d4 move select() functionality to Travis.Model and reuse it for accounts 2012-10-13 21:20:11 +02:00
Piotr Sarnacki
c707135ccd First spike of 'isComplete' functionality
When we get payload from pusher, we usually don't send the entire
record. Initially such records where fetched from server right away to
get missing data. This was done becuase Ember can't tell if given data
is complete or not and just assumes that the record is loaded.

To not fire unneeded request, this code sets incomplete flag on records
loaded from pusher and loads the rest of the data only if needed.
2012-10-13 20:47:21 +02:00
Piotr Sarnacki
2575218ddb Fix logs to always point to build or job view 2012-10-12 18:32:25 +02:00
Piotr Sarnacki
7fc77e66ea Limit repos list to 30 items 2012-10-09 18:23:11 +02:00
Sven Fuchs
847c120bd7 fuck yeah, flash messages 2012-10-09 15:16:54 +02:00
Piotr Sarnacki
9237770180 Forgot to add Travis.Location file 2012-10-09 12:59:27 +02:00
Sven Fuchs
7e6907feba Merge branch 'master' of github.com:travis-ci/travis-web
Conflicts:
	Gemfile.lock
	public/scripts/app.js
	public/scripts/min/app.js
	public/version
2012-10-09 12:33:11 +02:00
Sven Fuchs
6cbe6f140e refactor ajax, get rid of the module 2012-10-09 12:31:15 +02:00
Piotr Sarnacki
186ba1dd45 Fix links to log line numbers
This is working implementation of links on log line numbers. Although it
does the job, it's really hacky and involves overriding some of the
ember's methods (resolvePath, routeMatcher) beacuse currently
HistoryLocation can't handle hash additions in an easy way.

This code should be fixed as soon as ember's router gets more powerful
and gives much more granular control over matching routes.
2012-10-09 03:54:11 +02:00
Sven Fuchs
25dffc0a7a load user permissions 2012-10-06 23:40:05 +02:00
Sven Fuchs
152dde6e05 make things even more generic 2012-10-03 19:29:44 +02:00
Sven Fuchs
7b47863014 extract paths in Assetfile; rename javascripts to scripts, stylesheets to styles 2012-10-03 17:13:02 +02:00