Skip to content

Commit

Permalink
Merge pull request #885 from nobodyiam/fix-text-namespace-diff-view
Browse files Browse the repository at this point in the history
fix text namespace diff view when releaseId is provided in url
  • Loading branch information
lepdou authored Dec 16, 2017
2 parents deb492e + a89ad71 commit 11886fc
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});
Expand All @@ -93,6 +96,9 @@ function releaseHistoryController($scope, $location, AppUtil,
$scope.pageContext.namespaceName)
.then(function (result) {
$scope.isTextNamespace = result.format != "properties";
if ($scope.isTextNamespace) {
fixTextNamespaceViewType();
}
})
}

Expand All @@ -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;

Expand Down

0 comments on commit 11886fc

Please sign in to comment.