From a89ad7176a8dce0b029623f34e3f1d643ca71261 Mon Sep 17 00:00:00 2001 From: nobodyiam Date: Sat, 16 Dec 2017 22:12:30 +0800 Subject: [PATCH] fix text namespace diff view when releaseId is provided in url --- .../config/ReleaseHistoryController.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/apollo-portal/src/main/resources/static/scripts/controller/config/ReleaseHistoryController.js b/apollo-portal/src/main/resources/static/scripts/controller/config/ReleaseHistoryController.js index 981d87477..921bba3b9 100644 --- a/apollo-portal/src/main/resources/static/scripts/controller/config/ReleaseHistoryController.js +++ b/apollo-portal/src/main/resources/static/scripts/controller/config/ReleaseHistoryController.js @@ -71,7 +71,10 @@ function releaseHistoryController($scope, $location, AppUtil, if ($scope.pageContext.releaseHistoryId == history.id) { defaultToShowReleaseHistory = history; } else if ($scope.pageContext.releaseId == history.releaseId) { - history.viewType = CONFIG_VIEW_TYPE.ALL; + // text namespace doesn't support ALL view + if (!$scope.isTextNamespace) { + history.viewType = CONFIG_VIEW_TYPE.ALL; + } defaultToShowReleaseHistory = history; } }); @@ -93,6 +96,9 @@ function releaseHistoryController($scope, $location, AppUtil, $scope.pageContext.namespaceName) .then(function (result) { $scope.isTextNamespace = result.format != "properties"; + if ($scope.isTextNamespace) { + fixTextNamespaceViewType(); + } }) } @@ -107,6 +113,15 @@ function releaseHistoryController($scope, $location, AppUtil, } + function fixTextNamespaceViewType() { + $scope.releaseHistories.forEach(function (history) { + // text namespace doesn't support ALL view + if (history.viewType == CONFIG_VIEW_TYPE.ALL) { + switchConfigViewType(history, CONFIG_VIEW_TYPE.DIFF); + } + }); + } + function switchConfigViewType(history, viewType) { history.viewType = viewType; -- GitLab