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
27e29e67
Commit
27e29e67
authored
Oct 08, 2016
by
zhangle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config page show tips when app not created
parent
5654fc41
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
291 additions
and
269 deletions
+291
-269
config.html
apollo-portal/src/main/resources/static/config.html
+66
-56
404.png
apollo-portal/src/main/resources/static/img/404.png
+0
-0
ConfigBaseInfoController.js
...tic/scripts/controller/config/ConfigBaseInfoController.js
+219
-212
common-style.css
...-portal/src/main/resources/static/styles/common-style.css
+5
-0
namespace-panel.html
...ain/resources/static/views/component/namespace-panel.html
+1
-1
No files found.
apollo-portal/src/main/resources/static/config.html
View file @
27e29e67
...
...
@@ -20,61 +20,71 @@
<!--具体配置信息-->
<div
class=
"row config-info-container"
>
<!--tag导航-->
<div
class=
"col-md-3 col-xs-3 col-sm-3"
ng-controller=
"ConfigBaseInfoController"
>
<div
id=
"treeview"
></div>
<!--app info-->
<section
class=
"panel"
>
<header
class=
"panel-heading"
>
<img
src=
"img/info.png"
class=
"i-25-20"
/>
应用信息
<div
ng-controller=
"ConfigBaseInfoController"
>
<div
class=
"J_appNotFound hidden row text-center app-not-found"
ng-show=
"notFoundApp"
>
<img
src=
"img/404.png"
>
<br>
<p>
<span
ng-bind=
"pageContext.appId"
></span>
不存在,
<a
href=
"/app.html"
>
点击创建
</a>
</p>
</div>
<div
class=
"J_appFound hidden col-md-3 col-xs-3 col-sm-3"
ng-show=
"!notFoundApp"
>
<div
id=
"treeview"
></div>
<!--app info-->
<section
class=
"panel"
>
<header
class=
"panel-heading"
>
<img
src=
"img/info.png"
class=
"i-25-20"
/>
应用信息
<span
class=
"tools pull-right"
>
<a
href=
"javascript:;"
class=
"icon-chevron-down"
></a>
</span>
</header>
<div
class=
"panel-body"
>
<table
class=
"project-info"
>
<tbody
class=
"text-left"
>
<tr>
<th>
AppId:
</th>
<td
ng-bind=
"appBaseInfo.appId"
></td>
</tr>
<tr>
<th>
应用名:
</th>
<td
ng-bind=
"appBaseInfo.name"
></td>
</tr>
<tr>
<th>
部门:
</th>
<td
ng-bind=
"appBaseInfo.orgInfo"
></td>
</tr>
<tr>
<th>
负责人:
</th>
<td
ng-bind=
"appBaseInfo.ownerName"
></td>
</tr>
<tr>
<th>
负责人Email:
</th>
<td
ng-bind=
"appBaseInfo.ownerEmail"
></td>
</tr>
<tr
ng-show=
"missEnvs.length > 0"
>
<th>
缺失的环境:
</th>
<td>
</header>
<div
class=
"panel-body"
>
<table
class=
"project-info"
>
<tbody
class=
"text-left"
>
<tr>
<th>
AppId:
</th>
<td
ng-bind=
"appBaseInfo.appId"
></td>
</tr>
<tr>
<th>
应用名:
</th>
<td
ng-bind=
"appBaseInfo.name"
></td>
</tr>
<tr>
<th>
部门:
</th>
<td
ng-bind=
"appBaseInfo.orgInfo"
></td>
</tr>
<tr>
<th>
负责人:
</th>
<td
ng-bind=
"appBaseInfo.ownerName"
></td>
</tr>
<tr>
<th>
负责人Email:
</th>
<td
ng-bind=
"appBaseInfo.ownerEmail"
></td>
</tr>
<tr
ng-show=
"missEnvs.length > 0"
>
<th>
缺失的环境:
</th>
<td>
<span
ng-repeat=
"env in missEnvs"
ng-bind=
"env"
>
</span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<a
class=
"list-group-item"
ng-show=
"missEnvs.length > 0"
ng-click=
"createAppInMissEnv()"
>
<div
class=
"row icon-text icon-plus-orange"
>
<p
class=
"btn-title ng-binding"
>
补缺环境
</p>
</div>
</a>
</div>
</section>
<a
class=
"list-group-item"
ng-show=
"missEnvs.length > 0"
ng-click=
"createAppInMissEnv()"
>
<div
class=
"row icon-text icon-plus-orange"
>
<p
class=
"btn-title ng-binding"
>
补缺环境
</p>
</div>
</a>
<apolloentrance
apollo-title=
"'添加集群'"
apollo-img-src=
"'plus-orange'"
apollo-href=
"'cluster.html?#/appid=' + pageContext.appId"
ng-show=
"hasCreateClusterPermission"
></apolloentrance>
<apolloentrance
apollo-title=
"'添加集群'"
apollo-img-src=
"'plus-orange'"
apollo-href=
"'cluster.html?#/appid=' + pageContext.appId"
ng-show=
"hasCreateClusterPermission"
></apolloentrance>
<span
class=
"list-group-item cursor-pointer hover"
ng-click=
"showMasterPermissionTips()"
ng-show=
"!hasCreateClusterPermission"
>
<div
class=
"row icon-text icon-plus-orange"
>
...
...
@@ -82,9 +92,9 @@
</div>
</span>
<apolloentrance
apollo-title=
"'添加Namespace'"
apollo-img-src=
"'plus-orange'"
apollo-href=
"'namespace.html?#/appid=' + pageContext.appId"
ng-show=
"hasCreateNamespacePermission"
></apolloentrance>
<apolloentrance
apollo-title=
"'添加Namespace'"
apollo-img-src=
"'plus-orange'"
apollo-href=
"'namespace.html?#/appid=' + pageContext.appId"
ng-show=
"hasCreateNamespacePermission"
></apolloentrance>
<span
class=
"list-group-item cursor-pointer hover"
ng-click=
"showMasterPermissionTips()"
ng-show=
"!hasCreateNamespacePermission"
>
<div
class=
"row icon-text icon-plus-orange"
>
...
...
@@ -92,15 +102,15 @@
</div>
</span>
<apolloentrance
apollo-title=
"'项目权限'"
apollo-img-src=
"'user-manage'"
apollo-href=
"'/app/role.html?#/appid=' + pageContext.appId"
ng-show=
"hasAssignUserPermission"
></apolloentrance>
</section>
<apolloentrance
apollo-title=
"'项目权限'"
apollo-img-src=
"'user-manage'"
apollo-href=
"'/app/role.html?#/appid=' + pageContext.appId"
ng-show=
"hasAssignUserPermission"
></apolloentrance>
</section>
</div>
</div>
<!--namespaces-->
<div
class=
"col-md-9 col-xs-9 col-sm-9 config-item-container hide"
ng-controller=
"ConfigNamespaceController"
>
<div
class=
"alert alert-warning alert-dismissible"
role=
"alert"
...
...
apollo-portal/src/main/resources/static/img/404.png
0 → 100644
View file @
27e29e67
6.18 KB
apollo-portal/src/main/resources/static/scripts/controller/config/ConfigBaseInfoController.js
View file @
27e29e67
application_module
.
controller
(
"ConfigBaseInfoController"
,
[
'$rootScope'
,
'$scope'
,
'$location'
,
'toastr'
,
'AppService'
,
'PermissionService'
,
'AppUtil'
,
function
(
$rootScope
,
$scope
,
$location
,
toastr
,
AppService
,
PermissionService
,
AppUtil
)
{
var
appId
=
AppUtil
.
parseParams
(
$location
.
$$url
).
appid
;
$rootScope
.
hideTip
=
JSON
.
parse
(
localStorage
.
getItem
(
"hideTip"
));
//save user recent visited apps
var
VISITED_APPS_STORAGE_KEY
=
"VisitedApps"
;
var
visitedApps
=
JSON
.
parse
(
localStorage
.
getItem
(
VISITED_APPS_STORAGE_KEY
));
var
hasSaved
=
false
;
if
(
visitedApps
)
{
visitedApps
.
forEach
(
function
(
app
)
{
if
(
app
==
appId
)
{
hasSaved
=
true
;
return
;
}
});
}
else
{
visitedApps
=
[];
}
if
(
!
hasSaved
)
{
visitedApps
.
push
(
appId
);
localStorage
.
setItem
(
VISITED_APPS_STORAGE_KEY
,
JSON
.
stringify
(
visitedApps
));
}
//load session storage to recovery scene
var
scene
=
JSON
.
parse
(
sessionStorage
.
getItem
(
appId
));
var
pageContext
=
{
appId
:
appId
,
env
:
scene
?
scene
.
env
:
''
,
clusterName
:
scene
?
scene
.
cluster
:
'default'
};
$rootScope
.
pageContext
=
pageContext
;
////// load cluster nav tree //////
AppService
.
load_nav_tree
(
$rootScope
.
pageContext
.
appId
).
then
(
function
(
result
)
{
var
navTree
=
[];
var
nodes
=
AppUtil
.
collectData
(
result
);
if
(
!
nodes
||
nodes
.
length
==
0
)
{
toastr
.
error
(
"加载环境信息出错"
);
return
;
}
//default first env if session storage is empty
if
(
!
pageContext
.
env
)
{
pageContext
.
env
=
nodes
[
0
].
env
;
}
$rootScope
.
refreshNamespaces
();
nodes
.
forEach
(
function
(
env
,
envIdx
)
{
if
(
!
env
.
clusters
||
env
.
clusters
.
length
==
0
)
{
return
;
}
var
node
=
{};
node
.
text
=
env
.
env
;
var
clusterNodes
=
[];
//如果env下面只有一个default集群则不显示集群列表
if
(
env
.
clusters
&&
env
.
clusters
.
length
==
1
&&
env
.
clusters
[
0
].
name
==
'default'
)
{
if
(
pageContext
.
env
==
env
.
env
)
{
node
.
state
=
{};
node
.
state
.
selected
=
true
;
}
node
.
selectable
=
true
;
}
else
{
node
.
selectable
=
false
;
//cluster list
env
.
clusters
.
forEach
(
function
(
cluster
,
clusterIdx
)
{
var
clusterNode
=
{},
parentNode
=
[];
//default selection from session storage or first env & first cluster
if
(
pageContext
.
env
==
env
.
env
&&
pageContext
.
clusterName
==
cluster
.
name
)
{
clusterNode
.
state
=
{};
clusterNode
.
state
.
selected
=
true
;
}
clusterNode
.
text
=
cluster
.
name
;
parentNode
.
push
(
node
.
text
);
clusterNode
.
tags
=
[
'集群'
];
clusterNode
.
parentNode
=
parentNode
;
clusterNodes
.
push
(
clusterNode
);
});
}
node
.
nodes
=
clusterNodes
;
navTree
.
push
(
node
);
});
//init treeview
$
(
'#treeview'
).
treeview
({
color
:
"#797979"
,
showBorder
:
true
,
data
:
navTree
,
levels
:
99
,
expandIcon
:
''
,
collapseIcon
:
''
,
showTags
:
true
,
onNodeSelected
:
function
(
event
,
data
)
{
if
(
!
data
.
parentNode
)
{
//first nav node
$rootScope
.
pageContext
.
env
=
data
.
text
;
$rootScope
.
pageContext
.
clusterName
=
'default'
;
}
else
{
//second cluster node
$rootScope
.
pageContext
.
env
=
data
.
parentNode
[
0
];
$rootScope
.
pageContext
.
clusterName
=
data
.
text
;
}
//storage scene
sessionStorage
.
setItem
(
$rootScope
.
pageContext
.
appId
,
JSON
.
stringify
({
env
:
$rootScope
.
pageContext
.
env
,
cluster
:
$rootScope
.
pageContext
.
clusterName
}));
$rootScope
.
refreshNamespaces
();
}
});
var
envMapClusters
=
{};
navTree
.
forEach
(
function
(
node
)
{
if
(
node
.
nodes
&&
node
.
nodes
.
length
>
0
)
{
var
clusterNames
=
[];
node
.
nodes
.
forEach
(
function
(
cluster
)
{
if
(
cluster
.
text
!=
'default'
)
{
clusterNames
.
push
(
cluster
.
text
);
}
});
envMapClusters
[
node
.
text
]
=
clusterNames
.
join
(
","
);
}
});
$rootScope
.
envMapClusters
=
envMapClusters
;
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"加载导航出错"
);
});
////// app info //////
AppService
.
load
(
$rootScope
.
pageContext
.
appId
).
then
(
function
(
result
)
{
$scope
.
appBaseInfo
=
result
;
$scope
.
appBaseInfo
.
orgInfo
=
result
.
orgName
+
'('
+
result
.
orgId
+
')'
;
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"加载App信息出错"
);
});
////// 补缺失的环境 //////
$scope
.
missEnvs
=
[];
AppService
.
find_miss_envs
(
$rootScope
.
pageContext
.
appId
).
then
(
function
(
result
)
{
$scope
.
missEnvs
=
AppUtil
.
collectData
(
result
);
},
function
(
result
)
{
console
.
log
(
AppUtil
.
errorMsg
(
result
));
});
$scope
.
createAppInMissEnv
=
function
()
{
var
count
=
0
;
$scope
.
missEnvs
.
forEach
(
function
(
env
)
{
AppService
.
create_remote
(
env
,
$scope
.
appBaseInfo
).
then
(
function
(
result
)
{
toastr
.
success
(
env
,
'创建成功'
);
count
++
;
if
(
count
==
$scope
.
missEnvs
.
length
)
{
location
.
reload
(
true
);
}
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
'创建失败:'
+
env
);
count
++
;
if
(
count
==
$scope
.
missEnvs
.
length
)
{
location
.
reload
(
true
);
}
});
});
};
//permission
PermissionService
.
has_create_namespace_permission
(
appId
).
then
(
function
(
result
)
{
$scope
.
hasCreateNamespacePermission
=
result
.
hasPermission
;
},
function
(
result
)
{
});
PermissionService
.
has_create_cluster_permission
(
appId
).
then
(
function
(
result
)
{
$scope
.
hasCreateClusterPermission
=
result
.
hasPermission
;
},
function
(
result
)
{
});
PermissionService
.
has_assign_user_permission
(
appId
).
then
(
function
(
result
)
{
$scope
.
hasAssignUserPermission
=
result
.
hasPermission
;
},
function
(
result
)
{
});
$scope
.
showMasterPermissionTips
=
function
()
{
$
(
"#masterNoPermissionDialog"
).
modal
(
'show'
);
}
}]);
'AppUtil'
,
ConfigBaseInfoController
]);
function
ConfigBaseInfoController
(
$rootScope
,
$scope
,
$location
,
toastr
,
AppService
,
PermissionService
,
AppUtil
)
{
var
appId
=
AppUtil
.
parseParams
(
$location
.
$$url
).
appid
;
$rootScope
.
hideTip
=
JSON
.
parse
(
localStorage
.
getItem
(
"hideTip"
));
//save user recent visited apps
var
VISITED_APPS_STORAGE_KEY
=
"VisitedApps"
;
var
visitedApps
=
JSON
.
parse
(
localStorage
.
getItem
(
VISITED_APPS_STORAGE_KEY
));
var
hasSaved
=
false
;
if
(
visitedApps
)
{
visitedApps
.
forEach
(
function
(
app
)
{
if
(
app
==
appId
)
{
hasSaved
=
true
;
return
;
}
});
}
else
{
visitedApps
=
[];
}
if
(
!
hasSaved
)
{
visitedApps
.
push
(
appId
);
localStorage
.
setItem
(
VISITED_APPS_STORAGE_KEY
,
JSON
.
stringify
(
visitedApps
));
}
//load session storage to recovery scene
var
scene
=
JSON
.
parse
(
sessionStorage
.
getItem
(
appId
));
var
pageContext
=
{
appId
:
appId
,
env
:
scene
?
scene
.
env
:
''
,
clusterName
:
scene
?
scene
.
cluster
:
'default'
};
$rootScope
.
pageContext
=
pageContext
;
$scope
.
notFoundApp
=
true
;
////// app info //////
AppService
.
load
(
$rootScope
.
pageContext
.
appId
).
then
(
function
(
result
)
{
$scope
.
notFoundApp
=
false
;
$scope
.
appBaseInfo
=
result
;
$scope
.
appBaseInfo
.
orgInfo
=
result
.
orgName
+
'('
+
result
.
orgId
+
')'
;
loadNavTree
();
$
(
".J_appFound"
).
removeClass
(
"hidden"
);
},
function
(
result
)
{
$
(
".J_appNotFound"
).
removeClass
(
"hidden"
);
});
function
loadNavTree
()
{
AppService
.
load_nav_tree
(
$rootScope
.
pageContext
.
appId
).
then
(
function
(
result
)
{
var
navTree
=
[];
var
nodes
=
AppUtil
.
collectData
(
result
);
if
(
!
nodes
||
nodes
.
length
==
0
)
{
toastr
.
error
(
"系统出错,请重试或联系系统负责人"
);
return
;
}
//default first env if session storage is empty
if
(
!
pageContext
.
env
)
{
pageContext
.
env
=
nodes
[
0
].
env
;
}
$rootScope
.
refreshNamespaces
();
nodes
.
forEach
(
function
(
env
,
envIdx
)
{
if
(
!
env
.
clusters
||
env
.
clusters
.
length
==
0
)
{
return
;
}
var
node
=
{};
node
.
text
=
env
.
env
;
var
clusterNodes
=
[];
//如果env下面只有一个default集群则不显示集群列表
if
(
env
.
clusters
&&
env
.
clusters
.
length
==
1
&&
env
.
clusters
[
0
].
name
==
'default'
)
{
if
(
pageContext
.
env
==
env
.
env
)
{
node
.
state
=
{};
node
.
state
.
selected
=
true
;
}
node
.
selectable
=
true
;
}
else
{
node
.
selectable
=
false
;
//cluster list
env
.
clusters
.
forEach
(
function
(
cluster
,
clusterIdx
)
{
var
clusterNode
=
{},
parentNode
=
[];
//default selection from session storage or first env & first cluster
if
(
pageContext
.
env
==
env
.
env
&&
pageContext
.
clusterName
==
cluster
.
name
)
{
clusterNode
.
state
=
{};
clusterNode
.
state
.
selected
=
true
;
}
clusterNode
.
text
=
cluster
.
name
;
parentNode
.
push
(
node
.
text
);
clusterNode
.
tags
=
[
'集群'
];
clusterNode
.
parentNode
=
parentNode
;
clusterNodes
.
push
(
clusterNode
);
});
}
node
.
nodes
=
clusterNodes
;
navTree
.
push
(
node
);
});
//init treeview
$
(
'#treeview'
).
treeview
({
color
:
"#797979"
,
showBorder
:
true
,
data
:
navTree
,
levels
:
99
,
expandIcon
:
''
,
collapseIcon
:
''
,
showTags
:
true
,
onNodeSelected
:
function
(
event
,
data
)
{
if
(
!
data
.
parentNode
)
{
//first nav node
$rootScope
.
pageContext
.
env
=
data
.
text
;
$rootScope
.
pageContext
.
clusterName
=
'default'
;
}
else
{
//second cluster node
$rootScope
.
pageContext
.
env
=
data
.
parentNode
[
0
];
$rootScope
.
pageContext
.
clusterName
=
data
.
text
;
}
//storage scene
sessionStorage
.
setItem
(
$rootScope
.
pageContext
.
appId
,
JSON
.
stringify
({
env
:
$rootScope
.
pageContext
.
env
,
cluster
:
$rootScope
.
pageContext
.
clusterName
}));
$rootScope
.
refreshNamespaces
();
}
});
var
envMapClusters
=
{};
navTree
.
forEach
(
function
(
node
)
{
if
(
node
.
nodes
&&
node
.
nodes
.
length
>
0
)
{
var
clusterNames
=
[];
node
.
nodes
.
forEach
(
function
(
cluster
)
{
if
(
cluster
.
text
!=
'default'
)
{
clusterNames
.
push
(
cluster
.
text
);
}
});
envMapClusters
[
node
.
text
]
=
clusterNames
.
join
(
","
);
}
});
$rootScope
.
envMapClusters
=
envMapClusters
;
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"系统出错,请重试或联系系统负责人"
);
});
}
////// 补缺失的环境 //////
$scope
.
missEnvs
=
[];
AppService
.
find_miss_envs
(
$rootScope
.
pageContext
.
appId
).
then
(
function
(
result
)
{
$scope
.
missEnvs
=
AppUtil
.
collectData
(
result
);
},
function
(
result
)
{
});
$scope
.
createAppInMissEnv
=
function
()
{
var
count
=
0
;
$scope
.
missEnvs
.
forEach
(
function
(
env
)
{
AppService
.
create_remote
(
env
,
$scope
.
appBaseInfo
).
then
(
function
(
result
)
{
toastr
.
success
(
env
,
'创建成功'
);
count
++
;
if
(
count
==
$scope
.
missEnvs
.
length
)
{
location
.
reload
(
true
);
}
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
'创建失败:'
+
env
);
count
++
;
if
(
count
==
$scope
.
missEnvs
.
length
)
{
location
.
reload
(
true
);
}
});
});
};
//permission
PermissionService
.
has_create_namespace_permission
(
appId
).
then
(
function
(
result
)
{
$scope
.
hasCreateNamespacePermission
=
result
.
hasPermission
;
},
function
(
result
)
{
});
PermissionService
.
has_create_cluster_permission
(
appId
).
then
(
function
(
result
)
{
$scope
.
hasCreateClusterPermission
=
result
.
hasPermission
;
},
function
(
result
)
{
});
PermissionService
.
has_assign_user_permission
(
appId
).
then
(
function
(
result
)
{
$scope
.
hasAssignUserPermission
=
result
.
hasPermission
;
},
function
(
result
)
{
});
$scope
.
showMasterPermissionTips
=
function
()
{
$
(
"#masterNoPermissionDialog"
).
modal
(
'show'
);
}
}
apollo-portal/src/main/resources/static/styles/common-style.css
View file @
27e29e67
...
...
@@ -541,3 +541,8 @@ table th {
border-color
:
#a94442
;
}
.app-not-found
{
padding-top
:
50px
;
font-size
:
18px
;
}
apollo-portal/src/main/resources/static/views/component/namespace-panel.html
View file @
27e29e67
...
...
@@ -57,7 +57,7 @@
<img
src=
"img/sync.png"
>
同步配置
</a>
<a
type=
"button"
class=
"btn btn-d
anger
btn-sm J_tableview_btn"
<a
type=
"button"
class=
"btn btn-d
efault
btn-sm J_tableview_btn"
data-tooltip=
"tooltip"
data-placement=
"bottom"
title=
"您没有任何配置权限,请申请"
ng-click=
"showNoModifyPermissionDialog()"
ng-show=
"!namespace.hasModifyPermission && !namespace.hasReleasePermission"
>
...
...
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