mirror of
https://github.com/goharbor/harbor
synced 2024-09-21 05:25:32 +00:00
new updates for UI development file structure.
This commit is contained in:
parent
1223d37915
commit
02cb66cd3a
|
@ -0,0 +1,3 @@
|
|||
<ul class="nav-custom">
|
||||
<li ng-repeat="tab in tabs"><a href="//tab.url//">//tab.name//</a></li>
|
||||
</ul>
|
|
@ -0,0 +1,37 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.app')
|
||||
.directive('navigationTab', navigationTab);
|
||||
|
||||
function navigationTab() {
|
||||
var directive = {
|
||||
restrict: 'EA',
|
||||
scope: {
|
||||
"tabs": "="
|
||||
},
|
||||
|
||||
templateUrl: '/static/ng/resources/js/components/navigation-tab.directive.html',
|
||||
link: link
|
||||
}
|
||||
|
||||
return directive;
|
||||
|
||||
function link(scope, element, attrs) {
|
||||
element
|
||||
.on('mouseover', mouseover)
|
||||
.on('mouseout', mouseout);
|
||||
|
||||
function mouseover(event) {
|
||||
$(event.target).addClass('active');
|
||||
}
|
||||
|
||||
function mouseout(event) {
|
||||
$(event.target).removeClass('active');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
10
static/ng/resources/js/harbor.config.js
Normal file
10
static/ng/resources/js/harbor.config.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
angular
|
||||
.module('harbor.app')
|
||||
.config(function($interpolateProvider){
|
||||
$interpolateProvider.startSymbol('//');
|
||||
$interpolateProvider.endSymbol('//');
|
||||
});
|
||||
|
||||
})();
|
15
static/ng/resources/js/harbor.constants.js
Normal file
15
static/ng/resources/js/harbor.constants.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.app')
|
||||
.constant('navigationTabs', navigationTabs);
|
||||
|
||||
function navigationTabs() {
|
||||
var data = [
|
||||
{name: "Dashboard", url: "/ng/dashboard"},
|
||||
{name: "My Projects", url: "/ng/project"}];
|
||||
return data;
|
||||
}
|
||||
|
||||
})();
|
25
static/ng/resources/js/harbor.initialize.js
Normal file
25
static/ng/resources/js/harbor.initialize.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.app')
|
||||
.run(CurrentUser);
|
||||
|
||||
CurrentUser.$inject = ['CurrentUserService', '$log'];
|
||||
|
||||
function CurrentUser(CurrentUserService, $log) {
|
||||
|
||||
CurrentUserService()
|
||||
.then(getCurrentUserComplete)
|
||||
.catch(getCurrentUserFailed);
|
||||
|
||||
function getCurrentUserComplete(data) {
|
||||
$log.info(data.data);
|
||||
}
|
||||
|
||||
function getCurrentUserFailed(e){
|
||||
$log.info(e);
|
||||
}
|
||||
|
||||
}
|
||||
})();
|
8
static/ng/resources/js/harbor.module.js
Normal file
8
static/ng/resources/js/harbor.module.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
angular
|
||||
.module('harbor.app', [
|
||||
'harbor.services.user',
|
||||
'harbor.header',
|
||||
'harbor.index']);
|
||||
})();
|
8
static/ng/resources/js/header/header.data.js
Normal file
8
static/ng/resources/js/header/header.data.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.header');
|
||||
|
||||
})();
|
7
static/ng/resources/js/header/header.module.js
Normal file
7
static/ng/resources/js/header/header.module.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.header', []);
|
||||
})();
|
17
static/ng/resources/js/header/navigation.controllers.js
Normal file
17
static/ng/resources/js/header/navigation.controllers.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.header')
|
||||
.controller('NavigationController', NavigationController);
|
||||
|
||||
NavigationController.$inject = ['navigationTabs'];
|
||||
|
||||
|
||||
function NavigationController(navigationTabs) {
|
||||
var vm = this;
|
||||
vm.tabs = navigationTabs();
|
||||
}
|
||||
|
||||
})();
|
7
static/ng/resources/js/index/index.data.js
Normal file
7
static/ng/resources/js/index/index.data.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.index');
|
||||
})();
|
6
static/ng/resources/js/index/index.module.js
Normal file
6
static/ng/resources/js/index/index.module.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.index', []);
|
||||
})();
|
15
static/ng/resources/js/log/list-log.controller.js
Normal file
15
static/ng/resources/js/log/list-log.controller.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.log')
|
||||
.controller('ListLogController', ListLogController);
|
||||
|
||||
ListLogController.$inject = ['ListLogService']
|
||||
|
||||
function ListLogController(ListLogService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
10
static/ng/resources/js/log/log.module.js
Normal file
10
static/ng/resources/js/log/log.module.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.log', [
|
||||
'harbor.services.log'
|
||||
]);
|
||||
|
||||
})();
|
15
static/ng/resources/js/project/add-project.controller.js
Normal file
15
static/ng/resources/js/project/add-project.controller.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.project')
|
||||
.controller('AddProjectController', AddProjectController);
|
||||
|
||||
AddProjectController.$inject = ['AddProjectService'];
|
||||
|
||||
function AddProjectController(AddProjectService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
15
static/ng/resources/js/project/list-project.controller.js
Normal file
15
static/ng/resources/js/project/list-project.controller.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.project')
|
||||
.controller('ListProjectController', ListProjectController);
|
||||
|
||||
ListProjectController.$inject = ['ListProjectService'];
|
||||
|
||||
function ListProjectService(ListProjectService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
8
static/ng/resources/js/project/project.module.js
Normal file
8
static/ng/resources/js/project/project.module.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.project', [
|
||||
'harbor.services.project'
|
||||
]);
|
||||
})();
|
|
@ -0,0 +1,15 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.projectmember')
|
||||
.controller('AddProjectMemberController', AddProjectMemberController);
|
||||
|
||||
AddProjectMemberController.$inject = ['AddProjectMemberService'];
|
||||
|
||||
function AddProjectMemberController(AddProjectMemberService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
|
@ -0,0 +1,15 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.projectmember')
|
||||
.controller('DeleteProjectMemberController', DeleteProjectMemberController);
|
||||
|
||||
DeleteProjectMemberController.$inject = ['DeleteProjectMemberService'];
|
||||
|
||||
function DeleteProjectMemberController(DeleteProjectMemberService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
|
@ -0,0 +1,15 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.projectmember')
|
||||
.controller('EditProjectMemberController', EditProjectMemberController);
|
||||
|
||||
EditProjectMemberController.$inject = ['EditProjectMemberService'];
|
||||
|
||||
function EditProjectMemberController(EditProjectMemberService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
|
@ -0,0 +1,9 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.projectmember', [
|
||||
'harbor.services.projectmember']);
|
||||
|
||||
})();
|
|
@ -0,0 +1,15 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.repository')
|
||||
.controller('DeleteRepositoryController', DeleteRepositoryController);
|
||||
|
||||
DeleteRepositoryController.$inject = ['DeleteRepositoryService'];
|
||||
|
||||
function DeleteRepositoryController(DeleteRepositoryService) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
})();
|
|
@ -0,0 +1,15 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.repository')
|
||||
.controller('ListRepositoryController', ListRepositoryController);
|
||||
|
||||
ListRepositoryController.$inject = ['ListRepositoryService'];
|
||||
|
||||
function ListRepositoryController(ListRepositoryService) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
})();
|
7
static/ng/resources/js/repository/repository.module.js
Normal file
7
static/ng/resources/js/repository/repository.module.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.repository', [
|
||||
'harbor.services.repository']);
|
||||
})();
|
15
static/ng/resources/js/search/search.controller.js
Normal file
15
static/ng/resources/js/search/search.controller.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.search')
|
||||
.controller('SearchController', SearchController);
|
||||
|
||||
SearchController.$inject = ['SearchService'];
|
||||
|
||||
function SearchController(SearchService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
7
static/ng/resources/js/search/search.module.js
Normal file
7
static/ng/resources/js/search/search.module.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.search', [
|
||||
'harbor.services.search']);
|
||||
})();
|
19
static/ng/resources/js/services/log/services.list-log.js
Normal file
19
static/ng/resources/js/services/log/services.list-log.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.log')
|
||||
.factory('ListLogService', ListLogService);
|
||||
|
||||
CurrentUserService.$inject = ['$http', '$log'];
|
||||
|
||||
function ListLogService($http, $log) {
|
||||
|
||||
return LogResult;
|
||||
|
||||
function LogResult(queryParams) {
|
||||
$log.info(queryParams);
|
||||
}
|
||||
}
|
||||
})();
|
|
@ -0,0 +1,8 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.log', []);
|
||||
|
||||
})();
|
|
@ -0,0 +1,19 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.project')
|
||||
.factory('AddProjectService', AddProjectService);
|
||||
|
||||
AddProjectService.$inject = ['$http', '$log'];
|
||||
|
||||
function AddProjectService($http, $log) {
|
||||
|
||||
return AddProject;
|
||||
|
||||
function AddProject(project) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
|
@ -0,0 +1,18 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.project')
|
||||
.factory('ListProjectService', ListProjectService);
|
||||
|
||||
ListProjectService.$inject = ['$http', '$log'];
|
||||
|
||||
function ListProjectService($http, $log) {
|
||||
|
||||
return ListProject;
|
||||
|
||||
function ListProject(queryParams) {
|
||||
$log.info(queryParams);
|
||||
}
|
||||
}
|
||||
})();
|
|
@ -0,0 +1,7 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.project', []);
|
||||
|
||||
})();
|
|
@ -0,0 +1,21 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.projectmember')
|
||||
.factory('AddProjectMemberService', AddProjectMemberService);
|
||||
|
||||
AddProjectMemberService.$inject = ['$http', '$log'];
|
||||
|
||||
function AddProjectMemberService($http, $log) {
|
||||
|
||||
return AddProjectMember;
|
||||
|
||||
function AddProjectMember(projectMember) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})();
|
|
@ -0,0 +1,21 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.projectmember')
|
||||
.factory('DeleteProjectMemberService', DeleteProjectMemberService);
|
||||
|
||||
DeleteProjectMemberService.$inject = ['$http', '$log'];
|
||||
|
||||
function DeleteProjectMemberService($http, $log) {
|
||||
|
||||
return DeleteProjectMember;
|
||||
|
||||
function DeleteProjectMember(projectMember) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})();
|
|
@ -0,0 +1,21 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.projectmember')
|
||||
.factory('EditProjectMemberService', EditProjectMemberService);
|
||||
|
||||
EditProjectMemberService.$inject = ['$http', '$log'];
|
||||
|
||||
function EditProjectMemberService($http, $log) {
|
||||
|
||||
return EditProjectMember;
|
||||
|
||||
function EditProjectMember(projectMember) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})();
|
|
@ -0,0 +1,8 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.projectmember', []);
|
||||
|
||||
})();
|
|
@ -0,0 +1,19 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.repository')
|
||||
.factory('DeleteRepositoryService', DeleteRepositoryService);
|
||||
|
||||
DeleteRepositoryService.$inject = ['$http', '$log'];
|
||||
|
||||
function DeleteRepositoryService($http, $log) {
|
||||
|
||||
return DeleteRepository;
|
||||
|
||||
function DeleteRepository(repository) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
})();
|
|
@ -0,0 +1,18 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.repository')
|
||||
.factory('ListRepositoryService', ListRepositoryService);
|
||||
|
||||
ListRepositoryService.$inject = ['$http', '$log'];
|
||||
|
||||
function ListRepositoryService($http, $log) {
|
||||
|
||||
return RepositoryResult;
|
||||
|
||||
function RepositoryResult(queryParams) {
|
||||
$log.info(queryParams);
|
||||
}
|
||||
}
|
||||
})();
|
|
@ -0,0 +1,7 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.repository', []);
|
||||
|
||||
})();
|
21
static/ng/resources/js/services/search/services.search.js
Normal file
21
static/ng/resources/js/services/search/services.search.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.search')
|
||||
.factory('SearchService', SearchService);
|
||||
|
||||
SearchService.$inject = ['$http', '$log'];
|
||||
|
||||
function SearchService($http, $log) {
|
||||
|
||||
return Search;
|
||||
|
||||
function Search(queryParams) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})();
|
|
@ -0,0 +1,8 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.search', []);
|
||||
|
||||
})();
|
8
static/ng/resources/js/services/services.data.js
Normal file
8
static/ng/resources/js/services/services.data.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services');
|
||||
|
||||
|
||||
})();
|
6
static/ng/resources/js/services/services.module.js
Normal file
6
static/ng/resources/js/services/services.module.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services', []);
|
||||
})();
|
|
@ -0,0 +1,21 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.user')
|
||||
.factory('ChangePasswordService', ChangePasswordService);
|
||||
|
||||
ChangePasswordService.$inject = ['$http', '$log'];
|
||||
|
||||
function ChangePasswordService($http, $log) {
|
||||
|
||||
return ChangePassword;
|
||||
|
||||
function ChangePassword(user) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})();
|
|
@ -0,0 +1,20 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.user')
|
||||
.factory('CurrentUserService', CurrentUserService);
|
||||
|
||||
CurrentUserService.$inject = ['$http'];
|
||||
|
||||
function CurrentUserService($http, $log) {
|
||||
|
||||
return CurrentUser;
|
||||
|
||||
function CurrentUser() {
|
||||
return $http
|
||||
.get('/api/users/current');
|
||||
}
|
||||
}
|
||||
})();
|
21
static/ng/resources/js/services/user/services.delete-user.js
Normal file
21
static/ng/resources/js/services/user/services.delete-user.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.user')
|
||||
.factory('DeleteUserService', DeleteUserService);
|
||||
|
||||
DeleteUserService.$inject = ['$http', '$log'];
|
||||
|
||||
function DeleteUserService($http, $log) {
|
||||
|
||||
return DeleteUser;
|
||||
|
||||
function DeleteUser(user) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})();
|
|
@ -0,0 +1,21 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.user')
|
||||
.factory('ForgotPasswordService', ForgotPasswordService);
|
||||
|
||||
ForgotPasswordService.$inject = ['$http', '$log'];
|
||||
|
||||
function ForgotPasswordService($http, $log) {
|
||||
|
||||
return ForgotPassword;
|
||||
|
||||
function ForgotPassword(user) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})();
|
21
static/ng/resources/js/services/user/services.is-admin.js
Normal file
21
static/ng/resources/js/services/user/services.is-admin.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.user')
|
||||
.factory('IsAdminService', IsAdminService);
|
||||
|
||||
IsAdminService.$inject = ['$http', '$log'];
|
||||
|
||||
function IsAdminService($http, $log) {
|
||||
|
||||
return IsAdmin;
|
||||
|
||||
function IsAdmin() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
19
static/ng/resources/js/services/user/services.list-user.js
Normal file
19
static/ng/resources/js/services/user/services.list-user.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.user')
|
||||
.factory('ListUserService', ListUserService);
|
||||
|
||||
ListUserService.$inject = ['$http', '$log'];
|
||||
|
||||
function ListUserService($http, $log) {
|
||||
|
||||
return ListUser;
|
||||
|
||||
function ListUser(queryParams) {
|
||||
$log.info(queryParams);
|
||||
}
|
||||
}
|
||||
})();
|
19
static/ng/resources/js/services/user/services.sign-in.js
Normal file
19
static/ng/resources/js/services/user/services.sign-in.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.user')
|
||||
.factory('SignInService', SignInService);
|
||||
|
||||
SignInService.$inject = ['$http', '$log'];
|
||||
|
||||
function SignInService($http, $log) {
|
||||
|
||||
return SignIn;
|
||||
|
||||
function SignIn(user) {
|
||||
$log.info(user);
|
||||
}
|
||||
}
|
||||
})();
|
19
static/ng/resources/js/services/user/services.sign-up.js
Normal file
19
static/ng/resources/js/services/user/services.sign-up.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.user')
|
||||
.factory('SignUpService', SignUpService);
|
||||
|
||||
SignUpService.$inject = ['$http', '$log'];
|
||||
|
||||
function SignUpService($http, $log) {
|
||||
|
||||
return SignUp;
|
||||
|
||||
function SignUp(user) {
|
||||
$log.info(user);
|
||||
}
|
||||
}
|
||||
})();
|
|
@ -0,0 +1,8 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.services.user', []);
|
||||
|
||||
})();
|
15
static/ng/resources/js/user/change-password.controller.js
Normal file
15
static/ng/resources/js/user/change-password.controller.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.user');
|
||||
.controller('ChangePasswordController', ChangePasswordController);
|
||||
|
||||
ChangePassswordController.$inject = ['ChangePasswordService'];
|
||||
|
||||
function ChangePasswordController(ChangePasswordService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
15
static/ng/resources/js/user/delete-user.controller.js
Normal file
15
static/ng/resources/js/user/delete-user.controller.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.user');
|
||||
.controller('DeleteUserController', DeleteUserController);
|
||||
|
||||
DeleteUserController.$inject = ['DeleteUserService'];
|
||||
|
||||
function DeleteUserController(DeleteUserService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
16
static/ng/resources/js/user/forgot-password.controller.js
Normal file
16
static/ng/resources/js/user/forgot-password.controller.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.user');
|
||||
.controller('ForgotPasswordController', ForgotPasswordController);
|
||||
|
||||
|
||||
ForgotPasswordController.$inject = ['ForgotPasswordService'];
|
||||
|
||||
function ForgotPasswordController(ForgotPasswordService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
15
static/ng/resources/js/user/list-user.controller.js
Normal file
15
static/ng/resources/js/user/list-user.controller.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.user');
|
||||
.controller('ListUserController', ListUserController);
|
||||
|
||||
ListUserController.$inject = ['ListUserService'];
|
||||
|
||||
function ListUserController(ListUserService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
15
static/ng/resources/js/user/sign-in.controller.js
Normal file
15
static/ng/resources/js/user/sign-in.controller.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.user');
|
||||
.controller('SignInController', SignInController);
|
||||
|
||||
SignInController.$inject = ['SignInService'];
|
||||
|
||||
function SignInController(SignInService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
15
static/ng/resources/js/user/sign-up.controller.js
Normal file
15
static/ng/resources/js/user/sign-up.controller.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.user');
|
||||
.controller('SignUpController', SignUpController);
|
||||
|
||||
SignUpController.$inject = ['SignUpService'];
|
||||
|
||||
function SignUpController(SignUpService) {
|
||||
|
||||
}
|
||||
|
||||
})();
|
8
static/ng/resources/js/user/user.module.js
Normal file
8
static/ng/resources/js/user/user.module.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.user', [
|
||||
'harbor.services.user']);
|
||||
})();
|
768
static/ng/vendors/angularjs/angular-resource.js
vendored
Normal file
768
static/ng/vendors/angularjs/angular-resource.js
vendored
Normal file
|
@ -0,0 +1,768 @@
|
|||
/**
|
||||
* @license AngularJS v1.5.3
|
||||
* (c) 2010-2016 Google, Inc. http://angularjs.org
|
||||
* License: MIT
|
||||
*/
|
||||
(function(window, angular, undefined) {'use strict';
|
||||
|
||||
var $resourceMinErr = angular.$$minErr('$resource');
|
||||
|
||||
// Helper functions and regex to lookup a dotted path on an object
|
||||
// stopping at undefined/null. The path must be composed of ASCII
|
||||
// identifiers (just like $parse)
|
||||
var MEMBER_NAME_REGEX = /^(\.[a-zA-Z_$@][0-9a-zA-Z_$@]*)+$/;
|
||||
|
||||
function isValidDottedPath(path) {
|
||||
return (path != null && path !== '' && path !== 'hasOwnProperty' &&
|
||||
MEMBER_NAME_REGEX.test('.' + path));
|
||||
}
|
||||
|
||||
function lookupDottedPath(obj, path) {
|
||||
if (!isValidDottedPath(path)) {
|
||||
throw $resourceMinErr('badmember', 'Dotted member path "@{0}" is invalid.', path);
|
||||
}
|
||||
var keys = path.split('.');
|
||||
for (var i = 0, ii = keys.length; i < ii && angular.isDefined(obj); i++) {
|
||||
var key = keys[i];
|
||||
obj = (obj !== null) ? obj[key] : undefined;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a shallow copy of an object and clear other fields from the destination
|
||||
*/
|
||||
function shallowClearAndCopy(src, dst) {
|
||||
dst = dst || {};
|
||||
|
||||
angular.forEach(dst, function(value, key) {
|
||||
delete dst[key];
|
||||
});
|
||||
|
||||
for (var key in src) {
|
||||
if (src.hasOwnProperty(key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {
|
||||
dst[key] = src[key];
|
||||
}
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc module
|
||||
* @name ngResource
|
||||
* @description
|
||||
*
|
||||
* # ngResource
|
||||
*
|
||||
* The `ngResource` module provides interaction support with RESTful services
|
||||
* via the $resource service.
|
||||
*
|
||||
*
|
||||
* <div doc-module-components="ngResource"></div>
|
||||
*
|
||||
* See {@link ngResource.$resource `$resource`} for usage.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ngdoc service
|
||||
* @name $resource
|
||||
* @requires $http
|
||||
* @requires ng.$log
|
||||
* @requires $q
|
||||
* @requires ng.$timeout
|
||||
*
|
||||
* @description
|
||||
* A factory which creates a resource object that lets you interact with
|
||||
* [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources.
|
||||
*
|
||||
* The returned resource object has action methods which provide high-level behaviors without
|
||||
* the need to interact with the low level {@link ng.$http $http} service.
|
||||
*
|
||||
* Requires the {@link ngResource `ngResource`} module to be installed.
|
||||
*
|
||||
* By default, trailing slashes will be stripped from the calculated URLs,
|
||||
* which can pose problems with server backends that do not expect that
|
||||
* behavior. This can be disabled by configuring the `$resourceProvider` like
|
||||
* this:
|
||||
*
|
||||
* ```js
|
||||
app.config(['$resourceProvider', function($resourceProvider) {
|
||||
// Don't strip trailing slashes from calculated URLs
|
||||
$resourceProvider.defaults.stripTrailingSlashes = false;
|
||||
}]);
|
||||
* ```
|
||||
*
|
||||
* @param {string} url A parameterized URL template with parameters prefixed by `:` as in
|
||||
* `/user/:username`. If you are using a URL with a port number (e.g.
|
||||
* `http://example.com:8080/api`), it will be respected.
|
||||
*
|
||||
* If you are using a url with a suffix, just add the suffix, like this:
|
||||
* `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json')`
|
||||
* or even `$resource('http://example.com/resource/:resource_id.:format')`
|
||||
* If the parameter before the suffix is empty, :resource_id in this case, then the `/.` will be
|
||||
* collapsed down to a single `.`. If you need this sequence to appear and not collapse then you
|
||||
* can escape it with `/\.`.
|
||||
*
|
||||
* @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in
|
||||
* `actions` methods. If a parameter value is a function, it will be executed every time
|
||||
* when a param value needs to be obtained for a request (unless the param was overridden).
|
||||
*
|
||||
* Each key value in the parameter object is first bound to url template if present and then any
|
||||
* excess keys are appended to the url search query after the `?`.
|
||||
*
|
||||
* Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in
|
||||
* URL `/path/greet?salutation=Hello`.
|
||||
*
|
||||
* If the parameter value is prefixed with `@` then the value for that parameter will be extracted
|
||||
* from the corresponding property on the `data` object (provided when calling an action method).
|
||||
* For example, if the `defaultParam` object is `{someParam: '@someProp'}` then the value of
|
||||
* `someParam` will be `data.someProp`.
|
||||
*
|
||||
* @param {Object.<Object>=} actions Hash with declaration of custom actions that should extend
|
||||
* the default set of resource actions. The declaration should be created in the format of {@link
|
||||
* ng.$http#usage $http.config}:
|
||||
*
|
||||
* {action1: {method:?, params:?, isArray:?, headers:?, ...},
|
||||
* action2: {method:?, params:?, isArray:?, headers:?, ...},
|
||||
* ...}
|
||||
*
|
||||
* Where:
|
||||
*
|
||||
* - **`action`** – {string} – The name of action. This name becomes the name of the method on
|
||||
* your resource object.
|
||||
* - **`method`** – {string} – Case insensitive HTTP method (e.g. `GET`, `POST`, `PUT`,
|
||||
* `DELETE`, `JSONP`, etc).
|
||||
* - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of
|
||||
* the parameter value is a function, it will be executed every time when a param value needs to
|
||||
* be obtained for a request (unless the param was overridden).
|
||||
* - **`url`** – {string} – action specific `url` override. The url templating is supported just
|
||||
* like for the resource-level urls.
|
||||
* - **`isArray`** – {boolean=} – If true then the returned object for this action is an array,
|
||||
* see `returns` section.
|
||||
* - **`transformRequest`** –
|
||||
* `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
|
||||
* transform function or an array of such functions. The transform function takes the http
|
||||
* request body and headers and returns its transformed (typically serialized) version.
|
||||
* By default, transformRequest will contain one function that checks if the request data is
|
||||
* an object and serializes to using `angular.toJson`. To prevent this behavior, set
|
||||
* `transformRequest` to an empty array: `transformRequest: []`
|
||||
* - **`transformResponse`** –
|
||||
* `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
|
||||
* transform function or an array of such functions. The transform function takes the http
|
||||
* response body and headers and returns its transformed (typically deserialized) version.
|
||||
* By default, transformResponse will contain one function that checks if the response looks
|
||||
* like a JSON string and deserializes it using `angular.fromJson`. To prevent this behavior,
|
||||
* set `transformResponse` to an empty array: `transformResponse: []`
|
||||
* - **`cache`** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
|
||||
* GET request, otherwise if a cache instance built with
|
||||
* {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
|
||||
* caching.
|
||||
* - **`timeout`** – `{number}` – timeout in milliseconds.<br />
|
||||
* **Note:** In contrast to {@link ng.$http#usage $http.config}, {@link ng.$q promises} are
|
||||
* **not** supported in $resource, because the same value would be used for multiple requests.
|
||||
* If you are looking for a way to cancel requests, you should use the `cancellable` option.
|
||||
* - **`cancellable`** – `{boolean}` – if set to true, the request made by a "non-instance" call
|
||||
* will be cancelled (if not already completed) by calling `$cancelRequest()` on the call's
|
||||
* return value. Calling `$cancelRequest()` for a non-cancellable or an already
|
||||
* completed/cancelled request will have no effect.<br />
|
||||
* - **`withCredentials`** - `{boolean}` - whether to set the `withCredentials` flag on the
|
||||
* XHR object. See
|
||||
* [requests with credentials](https://developer.mozilla.org/en/http_access_control#section_5)
|
||||
* for more information.
|
||||
* - **`responseType`** - `{string}` - see
|
||||
* [requestType](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType).
|
||||
* - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods -
|
||||
* `response` and `responseError`. Both `response` and `responseError` interceptors get called
|
||||
* with `http response` object. See {@link ng.$http $http interceptors}.
|
||||
*
|
||||
* @param {Object} options Hash with custom settings that should extend the
|
||||
* default `$resourceProvider` behavior. The supported options are:
|
||||
*
|
||||
* - **`stripTrailingSlashes`** – {boolean} – If true then the trailing
|
||||
* slashes from any calculated URL will be stripped. (Defaults to true.)
|
||||
* - **`cancellable`** – {boolean} – If true, the request made by a "non-instance" call will be
|
||||
* cancelled (if not already completed) by calling `$cancelRequest()` on the call's return value.
|
||||
* This can be overwritten per action. (Defaults to false.)
|
||||
*
|
||||
* @returns {Object} A resource "class" object with methods for the default set of resource actions
|
||||
* optionally extended with custom `actions`. The default set contains these actions:
|
||||
* ```js
|
||||
* { 'get': {method:'GET'},
|
||||
* 'save': {method:'POST'},
|
||||
* 'query': {method:'GET', isArray:true},
|
||||
* 'remove': {method:'DELETE'},
|
||||
* 'delete': {method:'DELETE'} };
|
||||
* ```
|
||||
*
|
||||
* Calling these methods invoke an {@link ng.$http} with the specified http method,
|
||||
* destination and parameters. When the data is returned from the server then the object is an
|
||||
* instance of the resource class. The actions `save`, `remove` and `delete` are available on it
|
||||
* as methods with the `$` prefix. This allows you to easily perform CRUD operations (create,
|
||||
* read, update, delete) on server-side data like this:
|
||||
* ```js
|
||||
* var User = $resource('/user/:userId', {userId:'@id'});
|
||||
* var user = User.get({userId:123}, function() {
|
||||
* user.abc = true;
|
||||
* user.$save();
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* It is important to realize that invoking a $resource object method immediately returns an
|
||||
* empty reference (object or array depending on `isArray`). Once the data is returned from the
|
||||
* server the existing reference is populated with the actual data. This is a useful trick since
|
||||
* usually the resource is assigned to a model which is then rendered by the view. Having an empty
|
||||
* object results in no rendering, once the data arrives from the server then the object is
|
||||
* populated with the data and the view automatically re-renders itself showing the new data. This
|
||||
* means that in most cases one never has to write a callback function for the action methods.
|
||||
*
|
||||
* The action methods on the class object or instance object can be invoked with the following
|
||||
* parameters:
|
||||
*
|
||||
* - HTTP GET "class" actions: `Resource.action([parameters], [success], [error])`
|
||||
* - non-GET "class" actions: `Resource.action([parameters], postData, [success], [error])`
|
||||
* - non-GET instance actions: `instance.$action([parameters], [success], [error])`
|
||||
*
|
||||
*
|
||||
* Success callback is called with (value, responseHeaders) arguments, where the value is
|
||||
* the populated resource instance or collection object. The error callback is called
|
||||
* with (httpResponse) argument.
|
||||
*
|
||||
* Class actions return empty instance (with additional properties below).
|
||||
* Instance actions return promise of the action.
|
||||
*
|
||||
* The Resource instances and collections have these additional properties:
|
||||
*
|
||||
* - `$promise`: the {@link ng.$q promise} of the original server interaction that created this
|
||||
* instance or collection.
|
||||
*
|
||||
* On success, the promise is resolved with the same resource instance or collection object,
|
||||
* updated with data from server. This makes it easy to use in
|
||||
* {@link ngRoute.$routeProvider resolve section of $routeProvider.when()} to defer view
|
||||
* rendering until the resource(s) are loaded.
|
||||
*
|
||||
* On failure, the promise is rejected with the {@link ng.$http http response} object, without
|
||||
* the `resource` property.
|
||||
*
|
||||
* If an interceptor object was provided, the promise will instead be resolved with the value
|
||||
* returned by the interceptor.
|
||||
*
|
||||
* - `$resolved`: `true` after first server interaction is completed (either with success or
|
||||
* rejection), `false` before that. Knowing if the Resource has been resolved is useful in
|
||||
* data-binding.
|
||||
*
|
||||
* The Resource instances and collections have these additional methods:
|
||||
*
|
||||
* - `$cancelRequest`: If there is a cancellable, pending request related to the instance or
|
||||
* collection, calling this method will abort the request.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* # Credit card resource
|
||||
*
|
||||
* ```js
|
||||
// Define CreditCard class
|
||||
var CreditCard = $resource('/user/:userId/card/:cardId',
|
||||
{userId:123, cardId:'@id'}, {
|
||||
charge: {method:'POST', params:{charge:true}}
|
||||
});
|
||||
|
||||
// We can retrieve a collection from the server
|
||||
var cards = CreditCard.query(function() {
|
||||
// GET: /user/123/card
|
||||
// server returns: [ {id:456, number:'1234', name:'Smith'} ];
|
||||
|
||||
var card = cards[0];
|
||||
// each item is an instance of CreditCard
|
||||
expect(card instanceof CreditCard).toEqual(true);
|
||||
card.name = "J. Smith";
|
||||
// non GET methods are mapped onto the instances
|
||||
card.$save();
|
||||
// POST: /user/123/card/456 {id:456, number:'1234', name:'J. Smith'}
|
||||
// server returns: {id:456, number:'1234', name: 'J. Smith'};
|
||||
|
||||
// our custom method is mapped as well.
|
||||
card.$charge({amount:9.99});
|
||||
// POST: /user/123/card/456?amount=9.99&charge=true {id:456, number:'1234', name:'J. Smith'}
|
||||
});
|
||||
|
||||
// we can create an instance as well
|
||||
var newCard = new CreditCard({number:'0123'});
|
||||
newCard.name = "Mike Smith";
|
||||
newCard.$save();
|
||||
// POST: /user/123/card {number:'0123', name:'Mike Smith'}
|
||||
// server returns: {id:789, number:'0123', name: 'Mike Smith'};
|
||||
expect(newCard.id).toEqual(789);
|
||||
* ```
|
||||
*
|
||||
* The object returned from this function execution is a resource "class" which has "static" method
|
||||
* for each action in the definition.
|
||||
*
|
||||
* Calling these methods invoke `$http` on the `url` template with the given `method`, `params` and
|
||||
* `headers`.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* # User resource
|
||||
*
|
||||
* When the data is returned from the server then the object is an instance of the resource type and
|
||||
* all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD
|
||||
* operations (create, read, update, delete) on server-side data.
|
||||
|
||||
```js
|
||||
var User = $resource('/user/:userId', {userId:'@id'});
|
||||
User.get({userId:123}, function(user) {
|
||||
user.abc = true;
|
||||
user.$save();
|
||||
});
|
||||
```
|
||||
*
|
||||
* It's worth noting that the success callback for `get`, `query` and other methods gets passed
|
||||
* in the response that came from the server as well as $http header getter function, so one
|
||||
* could rewrite the above example and get access to http headers as:
|
||||
*
|
||||
```js
|
||||
var User = $resource('/user/:userId', {userId:'@id'});
|
||||
User.get({userId:123}, function(user, getResponseHeaders){
|
||||
user.abc = true;
|
||||
user.$save(function(user, putResponseHeaders) {
|
||||
//user => saved user object
|
||||
//putResponseHeaders => $http header getter
|
||||
});
|
||||
});
|
||||
```
|
||||
*
|
||||
* You can also access the raw `$http` promise via the `$promise` property on the object returned
|
||||
*
|
||||
```
|
||||
var User = $resource('/user/:userId', {userId:'@id'});
|
||||
User.get({userId:123})
|
||||
.$promise.then(function(user) {
|
||||
$scope.user = user;
|
||||
});
|
||||
```
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* # Creating a custom 'PUT' request
|
||||
*
|
||||
* In this example we create a custom method on our resource to make a PUT request
|
||||
* ```js
|
||||
* var app = angular.module('app', ['ngResource', 'ngRoute']);
|
||||
*
|
||||
* // Some APIs expect a PUT request in the format URL/object/ID
|
||||
* // Here we are creating an 'update' method
|
||||
* app.factory('Notes', ['$resource', function($resource) {
|
||||
* return $resource('/notes/:id', null,
|
||||
* {
|
||||
* 'update': { method:'PUT' }
|
||||
* });
|
||||
* }]);
|
||||
*
|
||||
* // In our controller we get the ID from the URL using ngRoute and $routeParams
|
||||
* // We pass in $routeParams and our Notes factory along with $scope
|
||||
* app.controller('NotesCtrl', ['$scope', '$routeParams', 'Notes',
|
||||
function($scope, $routeParams, Notes) {
|
||||
* // First get a note object from the factory
|
||||
* var note = Notes.get({ id:$routeParams.id });
|
||||
* $id = note.id;
|
||||
*
|
||||
* // Now call update passing in the ID first then the object you are updating
|
||||
* Notes.update({ id:$id }, note);
|
||||
*
|
||||
* // This will PUT /notes/ID with the note object in the request payload
|
||||
* }]);
|
||||
* ```
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* # Cancelling requests
|
||||
*
|
||||
* If an action's configuration specifies that it is cancellable, you can cancel the request related
|
||||
* to an instance or collection (as long as it is a result of a "non-instance" call):
|
||||
*
|
||||
```js
|
||||
// ...defining the `Hotel` resource...
|
||||
var Hotel = $resource('/api/hotel/:id', {id: '@id'}, {
|
||||
// Let's make the `query()` method cancellable
|
||||
query: {method: 'get', isArray: true, cancellable: true}
|
||||
});
|
||||
|
||||
// ...somewhere in the PlanVacationController...
|
||||
...
|
||||
this.onDestinationChanged = function onDestinationChanged(destination) {
|
||||
// We don't care about any pending request for hotels
|
||||
// in a different destination any more
|
||||
this.availableHotels.$cancelRequest();
|
||||
|
||||
// Let's query for hotels in '<destination>'
|
||||
// (calls: /api/hotel?location=<destination>)
|
||||
this.availableHotels = Hotel.query({location: destination});
|
||||
};
|
||||
```
|
||||
*
|
||||
*/
|
||||
angular.module('ngResource', ['ng']).
|
||||
provider('$resource', function() {
|
||||
var PROTOCOL_AND_DOMAIN_REGEX = /^https?:\/\/[^\/]*/;
|
||||
var provider = this;
|
||||
|
||||
this.defaults = {
|
||||
// Strip slashes by default
|
||||
stripTrailingSlashes: true,
|
||||
|
||||
// Default actions configuration
|
||||
actions: {
|
||||
'get': {method: 'GET'},
|
||||
'save': {method: 'POST'},
|
||||
'query': {method: 'GET', isArray: true},
|
||||
'remove': {method: 'DELETE'},
|
||||
'delete': {method: 'DELETE'}
|
||||
}
|
||||
};
|
||||
|
||||
this.$get = ['$http', '$log', '$q', '$timeout', function($http, $log, $q, $timeout) {
|
||||
|
||||
var noop = angular.noop,
|
||||
forEach = angular.forEach,
|
||||
extend = angular.extend,
|
||||
copy = angular.copy,
|
||||
isFunction = angular.isFunction;
|
||||
|
||||
/**
|
||||
* We need our custom method because encodeURIComponent is too aggressive and doesn't follow
|
||||
* http://www.ietf.org/rfc/rfc3986.txt with regards to the character set
|
||||
* (pchar) allowed in path segments:
|
||||
* segment = *pchar
|
||||
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
||||
* pct-encoded = "%" HEXDIG HEXDIG
|
||||
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
||||
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
|
||||
* / "*" / "+" / "," / ";" / "="
|
||||
*/
|
||||
function encodeUriSegment(val) {
|
||||
return encodeUriQuery(val, true).
|
||||
replace(/%26/gi, '&').
|
||||
replace(/%3D/gi, '=').
|
||||
replace(/%2B/gi, '+');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method is intended for encoding *key* or *value* parts of query component. We need a
|
||||
* custom method because encodeURIComponent is too aggressive and encodes stuff that doesn't
|
||||
* have to be encoded per http://tools.ietf.org/html/rfc3986:
|
||||
* query = *( pchar / "/" / "?" )
|
||||
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
||||
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
||||
* pct-encoded = "%" HEXDIG HEXDIG
|
||||
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
|
||||
* / "*" / "+" / "," / ";" / "="
|
||||
*/
|
||||
function encodeUriQuery(val, pctEncodeSpaces) {
|
||||
return encodeURIComponent(val).
|
||||
replace(/%40/gi, '@').
|
||||
replace(/%3A/gi, ':').
|
||||
replace(/%24/g, '$').
|
||||
replace(/%2C/gi, ',').
|
||||
replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
|
||||
}
|
||||
|
||||
function Route(template, defaults) {
|
||||
this.template = template;
|
||||
this.defaults = extend({}, provider.defaults, defaults);
|
||||
this.urlParams = {};
|
||||
}
|
||||
|
||||
Route.prototype = {
|
||||
setUrlParams: function(config, params, actionUrl) {
|
||||
var self = this,
|
||||
url = actionUrl || self.template,
|
||||
val,
|
||||
encodedVal,
|
||||
protocolAndDomain = '';
|
||||
|
||||
var urlParams = self.urlParams = {};
|
||||
forEach(url.split(/\W/), function(param) {
|
||||
if (param === 'hasOwnProperty') {
|
||||
throw $resourceMinErr('badname', "hasOwnProperty is not a valid parameter name.");
|
||||
}
|
||||
if (!(new RegExp("^\\d+$").test(param)) && param &&
|
||||
(new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) {
|
||||
urlParams[param] = {
|
||||
isQueryParamValue: (new RegExp("\\?.*=:" + param + "(?:\\W|$)")).test(url)
|
||||
};
|
||||
}
|
||||
});
|
||||
url = url.replace(/\\:/g, ':');
|
||||
url = url.replace(PROTOCOL_AND_DOMAIN_REGEX, function(match) {
|
||||
protocolAndDomain = match;
|
||||
return '';
|
||||
});
|
||||
|
||||
params = params || {};
|
||||
forEach(self.urlParams, function(paramInfo, urlParam) {
|
||||
val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];
|
||||
if (angular.isDefined(val) && val !== null) {
|
||||
if (paramInfo.isQueryParamValue) {
|
||||
encodedVal = encodeUriQuery(val, true);
|
||||
} else {
|
||||
encodedVal = encodeUriSegment(val);
|
||||
}
|
||||
url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), function(match, p1) {
|
||||
return encodedVal + p1;
|
||||
});
|
||||
} else {
|
||||
url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W|$)", "g"), function(match,
|
||||
leadingSlashes, tail) {
|
||||
if (tail.charAt(0) == '/') {
|
||||
return tail;
|
||||
} else {
|
||||
return leadingSlashes + tail;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// strip trailing slashes and set the url (unless this behavior is specifically disabled)
|
||||
if (self.defaults.stripTrailingSlashes) {
|
||||
url = url.replace(/\/+$/, '') || '/';
|
||||
}
|
||||
|
||||
// then replace collapse `/.` if found in the last URL path segment before the query
|
||||
// E.g. `http://url.com/id./format?q=x` becomes `http://url.com/id.format?q=x`
|
||||
url = url.replace(/\/\.(?=\w+($|\?))/, '.');
|
||||
// replace escaped `/\.` with `/.`
|
||||
config.url = protocolAndDomain + url.replace(/\/\\\./, '/.');
|
||||
|
||||
|
||||
// set params - delegate param encoding to $http
|
||||
forEach(params, function(value, key) {
|
||||
if (!self.urlParams[key]) {
|
||||
config.params = config.params || {};
|
||||
config.params[key] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function resourceFactory(url, paramDefaults, actions, options) {
|
||||
var route = new Route(url, options);
|
||||
|
||||
actions = extend({}, provider.defaults.actions, actions);
|
||||
|
||||
function extractParams(data, actionParams) {
|
||||
var ids = {};
|
||||
actionParams = extend({}, paramDefaults, actionParams);
|
||||
forEach(actionParams, function(value, key) {
|
||||
if (isFunction(value)) { value = value(); }
|
||||
ids[key] = value && value.charAt && value.charAt(0) == '@' ?
|
||||
lookupDottedPath(data, value.substr(1)) : value;
|
||||
});
|
||||
return ids;
|
||||
}
|
||||
|
||||
function defaultResponseInterceptor(response) {
|
||||
return response.resource;
|
||||
}
|
||||
|
||||
function Resource(value) {
|
||||
shallowClearAndCopy(value || {}, this);
|
||||
}
|
||||
|
||||
Resource.prototype.toJSON = function() {
|
||||
var data = extend({}, this);
|
||||
delete data.$promise;
|
||||
delete data.$resolved;
|
||||
return data;
|
||||
};
|
||||
|
||||
forEach(actions, function(action, name) {
|
||||
var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method);
|
||||
var numericTimeout = action.timeout;
|
||||
var cancellable = angular.isDefined(action.cancellable) ? action.cancellable :
|
||||
(options && angular.isDefined(options.cancellable)) ? options.cancellable :
|
||||
provider.defaults.cancellable;
|
||||
|
||||
if (numericTimeout && !angular.isNumber(numericTimeout)) {
|
||||
$log.debug('ngResource:\n' +
|
||||
' Only numeric values are allowed as `timeout`.\n' +
|
||||
' Promises are not supported in $resource, because the same value would ' +
|
||||
'be used for multiple requests. If you are looking for a way to cancel ' +
|
||||
'requests, you should use the `cancellable` option.');
|
||||
delete action.timeout;
|
||||
numericTimeout = null;
|
||||
}
|
||||
|
||||
Resource[name] = function(a1, a2, a3, a4) {
|
||||
var params = {}, data, success, error;
|
||||
|
||||
/* jshint -W086 */ /* (purposefully fall through case statements) */
|
||||
switch (arguments.length) {
|
||||
case 4:
|
||||
error = a4;
|
||||
success = a3;
|
||||
//fallthrough
|
||||
case 3:
|
||||
case 2:
|
||||
if (isFunction(a2)) {
|
||||
if (isFunction(a1)) {
|
||||
success = a1;
|
||||
error = a2;
|
||||
break;
|
||||
}
|
||||
|
||||
success = a2;
|
||||
error = a3;
|
||||
//fallthrough
|
||||
} else {
|
||||
params = a1;
|
||||
data = a2;
|
||||
success = a3;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
if (isFunction(a1)) success = a1;
|
||||
else if (hasBody) data = a1;
|
||||
else params = a1;
|
||||
break;
|
||||
case 0: break;
|
||||
default:
|
||||
throw $resourceMinErr('badargs',
|
||||
"Expected up to 4 arguments [params, data, success, error], got {0} arguments",
|
||||
arguments.length);
|
||||
}
|
||||
/* jshint +W086 */ /* (purposefully fall through case statements) */
|
||||
|
||||
var isInstanceCall = this instanceof Resource;
|
||||
var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data));
|
||||
var httpConfig = {};
|
||||
var responseInterceptor = action.interceptor && action.interceptor.response ||
|
||||
defaultResponseInterceptor;
|
||||
var responseErrorInterceptor = action.interceptor && action.interceptor.responseError ||
|
||||
undefined;
|
||||
var timeoutDeferred;
|
||||
var numericTimeoutPromise;
|
||||
|
||||
forEach(action, function(value, key) {
|
||||
switch (key) {
|
||||
default:
|
||||
httpConfig[key] = copy(value);
|
||||
break;
|
||||
case 'params':
|
||||
case 'isArray':
|
||||
case 'interceptor':
|
||||
case 'cancellable':
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
if (!isInstanceCall && cancellable) {
|
||||
timeoutDeferred = $q.defer();
|
||||
httpConfig.timeout = timeoutDeferred.promise;
|
||||
|
||||
if (numericTimeout) {
|
||||
numericTimeoutPromise = $timeout(timeoutDeferred.resolve, numericTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasBody) httpConfig.data = data;
|
||||
route.setUrlParams(httpConfig,
|
||||
extend({}, extractParams(data, action.params || {}), params),
|
||||
action.url);
|
||||
|
||||
var promise = $http(httpConfig).then(function(response) {
|
||||
var data = response.data;
|
||||
|
||||
if (data) {
|
||||
// Need to convert action.isArray to boolean in case it is undefined
|
||||
// jshint -W018
|
||||
if (angular.isArray(data) !== (!!action.isArray)) {
|
||||
throw $resourceMinErr('badcfg',
|
||||
'Error in resource configuration for action `{0}`. Expected response to ' +
|
||||
'contain an {1} but got an {2} (Request: {3} {4})', name, action.isArray ? 'array' : 'object',
|
||||
angular.isArray(data) ? 'array' : 'object', httpConfig.method, httpConfig.url);
|
||||
}
|
||||
// jshint +W018
|
||||
if (action.isArray) {
|
||||
value.length = 0;
|
||||
forEach(data, function(item) {
|
||||
if (typeof item === "object") {
|
||||
value.push(new Resource(item));
|
||||
} else {
|
||||
// Valid JSON values may be string literals, and these should not be converted
|
||||
// into objects. These items will not have access to the Resource prototype
|
||||
// methods, but unfortunately there
|
||||
value.push(item);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var promise = value.$promise; // Save the promise
|
||||
shallowClearAndCopy(data, value);
|
||||
value.$promise = promise; // Restore the promise
|
||||
}
|
||||
}
|
||||
response.resource = value;
|
||||
|
||||
return response;
|
||||
}, function(response) {
|
||||
(error || noop)(response);
|
||||
return $q.reject(response);
|
||||
});
|
||||
|
||||
promise['finally'](function() {
|
||||
value.$resolved = true;
|
||||
if (!isInstanceCall && cancellable) {
|
||||
value.$cancelRequest = angular.noop;
|
||||
$timeout.cancel(numericTimeoutPromise);
|
||||
timeoutDeferred = numericTimeoutPromise = httpConfig.timeout = null;
|
||||
}
|
||||
});
|
||||
|
||||
promise = promise.then(
|
||||
function(response) {
|
||||
var value = responseInterceptor(response);
|
||||
(success || noop)(value, response.headers);
|
||||
return value;
|
||||
},
|
||||
responseErrorInterceptor);
|
||||
|
||||
if (!isInstanceCall) {
|
||||
// we are creating instance / collection
|
||||
// - set the initial promise
|
||||
// - return the instance / collection
|
||||
value.$promise = promise;
|
||||
value.$resolved = false;
|
||||
if (cancellable) value.$cancelRequest = timeoutDeferred.resolve;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
// instance call
|
||||
return promise;
|
||||
};
|
||||
|
||||
|
||||
Resource.prototype['$' + name] = function(params, success, error) {
|
||||
if (isFunction(params)) {
|
||||
error = success; success = params; params = {};
|
||||
}
|
||||
var result = Resource[name].call(this, params, this, success, error);
|
||||
return result.$promise || result;
|
||||
};
|
||||
});
|
||||
|
||||
Resource.bind = function(additionalParamDefaults) {
|
||||
return resourceFactory(url, extend({}, paramDefaults, additionalParamDefaults), actions);
|
||||
};
|
||||
|
||||
return Resource;
|
||||
}
|
||||
|
||||
return resourceFactory;
|
||||
}];
|
||||
});
|
||||
|
||||
|
||||
})(window, window.angular);
|
1022
static/ng/vendors/angularjs/angular-route.js
vendored
Normal file
1022
static/ng/vendors/angularjs/angular-route.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
30714
static/ng/vendors/angularjs/angular.js
vendored
Normal file
30714
static/ng/vendors/angularjs/angular.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,7 @@
|
|||
{{.HeaderInclude}}
|
||||
<title>{{.Title}}</title>
|
||||
</head>
|
||||
<body>
|
||||
<body ng-app="harbor.app">
|
||||
{{.HeaderContent}}
|
||||
{{.LayoutContent}}
|
||||
{{.FooterContent}}
|
||||
|
|
|
@ -34,12 +34,8 @@
|
|||
</li>
|
||||
</ul-->
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<ul class="nav-custom">
|
||||
<li><a href="#">Dashboard</a></li>
|
||||
<li class="active"><a href="#">My Projects</a></li>
|
||||
<li><a href="#">Admin Options</a></li>
|
||||
</ul>
|
||||
<li ng-controller="NavigationController as vm">
|
||||
<navigation-tab tabs="vm.tabs"></navigation-tab>
|
||||
</li>
|
||||
<li>
|
||||
<form class="navbar-form pull-right" role="search">
|
||||
|
|
|
@ -19,3 +19,21 @@
|
|||
<link rel="stylesheet" href="/static/ng/resources/css/dashboard.css">
|
||||
<link rel="stylesheet" href="/static/ng/resources/css/project.css">
|
||||
<link rel="stylesheet" href="/static/ng/resources/css/repository.css">
|
||||
|
||||
<script src="/static/ng/vendors/angularjs/angular.js"></script>
|
||||
<script src="/static/ng/vendors/angularjs/angular-route.js"></script>
|
||||
|
||||
<script src="/static/ng/resources/js/harbor.module.js"></script>
|
||||
<script src="/static/ng/resources/js/harbor.config.js"></script>
|
||||
<script src="/static/ng/resources/js/harbor.initialize.js"></script>
|
||||
<script src="/static/ng/resources/js/harbor.constants.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>
|
||||
|
||||
<script src="/static/ng/resources/js/header/header.module.js"></script>
|
||||
<script src="/static/ng/resources/js/header/navigation.controllers.js"></script>
|
||||
|
||||
<script src="/static/ng/resources/js/index/index.module.js"></script>
|
||||
|
||||
<script src="/static/ng/resources/js/components/navigation-tab.directive.js"></script>
|
||||
|
|
Loading…
Reference in New Issue
Block a user