From b8c74bbb17fae46e8307afb2bd5ddb499bbeafbf Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Sun, 28 Jun 2015 08:27:39 +0300 Subject: [PATCH] Remove container usage tab and replace with changlog view Fixes #179 --- CHANGELOG.md | 2 +- endpoints/api/superuser.py | 18 ++++++++--------- static/js/pages/superuser.js | 12 ++++++------ static/partials/super-user.html | 34 ++++++++------------------------- test/test_api_security.py | 6 +++--- test/test_api_usage.py | 12 +----------- 6 files changed, 28 insertions(+), 56 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 574c50991..2825800e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/endpoints/api/superuser.py b/endpoints/api/superuser.py index 947b2a8db..bd00c0fe6 100644 --- a/endpoints/api/superuser.py +++ b/endpoints/api/superuser.py @@ -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) diff --git a/static/js/pages/superuser.js b/static/js/pages/superuser.js index 9717781e9..41dc8490d 100644 --- a/static/js/pages/superuser.js +++ b/static/js/pages/superuser.js @@ -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() { diff --git a/static/partials/super-user.html b/static/partials/super-user.html index 88a8da16a..5ad335ba4 100644 --- a/static/partials/super-user.html +++ b/static/partials/super-user.html @@ -28,8 +28,8 @@ tab-shown="setDashboardActive(true)" tab-hidden="setDashboardActive(false)"> - - + + @@ -86,30 +86,12 @@
- -
-
-
- - -
- You have deployed more repositories than your plan allows. Please - upgrade your subscription by contacting CoreOS Sales. -
- -
- You are at your current plan's number of allowed repositories. It might be time to think about - upgrading your subscription by contacting CoreOS Sales. -
- -
- You are nearing the number of allowed deployed repositories. It might be time to think about - upgrading your subscription by contacting CoreOS Sales. -
- - For more information: See Here. -
+ +
+

Change Log

+
+
+
diff --git a/test/test_api_security.py b/test/test_api_security.py index 078faecae..8c6a42af6 100644 --- a/test/test_api_security.py +++ b/test/test_api_security.py @@ -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) diff --git a/test/test_api_usage.py b/test/test_api_usage.py index 4683fe05b..bb7953b80 100644 --- a/test/test_api_usage.py +++ b/test/test_api_usage.py @@ -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)