Skip to content

Commit 94fa616

Browse files
committed
refresh namespace when doing lazy load
1 parent bd5ad50 commit 94fa616

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

apollo-portal/src/main/resources/static/scripts/controller/config/ConfigNamespaceController.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,10 @@ function controller($rootScope, $scope, toastr, AppUtil, EventManager, ConfigSer
128128

129129
$scope.namespaces.forEach(function (namespace, index) {
130130
if (namespace.baseInfo.namespaceName == result.baseInfo.namespaceName) {
131+
result.showNamespaceBody = true;
132+
result.initialized = true;
133+
result.show = namespace.show;
131134
$scope.namespaces[index] = result;
132-
$scope.namespaces[index].showNamespaceBody = true;
133-
$scope.namespaces[index].initialized = true;
134135
}
135136
});
136137

apollo-portal/src/main/resources/static/scripts/directive/namespace-panel-directive.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
4444

4545
var operate_branch_storage_key = 'OperateBranch';
4646

47-
scope.init = init;
47+
scope.refreshNamespace = refreshNamespace;
4848
scope.switchView = switchView;
4949
scope.toggleItemSearchInput = toggleItemSearchInput;
5050
scope.searchItems = searchItems;
@@ -80,7 +80,7 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
8080
preInit(scope.namespace);
8181

8282
if (!scope.lazyLoad || scope.namespace.initialized) {
83-
init(false);
83+
init();
8484
}
8585

8686
function preInit(namespace) {
@@ -93,13 +93,15 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
9393
.replace(".yaml", "");
9494
}
9595

96-
function init(forceShowBody) {
96+
function init() {
9797
initNamespace(scope.namespace);
9898
initOther();
9999
scope.namespace.initialized = true;
100-
if (forceShowBody) {
101-
scope.showNamespaceBody = true;
102-
}
100+
}
101+
102+
function refreshNamespace() {
103+
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
104+
{namespace: scope.namespace});
103105
}
104106

105107
function initNamespace(namespace, viewType) {

apollo-portal/src/main/resources/static/views/component/namespace-panel-master-tab.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<button type="button" class="btn btn-default btn-sm"
1313
data-tooltip="tooltip" data-placement="bottom" title="加载Namespace"
14-
ng-click="init(true)">
14+
ng-click="refreshNamespace()">
1515
<img src="img/more.png">
1616
加载Namespace
1717
</button>

0 commit comments

Comments
 (0)