Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apollo
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
apollo
Commits
8630a340
Commit
8630a340
authored
Dec 01, 2018
by
nobodyiam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do lazy load if page contains too many namespaces(>10)
parent
b3e5798b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
66 additions
and
31 deletions
+66
-31
apollo-portal/src/main/resources/static/config.html
apollo-portal/src/main/resources/static/config.html
+2
-1
apollo-portal/src/main/resources/static/scripts/controller/config/ConfigBaseInfoController.js
...tic/scripts/controller/config/ConfigBaseInfoController.js
+1
-1
apollo-portal/src/main/resources/static/scripts/controller/config/ConfigNamespaceController.js
...ic/scripts/controller/config/ConfigNamespaceController.js
+1
-0
apollo-portal/src/main/resources/static/scripts/directive/namespace-panel-directive.js
...ces/static/scripts/directive/namespace-panel-directive.js
+28
-13
apollo-portal/src/main/resources/static/views/component/namespace-panel-branch-tab.html
...es/static/views/component/namespace-panel-branch-tab.html
+2
-5
apollo-portal/src/main/resources/static/views/component/namespace-panel-header.html
...ources/static/views/component/namespace-panel-header.html
+8
-8
apollo-portal/src/main/resources/static/views/component/namespace-panel-master-tab.html
...es/static/views/component/namespace-panel-master-tab.html
+24
-3
No files found.
apollo-portal/src/main/resources/static/config.html
View file @
8630a340
...
@@ -214,7 +214,8 @@
...
@@ -214,7 +214,8 @@
pre-delete-item=
"preDeleteItem"
pre-delete-item=
"preDeleteItem"
show-text=
"showText"
show-text=
"showText"
show-no-modify-permission-dialog=
"showNoModifyPermissionDialog"
show-no-modify-permission-dialog=
"showNoModifyPermissionDialog"
show-body=
"namespaces.length == 1"
show-body=
"namespaces.length < 3"
lazy-load=
"namespaces.length > 10"
pre-create-branch=
"preCreateBranch"
pre-create-branch=
"preCreateBranch"
pre-delete-branch=
"preDeleteBranch"
>
pre-delete-branch=
"preDeleteBranch"
>
</apollonspanel>
</apollonspanel>
...
...
apollo-portal/src/main/resources/static/scripts/controller/config/ConfigBaseInfoController.js
View file @
8630a340
...
@@ -116,7 +116,7 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr
...
@@ -116,7 +116,7 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr
$scope
.
findMissingNamespaces
=
function
()
{
$scope
.
findMissingNamespaces
=
function
()
{
$scope
.
missingNamespaces
=
[];
$scope
.
missingNamespaces
=
[];
// only check missing private namespaces when app exists in current env
// only check missing private namespaces when app exists in current env
if
(
$scope
.
missEnvs
.
indexOf
(
$rootScope
.
pageContext
.
env
)
===
-
1
)
{
if
(
$
rootScope
.
pageContext
.
env
&&
$
scope
.
missEnvs
.
indexOf
(
$rootScope
.
pageContext
.
env
)
===
-
1
)
{
AppService
.
find_missing_namespaces
(
$rootScope
.
pageContext
.
appId
,
$rootScope
.
pageContext
.
env
,
AppService
.
find_missing_namespaces
(
$rootScope
.
pageContext
.
appId
,
$rootScope
.
pageContext
.
env
,
$rootScope
.
pageContext
.
clusterName
).
then
(
function
(
result
)
{
$rootScope
.
pageContext
.
clusterName
).
then
(
function
(
result
)
{
$scope
.
missingNamespaces
=
AppUtil
.
collectData
(
result
);
$scope
.
missingNamespaces
=
AppUtil
.
collectData
(
result
);
...
...
apollo-portal/src/main/resources/static/scripts/controller/config/ConfigNamespaceController.js
View file @
8630a340
...
@@ -130,6 +130,7 @@ function controller($rootScope, $scope, toastr, AppUtil, EventManager, ConfigSer
...
@@ -130,6 +130,7 @@ function controller($rootScope, $scope, toastr, AppUtil, EventManager, ConfigSer
if
(
namespace
.
baseInfo
.
namespaceName
==
result
.
baseInfo
.
namespaceName
)
{
if
(
namespace
.
baseInfo
.
namespaceName
==
result
.
baseInfo
.
namespaceName
)
{
$scope
.
namespaces
[
index
]
=
result
;
$scope
.
namespaces
[
index
]
=
result
;
$scope
.
namespaces
[
index
].
showNamespaceBody
=
true
;
$scope
.
namespaces
[
index
].
showNamespaceBody
=
true
;
$scope
.
namespaces
[
index
].
initialized
=
true
;
}
}
});
});
...
...
apollo-portal/src/main/resources/static/scripts/directive/namespace-panel-directive.js
View file @
8630a340
...
@@ -22,7 +22,8 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
...
@@ -22,7 +22,8 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
preCreateBranch
:
'
=
'
,
preCreateBranch
:
'
=
'
,
preDeleteBranch
:
'
=
'
,
preDeleteBranch
:
'
=
'
,
showMergeAndPublishGrayTips
:
'
=
'
,
showMergeAndPublishGrayTips
:
'
=
'
,
showBody
:
"
=?
"
showBody
:
"
=?
"
,
lazyLoad
:
"
=?
"
},
},
link
:
function
(
scope
)
{
link
:
function
(
scope
)
{
...
@@ -43,6 +44,7 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
...
@@ -43,6 +44,7 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
var
operate_branch_storage_key
=
'
OperateBranch
'
;
var
operate_branch_storage_key
=
'
OperateBranch
'
;
scope
.
init
=
init
;
scope
.
switchView
=
switchView
;
scope
.
switchView
=
switchView
;
scope
.
toggleItemSearchInput
=
toggleItemSearchInput
;
scope
.
toggleItemSearchInput
=
toggleItemSearchInput
;
scope
.
searchItems
=
searchItems
;
scope
.
searchItems
=
searchItems
;
...
@@ -75,18 +77,34 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
...
@@ -75,18 +77,34 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
subscriberId
,
scope
.
namespace
.
baseInfo
.
namespaceName
);
subscriberId
,
scope
.
namespace
.
baseInfo
.
namespaceName
);
});
});
init
(
);
preInit
(
scope
.
namespace
);
function
init
()
{
if
(
!
scope
.
lazyLoad
||
scope
.
namespace
.
initialized
)
{
init
(
false
);
}
function
preInit
(
namespace
)
{
scope
.
showNamespaceBody
=
false
;
namespace
.
isLinkedNamespace
=
namespace
.
isPublic
?
namespace
.
parentAppId
!=
namespace
.
baseInfo
.
appId
:
false
;
//namespace view name hide suffix
namespace
.
viewName
=
namespace
.
baseInfo
.
namespaceName
.
replace
(
"
.xml
"
,
""
).
replace
(
"
.properties
"
,
""
).
replace
(
"
.json
"
,
""
).
replace
(
"
.yml
"
,
""
)
.
replace
(
"
.yaml
"
,
""
);
}
function
init
(
forceShowBody
)
{
initNamespace
(
scope
.
namespace
);
initNamespace
(
scope
.
namespace
);
initOther
();
initOther
();
scope
.
namespace
.
initialized
=
true
;
if
(
forceShowBody
)
{
scope
.
showNamespaceBody
=
true
;
}
}
}
function
initNamespace
(
namespace
,
viewType
)
{
function
initNamespace
(
namespace
,
viewType
)
{
namespace
.
hasBranch
=
false
;
namespace
.
hasBranch
=
false
;
namespace
.
isBranch
=
false
;
namespace
.
isBranch
=
false
;
namespace
.
isLinkedNamespace
=
namespace
.
isPublic
?
namespace
.
parentAppId
!=
namespace
.
baseInfo
.
appId
:
false
;
namespace
.
displayControl
=
{
namespace
.
displayControl
=
{
currentOperateBranch
:
'
master
'
,
currentOperateBranch
:
'
master
'
,
showSearchInput
:
false
,
showSearchInput
:
false
,
...
@@ -309,12 +327,6 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
...
@@ -309,12 +327,6 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
}
}
function
initNamespaceViewName
(
namespace
)
{
function
initNamespaceViewName
(
namespace
)
{
//namespace view name hide suffix
namespace
.
viewName
=
namespace
.
baseInfo
.
namespaceName
.
replace
(
"
.xml
"
,
""
).
replace
(
"
.properties
"
,
""
).
replace
(
"
.json
"
,
""
).
replace
(
"
.yml
"
,
""
)
.
replace
(
"
.yaml
"
,
""
);
if
(
!
viewType
)
{
if
(
!
viewType
)
{
if
(
namespace
.
isPropertiesFormat
)
{
if
(
namespace
.
isPropertiesFormat
)
{
switchView
(
namespace
,
namespace_view_type
.
TABLE
);
switchView
(
namespace
,
namespace_view_type
.
TABLE
);
...
@@ -350,7 +362,7 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
...
@@ -350,7 +362,7 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
localStorage
.
setItem
(
operate_branch_storage_key
,
JSON
.
stringify
(
operateBranchStorage
));
localStorage
.
setItem
(
operate_branch_storage_key
,
JSON
.
stringify
(
operateBranchStorage
));
switchBranch
(
operateBranchStorage
[
namespaceId
]);
switchBranch
(
operateBranchStorage
[
namespaceId
]
,
false
);
}
}
...
@@ -380,11 +392,14 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
...
@@ -380,11 +392,14 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
});
});
}
}
function
switchBranch
(
branchName
)
{
function
switchBranch
(
branchName
,
forceShowBody
)
{
if
(
branchName
!=
'
master
'
)
{
if
(
branchName
!=
'
master
'
)
{
initRules
(
scope
.
namespace
.
branch
);
initRules
(
scope
.
namespace
.
branch
);
}
if
(
forceShowBody
)
{
scope
.
showNamespaceBody
=
true
;
scope
.
showNamespaceBody
=
true
;
}
}
scope
.
namespace
.
displayControl
.
currentOperateBranch
=
branchName
;
scope
.
namespace
.
displayControl
.
currentOperateBranch
=
branchName
;
//save to local storage
//save to local storage
...
...
apollo-portal/src/main/resources/static/views/component/namespace-panel-branch-tab.html
View file @
8630a340
<section
class=
"branch-panel-body"
<section
class=
"branch-panel-body"
ng-if=
"namespace.hasBranch && namespace.displayControl.currentOperateBranch != 'master'"
>
ng-if=
"namespace.initialized &&
(namespace.hasBranch && namespace.displayControl.currentOperateBranch != 'master')"
>
<!--main header-->
<!--main header-->
<header
class=
"panel-heading"
>
<header
class=
"panel-heading"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-md-6 col-sm-6 header-namespace"
>
<div
class=
"col-md-6 col-sm-6 header-namespace"
>
<span
class=
"cursor-pointer"
data-toggle=
"collapse"
data-target=
"#BODY{{namespace.branch.id}}"
aria-expanded=
"false"
ng-click=
"namespace.branch.displayControl.show = !namespace.branch.displayControl.show"
>
</span>
<b
class=
"namespace-name"
ng-bind=
"namespace.viewName"
></b>
<b
class=
"namespace-name"
ng-bind=
"namespace.viewName"
></b>
<span
class=
"label label-warning no-radius namespace-label"
<span
class=
"label label-warning no-radius namespace-label"
ng-show=
"namespace.branch.itemModifiedCnt > 0"
>
有修改
ng-show=
"namespace.branch.itemModifiedCnt > 0"
>
有修改
...
...
apollo-portal/src/main/resources/static/views/component/namespace-panel-header.html
View file @
8630a340
...
@@ -21,11 +21,11 @@
...
@@ -21,11 +21,11 @@
</div>
</div>
<div
class=
"col-md-6 text-right"
style=
"padding-right:23px;"
>
<div
class=
"col-md-6 text-right"
style=
"padding-right:23px;"
>
<span
data-toggle=
"collapse"
data-target=
"#BODY{{namespace.branch.id}}"
aria-expanded=
"false"
>
<span
data-toggle=
"collapse"
data-target=
"#BODY{{namespace.branch.id}}"
aria-expanded=
"false"
>
<span
<span
class=
"label no-radius cursor-pointer"
class=
"label no-radius cursor-pointer
"
data-toggle=
"collapse"
data-target=
"#BODY{{namespace.id}}"
aria-expanded=
"false
"
data-toggle=
"collapse"
data-target=
"#BODY{{namespace.id}}"
aria-expanded=
"false
"
ng-click=
"showNamespaceBody = !showNamespaceBody
"
ng-click=
"showNamespaceBody = !showNamespaceBody
"
>
ng-show=
"namespace.initialized
"
>
<a
><small>
[展开/收缩]
</small>
</a>
<a
>
[展开/收缩]
</a>
</span>
</span>
</span>
</span>
</div>
</div>
...
@@ -33,20 +33,20 @@
...
@@ -33,20 +33,20 @@
</header>
</header>
<!--branch nav-->
<!--branch nav-->
<header
class=
"panel-heading second-panel-heading"
ng-show=
"namespace.hasBranch"
>
<header
class=
"panel-heading second-panel-heading"
ng-show=
"namespace.
initialized && namespace.
hasBranch"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-md-8 pull-left"
>
<div
class=
"col-md-8 pull-left"
>
<ul
class=
"nav nav-tabs"
>
<ul
class=
"nav nav-tabs"
>
<li
role=
"presentation"
>
<li
role=
"presentation"
>
<a
ng-class=
"{'node_active': namespace.displayControl.currentOperateBranch == 'master'}"
<a
ng-class=
"{'node_active': namespace.displayControl.currentOperateBranch == 'master'}"
ng-click=
"switchBranch('master')"
>
ng-click=
"switchBranch('master'
, true
)"
>
<img
src=
"img/branch.png"
>
<img
src=
"img/branch.png"
>
主版本
主版本
</a>
</a>
</li>
</li>
<li
role=
"presentation"
>
<li
role=
"presentation"
>
<a
ng-class=
"{'node_active': namespace.displayControl.currentOperateBranch != 'master'}"
<a
ng-class=
"{'node_active': namespace.displayControl.currentOperateBranch != 'master'}"
ng-click=
"switchBranch(namespace.branchName)"
>
ng-click=
"switchBranch(namespace.branchName
, true
)"
>
<img
src=
"img/branch.png"
>
<img
src=
"img/branch.png"
>
灰度版本
灰度版本
</a>
</a>
...
...
apollo-portal/src/main/resources/static/views/component/namespace-panel-master-tab.html
View file @
8630a340
<!--master panel body when not initialized-->
<section
class=
"master-panel-body"
ng-if=
"!namespace.initialized"
>
<!--main header-->
<header
class=
"panel-heading"
>
<div
class=
"row"
>
<div
class=
"col-md-6 col-sm-6 header-namespace"
>
<b
class=
"namespace-name"
ng-bind=
"namespace.viewName"
></b>
</div>
<div
class=
"col-md-6 col-sm-6 text-right header-buttons"
>
<button
type=
"button"
class=
"btn btn-default btn-sm"
data-tooltip=
"tooltip"
data-placement=
"bottom"
title=
"加载Namespace"
ng-click=
"init(true)"
>
<img
src=
"img/more.png"
>
加载Namespace
</button>
</div>
</div>
</header>
</section>
<!--master panel body-->
<!--master panel body-->
<section
class=
"master-panel-body"
<section
class=
"master-panel-body"
ng-if=
"namespace.hasBranch
ng-if=
"namespace.initialized &&
&& namespace.displayControl.currentOperateBranch == 'master' ||
(namespace.hasBranch && namespace.displayControl.currentOperateBranch == 'master' || !namespace.hasBranch)"
>
!namespace.hasBranch"
>
<!--main header-->
<!--main header-->
<header
class=
"panel-heading"
>
<header
class=
"panel-heading"
>
<div
class=
"row"
>
<div
class=
"row"
>
...
...
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