adapt current code structure for UI development.

This commit is contained in:
kunw 2016-04-25 14:31:05 +08:00
parent f83c94f414
commit 76c77db807
4 changed files with 53 additions and 6 deletions

View File

@ -44,6 +44,8 @@ services:
volumes:
- ./config/ui/app.conf:/etc/ui/app.conf
- ./config/ui/private_key.pem:/etc/ui/private_key.pem
- ../static:/go/bin/static
- ../views:/go/bin/views
depends_on:
- log
logging:

View File

@ -6,9 +6,9 @@
.module('harbor.log')
.directive('advancedSearch', advancedSearch);
AdvancedSearchController.$inject = ['ListLogService'];
AdvancedSearchController.$inject = ['$scope', 'ListLogService'];
function AdvancedSearchController(ListLogService) {
function AdvancedSearchController($scope, ListLogService) {
var vm = this;
vm.checkOperation = checkOperation;
@ -20,7 +20,9 @@
vm.opPush = true;
vm.opDelete = true;
vm.opOthers = true;
vm.op = [];
vm.op.push('all');
function checkOperation(e) {
if(e.checked == 'all') {
vm.opCreate = vm.opAll;
@ -28,11 +30,36 @@
vm.opPush = vm.opAll;
vm.opDelete = vm.opAll;
vm.opOthers = vm.opAll;
}else {
vm.opAll = false;
}
vm.op = [];
if(vm.opCreate) {
vm.op.push('create');
}
if(vm.opPull) {
vm.op.push('pull');
}
if(vm.opPush) {
vm.op.push('push');
}
if(vm.opDelete) {
vm.op.push('delete');
}
if(vm.opOthers) {
vm.op.push(vm.others);
}
}
function search() {
vm.isOpen = false;
function search() {
if(vm.opAll) {
vm.op = [];
vm.op.push('all');
}
console.log(vm.op.join(","));
}
}

View File

@ -66,10 +66,13 @@ func updateInitPassword(userID int, password string) error {
func main() {
beego.BConfig.WebConfig.Session.SessionOn = true
beego.AddTemplateExt("htm")
beego.AddTemplateExt("tpl")
dao.InitDB()
if err := updateInitPassword(adminUserID, os.Getenv("HARBOR_ADMIN_PASSWORD")); err != nil {
log.Error(err)
}
initRouters()
initNgRouters()
beego.Run()
}

15
ui/ngrouter.go Normal file
View File

@ -0,0 +1,15 @@
package main
import (
"github.com/astaxie/beego"
"github.com/vmware/harbor/controllers/ng"
)
func initNgRouters() {
beego.SetStaticPath("ng/static", "ng")
beego.Router("/ng", &ng.IndexController{})
beego.Router("/ng/dashboard", &ng.DashboardController{})
beego.Router("/ng/project", &ng.ProjectController{})
beego.Router("/ng/repository", &ng.RepositoryController{})
}