Skip to content

Commit

Permalink
fix text namespace diff view when releaseId is provided in url
Browse files Browse the repository at this point in the history
  • Loading branch information
nobodyiam committed Dec 16, 2017
1 parent deb492e commit a89ad71
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 a89ad71

Please sign in to comment.