提交 9c5d43e9 编写于 作者: L lepdou

bugfix: email's apollo link change release id to release history id

上级 3aae94de
......@@ -6,7 +6,6 @@ import com.google.common.collect.Lists;
import com.ctrip.framework.apollo.common.constants.ReleaseOperation;
import com.ctrip.framework.apollo.common.dto.ReleaseDTO;
import com.ctrip.framework.apollo.common.entity.AppNamespace;
import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
import com.ctrip.framework.apollo.core.enums.Env;
import com.ctrip.framework.apollo.portal.constant.RoleType;
......@@ -24,7 +23,6 @@ import com.ctrip.framework.apollo.portal.util.RoleUtils;
import org.apache.commons.lang.time.FastDateFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
......@@ -47,6 +45,7 @@ public abstract class ConfigPublishEmailBuilder {
private static final String EMAIL_CONTENT_FIELD_OPERATOR = "\\$\\{operator}";
private static final String EMAIL_CONTENT_FIELD_RELEASE_TIME = "\\$\\{releaseTime}";
private static final String EMAIL_CONTENT_FIELD_RELEASE_ID = "\\$\\{releaseId}";
private static final String EMAIL_CONTENT_FIELD_RELEASE_HISTORY_ID = "\\$\\{releaseHistoryId}";
private static final String EMAIL_CONTENT_FIELD_RELEASE_TITLE = "\\$\\{releaseTitle}";
private static final String EMAIL_CONTENT_FIELD_RELEASE_COMMENT = "\\$\\{releaseComment}";
private static final String EMAIL_CONTENT_FIELD_APOLLO_SERVER_ADDRESS = "\\$\\{apollo.portal.address}";
......@@ -156,6 +155,8 @@ public abstract class ConfigPublishEmailBuilder {
renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_RELEASE_TITLE, Matcher.quoteReplacement(releaseHistory.getReleaseTitle()));
renderResult =
renderResult.replaceAll(EMAIL_CONTENT_FIELD_RELEASE_ID, String.valueOf(releaseHistory.getReleaseId()));
renderResult =
renderResult.replaceAll(EMAIL_CONTENT_FIELD_RELEASE_HISTORY_ID, String.valueOf(releaseHistory.getId()));
renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_RELEASE_COMMENT, Matcher.quoteReplacement(releaseHistory.getReleaseComment()));
renderResult = renderResult.replaceAll(EMAIL_CONTENT_FIELD_APOLLO_SERVER_ADDRESS, getApolloPortalAddress());
return renderResult
......
package com.ctrip.framework.apollo.portal.components.emailbuilder;
import com.google.common.base.Joiner;
import com.google.gson.Gson;
import com.ctrip.framework.apollo.common.constants.GsonType;
......@@ -21,6 +22,7 @@ public class GrayPublishEmailBuilder extends ConfigPublishEmailBuilder {
private static final String EMAIL_SUBJECT = "[Apollo] 灰度发布";
private Gson gson = new Gson();
private Joiner IP_JOINER = Joiner.on(", ");
@Override
protected String subject() {
......@@ -54,9 +56,7 @@ public class GrayPublishEmailBuilder extends ConfigPublishEmailBuilder {
.append(clientAppId)
.append("&nbsp;&nbsp; <b>IP:&nbsp;</b>");
for (String ip : ips) {
rulesHtmlBuilder.append(ip).append(",");
}
IP_JOINER.appendTo(rulesHtmlBuilder, ips);
}
}
......
......@@ -6,7 +6,7 @@ import java.util.Date;
public class RelativeDateFormat {
private static final FastDateFormat TIMESTAMP_FORMAT = FastDateFormat.getInstance("yyyyMMddHHmmss");
private static final FastDateFormat TIMESTAMP_FORMAT = FastDateFormat.getInstance("yyyy-MM-dd");
private static final long ONE_MINUTE = 60000L;
private static final long ONE_HOUR = 3600000L;
private static final long ONE_DAY = 86400000L;
......
......@@ -23,7 +23,6 @@ $(document).ready(function () {
$("textarea").niceScroll({cursoropacitymax: 0});
$("pre").niceScroll({cursoropacitymax: 0});
$(".release-history-list").niceScroll({cursoropacitymax: 0});
$(".release-info .config").niceScroll({cursoropacitymax: 0});
}, 2500);
});
......
......@@ -12,7 +12,8 @@ function releaseHistoryController($scope, $location, AppUtil,
env: params.env,
clusterName: params.clusterName,
namespaceName: params.namespaceName,
releaseId: params.releaseId
releaseId: params.releaseId,
releaseHistoryId: params.releaseHistoryId
};
var PAGE_SIZE = 10;
var CONFIG_VIEW_TYPE = {
......@@ -50,7 +51,7 @@ function releaseHistoryController($scope, $location, AppUtil,
$scope.pageContext.namespaceName,
$scope.page, PAGE_SIZE)
.then(function (result) {
if ($scope.page == 0){
if ($scope.page == 0) {
$(".release-history").removeClass('hidden');
}
......@@ -66,13 +67,14 @@ function releaseHistoryController($scope, $location, AppUtil,
if ($scope.page == 0) {
var defaultToShowReleaseHistory = result[0];
if ($scope.pageContext.releaseId){
$scope.releaseHistories.forEach(function (history) {
if ($scope.pageContext.releaseId == history.releaseId){
defaultToShowReleaseHistory = history;
}
})
}
$scope.releaseHistories.forEach(function (history) {
if ($scope.pageContext.releaseHistoryId == history.id) {
defaultToShowReleaseHistory = history;
} else if ($scope.pageContext.releaseId == history.releaseId) {
history.viewType = CONFIG_VIEW_TYPE.ALL;
defaultToShowReleaseHistory = history;
}
});
showReleaseHistoryDetail(defaultToShowReleaseHistory);
}
......@@ -98,26 +100,28 @@ function releaseHistoryController($scope, $location, AppUtil,
$scope.history = history;
$scope.selectedReleaseHistory = history.id;
history.viewType = CONFIG_VIEW_TYPE.DIFF;
showReleaseDiffConfiguration(history);
if (!history.viewType) {//default view type
history.viewType = CONFIG_VIEW_TYPE.DIFF;
getReleaseDiffConfiguration(history);
}
}
function switchConfigViewType(history, viewType) {
history.viewType = viewType;
if (viewType == CONFIG_VIEW_TYPE.DIFF) {
showReleaseDiffConfiguration(history);
getReleaseDiffConfiguration(history);
}
}
function showReleaseDiffConfiguration(history) {
history.viewType = CONFIG_VIEW_TYPE.DIFF;
function getReleaseDiffConfiguration(history) {
if (!history.changes) {
//Set previous release id to master latest release id when branch first gray release.
if (history.operation == 2 && history.previousReleaseId == 0){
if (history.operation == 2 && history.previousReleaseId == 0) {
history.previousReleaseId = history.operationContext.baseReleaseId;
}
......
......@@ -612,12 +612,6 @@ table th {
padding: 15px;
}
.release-history .panel-body {
max-height: 750px;
padding: 0;
overflow: scroll;
}
.release-history .empty-container {
padding: 15px;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册