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
78912008
Commit
78912008
authored
Jun 27, 2016
by
Jason Song
Committed by
GitHub
Jun 27, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #299 from lepdou/0627_0701
用户模糊搜索 流程优化
parents
2f620e6f
0496d7e3
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
244 additions
and
115 deletions
+244
-115
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
+105
-92
AppRoleController.js
...urces/static/scripts/controller/role/AppRoleController.js
+10
-3
NamespaceRoleController.js
...static/scripts/controller/role/NamespaceRoleController.js
+26
-8
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 @
78912008
...
@@ -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 @
78912008
...
@@ -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 @
78912008
...
@@ -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 @
78912008
namespace_module
.
controller
(
"LinkNamespaceController"
,
namespace_module
.
controller
(
"LinkNamespaceController"
,
[
'$scope'
,
'$location'
,
'$window'
,
'toastr'
,
'AppService'
,
'AppUtil'
,
'NamespaceService'
,
[
'$scope'
,
'$location'
,
'$window'
,
'toastr'
,
'AppService'
,
'AppUtil'
,
'NamespaceService'
,
function
(
$scope
,
$location
,
$window
,
toastr
,
AppService
,
AppUtil
,
NamespaceService
)
{
function
(
$scope
,
$location
,
$window
,
toastr
,
AppService
,
AppUtil
,
NamespaceService
)
{
var
params
=
AppUtil
.
parseParams
(
$location
.
$$url
);
var
params
=
AppUtil
.
parseParams
(
$location
.
$$url
);
$scope
.
appId
=
params
.
appid
;
$scope
.
appId
=
params
.
appid
;
$scope
.
type
=
params
.
type
;
$scope
.
type
=
params
.
type
;
$scope
.
step
=
1
;
$scope
.
step
=
1
;
NamespaceService
.
find_public_namespaces
().
then
(
function
(
result
)
{
NamespaceService
.
find_public_namespaces
().
then
(
function
(
result
)
{
var
publicNamespaces
=
[];
var
publicNamespaces
=
[];
result
.
forEach
(
function
(
item
)
{
result
.
forEach
(
function
(
item
)
{
var
namespace
=
{};
var
namespace
=
{};
namespace
.
id
=
item
.
name
;
namespace
.
id
=
item
.
name
;
namespace
.
text
=
item
.
name
;
namespace
.
text
=
item
.
name
;
publicNamespaces
.
push
(
namespace
);
publicNamespaces
.
push
(
namespace
);
});
});
$
(
'#namespaces'
).
select2
({
$
(
'#namespaces'
).
select2
({
placeholder
:
'请选择Namespace'
,
placeholder
:
'请选择Namespace'
,
width
:
'100%'
,
width
:
'100%'
,
data
:
publicNamespaces
data
:
publicNamespaces
});
});
},
function
(
result
)
{
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"load public namespace error"
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"load public namespace error"
);
});
});
AppService
.
load
(
$scope
.
appId
).
then
(
function
(
result
)
{
AppService
.
load
(
$scope
.
appId
).
then
(
function
(
result
)
{
$scope
.
appBaseInfo
=
result
;
$scope
.
appBaseInfo
=
result
;
$scope
.
appBaseInfo
.
namespacePrefix
=
result
.
orgId
+
'.'
;
$scope
.
appBaseInfo
.
namespacePrefix
=
result
.
orgId
+
'.'
;
},
function
(
result
)
{
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"加载App信息出错"
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"加载App信息出错"
);
});
});
$scope
.
appNamespace
=
{
$scope
.
appNamespace
=
{
appId
:
$scope
.
appId
,
appId
:
$scope
.
appId
,
name
:
''
,
name
:
''
,
comment
:
''
comment
:
''
};
};
$scope
.
concatNamespace
=
function
()
{
$scope
.
concatNamespace
=
function
()
{
if
(
!
$scope
.
appBaseInfo
)
{
if
(
!
$scope
.
appBaseInfo
)
{
return
''
;
return
''
;
}
}
return
$scope
.
appBaseInfo
.
namespacePrefix
+
return
$scope
.
appBaseInfo
.
namespacePrefix
+
(
$scope
.
appNamespace
.
name
?
$scope
.
appNamespace
.
name
:
''
);
(
$scope
.
appNamespace
.
name
?
$scope
.
appNamespace
.
name
:
''
);
};
};
var
selectedClusters
=
[];
var
selectedClusters
=
[];
$scope
.
collectSelectedClusters
=
function
(
data
)
{
$scope
.
collectSelectedClusters
=
function
(
data
)
{
selectedClusters
=
data
;
selectedClusters
=
data
;
};
};
$scope
.
createNamespace
=
function
()
{
$scope
.
createNamespace
=
function
()
{
if
(
$scope
.
type
==
'link'
)
{
if
(
$scope
.
type
==
'link'
)
{
if
(
selectedClusters
.
length
==
0
)
{
if
(
selectedClusters
.
length
==
0
)
{
toastr
.
warning
(
"请选择集群"
);
toastr
.
warning
(
"请选择集群"
);
return
;
return
;
}
}
if
(
$scope
.
namespaceType
==
1
)
{
if
(
$scope
.
namespaceType
==
1
)
{
var
selectedNamespaceName
=
$
(
'#namespaces'
).
select2
(
'data'
)[
0
].
id
;
var
selectedNamespaceName
=
$
(
'#namespaces'
).
select2
(
'data'
)[
0
].
id
;
if
(
!
selectedNamespaceName
)
{
if
(
!
selectedNamespaceName
)
{
toastr
.
warning
(
"请选择Namespace"
);
toastr
.
warning
(
"请选择Namespace"
);
return
;
return
;
}
}
$scope
.
namespaceName
=
selectedNamespaceName
;
$scope
.
namespaceName
=
selectedNamespaceName
;
}
}
var
namespaceCreationModels
=
[];
var
namespaceCreationModels
=
[];
selectedClusters
.
forEach
(
function
(
cluster
)
{
selectedClusters
.
forEach
(
function
(
cluster
)
{
namespaceCreationModels
.
push
({
namespaceCreationModels
.
push
({
env
:
cluster
.
env
,
env
:
cluster
.
env
,
namespace
:
{
namespace
:
{
appId
:
$scope
.
appId
,
appId
:
$scope
.
appId
,
clusterName
:
cluster
.
clusterName
,
clusterName
:
cluster
.
clusterName
,
namespaceName
:
$scope
.
namespaceName
namespaceName
:
$scope
.
namespaceName
}
}
});
});
});
});
NamespaceService
.
createNamespace
(
$scope
.
appId
,
namespaceCreationModels
)
NamespaceService
.
createNamespace
(
$scope
.
appId
,
namespaceCreationModels
)
.
then
(
function
(
result
)
{
.
then
(
function
(
result
)
{
toastr
.
success
(
"创建成功"
);
toastr
.
success
(
"创建成功"
);
$scope
.
step
=
2
;
$scope
.
step
=
2
;
},
function
(
result
)
{
setInterval
(
function
()
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
));
$window
.
location
.
href
=
});
'/namespace/role.html?#appid='
+
$scope
.
appId
}
else
{
+
"&namespaceName="
+
$scope
.
namespaceName
;
NamespaceService
.
createAppNamespace
(
$scope
.
appId
,
$scope
.
appNamespace
).
then
(
function
(
result
)
{
},
1000
);
$scope
.
step
=
2
;
},
function
(
result
)
{
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
));
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"创建失败"
);
});
});
}
else
{
}
NamespaceService
.
createAppNamespace
(
$scope
.
appId
,
$scope
.
appNamespace
).
then
(
function
(
result
)
{
$scope
.
step
=
2
;
setInterval
(
function
()
{
$window
.
location
.
reload
();
},
1000
);
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"创建失败"
);
});
}
};
};
$scope
.
namespaceType
=
1
;
$scope
.
namespaceType
=
1
;
$scope
.
selectNamespaceType
=
function
(
type
)
{
$scope
.
selectNamespaceType
=
function
(
type
)
{
$scope
.
namespaceType
=
type
;
$scope
.
namespaceType
=
type
;
};
};
$scope
.
back
=
function
()
{
$scope
.
back
=
function
()
{
$window
.
location
.
href
=
'/config.html?#appid='
+
$scope
.
appId
;
$window
.
location
.
href
=
'/config.html?#appid='
+
$scope
.
appId
;
};
};
}]);
$scope
.
switchType
=
function
(
type
)
{
$scope
.
type
=
type
;
};
}]);
apollo-portal/src/main/resources/static/scripts/controller/role/AppRoleController.js
View file @
78912008
...
@@ -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,19 @@ role_module.controller('AppRoleController',
...
@@ -21,14 +23,19 @@ role_module.controller('AppRoleController',
});
});
$scope
.
toAssignMasterRoleUser
=
''
;
$scope
.
assignMasterRoleToUser
=
function
()
{
$scope
.
assignMasterRoleToUser
=
function
()
{
var
user
=
$
(
'.'
+
$scope
.
userSelectWidgetId
).
select2
(
'data'
)[
0
];
if
(
!
user
){
toastr
.
warning
(
"请选择用户"
);
return
;
}
var
toAssignMasterRoleUser
=
user
.
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 @
78912008
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,39 @@ role_module.controller('NamespaceRoleController',
...
@@ -24,26 +29,39 @@ 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
user
=
$
(
'.'
+
$scope
.
releaseRoleWidgetId
).
select2
(
'data'
)[
0
];
if
(
!
user
){
toastr
.
warning
(
"请选择用户"
);
return
;
}
var
toAssignReleaseNamespaceRoleUser
=
user
.
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
user
=
$
(
'.'
+
$scope
.
modifyRoleWidgetId
).
select2
(
'data'
)[
0
];
if
(
!
user
){
toastr
.
warning
(
"请选择用户"
);
return
;
}
var
toAssignModifyNamespaceRoleUser
=
user
.
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 +102,5 @@ role_module.controller('NamespaceRoleController',
...
@@ -84,5 +102,5 @@ role_module.controller('NamespaceRoleController',
}
}
list
.
splice
(
index
,
1
);
list
.
splice
(
index
,
1
);
}
}
}]);
}]);
apollo-portal/src/main/resources/static/scripts/directive.js
View file @
78912008
...
@@ -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 @
78912008
...
@@ -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 @
78912008
<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