Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
219aff4a
Commit
219aff4a
authored
Jun 27, 2016
by
lepdou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户模糊搜索 流程优化
parent
2f620e6f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
126 additions
and
22 deletions
+126
-22
role.html
apollo-portal/src/main/resources/static/app/role.html
+4
-2
namespace.html
apollo-portal/src/main/resources/static/namespace.html
+21
-6
role.html
apollo-portal/src/main/resources/static/namespace/role.html
+8
-4
NamespaceController.js
...esources/static/scripts/controller/NamespaceController.js
+0
-0
AppRoleController.js
...urces/static/scripts/controller/role/AppRoleController.js
+5
-3
NamespaceRoleController.js
...static/scripts/controller/role/NamespaceRoleController.js
+18
-7
directive.js
apollo-portal/src/main/resources/static/scripts/directive.js
+52
-0
UserService.js
...src/main/resources/static/scripts/services/UserService.js
+16
-0
user-selector.html
.../main/resources/static/views/component/user-selector.html
+2
-0
No files found.
apollo-portal/src/main/resources/static/app/role.html
View file @
219aff4a
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
<link
rel=
"stylesheet"
type=
"text/css"
href=
"../vendor/angular/angular-toastr-1.4.1.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"../vendor/angular/angular-toastr-1.4.1.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
media=
'all'
href=
"../vendor/angular/loading-bar.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
media=
'all'
href=
"../vendor/angular/loading-bar.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"../styles/common-style.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"../styles/common-style.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"../vendor/select2/select2.min.css"
>
<title>
权限管理
</title>
<title>
权限管理
</title>
</head>
</head>
...
@@ -37,9 +38,9 @@
...
@@ -37,9 +38,9 @@
<div
class=
"col-sm-8"
>
<div
class=
"col-sm-8"
>
<form
class=
"form-inline"
ng-submit=
"assignMasterRoleToUser()"
>
<form
class=
"form-inline"
ng-submit=
"assignMasterRoleToUser()"
>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<
input
type=
"text"
class=
"form-control"
placeholder=
"域账号"
required
ng-model=
"toAssignMasterRoleUser"
>
<
apollouserselector
apollo-id=
"userSelectWidgetId"
></apollouserselector
>
</div>
</div>
<button
type=
"submit"
class=
"btn btn-default"
>
添加
</button>
<button
type=
"submit"
class=
"btn btn-default"
style=
"margin-left: 20px;"
>
添加
</button>
</form>
</form>
<!-- Split button -->
<!-- Split button -->
<div
class=
"user-container"
>
<div
class=
"user-container"
>
...
@@ -88,6 +89,7 @@
...
@@ -88,6 +89,7 @@
<!--nicescroll-->
<!--nicescroll-->
<script
src=
"../vendor/jquery.nicescroll.min.js"
></script>
<script
src=
"../vendor/jquery.nicescroll.min.js"
></script>
<script
src=
"../vendor/select2/select2.min.js"
type=
"text/javascript"
></script>
<!--biz-->
<!--biz-->
<!--must import-->
<!--must import-->
<script
type=
"application/javascript"
src=
"../scripts/app.js"
></script>
<script
type=
"application/javascript"
src=
"../scripts/app.js"
></script>
...
...
apollo-portal/src/main/resources/static/namespace.html
View file @
219aff4a
...
@@ -32,15 +32,26 @@
...
@@ -32,15 +32,26 @@
</header>
</header>
<div
class=
"panel-body"
>
<div
class=
"panel-body"
>
<form
class=
"form-horizontal"
ng-show=
"step == 1"
ng-submit=
"createNamespace()"
>
<div
class=
"row text-right"
style=
"padding-right: 20px;"
>
<div
class=
"btn-group btn-group-sm"
role=
"group"
aria-label=
"..."
>
<button
type=
"button"
class=
"btn btn-default"
ng-class=
"{active:type=='link'}"
ng-click=
"switchType('link')"
>
关联已存在的Namespace
</button>
<button
type=
"button"
class=
"btn btn-default"
ng-class=
"{active:type=='create'}"
ng-click=
"switchType('create')"
>
创建新的Namespace
</button>
</div>
</div>
<form
class=
"form-horizontal"
style=
"margin-top: 30px;"
ng-show=
"step == 1"
ng-submit=
"createNamespace()"
>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
应用ID
</label>
<label
class=
"col-sm-3 control-label"
>
应用ID
</label>
<div
class=
"col-sm-6"
ng-bind=
"appId"
>
<div
class=
"col-sm-6"
>
<label
ng-bind=
"appId"
></label>
</div>
</div>
</div>
</div>
<div
class=
"form-horizontal"
ng-show=
"type == 'link'"
>
<div
class=
"form-horizontal"
ng-show=
"type == 'link'"
>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
><apollorequiredfiled></apollorequiredfiled>
选择集群
</label>
<label
class=
"col-sm-3 control-label"
>
<apollorequiredfiled></apollorequiredfiled>
选择集群
</label>
<div
class=
"col-sm-6"
>
<div
class=
"col-sm-6"
>
<apolloclusterselector
apollo-app-id=
"appId"
apollo-default-all-checked=
"true"
<apolloclusterselector
apollo-app-id=
"appId"
apollo-default-all-checked=
"true"
apollo-select=
"collectSelectedClusters"
></apolloclusterselector>
apollo-select=
"collectSelectedClusters"
></apolloclusterselector>
...
@@ -48,7 +59,9 @@
...
@@ -48,7 +59,9 @@
</div>
</div>
</div>
</div>
<div
class=
"form-group"
ng-show=
"type == 'create'"
>
<div
class=
"form-group"
ng-show=
"type == 'create'"
>
<label
class=
"col-sm-3 control-label"
><apollorequiredfiled></apollorequiredfiled>
名称
</label>
<label
class=
"col-sm-3 control-label"
>
<apollorequiredfiled></apollorequiredfiled>
名称
</label>
<div
class=
"col-sm-4"
>
<div
class=
"col-sm-4"
>
<div
class=
"input-group"
>
<div
class=
"input-group"
>
<span
class=
"input-group-addon"
ng-bind=
"appBaseInfo.namespacePrefix"
></span>
<span
class=
"input-group-addon"
ng-bind=
"appBaseInfo.namespacePrefix"
></span>
...
@@ -65,7 +78,9 @@
...
@@ -65,7 +78,9 @@
</div>
</div>
</div>
</div>
<div
class=
"form-group"
ng-show=
"type == 'link'"
>
<div
class=
"form-group"
ng-show=
"type == 'link'"
>
<label
class=
"col-sm-3 control-label"
><apollorequiredfiled></apollorequiredfiled>
namespace
</label>
<label
class=
"col-sm-3 control-label"
>
<apollorequiredfiled></apollorequiredfiled>
namespace
</label>
<div
class=
"col-sm-4"
>
<div
class=
"col-sm-4"
>
<select
id=
"namespaces"
>
<select
id=
"namespaces"
>
<option></option>
<option></option>
...
@@ -75,7 +90,7 @@
...
@@ -75,7 +90,7 @@
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-3 col-sm-10"
>
<div
class=
"col-sm-offset-3 col-sm-10"
>
<button
type=
"submit"
class=
"btn btn-
default
"
>
提交
</button>
<button
type=
"submit"
class=
"btn btn-
primary
"
>
提交
</button>
</div>
</div>
</div>
</div>
</form>
</form>
...
...
apollo-portal/src/main/resources/static/namespace/role.html
View file @
219aff4a
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
<link
rel=
"stylesheet"
type=
"text/css"
href=
"../vendor/angular/angular-toastr-1.4.1.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"../vendor/angular/angular-toastr-1.4.1.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
media=
'all'
href=
"../vendor/angular/loading-bar.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
media=
'all'
href=
"../vendor/angular/loading-bar.min.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"../styles/common-style.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"../styles/common-style.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"../vendor/select2/select2.min.css"
>
<title>
权限管理
</title>
<title>
权限管理
</title>
</head>
</head>
...
@@ -37,9 +38,9 @@
...
@@ -37,9 +38,9 @@
<div
class=
"col-sm-8"
>
<div
class=
"col-sm-8"
>
<form
class=
"form-inline"
ng-submit=
"assignRoleToUser('ModifyNamespace')"
>
<form
class=
"form-inline"
ng-submit=
"assignRoleToUser('ModifyNamespace')"
>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<
input
type=
"text"
class=
"form-control"
placeholder=
"域账号"
required
ng-model=
"toAssignModifyNamespaceRoleUser"
>
<
apollouserselector
apollo-id=
"modifyRoleWidgetId"
></apollouserselector
>
</div>
</div>
<button
type=
"submit"
class=
"btn btn-default"
>
添加
</button>
<button
type=
"submit"
class=
"btn btn-default"
style=
"margin-left: 20px;"
>
添加
</button>
</form>
</form>
<!-- Split button -->
<!-- Split button -->
<div
class=
"user-container"
>
<div
class=
"user-container"
>
...
@@ -66,9 +67,10 @@
...
@@ -66,9 +67,10 @@
<div
class=
"col-sm-8"
>
<div
class=
"col-sm-8"
>
<form
class=
"form-inline"
ng-submit=
"assignRoleToUser('ReleaseNamespace')"
>
<form
class=
"form-inline"
ng-submit=
"assignRoleToUser('ReleaseNamespace')"
>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<input
type=
"text"
class=
"form-control"
placeholder=
"域账号"
required
ng-model=
"toAssignReleaseNamespaceRoleUser"
>
<apollouserselector
apollo-id=
"releaseRoleWidgetId"
></apollouserselector>
</div>
</div>
<button
type=
"submit"
class=
"btn btn-default"
>
添加
</button>
<button
type=
"submit"
class=
"btn btn-default"
style=
"margin-left: 20px;"
>
添加
</button>
</form>
</form>
<!-- Split button -->
<!-- Split button -->
<div
style=
"margin-top: 15px;"
>
<div
style=
"margin-top: 15px;"
>
...
@@ -116,6 +118,8 @@
...
@@ -116,6 +118,8 @@
<!--nicescroll-->
<!--nicescroll-->
<script
src=
"../vendor/jquery.nicescroll.min.js"
></script>
<script
src=
"../vendor/jquery.nicescroll.min.js"
></script>
<script
src=
"../vendor/select2/select2.min.js"
type=
"text/javascript"
></script>
<!--biz-->
<!--biz-->
<!--must import-->
<!--must import-->
<script
type=
"application/javascript"
src=
"../scripts/app.js"
></script>
<script
type=
"application/javascript"
src=
"../scripts/app.js"
></script>
...
...
apollo-portal/src/main/resources/static/scripts/controller/NamespaceController.js
View file @
219aff4a
This diff is collapsed.
Click to expand it.
apollo-portal/src/main/resources/static/scripts/controller/role/AppRoleController.js
View file @
219aff4a
...
@@ -7,6 +7,8 @@ role_module.controller('AppRoleController',
...
@@ -7,6 +7,8 @@ role_module.controller('AppRoleController',
appId
:
params
.
appid
appId
:
params
.
appid
};
};
$scope
.
userSelectWidgetId
=
'toAssignMasterRoleUser'
;
PermissionService
.
has_assign_user_permission
(
$scope
.
pageContext
.
appId
)
PermissionService
.
has_assign_user_permission
(
$scope
.
pageContext
.
appId
)
.
then
(
function
(
result
)
{
.
then
(
function
(
result
)
{
$scope
.
hasAssignUserPermission
=
result
.
hasPermission
;
$scope
.
hasAssignUserPermission
=
result
.
hasPermission
;
...
@@ -21,14 +23,14 @@ role_module.controller('AppRoleController',
...
@@ -21,14 +23,14 @@ role_module.controller('AppRoleController',
});
});
$scope
.
toAssignMasterRoleUser
=
''
;
$scope
.
assignMasterRoleToUser
=
function
()
{
$scope
.
assignMasterRoleToUser
=
function
()
{
var
toAssignMasterRoleUser
=
$
(
'.'
+
$scope
.
userSelectWidgetId
).
select2
(
'data'
)[
0
].
id
;
PermissionService
.
assign_master_role
(
$scope
.
pageContext
.
appId
,
PermissionService
.
assign_master_role
(
$scope
.
pageContext
.
appId
,
$scope
.
toAssignMasterRoleUser
)
toAssignMasterRoleUser
)
.
then
(
function
(
result
)
{
.
then
(
function
(
result
)
{
toastr
.
success
(
"添加成功"
);
toastr
.
success
(
"添加成功"
);
$scope
.
appRoleUsers
.
masterUsers
.
push
({
userId
:
$scope
.
toAssignMasterRoleUser
});
$scope
.
appRoleUsers
.
masterUsers
.
push
({
userId
:
toAssignMasterRoleUser
});
},
function
(
result
)
{
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"添加失败"
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"添加失败"
);
});
});
...
...
apollo-portal/src/main/resources/static/scripts/controller/role/NamespaceRoleController.js
View file @
219aff4a
role_module
.
controller
(
'NamespaceRoleController'
,
role_module
.
controller
(
'NamespaceRoleController'
,
[
'$scope'
,
'$location'
,
'$window'
,
'toastr'
,
'AppService'
,
'AppUtil'
,
'PermissionService'
,
[
'$scope'
,
'$location'
,
'$window'
,
'toastr'
,
'AppService'
,
'UserService'
,
'AppUtil'
,
function
(
$scope
,
$location
,
$window
,
toastr
,
AppService
,
AppUtil
,
PermissionService
)
{
'PermissionService'
,
function
(
$scope
,
$location
,
$window
,
toastr
,
AppService
,
UserService
,
AppUtil
,
PermissionService
)
{
var
params
=
AppUtil
.
parseParams
(
$location
.
$$url
);
var
params
=
AppUtil
.
parseParams
(
$location
.
$$url
);
$scope
.
pageContext
=
{
$scope
.
pageContext
=
{
appId
:
params
.
appid
,
appId
:
params
.
appid
,
namespaceName
:
params
.
namespaceName
namespaceName
:
params
.
namespaceName
};
};
$scope
.
releaseRoleWidgetId
=
'releaseRoleWidgetId'
;
$scope
.
modifyRoleWidgetId
=
'modifyRoleWidgetId'
;
PermissionService
.
has_assign_user_permission
(
$scope
.
pageContext
.
appId
)
PermissionService
.
has_assign_user_permission
(
$scope
.
pageContext
.
appId
)
.
then
(
function
(
result
)
{
.
then
(
function
(
result
)
{
...
@@ -24,26 +29,29 @@ role_module.controller('NamespaceRoleController',
...
@@ -24,26 +29,29 @@ role_module.controller('NamespaceRoleController',
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"加载授权用户出错"
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"加载授权用户出错"
);
});
});
$scope
.
toAssignReleaseNamespaceRoleUser
=
''
,
$scope
.
toAssignModifyNamespaceRoleUser
=
''
;
$scope
.
assignRoleToUser
=
function
(
roleType
)
{
$scope
.
assignRoleToUser
=
function
(
roleType
)
{
if
(
'ReleaseNamespace'
==
roleType
)
{
if
(
'ReleaseNamespace'
==
roleType
)
{
var
toAssignReleaseNamespaceRoleUser
=
$
(
'.'
+
$scope
.
releaseRoleWidgetId
).
select2
(
'data'
)[
0
].
id
;
PermissionService
.
assign_release_namespace_role
(
$scope
.
pageContext
.
appId
,
PermissionService
.
assign_release_namespace_role
(
$scope
.
pageContext
.
appId
,
$scope
.
pageContext
.
namespaceName
,
$scope
.
pageContext
.
namespaceName
,
$scope
.
toAssignReleaseNamespaceRoleUser
)
toAssignReleaseNamespaceRoleUser
)
.
then
(
function
(
result
)
{
.
then
(
function
(
result
)
{
toastr
.
success
(
"添加成功"
);
toastr
.
success
(
"添加成功"
);
$scope
.
rolesAssignedUsers
.
releaseRoleUsers
.
push
({
userId
:
$scope
.
toAssignReleaseNamespaceRoleUser
});
$scope
.
rolesAssignedUsers
.
releaseRoleUsers
.
push
(
{
userId
:
toAssignReleaseNamespaceRoleUser
});
},
function
(
result
)
{
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"添加失败"
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"添加失败"
);
});
});
}
else
{
}
else
{
var
toAssignModifyNamespaceRoleUser
=
$
(
'.'
+
$scope
.
modifyRoleWidgetId
).
select2
(
'data'
)[
0
].
id
;
PermissionService
.
assign_modify_namespace_role
(
$scope
.
pageContext
.
appId
,
PermissionService
.
assign_modify_namespace_role
(
$scope
.
pageContext
.
appId
,
$scope
.
pageContext
.
namespaceName
,
$scope
.
pageContext
.
namespaceName
,
$scope
.
toAssignModifyNamespaceRoleUser
)
toAssignModifyNamespaceRoleUser
)
.
then
(
function
(
result
)
{
.
then
(
function
(
result
)
{
toastr
.
success
(
"添加成功"
);
toastr
.
success
(
"添加成功"
);
$scope
.
rolesAssignedUsers
.
modifyRoleUsers
.
push
({
userId
:
$scope
.
toAssignModifyNamespaceRoleUser
});
$scope
.
rolesAssignedUsers
.
modifyRoleUsers
.
push
(
{
userId
:
toAssignModifyNamespaceRoleUser
});
},
function
(
result
)
{
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"添加失败"
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"添加失败"
);
});
});
...
@@ -84,5 +92,8 @@ role_module.controller('NamespaceRoleController',
...
@@ -84,5 +92,8 @@ role_module.controller('NamespaceRoleController',
}
}
list
.
splice
(
index
,
1
);
list
.
splice
(
index
,
1
);
}
}
$scope
.
modifyRoleUsersId
=
'J_modify_role_users'
;
$scope
.
releaseRoleUsersId
=
'J_release_role_users'
;
}]);
}]);
apollo-portal/src/main/resources/static/scripts/directive.js
View file @
219aff4a
...
@@ -258,3 +258,55 @@ directive_module.directive('apolloentrance', function ($compile, $window) {
...
@@ -258,3 +258,55 @@ directive_module.directive('apolloentrance', function ($compile, $window) {
});
});
/** entrance */
directive_module
.
directive
(
'apollouserselector'
,
function
(
$compile
,
$window
)
{
return
{
restrict
:
'E'
,
templateUrl
:
'../views/component/user-selector.html'
,
transclude
:
true
,
replace
:
true
,
scope
:
{
id
:
'=apolloId'
},
link
:
function
(
scope
,
element
,
attrs
)
{
scope
.
$watch
(
"id"
,
initSelect2
);
var
searchUsersAjax
=
{
ajax
:
{
url
:
'/users'
,
dataType
:
'json'
,
delay
:
250
,
data
:
function
(
params
)
{
return
{
keyword
:
params
.
term
?
params
.
term
:
''
,
limit
:
100
}
},
processResults
:
function
(
data
,
params
)
{
var
users
=
[];
data
.
forEach
(
function
(
user
)
{
users
.
push
({
id
:
user
.
userId
,
text
:
user
.
userId
+
" | "
+
user
.
name
+
" | "
+
user
.
email
})
});
return
{
results
:
users
}
},
cache
:
true
,
minimumInputLength
:
5
}
};
function
initSelect2
(){
$
(
'.'
+
scope
.
id
).
select2
(
searchUsersAjax
);
}
}
}
});
apollo-portal/src/main/resources/static/scripts/services/UserService.js
View file @
219aff4a
...
@@ -3,6 +3,10 @@ appService.service('UserService', ['$resource', '$q', function ($resource, $q) {
...
@@ -3,6 +3,10 @@ appService.service('UserService', ['$resource', '$q', function ($resource, $q) {
load_user
:{
load_user
:{
method
:
'GET'
,
method
:
'GET'
,
url
:
'/user'
url
:
'/user'
},
find_users
:
{
method
:
'GET'
,
url
:
'/users'
}
}
});
});
return
{
return
{
...
@@ -16,6 +20,18 @@ appService.service('UserService', ['$resource', '$q', function ($resource, $q) {
...
@@ -16,6 +20,18 @@ appService.service('UserService', ['$resource', '$q', function ($resource, $q) {
d
.
reject
(
result
);
d
.
reject
(
result
);
});
});
return
d
.
promise
;
return
d
.
promise
;
},
find_users
:
function
(
keyword
)
{
var
d
=
$q
.
defer
();
user_resource
.
find_users
({
keyword
:
keyword
},
function
(
result
)
{
d
.
resolve
(
result
);
},
function
(
result
)
{
d
.
reject
(
result
);
});
return
d
.
promise
;
}
}
}
}
}]);
}]);
apollo-portal/src/main/resources/static/views/component/user-selector.html
0 → 100644
View file @
219aff4a
<select
class=
"{{id}}"
style=
"width: 450px;"
>
</select>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment