Compare commits

..

No commits in common. "master" and "deploy.2014-05-12.09-19" have entirely different histories.

2169 changed files with 205492 additions and 53408 deletions

View File

@ -1,4 +0,0 @@
{
"directory": "bower_components",
"analytics": false
}

View File

@ -1,2 +1,2 @@
https://github.com/heroku/heroku-buildpack-ruby.git
https://github.com/travis-ci/travis-web-ember-cli-buildpack.git
https://github.com/travis-ci/travis-web-buildpack.git

View File

@ -1,34 +0,0 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
[*.js]
indent_style = space
indent_size = 2
[*.hbs]
insert_final_newline = false
indent_style = space
indent_size = 2
[*.css]
indent_style = space
indent_size = 2
[*.html]
indent_style = space
indent_size = 2
[*.{diff,md}]
trim_trailing_whitespace = false

View File

@ -1,9 +0,0 @@
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.
Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false
}

26
.gitignore vendored
View File

@ -1,19 +1,11 @@
# compiled output
dist
tmp
# dependencies
node_modules
bower_components
# misc
/.bundle
/config/travis.yml
/tmp
/public/scripts
/public/styles
/public/version
.sass-cache
connect.lock
coverage/*
libpeerconnection.log
npm-debug.log
testem.log
.localeapp/key
/assets/scripts/config/locales.js
.DS_Store
# files generated by older build tools
public/scripts
/public/images/emoji

View File

@ -1,42 +0,0 @@
{
"predef": [
"server",
"document",
"window",
"-Promise",
"jQuery",
"Visibility",
"$",
"Travis",
"_cio",
"_gaq",
"Log",
"moment",
"Pusher",
"md5"
],
"browser": true,
"boss": true,
"curly": true,
"debug": false,
"devel": true,
"eqeqeq": true,
"evil": true,
"forin": false,
"immed": false,
"laxbreak": false,
"newcap": true,
"noarg": true,
"noempty": false,
"nonew": false,
"nomen": false,
"onevar": false,
"plusplus": false,
"regexp": false,
"undef": true,
"sub": true,
"strict": false,
"white": false,
"eqnull": true,
"esnext": true
}

View File

@ -1 +0,0 @@
2.1.2

View File

@ -1,66 +1,30 @@
---
language: node_js
node_js: stable
language: ruby
rvm:
- 2.1.1
env:
- EMBER_VERSION=default
- EMBER_VERSION=release
- EMBER_VERSION=beta
- EMBER_VERSION=canary
matrix:
allow_failures:
- env: EMBER_VERSION=release
- env: EMBER_VERSION=beta
- env: EMBER_VERSION=canary
fast_finish: true
addons:
sauce_connect: true
sudo: false
cache:
branch: md5deep
directories:
- node_modules
global:
- secure: "RFuCOppyjWHC4XWKtQlgS4zO4B6KVxytdX8+G5jRY3XM+OEGte8VDD88gZLM\nKDpkqMFDbNJAVTsh1kMANCTct2ONi30RTxuJWLtRyK7RE5zCcaGbAkTNZgXo\nOR5OWLEPJZbNfbh17H6J7izTy6yiLR+CsVP1wMgeVusP0eoDhCA="
- secure: "duqMXPALumXB3e2j/kM2uCaCGwgZsRrU0GCDY+3Zk6a+PK+s0mE9BftcXdxm\n6u87ld2PvCBO0inpe5YeS9LOZsT+OFS4jj+GGTsRI6rmGz+kok0N+ATLTdcj\nu15zhLhUUlhoKW0DZURrDv/iTiC/FKvJ0u5Rft0XbjfTY+0go/M="
- secure: "sW8X/OxQQnCfSWfo5uho8os/4eV8Y3QWOx5LdhqcmOxb4KLlQkndRNNqz+DF\nKynSgnSpty2uvol6611J9RDPEVn6cZw7EFQj/EO7NRVQC8uD+8LtT/2C2J8L\nc/bf7sQqpAkDq9MOEub/A6R4jIk043lGQ4IyWAQmGlETMQ2Q/K0="
- secure: "XCGOrMQHDR59KARYeN2GaAkDQKwq2nW9okEFMaKEH1AuUFFcU4hHAsunNeXe\nwSHu4Dpo/CioI2EKQpxL8nwMUPsx3HaY/2W8ef1YPvhU1GuSyiPDW0va8sV7\nBmZf1b26ktrzqaYDxyJjwe1EKrzfZx0LPV0MNU6wSWdHILthPY8="
matrix:
- "TEST_SUITE=ruby ARTIFACTS_S3_BUCKET=travis-web-production"
- "TEST_SUITE=phantomjs"
- "TEST_SUITE=saucelabs BROWSER='firefox::Windows XP'"
- "TEST_SUITE=saucelabs BROWSER='chrome::Windows XP'"
script: "script/ci"
before_install:
- "npm config set spin false"
- "npm install -g npm@^2"
- mkdir travis-phantomjs
- wget https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2
- tar -xvf $PWD/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2 -C $PWD/travis-phantomjs
- export PATH=$PWD/travis-phantomjs:$PATH
install:
- npm install -g bower
- npm install
- bower install
script:
- ember try $EMBER_VERSION
- "gem install bundler"
before_script:
- "test $TEST_SUITE = \"ruby\" && gem install travis-artifacts || true"
- "bundle exec rakep"
- "phantomjs --version"
after_script:
- "test $TEST_SUITE = \"ruby\" && test $TRAVIS_PULL_REQUEST = \"false\" && travis-artifacts upload --target-path assets/$TRAVIS_BRANCH --path public/scripts:scripts --path public/styles:styles || true"
notifications:
irc: "irc.freenode.org#travis"
campfire:
secure: "JJezWGD9KJY/LC2aznI3Zyohy31VTIhcTKX7RWR4C/C8YKbW9kZv3xV6Vn11\nSHxJTeZo6st2Bpv6tjlWZ+HCR09kyCNavIChedla3+oHOiuL0D4gSo+gkTNW\nUKYZz9mcQUd9RoQpTeyxvdvX+l7z62/7JwFA7txHOqxbTS8jrjc="
before_deploy:
- ASSETS_HOST=https://s3.amazonaws.com/travis-error-pages ember build --env production
# delete some of the stuff that's useless for maintenance page
- rm -fr dist/assets/*.js dist/images/emoji dist/index.html dist/images/sponsors
- cp dist/maintenance.html dist/index.html
deploy:
provider: s3
access_key_id: $MAINTENANCE_S3_ACCESS_KEY_ID
secret_access_key: $MAINTENANCE_S3_SECRET_ACCESS_KEY
bucket: travis-error-pages
skip_cleanup: true
acl: public_read
local_dir: dist
region: us-east-1
on:
branch: master
condition: "$EMBER_VERSION = default"

View File

@ -1,3 +0,0 @@
{
"ignore_dirs": ["tmp", "dist"]
}

91
Assetfile Normal file
View File

@ -0,0 +1,91 @@
$: << 'lib'
require 'rake-pipeline-web-filters'
require 'travis/assets'
require 'compass'
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
assets ||= Travis::Assets.new
assets.setup_compass
assets.update_version
output 'public/scripts'
input assets.scripts do
match '**/*.hbs' do
travis_handlebars :precompile => false # assets.production?
concat 'templates.js'
end
match '**/*.coffee' do
coffee_script
end
match 'vendor/**/*.js' do
if assets.production?
reject 'ember.js'
else
reject 'ember.prod.js'
end
safe_concat assets.vendor_order, 'vendor.js'
end
match '{spec,spec/integration,spec/unit,spec/unit/views}/*.js' do
concat 'spec/specs.js'
end
match 'spec/support/*.js' do
concat 'spec/support.js'
end
match 'spec/vendor/*.js' do
concat assets.spec_vendor_order, 'spec/vendor.js'
end
match 'spec/{vendor,support,specs}.js' do
concat ['spec/vendor.js', 'spec/support.js', 'spec/specs.js'], 'specs.js'
end
match %r(^(?!vendor|spec).*\.js$) do
modules = proc { |input| input.path.gsub(%r((^app/|lib/|\.js$)), '') }
minispade(string: assets.development?, rewrite_requires: true, module_id_generator: modules)
end
match %r(^(?!spec).*\.js$) do
paths = ['min/app.js']
paths.push 'app.js' unless assets.production?
concat ['vendor.js'], paths
end
if assets.production?
match 'min/app.js' do
strip_debug
# uglify squeeze: true
concat 'app.js'
end
end
end
output 'public/styles'
input assets.styles do
match '**/*.{scss,sass}' do
sass assets.production? ? { style: :compressed } : {}
concat [], ['app.css']
end
end
output 'public/images'
input assets.images do
skip %r(^ui/)
match '**/*' do
copy
end
end
# output 'public'
# input assets.static do
# match '**/*' do
# copy
# end
# end

17
Gemfile
View File

@ -1,13 +1,21 @@
source 'http://rubygems.org'
ruby '2.1.2'
ruby '2.1.1'
gem 'travis-web', path: 'waiter'
gem 'puma'
gem 'rack-ssl', '~> 1.3'
gem 'rack-protection', '~> 1.3'
gem 'rack-cache'
gem 'rack-mobile-detect'
gem 'sinatra'
gem 'hashr'
gem 'rake-pipeline', github: 'livingsocial/rake-pipeline'
gem 'rake-pipeline-web-filters', github: 'wycats/rake-pipeline-web-filters'
gem 'coffee-script'
gem 'compass'
gem 'tilt'
gem 'uglifier'
gem 'yui-compressor'
gem 'libv8', '~> 3.16.0'
group :development, :test do
gem 'rake'
@ -17,6 +25,9 @@ end
group :development do
# gem 'debugger'
gem 'foreman'
gem 'rerun'
gem 'guard'
gem 'rb-fsevent', '~> 0.9.1'
end
group :test do

View File

@ -1,70 +1,131 @@
PATH
remote: waiter
GIT
remote: git://github.com/livingsocial/rake-pipeline.git
revision: 65b1e744defa208e313703d89f3453447cc103b2
specs:
travis-web (0.0.1)
rake-pipeline (0.8.0)
json
rake (~> 10.0.0)
thor
GIT
remote: git://github.com/wycats/rake-pipeline-web-filters.git
revision: fd8d838491bd6b8de0bab72d90115b9a4f2da8a1
specs:
rake-pipeline-web-filters (0.6.0)
rack
rake-pipeline (~> 0.6)
GEM
remote: http://rubygems.org/
specs:
backports (3.6.3)
diff-lcs (1.2.5)
dotenv (0.11.1)
dotenv-deployment (~> 0.0.2)
dotenv-deployment (0.0.2)
foreman (0.75.0)
dotenv (~> 0.11.1)
thor (~> 0.19.1)
hashr (0.0.22)
multi_json (1.10.1)
puma (2.9.1)
POpen4 (0.1.4)
Platform (>= 0.4.0)
open4
Platform (0.4.0)
backports (3.0.3)
chunky_png (1.2.7)
coderay (1.0.9)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.5.0)
compass (0.12.2)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
diff-lcs (1.2.1)
eventmachine (1.0.0)
execjs (1.4.0)
multi_json (~> 1.0)
foreman (0.61.0)
thor (>= 0.13.6)
fssm (0.2.10)
guard (1.6.2)
listen (>= 0.6.0)
lumberjack (>= 1.0.2)
pry (>= 0.9.10)
terminal-table (>= 1.4.3)
thor (>= 0.14.6)
json (1.7.7)
libv8 (3.16.14.3)
listen (0.7.3)
lumberjack (1.0.2)
method_source (0.8.1)
multi_json (1.6.1)
open4 (1.3.0)
pry (0.9.12)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.4)
puma (2.6.0)
rack (>= 1.1, < 2.0)
rack (1.5.2)
rack-cache (1.2)
rack (>= 0.4)
rack-mobile-detect (0.4.0)
rack
rack-protection (1.5.3)
rack-protection (1.3.2)
rack
rack-ssl (1.4.1)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
rake (10.1.1)
rspec (2.99.0)
rspec-core (~> 2.99.0)
rspec-expectations (~> 2.99.0)
rspec-mocks (~> 2.99.0)
rspec-core (2.99.2)
rspec-expectations (2.99.2)
rake (10.0.3)
rb-fsevent (0.9.3)
rerun (0.8.0)
listen
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.0)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.99.2)
sinatra (1.4.5)
rspec-mocks (2.13.0)
sass (3.2.6)
sinatra (1.3.5)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
sinatra-contrib (1.4.2)
rack-protection (~> 1.3)
tilt (~> 1.3, >= 1.3.3)
sinatra-contrib (1.3.2)
backports (>= 2.0)
multi_json
eventmachine
rack-protection
rack-test
sinatra (~> 1.4.0)
sinatra (~> 1.3.0)
tilt (~> 1.3)
thor (0.19.1)
tilt (1.4.1)
slop (3.4.3)
terminal-table (1.4.5)
thor (0.17.0)
tilt (1.3.3)
uglifier (1.3.0)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
yui-compressor (0.9.6)
POpen4 (>= 0.1.4)
PLATFORMS
ruby
DEPENDENCIES
coffee-script
compass
foreman
hashr
guard
libv8 (~> 3.16.0)
puma
rack-cache
rack-mobile-detect
rack-protection (~> 1.3)
rack-ssl (~> 1.3)
rake
rake-pipeline!
rake-pipeline-web-filters!
rb-fsevent (~> 0.9.1)
rerun
rspec (~> 2.11)
sinatra
sinatra-contrib
travis-web!
BUNDLED WITH
1.10.1
tilt
uglifier
yui-compressor

7
Guardfile Normal file
View File

@ -0,0 +1,7 @@
$: << 'lib'
guard 'assets' do
watch(%r(^Assetfile))
watch(%r(^assets))
end

6
Guardfile.phantom Normal file
View File

@ -0,0 +1,6 @@
$: << 'lib'
guard 'specs' do
watch(%r(^public))
end

View File

@ -1,3 +1,3 @@
web: bundle exec rackup -s puma -p $PORT waiter/config.ru
web: bundle exec rackup -s puma -p $PORT
assets: rerun -x -p 'assets/**/*' 'bundle exec rakep'
#specs: rerun -x -p 'public/**/*' './run_jasmine.coffee public/spec.html'

105
README.md
View File

@ -2,77 +2,56 @@
[![Build Status](https://travis-ci.org/travis-ci/travis-web.png?branch=master)](https://travis-ci.org/travis-ci/travis-web)
### Running the app
The app is developed using [Ember CLI](http://ember-cli.com). It requires nodejs
with npm installed.
In order to run the app you need to install dependencies with:
bower install
npm install
bundle install
Now you can run the server:
Then you have to run the server, the easiest way to do this is to
use foreman:
ember serve
bundle exec foreman start
And open http://localhost:4200 in the browser.
Now you can open [localhost:5000](http://localhost:5000)
Alternatively you can run `ember build --watch` and start the server with `waiter/script/server`
### Running the app in private repos mode
At the moment Travis CI is available as two separate sites - https://travis-ci.org for Open Source
projects and https://travis-ci.com for private projects. travis-web will connect
to the Open Source version by default. In order to connect it to the API for private projects
you need to run:
```
TRAVIS_PRO=true ember serve --ssl --ssl-key=ssl/server.key --ssl-cert=ssl/server.crt
```
One caveat here is that the command will start server with SSL, so the page will
be accessible at https://localhost:4200 (note `https` part).
### Running on SSL in general
Sometimes there is a need to test the app with an SSL connection. This is required
to make Pusher work when running Travis CI Pro, but it may also be needed in other
situations.
There's already an SSL certificate in the `ssl` directory, which is set for `localhost`
host. If you want to use it, you can start the server with:
```
ember serve --ssl --ssl-key=ssl/server.key --ssl-cert=ssl/server.crt
```
In case you want your own certificate, you can follow the instructions posted
here: https://gist.github.com/trcarden/3295935 and then point the server to your
certificate with `--ssl-key` and `--ssl-cert`.
### Running tests
To run a test suite execute:
ember test
You can also start an interactive test runner for easier development:
ember test --serve
By default it uses the official API at `https://api.travis-ci.org`, but you
can customize the API server URL using:
### Updating the team page
API_ENDPOINT="http://localhost:3000/" bundle exec foreman start
The team information can be found in `app/routes/team.js`.
To add another member just add the info in the same style as the previous ones. Like so
This will run against API run locally.
{
name: 'Mr T'
title: 'Mascot'
handle: 'travisci'
nationality: 'internet'
country: 'internet'
image: 'mrt'
}
### Compiling assets manually
The order of value pairs does not matter, the quotationmarks do. Name and title will be displayed as they are. The handle will be used to generate a link to Twitter and displayed with a '@' in front of it. Nationality and country determine the flags. Please use the name of the country and not the adjective (like 'germany' and NOT 'german'). Image is the identifier to find the right image and animated gif. 'mrt' in the example will result in `team-mrt.png` and `mrt-animated.gif`.
Add the images themselves to `public/images/team/` and additional flags to `public/images/pro-landing/`. Mind the naming conventions already in place.
bundle exec rakep
ENV=production bundle exec rakep
### Running the spec suite
First, start the app (see above).
bundle exec foreman start
To run the Ruby specs, run rspec against the spec/ directory:
bundle exec rspec spec/
To run the Jasmine specs, open the spec page: [localhost:5000/spec.html](http://localhost:5000/spec.html)
### i18n
Localization for travis-web is managed via [localeapp](http://localeapp.com).
If you are interested in improving the existing localizations or adding
a new locale, please contact us on irc (#travis) and we will set you up.
Please do **not** edit the YAML files directly.
Localization data can be synced with the following rake task:
bundle exec localeapp:update
This will publish any new keys in en.yml, as well as any missing keys
from your handlebars templates and pull down the latest localizations.
*note*: You will need to have the localeapp api key exported to
LOCALEAPP_API_KEY

36
Rakefile Normal file
View File

@ -0,0 +1,36 @@
$: << 'lib'
namespace :localeapp do
desc "syncs localeapp, yaml and handlebars"
task :update do
require 'localeapp-handlebars_i18n'
Localeapp::HandlebarsI18n.configure($stdout) do |config|
config.hbs_load_path = Dir[File.expand_path '../assets/scripts/app/templates/**/*.hbs', __FILE__]
config.yml_load_path = File.expand_path '../locales/', __FILE__
config.localeapp_api_key = ENV['LOCALEAPP_API_KEY']
end
system "localeapp push locales/#{Localeapp::HandlebarsI18n.default_locale}.yml"
Localeapp::HandlebarsI18n.send_missing_translations
system "localeapp pull"
end
end
namespace :ember do
desc 'update ember'
task :update do
if File.exists?('tmp/ember.js')
system 'cd tmp/ember.js; git fetch origin; git reset --hard origin/master'
else
system 'git clone https://github.com/emberjs/ember.js.git tmp/ember.js'
end
system 'cd tmp/ember.js; bundle update'
system 'cd tmp/ember.js; rake dist'
system 'cp tmp/ember.js/dist/ember.js assets/javascripts/vendor/ember.js'
end
end
task :update_emojis do
s = Dir.glob('assets/images/emoji/*.png').map {|png| png.split('/', 4)[3].gsub('.png', '')}.map{|png| "'#{png}'"}.join(", ")
e = "@EmojiDictionary = [#{s}]"
File.open("assets/scripts/config/emoij.coffee", "w") {|f| f.write(e) }
end

View File

@ -1,57 +0,0 @@
import config from 'travis/config/environment';
import Ember from 'ember';
import ActiveModelAdapter from 'active-model-adapter';
export default ActiveModelAdapter.extend({
auth: Ember.inject.service(),
host: config.apiEndpoint,
coalesceFindRequests: true,
// Before Ember Data 2.0 the default behaviour of running `findAll` was to get
// new records only when there're no records in the store. This will change
// to a different strategy in 2.0: when you run `findAll` it will not get any
// new data initially, but it will try loading new data in the background.
//
// I'm disabling the new behaviour for now.
shouldBackgroundReloadRecord() {
return false;
},
ajaxOptions(url, type, options) {
var base, hash, token;
hash = this._super(...arguments);
hash.headers = hash.headers || {};
hash.headers['accept'] = 'application/json; version=2';
if (token = this.get('auth').token()) {
if(!hash.headers['Authorization']) {
hash.headers['Authorization'] = "token " + token;
}
}
return hash;
},
findMany(store, type, ids) {
return this.ajax(this.buildURL(type.modelName), 'GET', {
data: {
ids: ids
}
});
},
handleResponse(status, headers, payload) {
if (status > 299) {
console.log("[ERROR] API responded with an error (" + status + "): " + (JSON.stringify(payload)));
}
return this._super(...arguments);
},
// this can be removed once this PR is merged and live:
// https://github.com/emberjs/data/pull/4204
findRecord(store, type, id, snapshot) {
return this.ajax(this.buildURL(type.modelName, id, snapshot, 'findRecord'), 'GET');
}
});

View File

@ -1,27 +0,0 @@
import Ember from 'ember';
import ApplicationAdapter from 'travis/adapters/application';
export default ApplicationAdapter.extend({
namespace: 'settings',
buildURL(type, id, record) {
var delimiter, repoId, url;
url = this._super.apply(this, arguments);
if (record && record.belongsTo('repo') && (repoId = record.belongsTo('repo').id)) {
delimiter = url.indexOf('?') !== -1 ? '&' : '?';
url = "" + url + delimiter + "repository_id=" + repoId;
}
return url;
},
updateRecord(store, type, record) {
var data, serializer;
data = {};
serializer = store.serializerFor(type.modelName);
serializer.serializeIntoHash(data, type, record);
var id = record.id;
return this.ajax(this.buildURL(type.modelName, id, record), "PATCH", {
data: data
});
}
});

View File

@ -1,9 +0,0 @@
import ApplicationAdapter from 'travis/adapters/application';
export default ApplicationAdapter.extend({
updateRecord(store, type, snapshot) {
return this._super(...arguments).then( (data) => {
return { hook: { id: snapshot.id } };
});
}
});

View File

@ -1,26 +0,0 @@
import V3Adapter from 'travis/adapters/v3';
import ApplicationAdapter from 'travis/adapters/application';
import Config from 'travis/config/environment';
let Adapter = Config.useV3API ? V3Adapter : ApplicationAdapter;
export default Adapter.extend({
defaultSerializer: '-repo',
ajaxOptions(url, type, options) {
var hash = options || {};
if(!hash.data) {
hash.data = {};
}
if(Config.useV3API) {
if(hash.data.include) {
hash.data.include += ',repository.default_branch,branch.last_build,build.commit';
} else {
hash.data.include = 'repository.default_branch,branch.last_build,build.commit';
}
}
return this._super(url, type, hash);
}
});

View File

@ -1,29 +0,0 @@
import Ember from 'ember';
import ApplicationAdapter from 'travis/adapters/application';
export default ApplicationAdapter.extend({
namespace: 'settings',
findRecord(store, type, id, record) {
return this.ajax(this.urlPrefix() + '/ssh_key/' + id, 'GET');
},
deleteRecord(store, type, record) {
var id = record.id;
return this.ajax(this.urlPrefix() + '/ssh_key/' + id, "DELETE");
},
createRecord(store, type, record) {
var data, serializer;
data = {};
serializer = store.serializerFor(type.modelName);
serializer.serializeIntoHash(data, type, record, {
includeId: true
});
var id = record.id;
return this.ajax(this.urlPrefix() + '/ssh_key/' + id, "PATCH", {
data: data
});
}
});

View File

@ -1,64 +0,0 @@
import Ember from 'ember';
import config from 'travis/config/environment';
import RESTAdapter from 'ember-data/adapters/rest';
export default RESTAdapter.extend({
auth: Ember.inject.service(),
host: config.apiEndpoint,
sortQueryParams: false,
coalesceFindRequests: false,
headers: {
'Travis-API-Version': '3',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
ajaxOptions: function(url, type, options) {
var hash = this._super(...arguments);
hash.headers = hash.headers || {};
var token;
if(token = this.get('auth').token()) {
hash.headers['Authorization'] = "token " + token;
}
return hash;
},
// TODO: I shouldn't override this method as it's private, a better way would
// be to create my own URL generator
_buildURL: function(modelName, id) {
var url = [];
var host = Ember.get(this, 'host');
var prefix = this.urlPrefix();
var path;
if (modelName) {
path = this.pathForType(modelName, id);
if (path) { url.push(path); }
}
if (id) { url.push(encodeURIComponent(id)); }
if (prefix) { url.unshift(prefix); }
url = url.join('/');
if (!host && url && url.charAt(0) !== '/') {
url = '/' + url;
}
return url;
},
pathForType: function(modelName, id) {
var underscored = Ember.String.underscore(modelName);
return id ? underscored : Ember.String.pluralize(underscored);
},
// this can be removed once this PR is merged and live:
// https://github.com/emberjs/data/pull/4204
findRecord(store, type, id, snapshot) {
return this.ajax(this.buildURL(type.modelName, id, snapshot, 'findRecord'), 'GET');
}
});

View File

@ -1,130 +0,0 @@
import Ember from 'ember';
import Resolver from './resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';
Ember.MODEL_FACTORY_INJECTIONS = true;
Ember.LinkComponent.reopen({
attributeBindings: ['alt']
});
var App = Ember.Application.extend(Ember.Evented, {
LOG_TRANSITIONS: true,
LOG_TRANSITIONS_INTERNAL: true,
LOG_ACTIVE_GENERATION: true,
LOG_MODULE_RESOLVER: true,
LOG_VIEW_LOOKUPS: true,
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver: Resolver,
flash(options) {
return Ember.getOwner(Travis).lookup('controller:flash').loadFlashes([options]);
},
toggleSidebar() {
var element;
$('body').toggleClass('maximized');
element = $('<span></span>');
$('#top .profile').append(element);
Ember.run.later((function() {
return element.remove();
}), 10);
element = $('<span></span>');
$('#repo').append(element);
return Ember.run.later((function() {
return element.remove();
}), 10);
},
ready() {
if (location.hash.slice(0, 2) === '#!') {
location.href = location.href.replace('#!/', '');
}
this.on('user:signed_in', function(user) {
return Travis.onUserUpdate(user);
});
this.on('user:refreshed', function(user) {
return Travis.onUserUpdate(user);
});
this.on('user:synced', function(user) {
return Travis.onUserUpdate(user);
});
return this.on('user:signed_out', function() {
if (config.userlike) {
return Travis.removeUserlike();
}
});
},
currentDate() {
return new Date();
},
onUserUpdate(user) {
if (config.pro) {
this.identifyCustomer(user);
}
if (config.userlike) {
this.setupUserlike(user);
}
return this.subscribePusher(user);
},
subscribePusher(user) {
var channels;
if (!user.channels) {
return;
}
channels = user.channels;
if (config.pro) {
channels = channels.map(function(channel) {
if (channel.match(/^private-/)) {
return channel;
} else {
return "private-" + channel;
}
});
}
return Travis.pusher.subscribeAll(channels);
},
setupUserlike(user) {
var btn, s, userlikeData;
btn = document.getElementById('userlikeCustomTab');
btn.classList.add("logged-in");
userlikeData = window.userlikeData = {};
userlikeData.user = {};
userlikeData.user.name = user.login;
userlikeData.user.email = user.email;
if (!document.getElementById('userlike-script')) {
s = document.createElement('script');
s.id = 'userlike-script';
s.src = '//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/0327dbb23382ccbbb91b445b76e8a91d4b37d90ef9f2faf84e11177847ff7bb9.js';
return document.body.appendChild(s);
}
},
removeUserlike() {
var btn;
btn = document.getElementById('userlikeCustomTab');
return btn.classList.remove("logged-in");
},
identifyCustomer(user) {
if (_cio && _cio.identify) {
return _cio.identify({
id: user.id,
email: user.email,
name: user.name,
created_at: (Date.parse(user.created_at) / 1000) || null,
login: user.login
});
}
}
});
loadInitializers(App, config.modulePrefix);
export default App;

View File

@ -1,55 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['form--envvar'],
classNameBindings: ['nameIsBlank:form-error'],
store: Ember.inject.service(),
isValid() {
if (Ember.isBlank(this.get('name'))) {
this.set('nameIsBlank', true);
return false;
} else {
return true;
}
},
reset() {
return this.setProperties({
name: null,
value: null,
"public": null
});
},
actions: {
save() {
var env_var, self;
if (this.get('isSaving')) {
return;
}
this.set('isSaving', true);
if (this.isValid()) {
env_var = this.get('store').createRecord('env_var', {
name: this.get('name'),
value: this.get('value'),
"public": this.get('public'),
repo: this.get('repo')
});
self = this;
return env_var.save().then(() => {
this.set('isSaving', false);
return this.reset();
}, () => {
return this.set('isSaving', false);
});
} else {
return this.set('isSaving', false);
}
},
nameChanged() {
return this.set('nameIsBlank', false);
}
}
});

View File

@ -1,85 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['form--sshkey'],
classNameBindings: ['valueError:form-error'],
store: Ember.inject.service(),
isSaving: false,
didInsertElement() {
var id = this.get('repo.id');
var model = this.get('store').recordForId('ssh_key', id);
if (model) {
this.get('store').unloadRecord(model);
var typeMap = this.get('store').typeMapFor(model.constructor);
var idToRecord = typeMap.idToRecord;
delete idToRecord[id];
}
model = this.get('store').createRecord('ssh_key', { id: id });
return this.set('model', model);
},
isValid() {
if (Ember.isBlank(this.get('value'))) {
this.set('valueError', 'Value can\'t be blank.');
return false;
} else {
return true;
}
},
reset() {
return this.setProperties({
description: null,
value: null
});
},
valueChanged: function() {
return this.set('valueError', false);
}.observes('value'),
addErrorsFromResponse(errArr) {
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') {
return this.set('valueError', 'The key can\'t have a passphrase.');
}
},
actions: {
save() {
var ssh_key;
this.set('valueError', false);
if (this.get('isSaving')) {
return;
}
this.set('isSaving', true);
if (this.isValid()) {
ssh_key = this.get('model');
ssh_key.setProperties({
description: this.get('description'),
value: this.get('value')
});
return ssh_key.save().then(() => {
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);
}
});
} else {
return this.set('isSaving', false);
}
}
}
});

View File

@ -1,103 +0,0 @@
import Ember from 'ember';
import { githubCommit as githubCommitUrl } from 'travis/utils/urls';
import TravisRoute from 'travis/routes/basic';
import config from 'travis/config/environment';
export default Ember.Component.extend({
routing: Ember.inject.service('-routing'),
tagName: 'li',
classNameBindings: ['build.last_build.state'],
classNames: ['branch-row', 'row-li'],
isLoading: false,
isTriggering: false,
hasTriggered: false,
urlGithubCommit: function() {
return githubCommitUrl(this.get('build.repository.slug'), this.get('build.last_build.commit.sha'));
}.property('build.last_build'),
getLast5Builds: function() {
var apiEndpoint, branchName, lastBuilds, options, repoId;
lastBuilds = Ember.ArrayProxy.create({
content: [{}, {}, {}, {}, {}],
isLoading: true,
count: 0
});
if (!this.get('build.last_build')) {
lastBuilds.set('isLoading', false);
} else {
apiEndpoint = config.apiEndpoint;
repoId = this.get('build.repository.id');
branchName = this.get('build.name');
options = {};
if (this.get('auth.signedIn')) {
options.headers = {
Authorization: "token " + (this.auth.token())
};
}
$.ajax(apiEndpoint + "/v3/repo/" + repoId + "/builds?branch.name=" + branchName + "&limit=5&build.event_type=push,api", options).then(function(response) {
var array, i, j, ref;
array = response.builds.map(function(build) {
return Ember.Object.create(build);
});
if (array.length < 5) {
for (i = j = 1, ref = 5 - array.length; j <= ref; i = j += 1) {
array.push({});
}
}
lastBuilds.set('count', response['@pagination'].count);
lastBuilds.set('content', array);
return lastBuilds.set('isLoading', false);
});
}
return lastBuilds;
}.property(),
canTrigger: function() {
var permissions;
if (!this.get('auth.signedIn')) {
return false;
} else {
permissions = this.get('auth.currentUser.permissions');
if (permissions.contains(parseInt(this.get('build.repository.id')))) {
return true;
} else {
return false;
}
}
}.property(),
triggerBuild: function() {
var apiEndpoint, options, repoId;
apiEndpoint = config.apiEndpoint;
repoId = this.get('build.repository.id');
options = {
type: 'POST',
body: {
request: {
branch: this.get('build.name')
}
}
};
if (this.get('auth.signedIn')) {
options.headers = {
Authorization: "token " + (this.auth.token())
};
}
return $.ajax(apiEndpoint + "/v3/repo/" + repoId + "/requests", options).then(() => {
this.set('isTriggering', false);
return this.set('hasTriggered', true);
});
},
actions: {
tiggerBuild(branch) {
this.set('isTriggering', true);
return this.triggerBuild();
},
viewAllBuilds(branch) {
return this.get('routing').transitionTo('builds');
}
}
});

View File

@ -1,21 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['broadcast'],
isOpen: false,
timeoutId: '',
actions: {
toggleBroadcasts() {
this.toggleProperty('isOpen');
this.sendAction('toggleBroadcasts');
if (this.get('isOpen') === true) {
return this.set('timeoutId', setTimeout(() => {
this.toggleProperty('isOpen');
return this.sendAction('toggleBroadcasts');
}, 10000));
} else {
return clearTimeout(this.get('timeoutId'));
}
}
}
});

View File

@ -1,27 +0,0 @@
import Ember from 'ember';
import { gravatarImage } from 'travis/utils/urls';
import GithubUrlProperties from 'travis/mixins/github-url-properties';
import { durationFrom, safe } from 'travis/utils/helpers';
import { githubCommit } from 'travis/utils/urls';
export default Ember.Component.extend({
tagName: 'section',
classNames: ['build-header'],
classNameBindings: ['item.state'],
isJob: function() {
if (this.get('item.build')) {
return true;
} else {
return false;
}
}.property('item'),
urlGithubCommit: function() {
return githubCommit(this.get('repo.slug'), this.get('commit.sha'));
}.property('item'),
elapsedTime: function() {
return durationFrom(this.get('item.startedAt'), this.get('item.finishedAt'));
}.property('item.startedAt', 'item.finishedAt', 'item.duration')
});

View File

@ -1,7 +0,0 @@
import Ember from 'ember';
import RepoActionsItemComponentMixin from 'travis/utils/repo-actions-item-component-mixin';
export default Ember.Component.extend(RepoActionsItemComponentMixin, {
item: Ember.computed.alias('build'),
type: 'build'
});

View File

@ -1,14 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'li',
classNameBindings: ['build.state'],
attributeBindings: ['title'],
title: function() {
var num, state;
num = this.get('build.number');
state = this.get('build.state');
return "Build #" + num + " " + state;
}.property('build')
});

View File

@ -1,12 +0,0 @@
import Ember from 'ember';
import { colorForState } from 'travis/utils/helpers';
import Polling from 'travis/mixins/polling';
export default Ember.Component.extend({
classNameBindings: ['color'],
pollModels: 'build',
color: function() {
return colorForState(this.get('build.state'));
}.property('build.state')
});

View File

@ -1,12 +0,0 @@
import Ember from 'ember';
import { githubCommit as githubCommitUrl } from 'travis/utils/urls';
export default Ember.Component.extend({
tagName: 'li',
classNameBindings: ['build.state'],
classNames: ['row-li', 'pr-row'],
urlGithubCommit: function() {
return githubCommitUrl(this.get('build.repo.slug'), this.get('build.commit.sha'));
}.property('build.commit.sha')
});

View File

@ -1,30 +0,0 @@
import Ember from 'ember';
import Polling from 'travis/mixins/polling';
export default Ember.Component.extend({
store: Ember.inject.service('store'),
pollHook: function(store) {
var contentType, repositoryId;
contentType = this.get('contentType');
repositoryId = this.get('repo.id');
store = this.get('store');
if (contentType === 'builds') {
return store.query('build', {
event_type: 'push',
repository_id: repositoryId
});
} else if (contentType === 'pull_requests') {
return store.filter('build', {
event_type: 'pull_request',
repository_id: repositoryId
});
} else {
return store.query('build', {
repository_id: repositoryId,
branches: true
});
}
}
});

View File

@ -1,33 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
ajax: Ember.inject.service(),
tagName: 'li',
classNames: ['cache-item'],
classNameBindings: ['cache.type'],
isDeleting: false,
actions: {
"delete": function() {
var data, deletingDone, repo;
if (this.get('isDeleting')) {
return;
}
if (confirm('Are you sure?')) {
this.set('isDeleting', true);
data = {
branch: this.get('cache.branch')
};
deletingDone = () => {
return this.set('isDeleting', false);
};
repo = this.get('repo');
return this.get('ajax').ajax("/repos/" + (repo.get('id')) + "/caches", "DELETE", {
data: data
}).then(deletingDone, deletingDone).then(() => {
return this.get('caches').removeObject(this.get('cache'));
});
}
}
}
});

View File

@ -1,36 +0,0 @@
import Ember from 'ember';
import { githubCommit as githubCommitUrl } from 'travis/utils/urls';
import config from 'travis/config/environment';
import { hasAdminPermission, hasPushPermission } from 'travis/utils/permission';
export default Ember.Component.extend({
tagName: 'li',
classNameBindings: ['repo.default_branch.last_build.state'],
classNames: ['rows', 'rows--dashboard'],
isLoading: false,
isTriggering: false,
hasTriggered: false,
dropupIsOpen: false,
urlGithubCommit: function() {
return githubCommitUrl(this.get('repo.slug'), this.get('repo.default_branch.last_build.commit.sha'));
}.property('repo'),
displayMenuTofu: function() {
return hasPushPermission(this.get('currentUser'), this.get('repo.id'));
},
displayActivateLink: function() {
return hasAdminPermission(this.get('currentUser'), this.get('repo.id'));
},
actions: {
tiggerBuild(branch) {
this.set('isTriggering', true);
return this.triggerBuild();
},
openDropup() {
this.toggleProperty('dropupIsOpen');
}
}
});

View File

@ -1,28 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['settings-envvar'],
classNameBindings: ['envVar.public:is-public'],
isDeleting: false,
validates: { name: ['presence'] },
actionType: 'Save',
showValueField: Ember.computed.alias('public'),
value: function(key) {
if (this.get('envVar.public')) {
return this.get('envVar.value');
} else {
return '••••••••••••••••';
}
}.property('envVar.value', 'envVar.public'),
actions: {
"delete": function() {
if (this.get('isDeleting')) {
return;
}
this.set('isDeleting', true);
return this.get('envVar').destroyRecord();
}
}
});

View File

@ -1,6 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'span',
classNames: ['icon-eye']
});

View File

@ -1,14 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
flashes: Ember.inject.service(),
classNames: ['flash'],
tagName: 'ul',
messagesBinding: 'flashes.messages',
actions: {
closeMessage(msg) {
return this.get('flashes').close(msg);
}
}
});

View File

@ -1,16 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'li',
classNameBindings: ['type'],
type: function() {
return this.get('flash.type') || 'broadcast';
}.property('flash.type'),
actions: {
close() {
return this.attrs.close(this.get('flash'));
}
}
});

View File

@ -1,17 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'a',
classNames: ['switch--icon'],
classNameBindings: ['active'],
activeBinding: "hook.active",
click() {
var hook;
this.sendAction('onToggle');
hook = this.get('hook');
return hook.toggle().then((function() {}), () => {
this.toggleProperty('hook.active');
return this.sendAction('onToggleError', hook);
});
}
});

View File

@ -1,23 +0,0 @@
import Ember from 'ember';
import config from 'travis/config/environment';
export default Ember.Component.extend({
tagName: 'li',
classNames: ['row'],
classNameBindings: ['hook.active:active'],
githubOrgsOauthAccessSettingsUrl: config.githubOrgsOauthAccessSettingsUrl,
actions: {
handleToggleError() {
return this.set("showError", true);
},
close() {
return this.send('resetErrors');
},
resetErrors() {
return this.set("showError", false);
}
}
});

View File

@ -1,35 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
logBinding: 'job.log',
classNames: ['job-log'],
didReceiveAttrs: function(options) {
this._super(...arguments);
let oldJob = options.oldAttrs && options.oldAttrs.job && options.oldAttrs.job.value,
newJob = options.newAttrs && options.newAttrs.job && options.newAttrs.job.value;
if(newJob !== oldJob) {
if(newJob) {
this.setupLog(newJob);
}
if(oldJob) {
this.teardownLog(oldJob);
}
}
},
teardownLog(job) {
job.unsubscribe();
},
setupLog(job) {
this.set('error', false);
job.get('log').fetch().then(function() { }, () => {
this.set('error', true);
});
job.subscribe();
}
});

View File

@ -1,7 +0,0 @@
import Ember from 'ember';
import RepoActionsItemComponentMixin from 'travis/utils/repo-actions-item-component-mixin';
export default Ember.Component.extend(RepoActionsItemComponentMixin, {
item: Ember.computed.alias('job'),
type: 'job'
});

View File

@ -1,18 +0,0 @@
import Ember from 'ember';
import { colorForState } from 'travis/utils/helpers';
import { githubCommit } from 'travis/utils/urls';
import Polling from 'travis/mixins/polling';
export default Ember.Component.extend({
pollModels: 'job.build',
commitBinding: 'job.commit',
currentItemBinding: 'job',
color: function() {
return colorForState(this.get('job.state'));
}.property('job.state'),
urlGithubCommit: function() {
return githubCommit(this.get('repo.slug'), this.get('commit.sha'));
}.property('repo.slug', 'commit.sha')
});

View File

@ -1,36 +0,0 @@
import Ember from 'ember';
import { colorForState } from 'travis/utils/helpers';
import { languageConfigKeys } from 'travis/utils/keys-map';
export default Ember.Component.extend({
tagName: 'li',
classNameBindings: ['job.state'],
classNames: ['jobs-item'],
languages: function() {
var config, gemfile, key, languageName, output, version;
output = [];
if (config = this.get('job.config')) {
for (key in languageConfigKeys) {
languageName = languageConfigKeys[key];
if (version = config[key]) {
output.push(languageName + ': ' + version);
}
}
gemfile = this.get('job.config.gemfile');
if (gemfile && this.get('job.config.env')) {
output.push("Gemfile: " + gemfile);
}
}
return output.join(' ');
}.property('job.config'),
environment: function() {
var env, gemfile;
if (env = this.get('job.config.env')) {
return env;
} else if (gemfile = this.get('job.config.gemfile')) {
return "Gemfile: " + gemfile;
}
}.property('job.config.env', 'job.config.gemfile')
});

View File

@ -1,13 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'section',
classNames: ['jobs'],
jobTableId: Ember.computed(function() {
if (this.get('required')) {
return 'jobs';
} else {
return 'allowed_failure_jobs';
}
})
});

View File

@ -1,8 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'li',
classNameBindings: ['build.state']
});

View File

@ -1,55 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['limit-concurrent-builds'],
description: function() {
var description;
description = "Limit concurrent jobs";
if (this.get('enabled')) {
description += " ";
}
return description;
}.property('enabled'),
limitChanged() {
var limit, repo, savingFinished;
repo = this.get('repo');
limit = parseInt(this.get('value'));
if (limit) {
this.set('isSaving', true);
savingFinished = () => {
return this.set('isSaving', false);
};
return repo.saveSettings({
maximum_number_of_builds: limit
}).then(savingFinished, savingFinished);
}
},
actions: {
toggle() {
var savingFinished;
if (!this.get('enabled')) {
if (this.get('value') === 0) {
return;
}
if (this.get('isSaving')) {
return;
}
this.set('isSaving', true);
savingFinished = () => {
return this.set('isSaving', false);
};
this.get('repo').saveSettings({
maximum_number_of_builds: 0
}).then(savingFinished, savingFinished);
return this.set('value', 0);
}
},
limitChanged() {
return Ember.run.debounce(this, 'limitChanged', 1000);
}
}
});

View File

@ -1,7 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'div',
classNameBindings: ['center:loading-container', 'inline:inline-block', 'height:icon-height'],
center: false
});

View File

@ -1,238 +0,0 @@
import Ember from 'ember';
import LinesSelector from 'travis/utils/lines-selector';
import LogFolder from 'travis/utils/log-folder';
import config from 'travis/config/environment';
import { plainTextLog as plainTextLogUrl } from 'travis/utils/urls';
Log.DEBUG = false;
Log.LIMIT = 10000;
Log.Scroll = function(options) {
options = options || {};
this.beforeScroll = options.beforeScroll;
return this;
};
Log.Scroll.prototype = $.extend(new Log.Listener(), {
insert: function(log, data, pos) {
if (this.numbers) {
this.tryScroll();
}
return true;
},
tryScroll: function() {
var element, ref;
if (element = $("#log p:visible.highlight:first")) {
if (this.beforeScroll) {
this.beforeScroll();
}
$('#main').scrollTop(0);
return $('html, body').scrollTop(((ref = element.offset()) != null ? ref.top : void 0) - (window.innerHeight / 3));
}
}
});
Log.Limit = function(max_lines, limitedLogCallback) {
this.max_lines = max_lines || 1000;
this.limitedLogCallback = limitedLogCallback || (function() {});
return this;
};
Log.Limit.prototype = Log.extend(new Log.Listener(), {
count: 0,
insert: function(log, node, pos) {
if (node.type === 'paragraph' && !node.hidden) {
this.count += 1;
if (this.limited) {
this.limitedLogCallback();
}
return this.count;
}
}
});
Object.defineProperty(Log.Limit.prototype, 'limited', {
get: function() {
return this.count >= this.max_lines;
}
});
export default Ember.Component.extend({
popup: Ember.inject.service(),
classNameBindings: ['logIsVisible:is-open'],
logIsVisible: false,
currentUserBinding: 'auth.currentUser',
didInsertElement() {
if (Log.DEBUG) {
console.log('log view: did insert');
}
this._super.apply(this, arguments);
Ember.run.scheduleOnce('afterRender', this, 'createEngine');
},
willDestroyElement() {
if (Log.DEBUG) {
console.log('log view: will destroy');
}
Ember.run.scheduleOnce('afterRender', this, 'teardownLog');
},
teardownLog(log) {
var parts, ref;
if (log || (log = this.get('log'))) {
parts = log.get('parts');
parts.removeArrayObserver(this, {
didChange: 'partsDidChange',
willChange: 'noop'
});
parts.destroy();
log.notifyPropertyChange('parts');
if ((ref = this.lineSelector) != null) {
ref.willDestroy();
}
this.clearLogElement();
}
},
clearLogElement() {
var logElement = this.$('#log');
if (logElement && logElement[0]) {
logElement[0].innerHTML = '';
}
},
createEngine(log) {
if (log || (log = this.get('log'))) {
this.clearLogElement();
log.onClear(() => {
this.teardownLog();
return this.createEngine();
});
this.scroll = new Log.Scroll({
beforeScroll: () => {
return this.unfoldHighlight();
}
});
this.limit = new Log.Limit(Log.LIMIT, () => {
return this.set('limited', true);
});
this.engine = Log.create({
listeners: [this.scroll, this.limit]
});
this.engine.limit = this.limit;
this.logFolder = new LogFolder(this.$('#log'));
this.lineSelector = new LinesSelector(this.$('#log'), this.scroll, this.logFolder);
this.observeParts(log);
}
},
didUpdateAttrs(changes) {
this._super.apply(this, arguments);
if (!changes.oldAttrs) {
return;
}
if (changes.newAttrs.job.value && changes.oldAttrs.job.value && changes.newAttrs.job.value !== changes.oldAttrs.job.value) {
this.teardownLog(changes.oldAttrs.job.value.get('log'));
return this.createEngine(changes.newAttrs.job.value.get('log'));
}
},
unfoldHighlight() {
return this.lineSelector.unfoldLines();
},
observeParts(log) {
var parts;
if (log || (log = this.get('log'))) {
parts = log.get('parts');
parts.addArrayObserver(this, {
didChange: 'partsDidChange',
willChange: 'noop'
});
parts = parts.slice(0);
this.partsDidChange(parts, 0, null, parts.length);
}
},
partsDidChange(parts, start, _, added) {
Ember.run.schedule('afterRender', this, function() {
var i, j, len, part, ref, ref1, ref2, results;
if (Log.DEBUG) {
console.log('log view: parts did change');
}
if (this.get('_state') !== 'inDOM') {
return;
}
ref = parts.slice(start, start + added);
results = [];
for (i = j = 0, len = ref.length; j < len; i = ++j) {
part = ref[i];
if ((ref1 = this.engine) != null ? (ref2 = ref1.limit) != null ? ref2.limited : void 0 : void 0) {
break;
}
results.push(this.engine.set(part.number, part.content));
}
return results;
});
},
plainTextLogUrl: function() {
var id, url;
if (id = this.get('log.job.id')) {
url = plainTextLogUrl(id);
if (config.pro) {
url += "&access_token=" + (this.get('job.log.token'));
}
return url;
}
}.property('job.log.id', 'job.log.token'),
hasPermission: function() {
var permissions;
if (permissions = this.get('currentUser.permissions')) {
return permissions.contains(parseInt(this.get('job.repo.id')));
}
}.property('currentUser.permissions.length', 'job.repo.id'),
canRemoveLog: function() {
var job;
if (job = this.get('job')) {
return job.get('canRemoveLog') && this.get('hasPermission');
}
}.property('job.canRemoveLog', 'hasPermission'),
showToTop: function() {
return this.get('log.hasContent') && this.get('job.canRemoveLog');
}.property('log.hasContent', 'job.canRemoveLog'),
showTailing: Ember.computed.alias('showToTop'),
actions: {
toTop() {
Travis.tailing.stop();
return $(window).scrollTop(0);
},
toggleTailing() {
Travis.tailing.toggle();
this.engine.autoCloseFold = !Travis.tailing.isActive();
return false;
},
removeLogPopup() {
if (this.get('canRemoveLog')) {
this.get('popup').open('remove-log-popup');
return false;
}
},
toggleLog() {
this.toggleProperty('logIsVisible');
}
},
// don't remove this, it's needed as an empty willChange callback
noop: function() {}
});

View File

@ -1,20 +0,0 @@
import Ember from 'ember';
import config from 'travis/config/environment';
export default Ember.Component.extend({
actions: {
triggerBuild() {
var apiEndpoint;
this.set('isLoading', true);
apiEndpoint = config.apiEndpoint;
return $.ajax(apiEndpoint + ("/v3/repo/" + (this.get('repo.repo.id')) + "/requests"), {
headers: {
Authorization: 'token ' + this.get('repo.auth')
},
type: "POST"
}).then(() => {
return this.set('isLoading', false);
});
}
}
});

View File

@ -1,3 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend();

View File

@ -1,3 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend();

View File

@ -1,28 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['media', 'account'],
tagName: 'li',
classNameBindings: ['type', 'selected'],
typeBinding: 'account.type',
selectedBinding: 'account.selected',
tokenIsVisible: false,
name: function() {
return this.get('account.name') || this.get('account.login');
}.property('account'),
avatarUrl: function() {
return this.get('account.avatarUrl') || false;
}.property('account'),
isUser: function() {
return this.get('account.type') === 'user';
}.property('account'),
actions: {
tokenVisibility() {
return this.toggleProperty('tokenIsVisible');
}
}
});

View File

@ -1,17 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['organisation-filter'],
actions: {
toggleOrgFilter() {
this.toggleProperty('showFilter');
return false;
},
select(org) {
this.toggleProperty('showFilter');
return this.sendAction('action', org);
}
}
});

View File

@ -1,24 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'li',
classNames: ['owner-tile', 'row-li'],
classNameBindings: ['repo.default_branch.last_build.state'],
ownerName: function() {
return this.get('repo.slug').split(/\//)[0];
}.property('repo.slug'),
repoName: function() {
return this.get('repo.slug').split(/\//)[1];
}.property('repo.slug'),
isAnimating: function() {
var animationStates, state;
state = this.get('repo.default_branch.last_build.state');
animationStates = ['received', 'queued', 'started', 'booting'];
if (animationStates.indexOf(state) !== -1) {
return true;
}
}.property('repo.default_branch.last_build.state')
});

View File

@ -1,4 +0,0 @@
import Ember from 'ember';
import SyncButton from 'travis/components/sync-button';
export default SyncButton.extend();

View File

@ -1,17 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
popup: Ember.inject.service(),
classNames: ['application'],
click(event) {
var targetAndParents = $(event.target).parents().andSelf();
if (!(targetAndParents.hasClass('open-popup') || targetAndParents.hasClass('popup'))) {
this.get('popup').close();
}
if (!targetAndParents.hasClass('menu') && !targetAndParents.is('#tools > a')) {
$('.menu').removeClass('display');
}
}
});

View File

@ -1,6 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['profile-orglist', 'columns', 'medium-4'],
tagName: 'aside',
});

View File

@ -1,18 +0,0 @@
import Ember from 'ember';
import config from 'travis/config/environment';
export default Ember.Component.extend({
store: Ember.inject.service(),
updateTimesService: Ember.inject.service('updateTimes'),
init() {
this._super.apply(this, arguments);
if (!Ember.testing) {
return Visibility.every(config.intervals.updateTimes, this.updateTimes.bind(this));
}
},
updateTimes() {
this.get('updateTimesService').push(this.get('jobs'));
}
});

View File

@ -1,27 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
close() {
$('.popup').removeClass('display');
return false;
},
removeLog() {
var job = this.get('job');
$('.popup').removeClass('display');
return job.removeLog().then(function() {
return Travis.flash({ success: 'Log has been successfully removed.' });
}, function(xhr) {
if (xhr.status === 409) {
return Travis.flash({ error: 'Log can\'t be removed' });
} else if (xhr.status === 401) {
return Travis.flash({ error: 'You don\'t have sufficient access to remove the log' });
} else {
return Travis.flash({ error: 'An error occured when removing the log' });
}
});
}
}
});

View File

@ -1,7 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['repo-main-tools']
});

View File

@ -1,74 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'nav',
classNames: ['tabnav'],
ariaRole: 'tablist',
classCurrent: function() {
if (this.get('tab') === 'current') {
return 'active';
}
}.property('tab'),
classBuilds: function() {
if (this.get('tab') === 'builds') {
return 'active';
}
}.property('tab'),
classPullRequests: function() {
if (this.get('tab') === 'pull_requests') {
return 'active';
}
}.property('tab'),
classBranches: function() {
if (this.get('tab') === 'branches') {
return 'active';
}
}.property('tab'),
classBuild: function() {
var classes, tab;
tab = this.get('tab');
classes = [];
if (tab === 'build') {
classes.push('active');
}
if (tab === 'build' || tab === 'job') {
classes.push('display-inline');
}
return classes.join(' ');
}.property('tab'),
classJob: function() {
if (this.get('tab') === 'job') {
return 'active';
}
}.property('tab'),
classRequests: function() {
if (this.get('tab') === 'requests') {
return 'active';
}
}.property('tab'),
classCaches: function() {
if (this.get('tab') === 'caches') {
return 'active';
}
}.property('tab'),
classSettings: function() {
if (this.get('tab') === 'settings') {
return 'active';
}
}.property('tab'),
classRequest: function() {
if (this.get('tab') === 'request') {
return 'active';
}
}.property('tab')
});

View File

@ -1,38 +0,0 @@
import Ember from 'ember';
import config from 'travis/config/environment';
import { hasPermission, hasPushPermission } from 'travis/utils/permission';
export default Ember.Component.extend({
popup: Ember.inject.service(),
classNames: ['option-button'],
classNameBindings: ['isOpen:display'],
isOpen: false,
click(event) {
if ($(event.target).is('a') && $(event.target).parents('.settings-dropdown').length) {
return this.closeMenu();
}
},
closeMenu() {
return this.toggleProperty('isOpen');
},
actions: {
menu() {
return this.toggleProperty('isOpen');
}
},
displaySettingsLink: function() {
return hasPushPermission(this.get('currentUser'), this.get('repo.id'));
}.property('currentUser.pushPermissions.length', 'repo'),
displayCachesLink: function() {
return hasPushPermission(this.get('currentUser'), this.get('repo.id')) && config.endpoints.caches;
}.property('currentUser.pushPermissions.length', 'repo'),
displayStatusImages: function() {
return hasPermission(this.get('currentUser'), this.get('repo.id'));
}.property('currentUser.permissions.length', 'repo.id')
});

View File

@ -1,7 +0,0 @@
import Polling from 'travis/mixins/polling';
import Ember from 'ember';
export default Ember.Component.extend(Polling, {
pollModels: 'repo',
classNameBindings: ['isLoading:loading']
});

View File

@ -1,3 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend();

View File

@ -1,27 +0,0 @@
import Ember from 'ember';
import Polling from 'travis/mixins/polling';
import { colorForState } from 'travis/utils/helpers';
export default Ember.Component.extend(Polling, {
routing: Ember.inject.service('-routing'),
tagName: 'li',
pollModels: 'repo',
classNames: ['repo'],
classNameBindings: ['selected'],
selected: function() {
return this.get('repo') === this.get('selectedRepo');
}.property('selectedRepo'),
color: function() {
return colorForState(this.get('repo.lastBuildState'));
}.property('repo.lastBuildState'),
scrollTop: function() {
if (window.scrollY > 0) {
return $('html, body').animate({
scrollTop: 0
}, 200);
}
}
});

View File

@ -1,48 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
auth: Ember.inject.service(),
currentUserBinding: 'auth.currentUser',
classRecent: function() {
if (this.get('tab') === 'recent') {
return 'active';
} else if (this.get('tab') === 'search' && this.get('auth.signedIn')) {
return 'hidden';
}
}.property('tab'),
classRunning: function() {
var classes;
classes = [];
if (this.get('tab') === 'running') {
classes.push('active');
}
return classes.join(' ');
}.property('tab'),
classOwned: function() {
var classes;
classes = [];
if (this.get('tab') === 'owned') {
classes.push('active');
}
if (this.get('currentUser')) {
classes.push('display-inline');
}
return classes.join(' ');
}.property('tab', 'currentUser'),
classSearch: function() {
if (this.get('tab') === 'search') {
return 'active';
}
}.property('tab'),
classNew: function() {
if (this.get('currentUser')) {
return 'display-inline';
}
}.property('currentUser')
});

View File

@ -1,7 +0,0 @@
import Ember from 'ember';
var ReposListComponent = Ember.Component.extend({
tagName: 'ul'
});
export default ReposListComponent;

View File

@ -1,25 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'span',
classNames: ['request-icon', 'icon'],
classNameBindings: ['event', 'state'],
isPush: function() {
return this.get('event') === 'push';
}.property('event'),
isPR: function() {
return this.get('event') === 'pull_request';
}.property('event'),
isAPI: function() {
return this.get('event') === 'api';
}.property('event'),
isEmpty: function() {
if (this.get('event') === null || this.get('event') === null) {
return true;
}
}.property('event')
});

View File

@ -1,57 +0,0 @@
import Ember from 'ember';
import config from 'travis/config/environment';
export default Ember.Component.extend({
classNames: ['request-item'],
classNameBindings: ['requestClass'],
tagName: 'li',
isGHPages: function() {
var message = this.get('request.message');
if (message === 'github pages branch') {
return true;
} else {
return false;
}
}.property('request.message'),
requestClass: function() {
if (this.get('request.isAccepted')) {
return 'accepted';
} else {
return 'rejected';
}
}.property('content.isAccepted'),
type: function() {
if (this.get('request.isPullRequest')) {
return 'pull_request';
} else {
return 'push';
}
}.property('request.isPullRequest'),
status: function() {
if (this.get('request.isAccepted')) {
return 'Accepted';
} else {
return 'Rejected';
}
}.property('request.isAccepted'),
hasBranchName: function() {
return this.get('request.branchName');
}.property('request'),
message: function() {
var message;
message = this.get('request.message');
if (config.pro && message === "private repository") {
return '';
} else if (!message) {
return 'Build created successfully ';
} else {
return message;
}
}.property('request.message')
});

View File

@ -1,6 +0,0 @@
import Ember from 'ember';
import Polling from 'travis/mixins/polling';
export default Ember.Component.extend(Polling, {
pollModels: 'job'
});

View File

@ -1,23 +0,0 @@
import Ember from 'ember';
import Polling from 'travis/mixins/polling';
import config from 'travis/config/environment';
export default Ember.Component.extend(Polling, {
store: Ember.inject.service(),
updateTimesService: Ember.inject.service('updateTimes'),
pollHook(store) {
return this.get('store').find('job', {});
},
init() {
this._super.apply(this, arguments);
if (!Ember.testing) {
return Visibility.every(config.intervals.updateTimes, this.updateTimes.bind(this));
}
},
updateTimes() {
this.get('updateTimesService').push(this.get('jobs'));
}
});

View File

@ -1,26 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'a',
classNames: ['switch'],
classNameBindings: ['active'],
click() {
var setting;
if (this.get('isSaving')) {
return;
}
this.set('isSaving', true);
this.toggleProperty('active');
setting = {};
setting[this.get('key')] = this.get('active');
return this.get('repo').saveSettings(setting).then(() => {
return this.set('isSaving', false);
}, () => {
this.set('isSaving', false);
return Travis.flash({
error: 'There was an error while saving settings. Please try again.'
});
});
}
});

View File

@ -1,22 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'button',
classNames: ['showmore-button'],
classNameBindings: ['isLoading', 'showMore'],
showMore: true,
attributeBindings: ['disabled'],
disabledBinding: 'isLoading',
buttonLabel: function() {
if (this.get('isLoading')) {
return 'Loading';
} else {
return 'Show more';
}
}.property('isLoading'),
click() {
return this.attrs.showMore();
}
});

View File

@ -1,22 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['settings-sshkey'],
isDeleting: false,
actions: {
"delete": function() {
var deletingDone;
if (this.get('isDeleting')) {
return;
}
this.set('isDeleting', true);
deletingDone = () => {
return this.set('isDeleting', false);
};
this.get('key').deleteRecord();
return this.get('key').save().then(deletingDone, deletingDone).then(() => {
return this.sendAction('sshKeyDeleted');
});
}
}
});

View File

@ -1,44 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'span',
classNames: ['status-icon', 'icon'],
classNameBindings: ['status'],
attributeBindings: ['label:aria-label', 'label:title'],
label: function() {
return 'Job ' + this.get('status');
}.property('status'),
hasPassed: function() {
return this.get('status') === 'passed' || this.get('status') === 'accepted';
}.property('status'),
hasFailed: function() {
return this.get('status') === 'failed' || this.get('status') === 'rejected';
}.property('status'),
hasErrored: function() {
return this.get('status') === 'errored';
}.property('status'),
wasCanceled: function() {
return this.get('status') === 'canceled';
}.property('status'),
isRunning: function() {
return this.get('status') === 'started' || this.get('status') === 'queued' || this.get('status') === 'booting' || this.get('status') === 'received' || this.get('status') === 'created';
}.property('status'),
isEmpty: function() {
if (!this.get('status')) {
return true;
} else {
if (this.get('status') === '') {
return true;
} else {
return false;
}
}
}.property('status')
});

View File

@ -1,7 +0,0 @@
import Ember from 'ember';
export default Ember.TextArea.extend({
click() {
this.get('element').select();
}
});

View File

@ -1,61 +0,0 @@
import Ember from 'ember';
import { format as formatStatusImage } from 'travis/utils/status-image-formats';
import Config from 'travis/config/environment';
export default Ember.Component.extend({
popup: Ember.inject.service(),
auth: Ember.inject.service(),
popupNameBinding: 'popup.popupName',
id: 'status-images',
attributeBindings: ['id'],
classNames: ['popup', 'status-images'],
formats: ['Image URL', 'Markdown', 'Textile', 'Rdoc', 'AsciiDoc', 'RST', 'Pod', 'CCTray'],
branches: function() {
let repoId = this.get('repo.id'),
popupName = this.get('popupName');
if(popupName === 'status-images') {
let array = Ember.ArrayProxy.create({ content: [] }),
apiEndpoint = Config.apiEndpoint,
options = {};
array.set('isLoaded', false);
if (this.get('auth.signedIn')) {
options.headers = {
Authorization: "token " + (this.auth.token())
};
}
$.ajax(apiEndpoint + "/v3/repo/" + repoId + "/branches?limit=100", options).then(function(response) {
if(response.branches.length) {
array.pushObjects(response.branches.map((branch) => { return branch.name; }));
} else {
array.pushObject('master');
}
array.set('isLoaded', true);
});
return array;
} else {
// if status images popup is not open, don't fetch any branches
return [];
}
}.property('popupName', 'repo'),
actions: {
close() {
return this.get('popup').close();
}
},
statusString: function() {
let format = this.get('format') || this.get('formats.firstObject'),
branch = this.get('branch') || 'master';
return formatStatusImage(format, this.get('repo.slug'), branch);
}.property('format', 'repo.slug', 'branch')
});

View File

@ -1,6 +0,0 @@
import Ember from 'ember';
import config from 'travis/config/environment';
export default Ember.Component.extend({
classNames: ['cta-btn']
});

View File

@ -1,10 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ["sync-button"],
actions: {
sync() {
return this.get('user').sync();
}
}
});

View File

@ -1,6 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'li',
classNames: ['team-member']
});

View File

@ -1,3 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({});

View File

@ -1,26 +0,0 @@
import Ember from 'ember';
import config from 'travis/config/environment';
export default Ember.Component.extend({
status: null,
statusPageStatusUrl: function() {
return config.statusPageStatusUrl;
}.property(),
didInsertElement() {
var self, url;
if (url = this.get('statusPageStatusUrl')) {
self = this;
return this.getStatus(url).then(function(response) {
if (response.status && response.status.indicator) {
return self.set('status', response.status.indicator);
}
});
}
},
getStatus(url) {
return $.ajax(url);
}
});

View File

@ -1,26 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'a',
classNames: ['travis-switch', 'switch'],
classNameBindings: ['_active:active'],
_active: function() {
return this.get('target.active') || this.get('active');
}.property('target.active', 'active'),
click() {
var target;
target = this.get('target');
if (this.get('toggleAutomatically') !== 'false') {
if (target) {
this.set('target.active', !this.get('target.active'));
} else {
this.set('active', !this.get('active'));
}
}
return Ember.run.next(this, function() {
return this.sendAction('action', target);
});
}
});

View File

@ -1,21 +0,0 @@
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'span',
classNameBindings: ['small:avatar--small:avatar'],
userInitials: function() {
var name = this.get('name');
var arr = name.split(' ');
var initials = '';
if (arr.length >= 2) {
initials = arr[0].split('')[0] + arr[1].split('')[0];
} else {
initials = arr[0].split('')[0];
}
return initials;
}.property('userInitials')
});

View File

@ -1,85 +0,0 @@
import Ember from 'ember';
export default Ember.Controller.extend({
allHooks: [],
userBinding: 'auth.currentUser',
init() {
var self;
this._super.apply(this, arguments);
self = this;
return Travis.on("user:synced", (function() {
return self.reloadHooks();
}));
},
actions: {
sync() {
return this.get('user').sync();
},
toggle(hook) {
return hook.toggle();
}
},
reloadHooks() {
var hooks, login;
if (login = this.get('model.login')) {
hooks = this.store.query('hook', {
all: true,
owner_name: login
});
hooks.then(function() {
return hooks.set('isLoaded', true);
});
return this.set('allHooks', hooks);
}
},
accountName: function() {
return this.get('model.name') || this.get('model.login');
}.property('model.name', 'model.login'),
hooks: function() {
var hooks;
if (!(hooks = this.get('allHooks'))) {
this.reloadHooks();
}
return this.get('allHooks').filter(function(hook) {
return hook.get('admin');
});
}.property('allHooks.length', 'allHooks'),
hooksWithoutAdmin: function() {
var hooks;
if (!(hooks = this.get('allHooks'))) {
this.reloadHooks();
}
return this.get('allHooks').filter(function(hook) {
return !hook.get('admin');
});
}.property('allHooks.length', 'allHooks'),
showPrivateReposHint: function() {
return this.config.show_repos_hint === 'private';
}.property(),
showPublicReposHint: function() {
return this.config.show_repos_hint === 'public';
}.property(),
billingUrl: function() {
var id;
id = this.get('model.type') === 'user' ? 'user' : this.get('model.login');
return this.config.billingEndpoint + "/subscriptions/" + id;
}.property('model.name', 'model.login'),
subscribeButtonInfo: function() {
return {
billingUrl: this.get('billingUrl'),
subscribed: this.get('model.subscribed'),
education: this.get('model.education')
};
}.property('model.login', 'model.type')
});

View File

@ -1,3 +0,0 @@
import Ember from 'ember';
export default Ember.Controller.extend();

View File

@ -1,6 +0,0 @@
import Ember from 'ember';
export default Ember.Controller.extend({
repos: Ember.inject.controller(),
userBinding: 'auth.currentUser'
});

View File

@ -1,3 +0,0 @@
import Ember from 'ember';
export default Ember.Controller.extend();

View File

@ -1,37 +0,0 @@
import Ember from 'ember';
import GithubUrlProperties from 'travis/mixins/github-url-properties';
export default Ember.Controller.extend({
defaultBranch: function() {
var output, repos;
repos = this.get('model');
output = repos.filter(function(item, index) {
return item.default_branch;
});
if (output.length) {
return output[0];
}
}.property('model'),
branchesExist: function() {
var branches = this.get('model');
return branches.length;
}.property('model'),
activeBranches: function() {
var repos;
repos = this.get('model');
return repos = repos.filter(function(item, index) {
return item.exists_on_github && !item.default_branch;
}).sortBy('last_build.finished_at').reverse();
}.property('model'),
inactiveBranches: function() {
var repos;
repos = this.get('model');
return repos = repos.filter(function(item, index) {
return !item.exists_on_github && !item.default_branch;
}).sortBy('last_build.finished_at').reverse();
}.property('model')
});

View File

@ -1,29 +0,0 @@
import Ember from 'ember';
import GithubUrlProperties from 'travis/mixins/github-url-properties';
export default Ember.Controller.extend(GithubUrlProperties, {
repoController: Ember.inject.controller('repo'),
repoBinding: 'repoController.repo',
commitBinding: 'build.commit',
currentUserBinding: 'auth.currentUser',
tabBinding: 'repoController.tab',
sendFaviconStateChanges: true,
currentItemBinding: 'build',
jobsLoaded: function() {
var jobs;
if (jobs = this.get('build.jobs')) {
return jobs.isEvery('config');
}
}.property('build.jobs.@each.config'),
loading: function() {
return this.get('build.isLoading');
}.property('build.isLoading'),
buildStateDidChange: function() {
if (this.get('sendFaviconStateChanges')) {
return this.send('faviconStateDidChange', this.get('build.state'));
}
}.observes('build.state')
});

View File

@ -1,59 +0,0 @@
import Ember from 'ember';
export default Ember.Controller.extend({
buildsSorting: ['number:desc'],
builds: Ember.computed.sort('model', 'buildsSorting'),
repoController: Ember.inject.controller('repo'),
repoBinding: 'repoController.repo',
tabBinding: 'repoController.tab',
isLoadedBinding: 'model.isLoaded',
isLoadingBinding: 'model.isLoading',
showMore() {
var id, number, type;
id = this.get('repo.id');
number = this.get('builds.lastObject.number');
type = this.get('tab') === "builds" ? 'push' : 'pull_request';
this.olderThanNumber(id, number, type);
},
displayShowMoreButton: function() {
return this.get('tab') !== 'branches' && parseInt(this.get('builds.lastObject.number')) > 1;
}.property('tab', 'builds.lastObject.number'),
displayPullRequests: function() {
return this.get('tab') === 'pull_requests';
}.property('tab'),
displayBranches: function() {
return this.get('tab') === 'branches';
}.property('tab'),
noticeData: function() {
return {
repo: this.get('repo'),
auth: this.auth.token()
};
}.property('repo'),
olderThanNumber(id, number, type) {
var options;
options = {
repository_id: id,
after_number: number
};
if (type != null) {
options.event_type = type.replace(/s$/, '');
if (options.event_type === 'push') {
options.event_type = ['push', 'api'];
}
}
return this.store.query('build', options);
},
actions: {
showMoreBuilds() {
return this.showMore();
}
}
});

View File

@ -1,31 +0,0 @@
import Ember from 'ember';
export default Ember.Controller.extend({
ajax: Ember.inject.service(),
repoController: Ember.inject.controller('repo'),
repo: Ember.computed.alias('repoController.repo'),
isDeleting: false,
cachesExist: function() {
return this.get('model.pushes.length') || this.get('model.pullRequests.length');
}.property('model.pushes.length', 'model.pullRequests.length'),
actions: {
deleteRepoCache() {
var deletingDone, repo;
if (this.get('isDeleting')) {
return;
}
if (confirm('Are you sure?')) {
this.set('isDeleting', true);
deletingDone = () => {
return this.set('isDeleting', false);
};
repo = this.get('repo');
return this.get('ajax').ajax("/repos/" + (this.get('repo.id')) + "/caches", "DELETE").then(deletingDone, deletingDone).then(() => {
return this.set('model', {});
});
}
}
}
});

View File

@ -1,18 +0,0 @@
import Ember from 'ember';
export default Ember.Controller.extend({
sync() {
return this.get('model').sync();
},
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 Ember.getOwner(this).lookup('router:main').send('renderFirstSync');
});
}
}.observes('isSyncing', 'auth.currentUser')
});

View File

@ -1,82 +0,0 @@
import Ember from 'ember';
import config from 'travis/config/environment';
export default Ember.Controller.extend({
queryParams: ['org'],
filter: null,
org: null,
filteredRepositories: function() {
var filter, org, repos;
filter = this.get('filter');
repos = this.get('model');
org = this.get('org');
repos = repos.filter(function(item, index) {
if (item.get('default_branch')) {
return item.get('default_branch.last_build') !== null;
}
}).sortBy('default_branch.last_build.finished_at').reverse();
if (org) {
repos = repos.filter(function(item, index) {
return item.get('owner.login') === org;
});
}
if (Ember.isBlank(filter)) {
return repos;
} else {
return repos.filter(function(item, index) {
return item.slug.match(new RegExp(filter));
});
}
}.property('filter', 'model', 'org'),
updateFilter() {
var value;
value = this.get('_lastFilterValue');
this.transitionToRoute({
queryParams: {
filter: value
}
});
return this.set('filter', value);
},
selectedOrg: function() {
return this.get('orgs').findBy('login', this.get('org'));
}.property('org', 'orgs.[]'),
orgs: function() {
var apiEndpoint, orgs;
orgs = Ember.ArrayProxy.create({
content: [],
isLoading: true
});
apiEndpoint = config.apiEndpoint;
$.ajax(apiEndpoint + '/v3/orgs', {
headers: {
Authorization: 'token ' + this.auth.token()
}
}).then(function(response) {
var array;
array = response.organizations.map(function(org) {
return Ember.Object.create(org);
});
orgs.set('content', array);
return orgs.set('isLoading', false);
});
return orgs;
}.property(),
actions: {
updateFilter(value) {
this.set('_lastFilterValue', value);
return Ember.run.throttle(this, this.updateFilter, [], 200, false);
},
selectOrg(org) {
var login;
login = org ? org.get('login') : null;
return this.set('org', login);
}
}
});

View File

@ -1,15 +0,0 @@
import Ember from 'ember';
export default Ember.Controller.extend({
layoutName: Ember.computed({
get(key) {
if(this._layoutName) {
return 'layouts/' + this._layoutName;
}
},
set(key, value) {
return this._layoutName = value;
}
})
});

View File

@ -1,6 +0,0 @@
import Ember from 'ember';
export default Ember.Controller.extend({
user: Ember.computed.alias('auth.currentUser'),
isSyncing: Ember.computed.alias('user.isSyncing')
});

View File

@ -1,9 +0,0 @@
import Ember from 'ember';
export default Ember.Controller.extend({
flashes: Ember.inject.service(),
loadFlashes() {
return this.get('flashes').loadFlashes(...arguments);
}
});

Some files were not shown because too many files have changed in this diff Show More