mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-22 07:31:28 +01:00
updates of dashboard and admin-options for UI.
This commit is contained in:
parent
601a930219
commit
2f59120e48
9
controllers/ng/adminoption.go
Normal file
9
controllers/ng/adminoption.go
Normal file
@ -0,0 +1,9 @@
|
||||
package ng
|
||||
|
||||
type AdminOptionController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
func (aoc *AdminOptionController) Get() {
|
||||
aoc.Forward("Admin Options", "admin-options.htm")
|
||||
}
|
@ -4,6 +4,6 @@ type IndexController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
func (c *IndexController) Get() {
|
||||
c.Forward("Index", "index.htm")
|
||||
func (ic *IndexController) Get() {
|
||||
ic.Forward("Index", "index.htm")
|
||||
}
|
||||
|
@ -22,6 +22,10 @@ func (cc *CommonController) Render() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cc *CommonController) LogOut() {
|
||||
cc.DestroySession()
|
||||
}
|
||||
|
||||
type messageDetail struct {
|
||||
Hint string
|
||||
URL string
|
||||
|
@ -14,6 +14,11 @@ func initNgRouters() {
|
||||
beego.Router("/ng/repository", &ng.RepositoryController{})
|
||||
beego.Router("/ng/sign_up", &ng.SignUpController{})
|
||||
beego.Router("/ng/account_setting", &ng.AccountSettingController{})
|
||||
beego.Router("/ng/admin_option", &ng.AdminOptionController{})
|
||||
beego.Router("/ng/forgot_password", &ng.ForgotPasswordController{})
|
||||
beego.Router("/ng/reset_password", &ng.ResetPasswordController{})
|
||||
|
||||
beego.Router("/ng/reset", &ng.CommonController{}, "post:ResetPassword")
|
||||
beego.Router("/ng/sendEmail", &ng.CommonController{}, "get:SendEmail")
|
||||
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
}
|
||||
|
||||
.single {
|
||||
margin-left: -15px;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,6 @@
|
||||
</ul>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="#"><span class="glyphicon glyphicon-log-out"></span> Log Out</a></li>
|
||||
<li><a href="javascript:void(0)" ng-click="vm.logOut()"><span class="glyphicon glyphicon-log-out"></span> Log Out</a></li>
|
||||
</ul>
|
||||
</div>
|
@ -6,10 +6,22 @@
|
||||
.module('harbor.optional.menu')
|
||||
.directive('optionalMenu', optionalMenu);
|
||||
|
||||
OptionalMenuController.$inject = ['$scope'];
|
||||
OptionalMenuController.$inject = ['$scope', '$window', 'LogOutService'];
|
||||
|
||||
function OptionalMenuController($scope, $timeout) {
|
||||
function OptionalMenuController($scope, $window, LogOutService) {
|
||||
var vm = this;
|
||||
vm.logOut = logOut;
|
||||
function logOut() {
|
||||
LogOutService()
|
||||
.success(logOutSuccess)
|
||||
.error(logOutFailed);
|
||||
}
|
||||
function logOutSuccess(data, status) {
|
||||
$window.location.href= '/ng';
|
||||
}
|
||||
function logOutFailed(data, status) {
|
||||
console.log('Failed to log out:' + data);
|
||||
}
|
||||
}
|
||||
|
||||
function optionalMenu() {
|
||||
|
@ -20,7 +20,7 @@
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-1 col-sm-10">
|
||||
<div class="pull-right">
|
||||
<a href="#">Forgot Password</a>
|
||||
<a href="javascript:void(0)" ng-click="vm.doForgotPassword()">Forgot Password</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -12,7 +12,9 @@
|
||||
vm.principal = "";
|
||||
vm.password = "";
|
||||
vm.doSignIn = doSignIn;
|
||||
|
||||
vm.doSignUp = doSignUp;
|
||||
vm.doForgotPassword = doForgotPassword;
|
||||
|
||||
function doSignIn() {
|
||||
if(vm.principal != "" && vm.password != "") {
|
||||
SignInService(vm.principal, vm.password)
|
||||
@ -32,6 +34,13 @@
|
||||
console.log(status);
|
||||
}
|
||||
|
||||
function doSignUp() {
|
||||
$window.location.href = '/ng/sign_up';
|
||||
}
|
||||
|
||||
function doForgotPassword() {
|
||||
$window.location.href = '/ng/forgot_password';
|
||||
}
|
||||
}
|
||||
|
||||
function signIn() {
|
||||
|
@ -1,15 +0,0 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.user');
|
||||
.controller('ChangePasswordController', ChangePasswordController);
|
||||
|
||||
ChangePassswordController.$inject = ['ChangePasswordService'];
|
||||
|
||||
function ChangePasswordController(ChangePasswordService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
@ -1,15 +0,0 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.user');
|
||||
.controller('DeleteUserController', DeleteUserController);
|
||||
|
||||
DeleteUserController.$inject = ['DeleteUserService'];
|
||||
|
||||
function DeleteUserController(DeleteUserService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
@ -1,16 +0,0 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.user');
|
||||
.controller('ForgotPasswordController', ForgotPasswordController);
|
||||
|
||||
|
||||
ForgotPasswordController.$inject = ['ForgotPasswordService'];
|
||||
|
||||
function ForgotPasswordController(ForgotPasswordService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
@ -1 +0,0 @@
|
||||
<list-user></list-user>
|
@ -1,28 +0,0 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.user')
|
||||
.directive('listUser', listUser);
|
||||
|
||||
ListUserController.$inject = ['ListUserService'];
|
||||
|
||||
function ListUserController(ListUserService) {
|
||||
|
||||
}
|
||||
|
||||
function listUser() {
|
||||
var directive = {
|
||||
restrict: 'E',
|
||||
templateUrl: '/static/ng/resources/js/components/user/list-user.directive.html',
|
||||
replace: true,
|
||||
controller: ListUserController,
|
||||
controllerAs: 'vm',
|
||||
bindToController: true
|
||||
}
|
||||
|
||||
return directive;
|
||||
}
|
||||
|
||||
})();
|
@ -1,15 +0,0 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.user');
|
||||
.controller('SignInController', SignInController);
|
||||
|
||||
SignInController.$inject = ['SignInService'];
|
||||
|
||||
function SignInController(SignInService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
@ -1,15 +0,0 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.user');
|
||||
.controller('SignUpController', SignUpController);
|
||||
|
||||
SignUpController.$inject = ['SignUpService'];
|
||||
|
||||
function SignUpController(SignUpService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
@ -0,0 +1,2 @@
|
||||
<button ng-show="vm.isAdmin" class="btn btn-success" ng-click="vm.toggle()">On</button>
|
||||
<button ng-show="!vm.isAdmin" class="btn btn-danger" ng-click="vm.toggle()">Off</button>
|
@ -0,0 +1,57 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.user')
|
||||
.directive('toggleAdmin', toggleAdmin);
|
||||
|
||||
ToggleAdminController.$inject = ['$scope', 'ToggleAdminService'];
|
||||
|
||||
function ToggleAdminController($scope, ToggleAdminService) {
|
||||
var vm = this;
|
||||
|
||||
vm.isAdmin = (vm.hasAdminRole == 1) ? true : false;
|
||||
vm.toggle = toggle;
|
||||
|
||||
function toggle() {
|
||||
ToggleAdminService(vm.userId)
|
||||
.success(toggleAdminSuccess)
|
||||
.error(toggleAdminFailed);
|
||||
}
|
||||
|
||||
function toggleAdminSuccess(data, status) {
|
||||
if(vm.isAdmin) {
|
||||
vm.isAdmin = false;
|
||||
}else{
|
||||
vm.isAdmin = true;
|
||||
}
|
||||
console.log('Toggled userId:' + vm.userId + ' to admin:' + vm.isAdmin);
|
||||
}
|
||||
|
||||
function toggleAdminFailed(data, status) {
|
||||
console.log('Failed toggle admin:' + data);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleAdmin() {
|
||||
var directive = {
|
||||
'restrict': 'E',
|
||||
'templateUrl': '/static/ng/resources/js/components/user/toggle-admin.directive.html',
|
||||
'scope': {
|
||||
'hasAdminRole': '=',
|
||||
'userId': '@'
|
||||
},
|
||||
'link': link,
|
||||
'controller': ToggleAdminController,
|
||||
'controllerAs': 'vm',
|
||||
'bindToController': true
|
||||
};
|
||||
return directive;
|
||||
|
||||
function link(scope, element, attrs, ctrl) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
@ -8,6 +8,15 @@
|
||||
})
|
||||
.config(function($httpProvider) {
|
||||
$httpProvider.defaults.headers.common = {'Accept': 'application/json, text/javascript, */*; q=0.01'};
|
||||
});
|
||||
})
|
||||
.filter('dateL', localizeDate);
|
||||
|
||||
function localizeDate() {
|
||||
return filter;
|
||||
|
||||
function filter(input, pattern) {
|
||||
return moment(new Date(input || '')).format(pattern);
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
@ -12,11 +12,14 @@
|
||||
'harbor.layout.forgot.password',
|
||||
'harbor.layout.reset.password',
|
||||
'harbor.layout.index',
|
||||
'harbor.layout.dashboard',
|
||||
'harbor.layout.project',
|
||||
'harbor.layout.repository',
|
||||
'harbor.layout.project.member',
|
||||
'harbor.layout.user',
|
||||
'harbor.layout.system.management',
|
||||
'harbor.layout.log',
|
||||
'harbor.layout.admin.option',
|
||||
'harbor.services.project',
|
||||
'harbor.services.user',
|
||||
'harbor.services.repository',
|
||||
|
@ -0,0 +1,26 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.layout.admin.option')
|
||||
.config(routeConfig);
|
||||
|
||||
function routeConfig($routeProvider) {
|
||||
$routeProvider
|
||||
.when('/all_user', {
|
||||
'templateUrl': '/static/ng/resources/js/layout/user/user.controller.html',
|
||||
'controller': 'UserController',
|
||||
'controllerAs': 'vm'
|
||||
})
|
||||
.when('/system_management', {
|
||||
'templateUrl': '/static/ng/resources/js/layout/system-management/system-management.controller.html',
|
||||
'controller': 'SystemManagementController',
|
||||
'controllerAs': 'vm'
|
||||
})
|
||||
.otherwise({
|
||||
'redirectTo': '/'
|
||||
});
|
||||
}
|
||||
|
||||
})();
|
@ -0,0 +1,23 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.layout.admin.option')
|
||||
.controller('AdminOptionController', AdminOptionController);
|
||||
|
||||
function AdminOptionController() {
|
||||
var vm = this;
|
||||
vm.toggle = false;
|
||||
vm.toggleAdminOption = toggleAdminOption;
|
||||
|
||||
function toggleAdminOption() {
|
||||
if(vm.toggle) {
|
||||
vm.toggle = false;
|
||||
}else{
|
||||
vm.toggle = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
@ -0,0 +1,8 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.layout.admin.option', []);
|
||||
|
||||
})();
|
@ -0,0 +1,49 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.layout.dashboard')
|
||||
.controller('DashboardController', DashboardController);
|
||||
|
||||
DashboardController.$inject = ['StatProjectService', 'ListTop10RepositoryService', 'ListIntegratedLogService'];
|
||||
|
||||
function DashboardController(StatProjectService, ListTop10RepositoryService, ListIntegratedLogService) {
|
||||
var vm = this;
|
||||
|
||||
StatProjectService()
|
||||
.then(statProjectSuccess, statProjectFailed);
|
||||
|
||||
ListTop10RepositoryService()
|
||||
.then(listTop10RepositorySuccess, listTop10RepositoryFailed);
|
||||
|
||||
ListIntegratedLogService()
|
||||
.then(listIntegratedLogSuccess, listIntegratedLogFailed);
|
||||
|
||||
function statProjectSuccess(data) {
|
||||
vm.statProjects = data;
|
||||
}
|
||||
|
||||
function statProjectFailed(data) {
|
||||
console.log('Failed stat project:' + data);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})();
|
12
static/ng/resources/js/layout/dashboard/dashboard.module.js
Normal file
12
static/ng/resources/js/layout/dashboard/dashboard.module.js
Normal file
@ -0,0 +1,12 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.layout.dashboard', [
|
||||
'harbor.services.project',
|
||||
'harbor.services.repository',
|
||||
'harbor.services.log'
|
||||
]);
|
||||
|
||||
})();
|
@ -5,8 +5,8 @@
|
||||
angular
|
||||
.module('harbor.details')
|
||||
.config(routeConfig)
|
||||
.filter('name', nameFilter)
|
||||
.filter('dateL', localizeDate);
|
||||
.filter('name', nameFilter);
|
||||
|
||||
|
||||
function routeConfig($routeProvider) {
|
||||
$routeProvider
|
||||
@ -48,13 +48,6 @@
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
function localizeDate() {
|
||||
return filter;
|
||||
|
||||
function filter(input, pattern) {
|
||||
return moment(new Date(input || '')).format(pattern);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})();
|
@ -0,0 +1,66 @@
|
||||
<div class="section">
|
||||
<form name="form" class="form-horizontal" ng-submit="form.$valid && vm.changeSettings(system)" >
|
||||
<div class="row">
|
||||
<h5>System Settings</h5>
|
||||
<hr/>
|
||||
<div class="col-md-12 col-md-off-set-1 main-content">
|
||||
<div class="form-group">
|
||||
<label for="hostName" class="col-sm-3 control-label">Host Name:</label>
|
||||
<div class="col-sm-7">
|
||||
<input type="text" class="form-control" id="hostName" ng-model="system.hostName" ng-model-options="{ updateOn: 'blur' }" ng-value="vm.system.hostName" name="uHostName" required>
|
||||
<div ng-messages="form.$dirty && form.uHostName.$error">
|
||||
<span ng-message="required">Host name is required.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="urlProtocol" class="col-sm-3 control-label">URL Protocol:</label>
|
||||
<div class="col-sm-7">
|
||||
<input type="text" class="form-control" id="urlProtocol" ng-model="system.urlProtocol" ng-model-options="{ updateOn: 'blur' }" ng-value="vm.system.urlProtocol" name="uUrlProtocol" required>
|
||||
<div ng-messages="form.$dirty && form.uUrlProtocol.$error">
|
||||
<span ng-message="required">Url protocol is required.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="emailServer" class="col-sm-3 control-label">Email server:</label>
|
||||
<div class="col-sm-7">
|
||||
<input type="text" class="form-control" id="emailServer" ng-model="system.emailServer" ng-model-options="{ updateOn: 'blur' }" ng-value="vm.system.emailServer" name="uEmailServer" required>
|
||||
<div ng-messages="form.$dirty && form.uEmailServer.$error">
|
||||
<span ng-message="required">Email server is required.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="ldapUrl" class="col-sm-3 control-label">LDAP URL:</label>
|
||||
<div class="col-sm-7">
|
||||
<input type="text" class="form-control" id="ldapUrl" ng-model="system.ldapUrl" ng-model-options="{ updateOn: 'blur' }" ng-value="vm.system.ldapUrl" name="uLdapUrl" required>
|
||||
<div ng-messages="form.$dirty && form.uLdapUrl.$error">
|
||||
<span ng-message="required">LDAP URL is required.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<h5>Registration</h5>
|
||||
<hr/>
|
||||
<div class="col-md-12 col-md-off-set-1 main-content">
|
||||
<div class="form-group">
|
||||
<label for="registration" class="col-sm-3 control-label">Registration:</label>
|
||||
<div class="col-sm-7">
|
||||
<select class="form-control" ng-model="vm.currentRegistration" ng-options="r as r.name for r in vm.registrationOptions track by r.value" ng-click="vm.selectRegistration()"></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 col-md-off-set-1 main-content">
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-7 col-md-10">
|
||||
<input type="submit" class="btn btn-default" ng-click="vm.cancel()" value="Cancel">
|
||||
<input type="submit" class="btn btn-primary" ng-disabled="form.$invalid" value="Save">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1,39 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.layout.system.management')
|
||||
.controller('SystemManagementController', SystemManagementController);
|
||||
|
||||
function SystemManagementController() {
|
||||
var vm = this;
|
||||
vm.registrationOptions = [
|
||||
{
|
||||
'name': 'on',
|
||||
'value': true
|
||||
},
|
||||
{
|
||||
'name': 'off',
|
||||
'value': false
|
||||
}
|
||||
];
|
||||
vm.currentRegistration = {
|
||||
'name': 'on',
|
||||
'value': true
|
||||
};
|
||||
|
||||
vm.changeSettings = changeSettings;
|
||||
|
||||
vm.selectRegistration = selectRegistration;
|
||||
|
||||
function selectRegistration() {
|
||||
|
||||
}
|
||||
|
||||
function changeSettings(system) {
|
||||
console.log(system);
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
@ -0,0 +1,8 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.layout.system.management', []);
|
||||
|
||||
})();
|
@ -1 +1,33 @@
|
||||
<list-user></list-user>
|
||||
<div class="sub-pane">
|
||||
<div class="form-inline">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" placeholder="" ng-model="vm.username" size="30">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary" type="button" ng-click="vm.searchUser()"><span class="glyphicon glyphicon-search"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 500px; overflow-y: auto;">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th>Username</th><th>Role</th><th>Email</th><th>Registration Time</th><th>Operation</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="u in vm.users">
|
||||
<td>//u.username//</td>
|
||||
<td>N/A</td>
|
||||
<td>//u.email//</td>
|
||||
<td>//u.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
|
||||
<td>
|
||||
<toggle-admin has-admin-role="u.HasAdminRole == 1" user-id="//u.UserId//"></toggle-admin>
|
||||
<a href="javascript:void(0)" ng-click="vm.deleteUser(u.UserId)"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4 col-md-12 well well-sm well-custom">
|
||||
<div class="col-md-offset-10">//vm.users ? vm.users.length : 0// items</div>
|
||||
</div>
|
||||
|
||||
|
@ -6,7 +6,52 @@
|
||||
.module('harbor.layout.user')
|
||||
.controller('UserController', UserController);
|
||||
|
||||
function UserController() {
|
||||
UserController.$inject = ['ListUserService', 'DeleteUserService'];
|
||||
|
||||
function UserController(ListUserService, DeleteUserService) {
|
||||
var vm = this;
|
||||
|
||||
vm.username = '';
|
||||
vm.searchUser = searchUser;
|
||||
vm.deleteUser = deleteUser;
|
||||
vm.retrieve = retrieve;
|
||||
|
||||
vm.retrieve();
|
||||
|
||||
function searchUser() {
|
||||
vm.retrieve();
|
||||
}
|
||||
|
||||
function deleteUser(userId) {
|
||||
DeleteUserService(userId)
|
||||
.success(deleteUserSuccess)
|
||||
.error(deleteUserFailed);
|
||||
}
|
||||
|
||||
function retrieve() {
|
||||
ListUserService(vm.username)
|
||||
.success(listUserSuccess)
|
||||
.error(listUserFailed);
|
||||
}
|
||||
|
||||
function deleteUserSuccess(data, status) {
|
||||
console.log('Successful delete user.');
|
||||
vm.retrieve();
|
||||
}
|
||||
|
||||
function deleteUserFailed(data, status) {
|
||||
console.log('Failed delete user.');
|
||||
}
|
||||
|
||||
function listUserSuccess(data, status) {
|
||||
vm.users = data;
|
||||
}
|
||||
|
||||
function listUserFailed(data, status) {
|
||||
console.log('Failed list user:' + data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -3,5 +3,8 @@
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.layout.user', []);
|
||||
.module('harbor.layout.user', [
|
||||
'harbor.services.user'
|
||||
]);
|
||||
|
||||
})();
|
@ -0,0 +1,62 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return listIntegratedLog;
|
||||
|
||||
function listIntegratedLog() {
|
||||
return async();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
})();
|
@ -0,0 +1,40 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.project')
|
||||
.factory('StatProjectService', StatProjectService);
|
||||
|
||||
StatProjectService.$inject = ['$http', '$q', '$timeout'];
|
||||
|
||||
function StatProjectService($http, $q, $timeout) {
|
||||
|
||||
var mockData = {
|
||||
'projects': 30,
|
||||
'public_projects': 50,
|
||||
'total_projects': 120,
|
||||
'repositories': 50,
|
||||
'public_repositories': 40,
|
||||
'total_repositories': 110
|
||||
};
|
||||
|
||||
function async() {
|
||||
var deferred = $q.defer();
|
||||
|
||||
$timeout(function() {
|
||||
deferred.resolve(mockData);
|
||||
}, 500);
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
return statProject;
|
||||
|
||||
function statProject() {
|
||||
return async();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})();
|
@ -0,0 +1,58 @@
|
||||
(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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
})();
|
@ -12,8 +12,9 @@
|
||||
|
||||
return DeleteUser;
|
||||
|
||||
function DeleteUser(user) {
|
||||
|
||||
function DeleteUser(userId) {
|
||||
return $http
|
||||
.delete('/api/users/' + userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,10 +10,15 @@
|
||||
|
||||
function ListUserService($http, $log) {
|
||||
|
||||
return ListUser;
|
||||
return listUser;
|
||||
|
||||
function ListUser(queryParams) {
|
||||
$log.info(queryParams);
|
||||
function listUser(username) {
|
||||
return $http
|
||||
.get('/api/users', {
|
||||
'params' : {
|
||||
'username': username
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
})();
|
19
static/ng/resources/js/services/user/services.log-out.js
Normal file
19
static/ng/resources/js/services/user/services.log-out.js
Normal file
@ -0,0 +1,19 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.user')
|
||||
.factory('LogOutService', LogOutService);
|
||||
|
||||
LogOutService.$inject = ['$http'];
|
||||
|
||||
function LogOutService($http) {
|
||||
return logOut;
|
||||
function logOut() {
|
||||
return $http
|
||||
.get('/ng/log_out');
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
@ -0,0 +1,22 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.user')
|
||||
.factory('ToggleAdminService', ToggleAdminService);
|
||||
|
||||
ToggleAdminService.$inject = ['$http'];
|
||||
|
||||
function ToggleAdminService($http) {
|
||||
|
||||
return toggleAdmin;
|
||||
|
||||
function toggleAdmin(userId) {
|
||||
return $http
|
||||
.put('/api/users/' + userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})();
|
@ -4,11 +4,11 @@
|
||||
|
||||
angular
|
||||
.module('harbor.session')
|
||||
.controller('CurrentUserController', CurrentUserController)
|
||||
|
||||
CurrentUserController.$inject = ['CurrentUserService', 'currentUser', '$scope', '$timeout'];
|
||||
.controller('CurrentUserController', CurrentUserController);
|
||||
|
||||
CurrentUserController.$inject = ['CurrentUserService', 'currentUser', '$scope', '$timeout', '$window'];
|
||||
|
||||
function CurrentUserController(CurrentUserService, currentUser, $scope, $timeout) {
|
||||
function CurrentUserController(CurrentUserService, currentUser, $scope, $timeout, $window) {
|
||||
|
||||
var vm = this;
|
||||
|
||||
@ -25,8 +25,15 @@
|
||||
}
|
||||
|
||||
function getCurrentUserFailed(e){
|
||||
console.log('Have not logged in yet.');
|
||||
var url = location.pathname;
|
||||
var exclusions = ['/ng', '/ng/forgot_password', '/ng/sign_up', '/ng/reset_password'];
|
||||
for(var i = 0; i < exclusions.length; i++) {
|
||||
if(exclusions[i]===url) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$window.location.href = '/ng';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})();
|
@ -13,9 +13,10 @@ func initNgRouters() {
|
||||
beego.Router("/ng/repository", &ng.RepositoryController{})
|
||||
beego.Router("/ng/sign_up", &ng.SignUpController{})
|
||||
beego.Router("/ng/account_setting", &ng.AccountSettingController{})
|
||||
beego.Router("/ng/admin_option", &ng.AdminOptionController{})
|
||||
beego.Router("/ng/forgot_password", &ng.ForgotPasswordController{})
|
||||
beego.Router("/ng/reset_password", &ng.ResetPasswordController{})
|
||||
|
||||
beego.Router("/ng/log_out", &ng.CommonController{}, "get:LogOut")
|
||||
beego.Router("/ng/reset", &ng.CommonController{}, "post:ResetPassword")
|
||||
beego.Router("/ng/sendEmail", &ng.CommonController{}, "get:SendEmail")
|
||||
|
||||
|
20
views/ng/admin-options.htm
Normal file
20
views/ng/admin-options.htm
Normal file
@ -0,0 +1,20 @@
|
||||
<div class="container-fluid container-fluid-custom" ng-controller="AdminOptionController as vm">
|
||||
<div class="container container-custom">
|
||||
<div class="row extend-height">
|
||||
<div class="col-xs-12 col-md-12 extend-height">
|
||||
<div class="section">
|
||||
<h4 class="page-header">
|
||||
<span ng-show="!vm.toggle">Users</span>
|
||||
<a ng-show="vm.toggle" href="#/all_user" ng-click="vm.toggleAdminOption()">Users</a>
|
||||
<span class="gutter">|</span>
|
||||
<span ng-show="vm.toggle">System Management</span>
|
||||
<a ng-show="!vm.toggle" href="#/system_management" class="title-color" ng-click="vm.toggleAdminOption()">System Management</a>
|
||||
</h4>
|
||||
<div class="project-pane">
|
||||
<ng-view></ng-view>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,4 +1,4 @@
|
||||
<div class="container-fluid container-fluid-custom">
|
||||
<div class="container-fluid container-fluid-custom" ng-controller="DashboardController as vm">
|
||||
<div class="container">
|
||||
<div class="row row-custom">
|
||||
<div class="col-xs-4 col-md-4">
|
||||
@ -6,34 +6,28 @@
|
||||
<div class="up-section">
|
||||
<h4 class="page-header title-color underlined">Summary</h4>
|
||||
<dl class="page-content dl-horizontal">
|
||||
<dt>Projects:</dt><dd>40</dd>
|
||||
<dt>Public Projects:</dt><dd>30</dd>
|
||||
<dt>Total Projects:</dt><dd>60</dd>
|
||||
<dt>Repositories:</dt><dd>20</dd>
|
||||
<dt>Public Repositories:</dt><dd>18</dd>
|
||||
<dt>Total Repositories:</dt><dd>32</dd>
|
||||
<dt>Projects:</dt><dd>//vm.statProjects['projects']//</dd>
|
||||
<dt>Public Projects:</dt><dd>//vm.statProjects['public_projects']//</dd>
|
||||
<dt>Total Projects:</dt><dd>//vm.statProjects['total_projects']//</dd>
|
||||
<dt>Repositories:</dt><dd>//vm.statProjects['repositories']//</dd>
|
||||
<dt>Public Repositories:</dt><dd>//vm.statProjects['public_repositories']//</dd>
|
||||
<dt>Total Repositories:</dt><dd>//vm.statProjects['total_repositories']//</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-8 col-md-8">
|
||||
<div class="up-section">
|
||||
<h4 class="page-header title-color underlined">Logs</h4>
|
||||
<h4 class="page-header title-color underlined">Top 10 Repositories</h4>
|
||||
<div class="col-xs-4 col-md-12 up-table-pane">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th>Username</th><th>Repository Name</th><th>Operation</th><th>Timestamp</th>
|
||||
<th>Repository Name</th><th>Size</th><th>Creator</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Haox</td><td>myrepo/Ubuntu</td><td>Create</td><td>2016-03-22 12:35:00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Haox</td><td>myrepo/MySQL</td><td>Push</td><td>2016-03-22 12:35:00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Daniel</td><td>myproject/Golang</td><td>Create</td><td>2016-03-12 12:35:00</td>
|
||||
</tr>
|
||||
<tr ng-repeat="t in vm.top10Repositories">
|
||||
<td>//t.repo_name//</td><td>//t.image_size//MB</td><td>//t.creator//</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -45,25 +39,18 @@
|
||||
<div class="row row-custom">
|
||||
<div class="col-xs-12 col-md-12">
|
||||
<div class="down-section single">
|
||||
<h4 class="page-header title-color underlined">Total Projects and Repositories Trends</h4>
|
||||
<p class="page-content text-justify">
|
||||
Project Harbor is to build an enterprise-class,
|
||||
reliable registry server. Enterprises can set
|
||||
up a private registry server in their own environment
|
||||
to improve productivity as well as security.
|
||||
Project Harbor can be used in both development
|
||||
and production environment.
|
||||
</p>
|
||||
<ul>
|
||||
<li title="Security: Keep their intellectual properties within their organizations.">Security: Keep their intellectual properties ...</li>
|
||||
<li title="Efficiency: A private registry server is set up within the organization's network and can reduce significantly the internet traffic to the public service.">Efficiency: A private registry server is set up ...</li>
|
||||
<li title="Access Control: RBAC (Role Based Access Control) is provided. User management can be integrated with existing enterprise identity services like AD/LDAP.">Access Control: RBAC (Role Based Access ...</li>
|
||||
<li title="Audit: All access to the registry are logged and can be used for audit purpose.">Audit: All access to the registry are logged ...</li>
|
||||
<li title="GUI: User friendly single-pane-of-glass management console.">GUI: User friendly single-pane-of-glass ...</li>
|
||||
</ul>
|
||||
<div class="page-content pull-right">
|
||||
<a href="#">Learn more...</a>
|
||||
</div>
|
||||
<h4 class="page-header title-color underlined">Logs</h4>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th>Task Name</th><th>Details</th><th>User</th><th>Time</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="t in vm.integratedLogs">
|
||||
<td>//t.task_name//</td><td>//t.details//</td><td>//t.user//</td><td>//t.creation_time//</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -63,6 +63,9 @@
|
||||
<script src="/static/ng/resources/js/layout/index/index.module.js"></script>
|
||||
<script src="/static/ng/resources/js/layout/index/index.controller.js"></script>
|
||||
|
||||
<script src="/static/ng/resources/js/layout/dashboard/dashboard.module.js"></script>
|
||||
<script src="/static/ng/resources/js/layout/dashboard/dashboard.controller.js"></script>
|
||||
|
||||
<script src="/static/ng/resources/js/layout/project/project.module.js"></script>
|
||||
<script src="/static/ng/resources/js/layout/project/project.controller.js"></script>
|
||||
|
||||
@ -79,9 +82,16 @@
|
||||
<script src="/static/ng/resources/js/layout/user/user.module.js"></script>
|
||||
<script src="/static/ng/resources/js/layout/user/user.controller.js"></script>
|
||||
|
||||
<script src="/static/ng/resources/js/layout/system-management/system-management.module.js"></script>
|
||||
<script src="/static/ng/resources/js/layout/system-management/system-management.controller.js"></script>
|
||||
|
||||
<script src="/static/ng/resources/js/layout/log/log.module.js"></script>
|
||||
<script src="/static/ng/resources/js/layout/log/log.controller.js"></script>
|
||||
|
||||
<script src="/static/ng/resources/js/layout/admin-option/admin-option.module.js"></script>
|
||||
<script src="/static/ng/resources/js/layout/admin-option/admin-option.controller.js"></script>
|
||||
<script src="/static/ng/resources/js/layout/admin-option/admin-option.config.js"></script>
|
||||
|
||||
<script src="/static/ng/resources/js/services/search/services.search.module.js"></script>
|
||||
<script src="/static/ng/resources/js/services/search/services.search.js"></script>
|
||||
|
||||
@ -89,6 +99,7 @@
|
||||
<script src="/static/ng/resources/js/services/project/services.list-project.js"></script>
|
||||
<script src="/static/ng/resources/js/services/project/services.add-project.js"></script>
|
||||
<script src="/static/ng/resources/js/services/project/services.edit-project.js"></script>
|
||||
<script src="/static/ng/resources/js/services/project/services.stat-project.js"></script>
|
||||
|
||||
<script src="/static/ng/resources/js/services/user/services.user.module.js"></script>
|
||||
<script src="/static/ng/resources/js/services/user/services.current-user.js"></script>
|
||||
@ -98,13 +109,17 @@
|
||||
<script src="/static/ng/resources/js/services/user/services.change-password.js"></script>
|
||||
<script src="/static/ng/resources/js/services/user/services.send-mail.js"></script>
|
||||
<script src="/static/ng/resources/js/services/user/services.reset-password.js"></script>
|
||||
|
||||
<script src="/static/ng/resources/js/services/user/services.list-user.js"></script>
|
||||
<script src="/static/ng/resources/js/services/user/services.toggle-admin.js"></script>
|
||||
<script src="/static/ng/resources/js/services/user/services.delete-user.js"></script>
|
||||
<script src="/static/ng/resources/js/services/user/services.log-out.js"></script>
|
||||
|
||||
<script src="/static/ng/resources/js/services/repository/services.repository.module.js"></script>
|
||||
<script src="/static/ng/resources/js/services/repository/services.list-repository.js"></script>
|
||||
<script src="/static/ng/resources/js/services/repository/services.list-tag.js"></script>
|
||||
<script src="/static/ng/resources/js/services/repository/services.list-manifest.js"></script>
|
||||
<script src="/static/ng/resources/js/services/repository/services.delete-repository.js"></script>
|
||||
<script src="/static/ng/resources/js/services/repository/services.list-top10-repository.js"></script>
|
||||
|
||||
<script src="/static/ng/resources/js/services/project-member/services.project-member.module.js"></script>
|
||||
<script src="/static/ng/resources/js/services/project-member/services.current-project-member.js"></script>
|
||||
@ -115,6 +130,7 @@
|
||||
|
||||
<script src="/static/ng/resources/js/services/log/services.log.module.js"></script>
|
||||
<script src="/static/ng/resources/js/services/log/services.list-log.js"></script>
|
||||
<script src="/static/ng/resources/js/services/log/services.list-integrated-log.js"></script>
|
||||
|
||||
<script src="/static/ng/resources/js/session/session.module.js"></script>
|
||||
<script src="/static/ng/resources/js/session/session.current-user.js"></script>
|
||||
@ -160,6 +176,7 @@
|
||||
<script src="/static/ng/resources/js/components/project-member/edit-project-member.directive.js"></script>
|
||||
|
||||
<script src="/static/ng/resources/js/components/user/user.module.js"></script>
|
||||
<script src="/static/ng/resources/js/components/user/toggle-admin.directive.js"></script>
|
||||
|
||||
<script src="/static/ng/resources/js/components/log/log.module.js"></script>
|
||||
<script src="/static/ng/resources/js/components/log/log.config.js"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user