Commit 9c5d43e9 by lepdou

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

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