parent
cea4ad2d85
commit
b8c74bbb17
6 changed files with 28 additions and 56 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
The following are features that have been merged, but not yet deployed:
|
||||
|
||||
- Nothing yet!
|
||||
- Add a Changelog view to the superuser panel (#186)
|
||||
|
||||
### 1.9.7
|
||||
|
||||
|
|
|
@ -118,21 +118,21 @@ def user_view(user):
|
|||
'super_user': superusers.is_superuser(user.username)
|
||||
}
|
||||
|
||||
@resource('/v1/superuser/usage/')
|
||||
@resource('/v1/superuser/changelog/')
|
||||
@internal_only
|
||||
@show_if(features.SUPER_USERS)
|
||||
class UsageInformation(ApiResource):
|
||||
""" Resource for returning the usage information for enterprise customers. """
|
||||
class ChangeLog(ApiResource):
|
||||
""" Resource for returning the change log for enterprise customers. """
|
||||
@require_fresh_login
|
||||
@verify_not_prod
|
||||
@nickname('getSystemUsage')
|
||||
@nickname('getChangeLog')
|
||||
def get(self):
|
||||
""" Returns the number of repository handles currently held. """
|
||||
""" Returns the change log for this installation. """
|
||||
if SuperUserPermission().can():
|
||||
return {
|
||||
'usage': model.get_repository_usage(),
|
||||
'allowed': app.config.get('MAXIMUM_REPOSITORY_USAGE', 20)
|
||||
}
|
||||
with open ('CHANGELOG.md', 'r') as f:
|
||||
return {
|
||||
'log': f.read()
|
||||
}
|
||||
|
||||
abort(403)
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
$scope.logsCounter = 0;
|
||||
$scope.newUser = {};
|
||||
$scope.createdUser = null;
|
||||
$scope.systemUsage = null;
|
||||
$scope.changeLog = null;
|
||||
$scope.debugServices = null;
|
||||
$scope.debugLogs = null;
|
||||
$scope.pollChannel = null;
|
||||
|
@ -89,12 +89,12 @@
|
|||
}, ApiService.errorDisplay('Cannot load system logs. Please contact support.'))
|
||||
};
|
||||
|
||||
$scope.getUsage = function() {
|
||||
if ($scope.systemUsage) { return; }
|
||||
$scope.getChangeLog = function() {
|
||||
if ($scope.changeLog) { return; }
|
||||
|
||||
ApiService.getSystemUsage().then(function(resp) {
|
||||
$scope.systemUsage = resp;
|
||||
}, ApiService.errorDisplay('Cannot load system usage. Please contact support.'))
|
||||
ApiService.getChangeLog().then(function(resp) {
|
||||
$scope.changeLog = resp;
|
||||
}, ApiService.errorDisplay('Cannot load change log. Please contact support.'))
|
||||
}
|
||||
|
||||
$scope.loadUsageLogs = function() {
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
tab-shown="setDashboardActive(true)" tab-hidden="setDashboardActive(false)">
|
||||
<i class="fa fa-tachometer"></i>
|
||||
</span>
|
||||
<span class="cor-tab" tab-title="Container Usage" tab-target="#usage-counter" tab-init="getUsage()">
|
||||
<i class="fa fa-pie-chart"></i>
|
||||
<span class="cor-tab" tab-title="Change Log" tab-target="#change-log" tab-init="getChangeLog()">
|
||||
<i class="fa fa-rss"></i>
|
||||
</span>
|
||||
<span class="cor-tab" tab-title="Usage Logs" tab-target="#logs" tab-init="loadUsageLogs()">
|
||||
<i class="fa fa-bar-chart"></i>
|
||||
|
@ -86,30 +86,12 @@
|
|||
<div class="logsView" makevisible="logsCounter" all-logs="true"></div>
|
||||
</div> <!-- /logs tab-->
|
||||
|
||||
<!-- Usage tab -->
|
||||
<div id="usage-counter" class="tab-pane">
|
||||
<div class="cor-loader" ng-show="systemUsage == null"></div>
|
||||
<div class="usage-chart" total="systemUsage.allowed" limit="systemUsageLimit"
|
||||
current="systemUsage.usage" usage-title="Deployed Containers"></div>
|
||||
|
||||
<!-- Alerts -->
|
||||
<div class="alert alert-danger" ng-show="systemUsageLimit == 'over' && systemUsage">
|
||||
You have deployed more repositories than your plan allows. Please
|
||||
upgrade your subscription by contacting <a href="mailto:sales@coreos.com">CoreOS Sales</a>.
|
||||
</div>
|
||||
|
||||
<div class="alert alert-warning" ng-show="systemUsageLimit == 'at' && systemUsage">
|
||||
You are at your current plan's number of allowed repositories. It might be time to think about
|
||||
upgrading your subscription by contacting <a href="mailto:sales@coreos.com">CoreOS Sales</a>.
|
||||
</div>
|
||||
|
||||
<div class="alert alert-success" ng-show="systemUsageLimit == 'near' && systemUsage">
|
||||
You are nearing the number of allowed deployed repositories. It might be time to think about
|
||||
upgrading your subscription by contacting <a href="mailto:sales@coreos.com">CoreOS Sales</a>.
|
||||
</div>
|
||||
|
||||
For more information: <a href="https://coreos.com/products/enterprise-registry/plans/">See Here</a>.
|
||||
</div> <!-- /usage-counter tab-->
|
||||
<!-- Change Log tab -->
|
||||
<div id="change-log" class="tab-pane">
|
||||
<h3 style="margin-top: 0px;">Change Log</h3>
|
||||
<div class="cor-loader" ng-if="!changeLog"></div>
|
||||
<div class="markdown-view" content="changeLog.log" ng-if="changeLog"></div>
|
||||
</div> <!-- /change-log tab-->
|
||||
|
||||
<!-- Organizations tab -->
|
||||
<div id="organizations" class="tab-pane">
|
||||
|
|
|
@ -45,7 +45,7 @@ from endpoints.api.repository import RepositoryList, RepositoryVisibility, Repos
|
|||
from endpoints.api.permission import (RepositoryUserPermission, RepositoryTeamPermission,
|
||||
RepositoryTeamPermissionList, RepositoryUserPermissionList)
|
||||
from endpoints.api.superuser import (SuperUserLogs, SuperUserList, SuperUserManagement,
|
||||
SuperUserSendRecoveryEmail, UsageInformation,
|
||||
SuperUserSendRecoveryEmail, ChangeLog,
|
||||
SuperUserOrganizationManagement, SuperUserOrganizationList)
|
||||
|
||||
|
||||
|
@ -3928,10 +3928,10 @@ class TestTeamMemberInvite(ApiTestCase):
|
|||
self._run_test('DELETE', 400, 'devtable', None)
|
||||
|
||||
|
||||
class TestUsageInformation(ApiTestCase):
|
||||
class TestChangeLog(ApiTestCase):
|
||||
def setUp(self):
|
||||
ApiTestCase.setUp(self)
|
||||
self._set_url(UsageInformation)
|
||||
self._set_url(ChangeLog)
|
||||
|
||||
def test_get_anonymous(self):
|
||||
self._run_test('GET', 401, None, None)
|
||||
|
|
|
@ -47,8 +47,7 @@ from endpoints.api.organization import (OrganizationList, OrganizationMember,
|
|||
from endpoints.api.repository import RepositoryList, RepositoryVisibility, Repository
|
||||
from endpoints.api.permission import (RepositoryUserPermission, RepositoryTeamPermission,
|
||||
RepositoryTeamPermissionList, RepositoryUserPermissionList)
|
||||
from endpoints.api.superuser import (SuperUserLogs, SuperUserList, SuperUserManagement,
|
||||
UsageInformation)
|
||||
from endpoints.api.superuser import (SuperUserLogs, SuperUserList, SuperUserManagement)
|
||||
|
||||
try:
|
||||
app.register_blueprint(api_bp, url_prefix='/api')
|
||||
|
@ -2877,15 +2876,6 @@ class TestSuperUserList(ApiTestCase):
|
|||
assert len(json['users']) > 0
|
||||
|
||||
|
||||
class TestUsageInformation(ApiTestCase):
|
||||
def test_get_usage(self):
|
||||
self.login(ADMIN_ACCESS_USER)
|
||||
json = self.getJsonResponse(UsageInformation)
|
||||
|
||||
assert 'usage' in json
|
||||
assert 'allowed' in json
|
||||
|
||||
|
||||
class TestSuperUserManagement(ApiTestCase):
|
||||
def test_get_user(self):
|
||||
self.login(ADMIN_ACCESS_USER)
|
||||
|
|
Reference in a new issue