Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,15 @@ kbd {
.site-nav__item a:focus, .site-nav__item--active a:focus, .site-nav__item a:hover, .site-nav__item--active a:hover {
background: #2E9625;
color: #F2F4F0; }
.site-nav__item a.disabled, .site-nav__item--active a.disabled {
color: #2E9625;
pointer-events: none;
cursor: default; }

.site-nav__item--active a {
background: #2E9625;
color: #FFFFFF; }
.site-nav__item--active a:focus, .site-nav__item--active a:hover {
.site-nav__item--active a:focus, .site-nav__item--active a:hover, .site-nav__item--active a.disabled {
background: #2E9625;
color: #FFFFFF; }

Expand Down
7 changes: 5 additions & 2 deletions src/js/config/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ define(['es-ui'], function (app) {
.state('app', {
url: '/',
templateUrl: 'index.tpl.html',
abstract: true
//controller: ['$state']
abstract: true,
controller: ['$scope', function($scope) {
$scope.notAdminMessage = 'You must be an admin to view this item';
$scope.projectionsNotRunningMessage = 'Projections are not running on Event Store';
}]
});
}]);
});
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,14 @@ define(['./_module'], function (app) {
msg.failure('projection could not be stopped');
});
};

$scope.goBack = function() {
if($stateParams.fromQueryState) {
$state.go('query', {location: $scope.location});
} else {
$state.go('^.details');
}
}
}
]);
});
26 changes: 18 additions & 8 deletions src/js/modules/projections/controllers/QueryCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ define(['./_module'], function (app) {
// todo: remove State Params if we will not add query for existing queries

return app.controller('QueryCtrl', [
'$scope', '$state', '$stateParams', 'QueryService', 'ProjectionsMonitor', 'MessageService',
function ($scope, $state, $stateParams, queryService, monitor, msg) {
'$scope', '$state', '$stateParams', 'QueryService', 'ProjectionsMonitor', 'MessageService','ProjectionsService',
function ($scope, $state, $stateParams, queryService, monitor, msg, projectionsService) {

var location;
if ($stateParams.location) {
location = $stateParams.location;
projectionsService.query(location).then(function (result) {
$scope.query = result.data.query
});
}

function create () {
var param = {
Expand Down Expand Up @@ -38,7 +44,7 @@ define(['./_module'], function (app) {
ignoreQuery: true,
ignoreResult: true
}).then(null, null, function (data) {
var s, stopped;
var projection, status, stateReason, stopped;

if(data.state) {
$scope.state = data.state;
Expand All @@ -48,10 +54,13 @@ define(['./_module'], function (app) {
}

if(data.statistics && data.statistics.projections.length) {
s = data.statistics.projections[0].status;
$scope.status = s;

stopped = (!!~s.indexOf('Stopped') && !~s.indexOf('Preparing')) || !!~s.indexOf('Faulted') ||!!~s.indexOf('Completed');
projection = data.statistics.projections[0];
status = projection.status;
stateReason = projection.stateReason;
$scope.status = status;
var lines = stateReason.match(/[^\r\n]+/g);
$scope.stateReason = lines !== null && lines.length > 0 ? lines[0] : stateReason;
stopped = (!!~status.indexOf('Stopped') && !~status.indexOf('Preparing')) || !!~status.indexOf('Faulted') ||!!~status.indexOf('Completed');
$scope.isStopped = stopped;
}
});
Expand Down Expand Up @@ -134,7 +143,8 @@ define(['./_module'], function (app) {
queryService.reset(location)
.then(function onQueryReset(){
$state.go('projections.item.debug', {
location: encodeURIComponent(location)
location: encodeURIComponent(location),
fromQueryState : true
}, {
inherit: false
});
Expand Down
4 changes: 2 additions & 2 deletions src/js/modules/projections/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ define(['./_index'], function (app) {
}
})
.state('projections.item.debug', {
url: '/debug',
url: '/debug?fromQueryState',
templateUrl: 'projections.item.debug.tpl.html',
controller: 'ProjectionsItemDebugCtrl',
data: {
Expand All @@ -84,7 +84,7 @@ define(['./_index'], function (app) {

// ========================================QUERY============
.state('query', {
url: 'query',
url: 'query?location',
parent: 'app',
templateUrl: 'query.tpl.html',
controller: 'QueryCtrl',
Expand Down
4 changes: 2 additions & 2 deletions src/js/modules/projections/templates/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ try {
}
module.run(['$templateCache', function($templateCache) {
$templateCache.put('projections.item.debug.tpl.html',
'<header class=page-header><h2 class=page-title>Projection Debug</h2><ul class=page-nav><li class=page-nav__item><button ng-click=runStep() ng-disabled=isRunning>Run Step</button></li><li class=page-nav__item><button ng-click=stop() ng-disabled=!isRunning>Stop</button></li><li class=page-nav__item><button ng-click=update() ng-disabled=isUpdating>Update</button></li><li class=page-nav__item><a ui-sref=^.details>Back</a></li></ul></header><h3>Current Status: <small>{{statusInfo}}</small></h3><div class=container><div class=container-left><h3 class=block-title>Source</h3><div ng-show=queryUpdated><h4>The query has been updated but not saved. Your changes will not take effect until you hit the "Update" button</h4></div><div ui-ace=aceConfig ng-model=query></div></div><div class=container-right><h3 class=block-title>State {{ currentPartition }}</h3><pre>\n' +
'<header class=page-header><h2 class=page-title>Projection Debug</h2><ul class=page-nav><li class=page-nav__item><button ng-click=runStep() ng-disabled=isRunning>Run Step</button></li><li class=page-nav__item><button ng-click=stop() ng-disabled=!isRunning>Stop</button></li><li class=page-nav__item><button ng-click=update() ng-disabled=isUpdating>Update</button></li><li class=page-nav__item><a ng-click=goBack()>Back</a></li></ul></header><h3>Current Status: <small>{{statusInfo}}</small></h3><div class=container><div class=container-left><h3 class=block-title>Source</h3><div ng-show=queryUpdated><h4>The query has been updated but not saved. Your changes will not take effect until you hit the "Update" button</h4></div><div ui-ace=aceConfig ng-model=query></div></div><div class=container-right><h3 class=block-title>State {{ currentPartition }}</h3><pre>\n' +
'{{ state | json }}\n' +
' </pre><h3 class=block-title>Events</h3><div ui-ace=aceEventsConfig readonly=true ng-model=events></div></div></div><div class=container><div class=container-left><div class=block><h3 class=block-title>Instructions</h3><ol><li>Make sure you use the Google Chrome browser.</li><li>Open a debugger (<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>J</kbd> on Windows).</li><li>Check the debugger console for errors (occurred while running the projection definition on while loading state and events).</li><li>Click the ‘Run’ button above.</li><li>Watch for errors in the debugger console</li><li>Check the debugging status on XXXXXXXXX.</li><li>Execution will stop on ‘debugger’ statement immediately before invoking your event handler.</li></ol><p>Any log output and emitted events will appear in the log viewer.</p></div></div><div class=container-right><h3 class=block-title>Log Viewer</h3><div es-proj-debug-frame es-location=location></div></div></div>');
}]);
Expand Down Expand Up @@ -126,7 +126,7 @@ try {
}
module.run(['$templateCache', function($templateCache) {
$templateCache.put('query.tpl.html',
'<header class=page-header><h2 class=page-title>Query</h2><ul class=page-nav><li class=page-nav__item><button ng-click=run()>Run</button></li><li class=page-nav__item><button ng-click=stop() ng-disabled=disableStop()>Break</button></li><li class=page-nav__item><button ng-click=debug() ng-disabled=!isCreated>Debug</button></li></ul></header><h3 ng-visible=status>{{status}}</h3><div class=container><div class=container-left><h3 class=block-title>Source</h3><div ui-ace=aceConfig ng-model=query></div></div><div class=container-right><h3 class=block-title>State</h3><pre>\n' +
'<header class=page-header><h2 class=page-title>Query</h2><ul class=page-nav><li class=page-nav__item><button ng-click=run()>Run</button></li><li class=page-nav__item><button ng-click=stop() ng-disabled=disableStop()>Break</button></li><li class=page-nav__item><button ng-click=debug() ng-disabled=!isCreated>Debug</button></li></ul></header><h3 ng-visible=status>{{status}}<br></h3><i>{{stateReason}}</i><div class=container><div class=container-left><h3 class=block-title>Source</h3><div ui-ace=aceConfig ng-model=query></div></div><div class=container-right><h3 class=block-title>State</h3><pre>\n' +
'{{state | json}}\n' +
' </pre></div></div>');
}]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h2 class="page-title">Projection Debug</h2>
<li class="page-nav__item">
<button ng-click="update()" ng-disabled="isUpdating">Update</button>
</li>
<li class="page-nav__item"><a ui-sref="^.details">Back</a></li>
<li class="page-nav__item"><a ng-click="goBack()">Back</a></li>
</ul>
</header>

Expand Down
3 changes: 2 additions & 1 deletion src/js/modules/projections/views/query.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ <h2 class="page-title">Query</h2>
</header>

<h3 ng-visible="status">
{{status}}
{{status}}<br/>
</h3>
<i>{{stateReason}}</i>

<div class="container">
<div class="container-left">
Expand Down
27 changes: 17 additions & 10 deletions src/js/modules/security/controllers/SignInCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,23 @@ define(['./_module'], function (app) {
$rootScope.esVersion = $rootScope.esVersion == '0.0.0.0' ? 'development build' : $rootScope.esVersion;
$rootScope.projectionsAllowed = info.projectionsMode != 'None';
$rootScope.projectionsMode = info.projectionsMode;
scavengeNotificationService.start();
authService.setCredentials($scope.log.username, $scope.log.password, $scope.log.server);
infoService.getOptions().then(function onGetOptions(response){
var options = response.data;
for (var index in options) {
if(options[index].name == "ClusterSize" && options[index].value > 1){
$rootScope.singleNode = false;
}
}
redirectAfterLoggingIn();

authService.getUserGroups($scope.log.username).then(function(groups) {
authService.setCredentials($scope.log.username, $scope.log.password, $scope.log.server, groups);
if($rootScope.isAdmin) {
scavengeNotificationService.start();
infoService.getOptions().then(function onGetOptions(response){
var options = response.data;
for (var index in options) {
if(options[index].name == "ClusterSize" && options[index].value > 1){
$rootScope.singleNode = false;
}
}
redirectAfterLoggingIn();
});
} else {
redirectAfterLoggingIn();
}
});
})
.error(function () {
Expand Down
38 changes: 22 additions & 16 deletions src/js/modules/streams/controllers/StreamsListCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ define(['./_module'], function (app) {
'use strict';

return app.controller('StreamsListCtrl', [
'$scope', '$state', 'StreamsService',
function ($scope, $state, streamsService) {
'$rootScope', '$scope', '$state', 'StreamsService', 'MessageService',
function ($rootScope, $scope, $state, streamsService, msg) {

function filter (entries) {
var filtered = {}, i = 0, length = entries.length, item, result = [];
Expand All @@ -23,26 +23,32 @@ define(['./_module'], function (app) {
return result;
}

$scope.search = '$all';

$scope.gotoStream = function ($event) {
$event.preventDefault();
$event.stopPropagation();

// todo: do check if stream exists

$state.go('^.item.events', { streamId: $scope.search });
streamsService.checkStreamExists($scope.search).then(function(exists) {
if(exists) {
$state.go('^.item.events', { streamId: $scope.search });
} else {
msg.warn('Could not open stream ' + $scope.search +'. This usually means the stream does not exist or you do not have permission to view it');
}
});
};

streamsService.recentlyChangedStreams()
.success(function (data) {
$scope.changedStreams = filter(data.entries);
});

streamsService.recentlyCreatedStreams()
.success(function (data) {
$scope.createdStreams = filter(data.entries);
});
if($rootScope.isAdmin !== false) {
$scope.search = '$all';

streamsService.recentlyChangedStreams()
.success(function (data) {
$scope.changedStreams = filter(data.entries);
});

streamsService.recentlyCreatedStreams()
.success(function (data) {
$scope.createdStreams = filter(data.entries);
});
}
}
]);
});
Expand Down
10 changes: 10 additions & 0 deletions src/js/modules/streams/services/StreamsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ define(['./_module'], function(app) {
};

return $http.get(url, header);
},
checkStreamExists: function(streamId) {
var deferred = $q.defer();
var url = urlBuilder.build(urls.streams.events, streamId);
$http.get(url).success(function() {
deferred.resolve(true);
}).error(function() {
deferred.resolve(false);
});
return deferred.promise;
}
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/js/modules/streams/templates/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ try {
}
module.run(['$templateCache', function($templateCache) {
$templateCache.put('streams.item.tpl.html',
'<header class=page-header><h2 class=page-title>Event Stream \'{{ streamId }}\'</h2><ul class=page-nav><li class=page-nav__item><a ng-class="{highlight: isPolling == false}" ng-click=togglePause() ng-show=headOfStream>{{ isPolling == true ? \'Pause\' : \'Resume\' }}</a></li><li class=page-nav__item><a ui-sref=.acl ng-show="streamId !== \'$all\'">Edit ACL</a></li><li class=page-nav__item><a ui-sref=^.list>Back</a></li></ul></header><ul style="list-style-type: none; padding:0 0 0.75rem 0 !important"><li class=page-nav__item ng-repeat="link in links"><a ng-href={{link.uri}}>{{ link.relation }}</a></li></ul><br><div ui-view es-link-header></div>');
'<header class=page-header><h2 class=page-title>Event Stream \'{{ streamId }}\'</h2><ul class=page-nav><li class=page-nav__item><a ng-class="{highlight: isPolling == false}" ng-click=togglePause() ng-show=headOfStream>{{ isPolling == true ? \'Pause\' : \'Resume\' }}</a></li><li class=page-nav__item><a ui-sref=.acl ng-show="streamId !== \'$all\' && isAdmin">Edit ACL</a></li><li class=page-nav__item><a ui-sref=^.list>Back</a></li></ul></header><ul style="list-style-type: none; padding:0 0 0.75rem 0 !important"><li class=page-nav__item ng-repeat="link in links"><a ng-href={{link.uri}}>{{ link.relation }}</a></li></ul><br><div ui-view es-link-header></div>');
}]);
})();

Expand All @@ -66,7 +66,7 @@ try {
}
module.run(['$templateCache', function($templateCache) {
$templateCache.put('streams.list.tpl.html',
'<header class=page-header><h2 class=page-title>Stream Browser</h2><ul class=page-nav><li class=page-nav__item><form><input ui-keypress="{\'enter\': \'gotoStream($event)\'}" ng-model="search"></form></li></ul></header><div class=container><div class=container-left><table><thead><tr><th>Recently Created Streams</th></tr></thead><tbody><tr ng-repeat="stream in createdStreams"><td><a ui-sref="^.item.events({streamId: stream.streamId})">{{ stream.streamId }}</a></td></tr><tr ng-hide=createdStreams><td><em>No recently created streams</em></td></tr></tbody></table></div><div class=container-right><table><thead><tr><th>Recently Changed Streams</th></tr></thead><tbody><tr ng-repeat="stream in changedStreams"><td><a ui-sref="^.item.events({streamId: stream.streamId})">{{ stream.streamId }}</a></td></tr><tr ng-hide=changedStreams><td><em>No recently changed streams</em></td></tr></tbody></table></div></div>');
'<header class=page-header><h2 class=page-title>Stream Browser</h2><ul class=page-nav><li class=page-nav__item><form><input ui-keypress="{\'enter\': \'gotoStream($event)\'}" ng-model=search placeholder="Search for stream"></form></li></ul></header><div ng-if=isAdmin class=container><div class=container-left><table><thead><tr><th>Recently Created Streams</th></tr></thead><tbody><tr ng-repeat="stream in createdStreams"><td><a ui-sref="^.item.events({streamId: stream.streamId})">{{ stream.streamId }}</a></td></tr><tr ng-hide=createdStreams><td><em>No recently created streams</em></td></tr></tbody></table></div><div class=container-right><table><thead><tr><th>Recently Changed Streams</th></tr></thead><tbody><tr ng-repeat="stream in changedStreams"><td><a ui-sref="^.item.events({streamId: stream.streamId})">{{ stream.streamId }}</a></td></tr><tr ng-hide=changedStreams><td><em>No recently changed streams</em></td></tr></tbody></table></div></div><em ng-if=!isAdmin>You must be an admin to view recently created streams</em>');
}]);
})();

Expand Down
2 changes: 1 addition & 1 deletion src/js/modules/streams/views/streams.item.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h2 class="page-title">Event Stream '{{ streamId }}'</h2>
<a ng-class="{highlight: isPolling == false}" ng-click="togglePause()" ng-show="headOfStream">{{ isPolling == true ? 'Pause' : 'Resume' }}</a>
</li>
<li class="page-nav__item">
<a ui-sref=".acl" ng-show="streamId !== '$all'">Edit ACL</a>
<a ui-sref=".acl" ng-show="streamId !== '$all' && isAdmin">Edit ACL</a>
</li>
<li class="page-nav__item">
<a ui-sref="^.list">Back</a>
Expand Down
5 changes: 3 additions & 2 deletions src/js/modules/streams/views/streams.list.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ <h2 class="page-title">Stream Browser</h2>
<ul class="page-nav">
<li class="page-nav__item">
<form>
<input type="text" ui-keypress="{'enter': 'gotoStream($event)'}" ng-model="search" />
<input type="text" ui-keypress="{'enter': 'gotoStream($event)'}" ng-model="search" placeholder="Search for stream"/>
</form>
</li>
</ul>
</header>
<div class="container">
<div ng-if="isAdmin" class="container">
<div class="container-left">
<table>
<thead>
Expand Down Expand Up @@ -56,3 +56,4 @@ <h2 class="page-title">Stream Browser</h2>
</table>
</div>
</div>
<em ng-if="!isAdmin">You must be an admin to view recently created streams</em>
18 changes: 10 additions & 8 deletions src/js/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ define(['es-ui'], function (app) {
$rootScope.esVersion = $rootScope.esVersion == '0.0.0.0' ? 'development build' : $rootScope.esVersion;
$rootScope.projectionsAllowed = info.projectionsMode != 'None';
$rootScope.projectionsMode = info.projectionsMode;
scavengeNotificationService.start();
infoService.getOptions().then(function onGetOptions(response){
var options = response.data;
for (var index in options) {
if(options[index].name == "ClusterSize" && options[index].value > 1){
$rootScope.singleNode = false;
if($rootScope.isAdmin) {
scavengeNotificationService.start();
infoService.getOptions().then(function onGetOptions(response){
var options = response.data;
for (var index in options) {
if(options[index].name == "ClusterSize" && options[index].value > 1){
$rootScope.singleNode = false;
}
}
}
});
});
}
});
}, function () {
$rootScope.previousUrl = $location.$$path;
Expand Down
Loading