Commit e600f5b8 authored by Jason Song's avatar Jason Song Committed by GitHub

Merge pull request #1733 from nobodyiam/refresh-namespace-when-lazy-load

refresh namespace when doing lazy load
parents bd5ad503 94fa6164
...@@ -128,9 +128,10 @@ function controller($rootScope, $scope, toastr, AppUtil, EventManager, ConfigSer ...@@ -128,9 +128,10 @@ function controller($rootScope, $scope, toastr, AppUtil, EventManager, ConfigSer
$scope.namespaces.forEach(function (namespace, index) { $scope.namespaces.forEach(function (namespace, index) {
if (namespace.baseInfo.namespaceName == result.baseInfo.namespaceName) { if (namespace.baseInfo.namespaceName == result.baseInfo.namespaceName) {
result.showNamespaceBody = true;
result.initialized = true;
result.show = namespace.show;
$scope.namespaces[index] = result; $scope.namespaces[index] = result;
$scope.namespaces[index].showNamespaceBody = true;
$scope.namespaces[index].initialized = true;
} }
}); });
......
...@@ -44,7 +44,7 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na ...@@ -44,7 +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.refreshNamespace = refreshNamespace;
scope.switchView = switchView; scope.switchView = switchView;
scope.toggleItemSearchInput = toggleItemSearchInput; scope.toggleItemSearchInput = toggleItemSearchInput;
scope.searchItems = searchItems; scope.searchItems = searchItems;
...@@ -80,7 +80,7 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na ...@@ -80,7 +80,7 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
preInit(scope.namespace); preInit(scope.namespace);
if (!scope.lazyLoad || scope.namespace.initialized) { if (!scope.lazyLoad || scope.namespace.initialized) {
init(false); init();
} }
function preInit(namespace) { function preInit(namespace) {
...@@ -93,13 +93,15 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na ...@@ -93,13 +93,15 @@ function directive($window, toastr, AppUtil, EventManager, PermissionService, Na
.replace(".yaml", ""); .replace(".yaml", "");
} }
function init(forceShowBody) { function init() {
initNamespace(scope.namespace); initNamespace(scope.namespace);
initOther(); initOther();
scope.namespace.initialized = true; scope.namespace.initialized = true;
if (forceShowBody) { }
scope.showNamespaceBody = true;
} function refreshNamespace() {
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{namespace: scope.namespace});
} }
function initNamespace(namespace, viewType) { function initNamespace(namespace, viewType) {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<button type="button" class="btn btn-default btn-sm" <button type="button" class="btn btn-default btn-sm"
data-tooltip="tooltip" data-placement="bottom" title="加载Namespace" data-tooltip="tooltip" data-placement="bottom" title="加载Namespace"
ng-click="init(true)"> ng-click="refreshNamespace()">
<img src="img/more.png"> <img src="img/more.png">
加载Namespace 加载Namespace
</button> </button>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment