-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b27963d
Showing
15 changed files
with
453 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"directory": "source/bower_components", | ||
"interactive": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*.md] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# nodejs | ||
# ------ | ||
# Dependency directory | ||
# Commenting this out is preferred by some people, see | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- | ||
node_modules | ||
npm-debug.log | ||
|
||
# bower | ||
# ----- | ||
source/bower_components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"globalstrict": true, | ||
"globals": { | ||
"afterEach": false, | ||
"angular": false, | ||
"beforeEach": false, | ||
"console": false, | ||
"describe": false, | ||
"document": false, | ||
"expect": false, | ||
"inject": false, | ||
"it": false, | ||
"module": false, | ||
"window": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: node_modules/http-server/bin/http-server source -p $PORT -c-1 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "circleboard", | ||
"description": "circleboard", | ||
"version": "0.1.0", | ||
"private": true, | ||
"license": "proprietary", | ||
"dependencies": { | ||
"angular": "~1.4", | ||
"angular-loader": "~1.4", | ||
"angular-mocks": "~1.4", | ||
"angular-route": "~1.4", | ||
"angular-translate": "~2.7", | ||
"animate.css": "~3.4.0" | ||
}, | ||
"devDependencies": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "circleboard", | ||
"version": "2.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"postinstall": "node_modules/bower/bin/bower install;", | ||
"prestart": "npm install", | ||
"start": "node_modules/http-server/bin/http-server source -p 8000 -c-1" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Marcel Eichner", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"license": "ISC", | ||
"dependencies": { | ||
"bower": "^1.5.3", | ||
"http-server": "^0.8.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" class="no-js" ng-app="m3App"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<title>CircleStatus</title> | ||
<meta name="description" content=""> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.5/cyborg/bootstrap.min.css"> | ||
<link rel="stylesheet" href="bower_components/animate.css/animate.min.css"> | ||
</head> | ||
<body style="padding-top: 70px;"> | ||
|
||
<noscript> | ||
<p class="alert alert-danger"> | ||
You are seeing this message as your browser does not support javascript | ||
or you have disabled it. What a shame. This web-application uses javascript | ||
to function. Please enable javascript if possible. | ||
</p> | ||
</noscript> | ||
|
||
<nav class="navbar navbar-default navbar-fixed-top"> | ||
<div class="container-fluid"> | ||
<a class="pull-left navbar-brand" href="/#/"> | ||
CircleBoard | ||
</a> | ||
<div class="btn-toolbar pull-right navbar-btn"> | ||
<div class="btn-group navbar-btn"> | ||
<a class="btn btn-default " ng-click="increaseFontSize()"> | ||
<i class="glyphicon glyphicon-plus-sign"></i> | ||
</a> | ||
<a class="btn btn-default" ng-click="decreaseFontSize()"> | ||
<i class="glyphicon glyphicon-minus-sign"></i> | ||
</a> | ||
</div> | ||
<a class="btn btn-default navbar-btn" href="/#/config"> | ||
<i class="glyphicon glyphicon-cog"></i> | ||
</a> | ||
</div> | ||
</div> | ||
</nav> | ||
|
||
<div class="container-fluid"> | ||
<div ng-view="" id="ng-view"></div> | ||
</div> | ||
|
||
<script src="bower_components/angular/angular.js"></script> | ||
<script src="bower_components/angular-route/angular-route.js"></script> | ||
|
||
<script src="scripts/App.js"></script> | ||
<script src="scripts/Config.js"></script> | ||
<script src="scripts/AppController.js"></script> | ||
<script src="scripts/ConfigController.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
'use strict'; | ||
|
||
// Declare app level module which depends on views, and components | ||
var app = angular.module('m3App', [ | ||
'ngRoute', | ||
]); | ||
|
||
app.config(['$routeProvider', function($routeProvider) { | ||
|
||
var viewBase = '/views'; | ||
|
||
$routeProvider | ||
.when('/', { | ||
controller: 'AppController', | ||
templateUrl: viewBase + '/main.html' | ||
}) | ||
.when('/config', { | ||
controller: 'ConfigController', | ||
templateUrl: viewBase + '/config.html' | ||
}) | ||
; | ||
|
||
}]); | ||
|
||
app.run(function($rootScope, $location, $http, $log, Config) { | ||
|
||
$rootScope.setFontSize = function(sizePixel) { | ||
$log.info('Setting font size to %dpx', sizePixel); | ||
var bodyElm = document.querySelector('body'); | ||
bodyElm.style.fontSize = sizePixel + "px"; | ||
}; | ||
$rootScope.increaseFontSize = function() { | ||
if (!Config.fontSize) { | ||
Config.fontSize = 12; | ||
} | ||
Config.fontSize += 1; | ||
Config.save(); | ||
$log.info('Increase font size to ', Config.fontSize); | ||
$rootScope.setFontSize(Config.fontSize); | ||
}; | ||
$rootScope.decreaseFontSize = function() { | ||
if (!Config.fontSize) { | ||
Config.fontSize = 12; | ||
} | ||
Config.fontSize -= 1; | ||
Config.save(); | ||
$log.info('Decrease font size to ', Config.fontSize); | ||
$rootScope.setFontSize(Config.fontSize); | ||
}; | ||
|
||
if (Config.fontSize) { | ||
$rootScope.setFontSize(Config.fontSize); | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
'use strict'; | ||
|
||
(function() { | ||
|
||
angular | ||
.module('m3App') | ||
.controller('AppController', AppController); | ||
|
||
AppController.$inject = [ | ||
'$rootScope', | ||
'$scope', | ||
'$log', | ||
'$http', | ||
'$q', | ||
'Config' | ||
]; | ||
|
||
function AppController( | ||
$rootScope, | ||
$scope, | ||
$log, | ||
$http, | ||
$q, | ||
Config | ||
) { | ||
|
||
var APITOKEN = Config.apiToken; | ||
var REFRESH_INTERVAL = Config.refreshInterval; | ||
|
||
$scope.builds = []; | ||
$scope.countdown = 1; | ||
$scope.config = Config; | ||
|
||
// https://circleci.com/docs/api#recent-builds-project | ||
function fetchRecentBuilds() { | ||
var deferred = $q.defer(); | ||
var url = 'https://circleci.com/api/v1/recent-builds'; | ||
var options = { | ||
params: { | ||
'circle-token': APITOKEN | ||
} | ||
}; | ||
$http.get(url, options) | ||
.success(function(response) { | ||
deferred.resolve(response); | ||
}) | ||
.error(function(err) { | ||
$log.error(err); | ||
deferred.reject(err); | ||
}); | ||
return deferred.promise; | ||
} | ||
|
||
function update() { | ||
$log.info('starting an update'); | ||
fetchRecentBuilds().then(function(builds) { | ||
$scope.builds = builds; | ||
}); | ||
} | ||
|
||
$scope.refreshInterval = null; | ||
function startPolling() { | ||
$log.info('polling started'); | ||
// countdown | ||
$scope.refreshInterval = window.setInterval(function() { | ||
$scope.countdown--; | ||
$log.info('%d seconds left till refresh', $scope.countdown); | ||
if ($scope.countdown < 0) { | ||
update(); | ||
$scope.countdown = REFRESH_INTERVAL; | ||
} | ||
$scope.$apply(); | ||
}, 1000); | ||
} | ||
function stopPolling() { | ||
$log.info('polling stopped'); | ||
if ($scope.refreshInterval) { | ||
window.clearInterval($scope.refreshInterval); | ||
} | ||
} | ||
|
||
if (Config.apiToken) { | ||
$log.info('apiToken found, start polling'); | ||
startPolling(); | ||
} | ||
|
||
} | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use strict'; | ||
|
||
(function() { | ||
|
||
angular | ||
.module('m3App') | ||
.factory('Config', ConfigFactory); | ||
|
||
ConfigFactory.$inject = [ | ||
]; | ||
|
||
function ConfigFactory($rootScope) { | ||
|
||
// default configuration | ||
var defaults = { | ||
apiToken: null, | ||
refreshInterval: 30 | ||
}; | ||
|
||
function Config(prefix) { | ||
|
||
prefix = prefix || 'config'; | ||
|
||
var storage = window.localStorage; | ||
|
||
var storageContents = JSON.parse(storage.getItem(prefix)); | ||
angular.extend(this, angular.extend(defaults, storageContents)); | ||
|
||
// make sure the interval isn’t to low | ||
if (this.refreshInterval < 20) { | ||
this.refreshInterval = 20; | ||
} | ||
|
||
this.save = function() { | ||
storage.setItem(prefix, JSON.stringify(this)); | ||
}; | ||
this.reset = function() { | ||
storage.setItem(prefix, JSON.stringify(defaults)); | ||
}; | ||
} | ||
|
||
return new Config('circleboard'); | ||
} | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict'; | ||
|
||
(function() { | ||
|
||
angular | ||
.module('m3App') | ||
.controller('ConfigController', ConfigController); | ||
|
||
ConfigController.$inject = [ | ||
'$rootScope', | ||
'$scope', | ||
'$log', | ||
'Config' | ||
]; | ||
|
||
function ConfigController( | ||
$rootScope, | ||
$scope, | ||
$log, | ||
Config | ||
) { | ||
|
||
$scope.config = Config; | ||
|
||
$scope.save = function() { | ||
$log.log('saving config', Config); | ||
$scope.config.save(); | ||
}; | ||
|
||
} | ||
|
||
})(); |
Oops, something went wrong.