Skip to content

Commit 3256c81

Browse files
author
James Geall
authored
Merge pull request #244 from EventStore/use-login-endpoint
Use login endpoint
2 parents fca39bc + 89e1f4d commit 3256c81

File tree

12 files changed

+28
-20
lines changed

12 files changed

+28
-20
lines changed

src/js/config/urls.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ define(['es-ui'], function (app) {
1010
replicationStats: '/stats/replication',
1111
admin: {
1212
shutdown: '/admin/shutdown',
13-
scavenge: '/admin/scavenge'
13+
scavenge: '/admin/scavenge',
14+
login: '/admin/login'
1415
},
1516
gossip: '/gossip',
1617
users: {

src/js/modules/clusterstatus/templates/templates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ try {
66
}
77
module.run(['$templateCache', function($templateCache) {
88
$templateCache.put('clusterstatus.list.tpl.html',
9-
'<header class=page-header><h2 class=page-title>Cluster Status</h2><ul class=page-nav><li class=page-nav__item><a ui-sref=^.snapshot>Snapshot</a></li></ul></header><div class=last-updated>Last updated: <span>{{ lastUpdatedTime | date : \'yyyy-MM-d HH:mm:ss\' }}</span></div><div><table class=table-nodes><thead><tr><th>State</th><th>Status</th><th>Timestamp (UTC)</th><th>Checkpoints</th><th>Tcp</th><th>Http</th><th>Actions</th></tr><tr><th></th><th></th><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody><tr ng-repeat="node in nodes" ng-class="{dead: !node.isAlive}"><td><text ng-if="node.state == \'Leader\'"><b>{{ node.state }}</b></text><text ng-if="node.state == \'Manager\'" style=color:lightgray>{{ node.state }}</text><text ng-if="node.state != \'Leader\' && node.state != \'Manager\'">{{ node.state }}</text></td><td ng-class="{dead: !node.isAlive}"><text ng-if=node.isAlive>Alive</text><text ng-if=!node.isAlive>Dead</text></td><td>{{ node.timeStamp | date : \'yyyy-MM-d HH:mm:ss\' }}</td><td><text ng-if="node.state == \'Manager\'">n/a</text><text ng-if="node.state != \'Manager\'">L{{ node.lastCommitPosition}} / W {{node.writerCheckpoint}} / C {{node.chaserCheckpoint}}<br>E{{ node.epochNumber }} @ {{ node.epochPosition }} : { {{ node.epochId }} }</text></td><td>Internal : {{ node.internalTcpIp }}:{{ node.internalTcpPort }}<br>External : {{ node.externalTcpIp }}:{{ node.externalTcpPort }}</td><td>Internal : {{ node.internalHttpIp }}:{{ node.internalHttpPort }}<br>External : {{ node.externalHttpIp }}:{{ node.externalHttpPort }}</td><td style=text-align:center;><ul class=page-nav><li class=page-nav__item><a ng-href=//{{node.externalHttpIp}}:{{node.externalHttpPort}}/ping target=_blank>ping</a></li><li class=page-nav__item><a ng-href=//{{node.externalHttpIp}}:{{node.externalHttpPort}} target=_blank>show website</a></li><li class=page-nav__item><a ng-href=//{{node.internalHttpIp}}:{{node.internalHttpPort}}/gossip target=_blank>show gossip</a></li></ul></td></tr><tr ng-hide=nodes><td colspan=9><em>No nodes in the cluster</em></td></tr></tbody></table><br><div ng-show="replicas.length > 0"><br><header class=page-header><h2 class=page-title>Replica Status</h2></header><table class=table-nodes><thead><tr><th>Replica Endpoint</th><th>Total Sent (bytes)</th><th>Total Received (bytes)</th><th>Pending Send (bytes)</th><th>Pending Receive (bytes)</th><th>Send Queue Size</th><th>To Catch Up (bytes)</th><th>Transfer Speed (bytes/second)</th><th>Estimated Time</th></tr></thead><tbody><tr ng-repeat="replica in replicas"><td>{{replica.subscriptionEndpoint}}</td><td>{{replica.totalBytesSent | number}}</td><td>{{replica.totalBytesReceived | number}}</td><td>{{replica.pendingSendBytes | number}}</td><td>{{replica.pendingReceivedBytes | number}}</td><td>{{replica.sendQueueSize | number}}</td><td ng-if=!replica.isCatchingUp colspan=3>Caught Up</td><td ng-if=replica.isCatchingUp>{{replica.bytesToCatchUp | number}}</td><td ng-if=replica.isCatchingUp>{{replica.approxSpeed | number}}</td><td ng-if=replica.isCatchingUp>{{replica.estimatedTime}}</td></tr></tbody></table></div></div><script>function selectText(element) {\n' +
9+
'<header class=page-header><h2 class=page-title>Cluster Status</h2><ul class=page-nav><li class=page-nav__item><a ui-sref=^.snapshot>Snapshot</a></li></ul></header><div class=last-updated>Last updated: <span>{{ lastUpdatedTime | date : \'yyyy-MM-d HH:mm:ss\' }}</span></div><div><table class=table-nodes><thead><tr><th>State</th><th>Status</th><th>Timestamp (UTC)</th><th>Checkpoints</th><th>Tcp</th><th>Http</th><th>Actions</th></tr><tr><th></th><th></th><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody><tr ng-repeat="node in nodes" ng-class="{dead: !node.isAlive}"><td><text ng-if="node.state == \'Leader\'"><b>{{ node.state }}</b></text><text ng-if="node.state == \'Manager\'" style=color:lightgray>{{ node.state }}</text><text ng-if="node.state != \'Leader\' && node.state != \'Manager\'">{{ node.state }}</text></td><td ng-class="{dead: !node.isAlive}"><text ng-if=node.isAlive>Alive</text><text ng-if=!node.isAlive>Dead</text></td><td>{{ node.timeStamp | date : \'yyyy-MM-d HH:mm:ss\' }}</td><td><text ng-if="node.state == \'Manager\'">n/a</text><text ng-if="node.state != \'Manager\'">L{{ node.lastCommitPosition}} / W {{node.writerCheckpoint}} / C {{node.chaserCheckpoint}}<br>E{{ node.epochNumber }} @ {{ node.epochPosition }} : { {{ node.epochId }} }</text></td><td>Internal : {{ node.internalTcpIp }}:{{ node.internalTcpPort }}<br>External : {{ node.externalTcpIp }}:{{ node.externalTcpPort }}</td><td>Internal : {{ node.internalHttpIp }}:{{ node.internalHttpPort }}<br>External : {{ node.externalHttpIp }}:{{ node.externalHttpPort }}</td><td style=text-align:center;><ul class=page-nav><li class=page-nav__item><a ng-href="//{{node.externalHttpIp}}:{{node.externalHttpPort}}/ping?format=json" target=_blank>ping</a></li><li class=page-nav__item><a ng-href=//{{node.externalHttpIp}}:{{node.externalHttpPort}} target=_blank>show website</a></li><li class=page-nav__item><a ng-href="//{{node.externalHttpIp}}:{{node.externalHttpPort}}/gossip?format=json" target=_blank>show gossip</a></li></ul></td></tr><tr ng-hide=nodes><td colspan=9><em>No nodes in the cluster</em></td></tr></tbody></table><br><div ng-show="replicas.length > 0"><br><header class=page-header><h2 class=page-title>Replica Status</h2></header><table class=table-nodes><thead><tr><th>Replica Endpoint</th><th>Total Sent (bytes)</th><th>Total Received (bytes)</th><th>Pending Send (bytes)</th><th>Pending Receive (bytes)</th><th>Send Queue Size</th><th>To Catch Up (bytes)</th><th>Transfer Speed (bytes/second)</th><th>Estimated Time</th></tr></thead><tbody><tr ng-repeat="replica in replicas"><td>{{replica.subscriptionEndpoint}}</td><td>{{replica.totalBytesSent | number}}</td><td>{{replica.totalBytesReceived | number}}</td><td>{{replica.pendingSendBytes | number}}</td><td>{{replica.pendingReceivedBytes | number}}</td><td>{{replica.sendQueueSize | number}}</td><td ng-if=!replica.isCatchingUp colspan=3>Caught Up</td><td ng-if=replica.isCatchingUp>{{replica.bytesToCatchUp | number}}</td><td ng-if=replica.isCatchingUp>{{replica.approxSpeed | number}}</td><td ng-if=replica.isCatchingUp>{{replica.estimatedTime}}</td></tr></tbody></table></div></div><script>function selectText(element) {\n' +
1010
' var doc = document\n' +
1111
' , text = doc.getElementById(element)\n' +
1212
' , range\n' +

src/js/modules/projections/controllers/ProjectionsListCtrl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ define(['./_module'], function (app) {
66
'$rootScope', '$scope', '$timeout', 'ProjectionsService', 'ProjectionsMapper', 'poller', 'MessageService', '$state',
77
function ($rootScope, $scope, $timeout, projectionsService, projectionsMapper, pollerProvider, msg, $state) {
88

9-
if($rootScope.projectionsMode === 'None') {
9+
if(!$rootScope.projectionsEnabled) {
1010
msg.failure('Projections are not enabled on the node');
1111
$state.go('dashboard.list');
1212
return;

src/js/modules/security/controllers/SignInCtrl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ define(['./_module'], function (app) {
2727
$rootScope.singleNode = true;
2828
$rootScope.esVersion = info.esVersion || '0.0.0.0';
2929
$rootScope.esVersion = $rootScope.esVersion === '0.0.0.0' ? 'development build' : $rootScope.esVersion;
30-
$rootScope.projectionsAllowed = info.projectionsMode !== 'None';
31-
$rootScope.projectionsMode = info.projectionsMode;
30+
$rootScope.projectionsEnabled = info.features.projections === true;
31+
$rootScope.userManagementEnabled = info.features.userManagement === true;
3232

3333
authService.getUserGroups($scope.log.username).then(function(groups) {
3434
authService.setCredentials($scope.log.username, $scope.log.password, $scope.log.server, groups);

src/js/modules/streams/templates/templates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ try {
6666
}
6767
module.run(['$templateCache', function($templateCache) {
6868
$templateCache.put('streams.item.tpl.html',
69-
'<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=.addStreamEvent ng-show="streamId.indexOf(\'$\') !== 0">Add Event</a></li><li class=page-nav__item><a ng-click=deleteStream()>Delete</a></li><li ng-if=projectionsAllowed class=page-nav__item><a ui-sref="query({ initStreamId: streamId })">Query</a></li><li class=page-nav__item><a ui-sref=subscriptions.list ng-show="source == \'persistentSubscriptions\'">Back</a> <a ui-sref=^.list ng-show="source == undefined">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>');
69+
'<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=.addStreamEvent ng-show="streamId.indexOf(\'$\') !== 0">Add Event</a></li><li class=page-nav__item><a ng-click=deleteStream()>Delete</a></li><li ng-if=projectionsEnabled class=page-nav__item><a ui-sref="query({ initStreamId: streamId })">Query</a></li><li class=page-nav__item><a ui-sref=subscriptions.list ng-show="source == \'persistentSubscriptions\'">Back</a> <a ui-sref=^.list ng-show="source == undefined">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>');
7070
}]);
7171
})();
7272

src/js/modules/streams/views/streams.item.tpl.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ <h2 class="page-title">Event Stream '{{ streamId }}'</h2>
1313
<li class="page-nav__item">
1414
<a ng-click="deleteStream()">Delete</a>
1515
</li>
16-
<li ng-if="projectionsAllowed" class="page-nav__item">
16+
<li ng-if="projectionsEnabled" class="page-nav__item">
1717
<a ui-sref="query({ initStreamId: streamId })">Query</a>
1818
</li>
1919
<li class="page-nav__item">

src/js/modules/users/controllers/UsersListCtrl.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ define(['./_module'], function (app) {
55
return app.controller('UsersListCtrl', [
66
'$scope', 'UserService', 'poller', 'MessageService',
77
function ($scope, userService, poller, msg) {
8+
if(!$rootScope.userManagementEnabled) {
9+
msg.failure('User Management is not available');
10+
$state.go('dashboard.list');
11+
return;
12+
}
813

914
var all = poller.create({
1015
interval: 1000,

src/js/run.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ define(['es-ui'], function (app) {
1010
return app.run([
1111
'$rootScope', '$location', '$state', '$stateParams', 'AuthService', 'InfoService', 'ScavengeNotificationService',
1212
function ($rootScope, $location, $state, $stateParams, authService, infoService, scavengeNotificationService) {
13-
$rootScope.projectionsAllowed = false;
13+
$rootScope.projectionsEnabled = false;
14+
$rootScope.userManagementEnabled = false;
1415
$rootScope.singleNode = true;
1516
var log = {
1617
username: '',
@@ -28,8 +29,9 @@ define(['es-ui'], function (app) {
2829
.success(function(info){
2930
$rootScope.esVersion = info.esVersion || '0.0.0.0';
3031
$rootScope.esVersion = $rootScope.esVersion === '0.0.0.0' ? 'development build' : $rootScope.esVersion;
31-
$rootScope.projectionsAllowed = info.projectionsMode !== 'None';
32-
$rootScope.projectionsMode = info.projectionsMode;
32+
$rootScope.projectionsEnabled = info.features.projections === true;
33+
$rootScope.userManagementEnabled = info.features.userManagement === true;
34+
3335
if($rootScope.isAdminOrOps) {
3436
scavengeNotificationService.start();
3537
infoService.getOptions().then(function onGetOptions(response){

src/js/services/AuthService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ define(['./_module'], function (app) {
164164
},
165165
getUserGroups: function(username) {
166166
var deferred = $q.defer();
167-
$http.get(urlBuilder.build(urls.users.current, username)).success(function(userInfo) {
167+
$http.get(urlBuilder.build(urls.admin.login, username)).success(function(userInfo) {
168168
var groups = userInfo.data.groups;
169169
deferred.resolve(groups);
170170
});

src/js/templates/templates.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)