diff --git a/static/ng/resources/js/components/summary/summary.directive.js b/static/ng/resources/js/components/summary/summary.directive.js
index 880f9d2e0..2341d7c7f 100644
--- a/static/ng/resources/js/components/summary/summary.directive.js
+++ b/static/ng/resources/js/components/summary/summary.directive.js
@@ -15,7 +15,7 @@
.success(statProjectSuccess)
.error(statProjectFailed);
- function statProjectSuccess(data, status) {
+ function statProjectSuccess(data) {
vm.statProjects = data;
}
diff --git a/static/ng/resources/js/components/top-repository/top-repository.directive.html b/static/ng/resources/js/components/top-repository/top-repository.directive.html
new file mode 100644
index 000000000..e3b79fbfb
--- /dev/null
+++ b/static/ng/resources/js/components/top-repository/top-repository.directive.html
@@ -0,0 +1,16 @@
+
+
+
+
+ // 'repository_name' | tr // | // 'count' | tr // | // 'creator' | tr // |
+
+
+
+ // 'no_top_repositories' | tr // |
+
+
+ //t.name// | //t.count// | //t.creator// |
+
+
+
+
\ No newline at end of file
diff --git a/static/ng/resources/js/components/top-repository/top-repository.directive.js b/static/ng/resources/js/components/top-repository/top-repository.directive.js
new file mode 100644
index 000000000..e66a6176d
--- /dev/null
+++ b/static/ng/resources/js/components/top-repository/top-repository.directive.js
@@ -0,0 +1,41 @@
+(function() {
+
+ 'use strict';
+
+ angular
+ .module('harbor.top.repository')
+ .directive('topRepository', topRepository);
+
+ TopRepositoryController.$inject = ['ListTopRepositoryService'];
+
+ function TopRepositoryController(ListTopRepositoryService) {
+ var vm = this;
+
+ ListTopRepositoryService(10)
+ .success(listTopRepositorySuccess)
+ .error(listTopRepositoryFailed);
+
+ function listTopRepositorySuccess(data) {
+ vm.top10Repositories = data || []
+ console.log(vm.top10Repositories.length);
+ }
+
+ function listTopRepositoryFailed(data, status) {
+ console.log('Failed list integrated logs:' + status);
+ }
+ }
+
+ function topRepository() {
+ var directive = {
+ 'restrict': 'E',
+ 'templateUrl': '/static/ng/resources/js/components/top-repository/top-repository.directive.html',
+ 'controller': TopRepositoryController,
+ 'scope' : true,
+ 'controllerAs': 'vm',
+ 'bindToController': true
+ };
+
+ return directive;
+ }
+
+})();
\ No newline at end of file
diff --git a/static/ng/resources/js/components/top-repository/top-repository.module.js b/static/ng/resources/js/components/top-repository/top-repository.module.js
new file mode 100644
index 000000000..47cf73f05
--- /dev/null
+++ b/static/ng/resources/js/components/top-repository/top-repository.module.js
@@ -0,0 +1,10 @@
+(function() {
+
+ 'use strict';
+
+ angular
+ .module('harbor.top.repository', [
+ 'harbor.services.repository'
+ ]);
+
+})();
\ No newline at end of file
diff --git a/static/ng/resources/js/components/user-log/user-log.directive.html b/static/ng/resources/js/components/user-log/user-log.directive.html
new file mode 100644
index 000000000..1247a2448
--- /dev/null
+++ b/static/ng/resources/js/components/user-log/user-log.directive.html
@@ -0,0 +1,16 @@
+
+
+
+
+ // 'task_name' | tr // | // 'details' | tr // | // 'user' | tr // | // 'creation_time' | tr // |
+
+
+
+ // 'no_user_logs' | tr // |
+
+
+ //t.Operation// | //t.RepoName// | //t.Username// | //t.OpTime | dateL : 'YYYY-MM-DD HH:mm:ss'// |
+
+
+
+
\ No newline at end of file
diff --git a/static/ng/resources/js/components/user-log/user-log.directive.js b/static/ng/resources/js/components/user-log/user-log.directive.js
new file mode 100644
index 000000000..17ded8c65
--- /dev/null
+++ b/static/ng/resources/js/components/user-log/user-log.directive.js
@@ -0,0 +1,40 @@
+(function() {
+
+ 'use strict';
+
+ angular
+ .module('harbor.user.log')
+ .directive('userLog', userLog);
+
+ UserLogController.$inject = ['ListIntegratedLogService'];
+
+ function UserLogController(ListIntegratedLogService) {
+ var vm = this;
+
+ ListIntegratedLogService()
+ .success(listIntegratedLogSuccess)
+ .error(listIntegratedLogFailed);
+
+ function listIntegratedLogSuccess(data) {
+ vm.integratedLogs = data || []
+ }
+
+ function listIntegratedLogFailed(data, status) {
+ console.log('Failed list integrated logs:' + status);
+ }
+ }
+
+ function userLog() {
+ var directive = {
+ 'restrict': 'E',
+ 'templateUrl': '/static/ng/resources/js/components/user-log/user-log.directive.html',
+ 'controller': UserLogController,
+ 'scope' : true,
+ 'controllerAs': 'vm',
+ 'bindToController': true
+ };
+
+ return directive;
+ }
+
+})();
\ No newline at end of file
diff --git a/static/ng/resources/js/components/user-log/user-log.module.js b/static/ng/resources/js/components/user-log/user-log.module.js
new file mode 100644
index 000000000..71af5fabf
--- /dev/null
+++ b/static/ng/resources/js/components/user-log/user-log.module.js
@@ -0,0 +1,10 @@
+(function() {
+
+ 'use strict';
+
+ angular
+ .module('harbor.user.log', [
+ 'harbor.services.log'
+ ]);
+
+})();
\ No newline at end of file
diff --git a/static/ng/resources/js/harbor.module.js b/static/ng/resources/js/harbor.module.js
index 389a69fdb..2ccb547a5 100644
--- a/static/ng/resources/js/harbor.module.js
+++ b/static/ng/resources/js/harbor.module.js
@@ -26,6 +26,8 @@
'harbor.services.replication.job',
'harbor.services.destination',
'harbor.summary',
+ 'harbor.user.log',
+ 'harbor.top.repository',
'harbor.optional.menu',
'harbor.modal.dialog',
'harbor.sign.in',
diff --git a/static/ng/resources/js/layout/dashboard/dashboard.controller.js b/static/ng/resources/js/layout/dashboard/dashboard.controller.js
index bd2f8b61e..7b64af884 100644
--- a/static/ng/resources/js/layout/dashboard/dashboard.controller.js
+++ b/static/ng/resources/js/layout/dashboard/dashboard.controller.js
@@ -6,33 +6,8 @@
.module('harbor.layout.dashboard')
.controller('DashboardController', DashboardController);
- DashboardController.$inject = ['ListTop10RepositoryService', 'ListIntegratedLogService'];
+ function DashboardController() {
- function DashboardController(ListTop10RepositoryService, ListIntegratedLogService) {
- var vm = this;
-
- ListTop10RepositoryService()
- .then(listTop10RepositorySuccess, listTop10RepositoryFailed);
-
- ListIntegratedLogService()
- .then(listIntegratedLogSuccess, listIntegratedLogFailed);
-
- function listTop10RepositorySuccess(data) {
- vm.top10Repositories = data;
- }
-
- function listTop10RepositoryFailed(data) {
- console.log('Failed list top 10 repositories:' + data);
- }
-
- function listIntegratedLogSuccess(data) {
- vm.integratedLogs = data;
- }
-
- function listIntegratedLogFailed(data) {
- console.log('Failed list integrated logs:' + data);
- }
-
}
})();
\ No newline at end of file
diff --git a/static/ng/resources/js/layout/dashboard/dashboard.module.js b/static/ng/resources/js/layout/dashboard/dashboard.module.js
index cc45227c2..cd92519dd 100644
--- a/static/ng/resources/js/layout/dashboard/dashboard.module.js
+++ b/static/ng/resources/js/layout/dashboard/dashboard.module.js
@@ -4,8 +4,7 @@
angular
.module('harbor.layout.dashboard', [
- 'harbor.services.repository',
- 'harbor.services.log'
+ 'harbor.services.repository'
]);
})();
\ No newline at end of file
diff --git a/static/ng/resources/js/services/i18n/locale_messages_en-US.js b/static/ng/resources/js/services/i18n/locale_messages_en-US.js
index 4298817d2..9ee8e3d2c 100644
--- a/static/ng/resources/js/services/i18n/locale_messages_en-US.js
+++ b/static/ng/resources/js/services/i18n/locale_messages_en-US.js
@@ -60,11 +60,14 @@ var locale_messages = {
'top_10_repositories': 'Top 10 Repositories',
'repository_name': 'Repository Name',
'size': 'Size',
+ 'count': 'Count',
'creator': 'Creator',
+ 'no_top_repositories': 'No data, start with Harbor now!',
'logs': 'Logs',
'task_name': 'Task Name',
'details': 'Details',
'user': 'User',
+ 'no_user_logs': 'No data, start with Harbor now!',
'users': 'Users',
'my_projects': 'My Projects',
'project_name': 'Project Name',
diff --git a/static/ng/resources/js/services/i18n/locale_messages_zh-CN.js b/static/ng/resources/js/services/i18n/locale_messages_zh-CN.js
index babfb8b5d..4f4150aa5 100644
--- a/static/ng/resources/js/services/i18n/locale_messages_zh-CN.js
+++ b/static/ng/resources/js/services/i18n/locale_messages_zh-CN.js
@@ -60,11 +60,14 @@ var locale_messages = {
'top_10_repositories': 'Top 10 镜像仓库',
'repository_name': '镜像仓库名',
'size': '规格',
+ 'count': '次数',
'creator': '创建者',
+ 'no_top_repositories': '没有数据,开始使用Harbor!',
'logs': '日志',
'task_name': '任务名称',
'details': '详细信息',
'user': '用户',
+ 'no_user_logs': '没有数据,开始使用Harbor!',
'users': '用户',
'my_projects': '我的项目',
'project_name': '项目名称',
diff --git a/static/ng/resources/js/services/log/services.list-integrated-log.js b/static/ng/resources/js/services/log/services.list-integrated-log.js
index c8119128d..4c87f59a2 100644
--- a/static/ng/resources/js/services/log/services.list-integrated-log.js
+++ b/static/ng/resources/js/services/log/services.list-integrated-log.js
@@ -1,62 +1,26 @@
(function() {
-
'use strict';
-
- angular
+
+ angular
.module('harbor.services.log')
.factory('ListIntegratedLogService', ListIntegratedLogService);
-
- ListIntegratedLogService.$inject = ['$http', '$q', '$timeout'];
-
- function ListIntegratedLogService($http, $q, $timeout) {
-
- var mockData = [
- {
- 'task_name': 'create',
- 'details': 'created myproject/ubuntu',
- 'user': 'kunw',
- 'creation_time': '2016-05-10 17:53:25'
- },
- {
- 'task_name': 'push',
- 'details': 'pushed myproject/mysql',
- 'user': 'kunw',
- 'creation_time': '2016-05-10 16:25:15'
- },
- {
- 'task_name': 'pull',
- 'details': 'pulled myrepo/nginx',
- 'user': 'user1',
- 'creation_time': '2016-05-11 10:42:43'
- },
- {
- 'task_name': 'delete',
- 'details': 'deleted myrepo/golang',
- 'user': 'user1',
- 'creation_time': '2016-05-11 12:21:35'
- }
- ];
-
- function async() {
-
- var deferred = $q.defer();
-
- $timeout(function() {
- deferred.resolve(mockData);
- }, 500);
-
- return deferred.promise;
- }
+
+ ListIntegratedLogService.$inject = ['$http', '$log'];
+
+ function ListIntegratedLogService($http, $log) {
return listIntegratedLog;
- function listIntegratedLog() {
- return async();
+ function listIntegratedLog(lines) {
+ $log.info('Get recent logs of the projects which the user is a member of:');
+ return $http
+ .get('/api/logs', {
+ 'params' : {
+ 'lines': lines,
+ }
+ });
+
}
-
}
-
-
-
})();
\ No newline at end of file
diff --git a/static/ng/resources/js/services/repository/services.list-top-repository.js b/static/ng/resources/js/services/repository/services.list-top-repository.js
new file mode 100644
index 000000000..20b271379
--- /dev/null
+++ b/static/ng/resources/js/services/repository/services.list-top-repository.js
@@ -0,0 +1,26 @@
+(function() {
+ 'use strict';
+
+ angular
+ .module('harbor.services.repository')
+ .factory('ListTopRepositoryService', ListTopRepositoryService);
+
+ ListTopRepositoryService.$inject = ['$http', '$log'];
+
+ function ListTopRepositoryService($http, $log) {
+
+ return listTopRepository;
+
+ function listTopRepository(count) {
+ $log.info('Get public repositories which are accessed most:');
+ return $http
+ .get('/api/repositories/top', {
+ 'params' : {
+ 'count': count,
+ }
+ });
+
+ }
+ }
+
+})();
\ No newline at end of file
diff --git a/static/ng/resources/js/services/repository/services.list-top10-repository.js b/static/ng/resources/js/services/repository/services.list-top10-repository.js
deleted file mode 100644
index 693809332..000000000
--- a/static/ng/resources/js/services/repository/services.list-top10-repository.js
+++ /dev/null
@@ -1,58 +0,0 @@
-(function() {
-
- 'use strict';
-
- angular
- .module('harbor.services.repository')
- .factory('ListTop10RepositoryService', ListTop10RepositoryService);
-
- ListTop10RepositoryService.$inject = ['$http', '$q', '$timeout'];
-
- function ListTop10RepositoryService($http, $q, $timeout) {
-
- var mockData = [
- {
- 'repo_name': 'myproject/ubuntu',
- 'image_size': '89',
- 'creator': 'kunw'
- },
- {
- 'repo_name': 'myproject/nginx',
- 'image_size': '67',
- 'creator': 'kunw'
- },
- {
- 'repo_name': 'myrepo/mysql',
- 'image_size': '122',
- 'creator': 'user1'
- },
- {
- 'repo_name': 'target/golang',
- 'image_size': '587',
- 'creator': 'tester'
- }
- ];
-
- function async() {
-
- var deferred = $q.defer();
-
- $timeout(function() {
- deferred.resolve(mockData);
- }, 500);
-
- return deferred.promise;
- }
-
- return listTop10Repository;
-
- function listTop10Repository() {
- return async();
- }
-
- }
-
-
-
-
-})();
\ No newline at end of file
diff --git a/views/ng/dashboard.htm b/views/ng/dashboard.htm
index 5616ea4d3..8248854ee 100644
--- a/views/ng/dashboard.htm
+++ b/views/ng/dashboard.htm
@@ -10,19 +10,7 @@
-
-
-
-
- // 'repository_name' | tr // | // 'size' | tr // | // 'creator' | tr // |
-
-
-
- //t.repo_name// | //t.image_size//MB | //t.creator// |
-
-
-
-
+
@@ -31,18 +19,7 @@
-
-
-
-
- // 'task_name' | tr // | // 'details' | tr // | // 'user' | tr // | // 'creation_time' | tr // |
-
-
-
- //t.task_name// | //t.details// | //t.user// | //t.creation_time// |
-
-
-
+
diff --git a/views/ng/sections/header-include.htm b/views/ng/sections/header-include.htm
index cd1bee552..fc646e450 100644
--- a/views/ng/sections/header-include.htm
+++ b/views/ng/sections/header-include.htm
@@ -122,7 +122,7 @@
-
+
@@ -219,3 +219,9 @@
+
+
+
+
+
+