-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
Showing
42 changed files
with
6,140 additions
and
1,377 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,14 @@ | ||
let Clockwork = angular.module('Clockwork', []) | ||
let Clockwork = angular.module('Clockwork', [ 'chart.js', 'ngclipboard' ]) | ||
.config([ '$compileProvider', ($compileProvider) => { | ||
$compileProvider.debugInfoEnabled(false) | ||
$compileProvider.commentDirectivesEnabled(false) | ||
} ]) | ||
.factory('filter', [ '$timeout', ($timeout) => { | ||
return { | ||
create (tags, mapValue) { return new Filter(tags, mapValue, $timeout) } | ||
} | ||
} ]) | ||
.factory('profiler', [ 'requests', requests => new Profiler(requests) ]) | ||
.factory('requests', () => new Requests) | ||
.factory('updateNotification', () => new UpdateNotification) | ||
.filter('profilerMetric', [ 'profiler', profiler => profiler.metricFilter() ]) |
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,42 @@ | ||
class Authentication | ||
{ | ||
constructor ($scope, $q, requests) { | ||
this.$scope = $scope | ||
this.$q = $q | ||
this.requests = requests | ||
} | ||
|
||
attempt () { | ||
let data = { username: this.username, password: this.password } | ||
|
||
this.username = this.password = '' | ||
this.failed = false | ||
|
||
return this.requests.client('POST', `${this.requests.remoteUrl}auth`, data).then(data => { | ||
this.shown = false | ||
|
||
this.requests.setAuthenticationToken(data.token) | ||
|
||
this.requests.items.forEach(request => { | ||
if (request.error && request.error.error == 'requires-authentication') { | ||
return this.requests.loadId(request.id) | ||
} | ||
}) | ||
|
||
this.accept() | ||
}).catch(e => { | ||
this.failed = true | ||
}) | ||
} | ||
|
||
request (message, requires) { | ||
this.shown = true | ||
this.requires = requires | ||
this.message = message | ||
|
||
return this.$q((accept, reject) => { | ||
this.accept = accept | ||
this.reject = reject | ||
}) | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
Clockwork/Web/public/assets/javascripts/directives/load-more-requests.js
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Clockwork.directive('loadMoreRequests', function ($parse) { | ||
return function (scope, element, attrs) { | ||
$(element).scrollTop($('.load-more').height() + 1) | ||
element[0].scrollTop = document.querySelector('.load-more').offsetHeight + 1 | ||
} | ||
}) |
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
24 changes: 0 additions & 24 deletions
24
Clockwork/Web/public/assets/javascripts/directives/resizable-columns.js
This file was deleted.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
Clockwork/Web/public/assets/javascripts/directives/scroll-to-new.js
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
Clockwork.directive('scrollToNew', function ($parse) { | ||
return function(scope, element, attrs) { | ||
if (scope.showIncomingRequests && scope.$last) { | ||
var $container = $(element).parents('.requests-container').first() | ||
var $parent = $(element).parent() | ||
let container = document.querySelector('.requests-container') | ||
let parent = element[0].parentNode | ||
|
||
$container.scrollTop($parent.height()) | ||
container.scrollTop = parent.offsetHeight | ||
} | ||
} | ||
}) |
4 changes: 2 additions & 2 deletions
4
Clockwork/Web/public/assets/javascripts/directives/shortened-text.js
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
21 changes: 21 additions & 0 deletions
21
Clockwork/Web/public/assets/javascripts/directives/stack-trace.js
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,21 @@ | ||
Clockwork.directive('stackTrace', function ($parse) { | ||
return { | ||
restrict: 'E', | ||
transclude: false, | ||
scope: { trace: '=trace', shortPath: '=shortPath', fullPath: '=fullPath' }, | ||
templateUrl: 'assets/partials/stack-trace.html', | ||
controller: function ($scope, $element) { | ||
$scope.showPopover = false | ||
|
||
$scope.togglePopover = function () { | ||
$scope.showPopover = ! $scope.showPopover | ||
|
||
let popoverContainerEl = $element[0].querySelector('.popover-container') | ||
let popoverEl = $element[0].querySelector('.popover') | ||
if (window.innerWidth - popoverContainerEl.getBoundingClientRect().left < 300) { | ||
popoverEl.classList.add('right-aligned') | ||
} | ||
} | ||
} | ||
} | ||
}) |
7 changes: 0 additions & 7 deletions
7
Clockwork/Web/public/assets/javascripts/directives/stupid-table.js
This file was deleted.
Oops, something went wrong.
33 changes: 24 additions & 9 deletions
33
Clockwork/Web/public/assets/javascripts/directives/tabs.js
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 |
---|---|---|
@@ -1,18 +1,33 @@ | ||
Clockwork.directive('tabs', function ($parse) { | ||
return { | ||
link: function (scope, element, attrs) { | ||
$(element).find('[tab-name]').on('click', function () { | ||
let tabs = $(this).parents('[tabs]') | ||
let tabName = $(this).attr('tab-name') | ||
let tabs = element[0] | ||
let namespace = tabs.getAttribute('tabs') | ||
let namespacePrefix = namespace ? `${namespace}.` : '' | ||
|
||
tabs.find('[tab-name]').removeClass('active') | ||
$(this).addClass('active') | ||
let attributeStartsWith = (attribute, prefix) => { | ||
return (element) => element.getAttribute(attribute).startsWith(prefix) | ||
} | ||
|
||
tabs.find('[tab-content]').hide() | ||
tabs.find('[tab-content="' + tabName + '"]').show() | ||
}) | ||
let showTab = (tabEl) => { | ||
let tabName = tabEl.getAttribute('tab-name') | ||
|
||
$(element).find('[tab-name].active').click() | ||
if (! tabEl.getAttribute('tab-name')) return | ||
|
||
if (namespace && ! tabName.startsWith(namespacePrefix)) return | ||
|
||
tabs.querySelectorAll(`[tab-name^="${namespacePrefix}"]`) | ||
.forEach(el => el.classList.remove('active')) | ||
tabEl.classList.add('active') | ||
|
||
tabs.querySelectorAll(`[tab-content^="${namespacePrefix}"]`) | ||
.forEach(el => el.style.display = 'none') | ||
tabs.querySelector(`[tab-content="${tabName}"]`).style.display = 'block' | ||
} | ||
|
||
tabs.addEventListener('click', ev => showTab(ev.target)) | ||
|
||
showTab(tabs.querySelector(`[tab-name^="${namespacePrefix}"].active`)) | ||
} | ||
} | ||
}) |
Oops, something went wrong.