Browse Source

Merge pull request #821 in DESIGN/design from ~PLOUGH/10-design:feature/10.0 to feature/10.0

* commit 'd6b79f07429879822ea43d9bccd76bcce3642704':
  REPORT-14865 更新日志推送=>调整代码
  REPORT-14865 更新日志推送=>埋点
  REPORT-14865 更新日志推送=>视觉优化
research/10.0
plough 6 years ago
parent
commit
0036bafed2
  1. 40
      designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateDialog.java
  2. 7
      designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java
  3. 46
      designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.css
  4. 107
      designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.js
  5. 2
      designer-base/src/test/java/com/fr/design/update/push/DesignerPushUpdateDialogTest.java

40
designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateDialog.java

@ -2,7 +2,12 @@ package com.fr.design.update.push;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.ui.ModernUIPane; import com.fr.design.ui.ModernUIPane;
import com.fr.design.utils.BrowseUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.intelli.record.FocusPoint;
import com.fr.intelli.record.MetricRegistry;
import com.fr.intelli.record.Original;
import com.fr.stable.StringUtils;
import com.fr.web.struct.AssembleComponent; import com.fr.web.struct.AssembleComponent;
import com.fr.web.struct.Atom; import com.fr.web.struct.Atom;
import com.fr.web.struct.browser.RequestClient; import com.fr.web.struct.browser.RequestClient;
@ -19,7 +24,7 @@ import java.awt.Frame;
* Created by plough on 2019/4/10. * Created by plough on 2019/4/10.
*/ */
class DesignerPushUpdateDialog extends UIDialog { class DesignerPushUpdateDialog extends UIDialog {
public static final Dimension DEFAULT = new Dimension(640, 320); public static final Dimension DEFAULT = new Dimension(640, 360);
private ModernUIPane<Model> jsPane; private ModernUIPane<Model> jsPane;
@ -111,8 +116,10 @@ class DesignerPushUpdateDialog extends UIDialog {
this.content = content; this.content = content;
} }
public String getMoreInfoUrl() { public void browseMoreInfoUrl() {
return moreInfoUrl; if (StringUtils.isNotEmpty(moreInfoUrl)) {
BrowseUtils.browser(moreInfoUrl);
}
} }
public void setMoreInfoUrl(String moreInfoUrl) { public void setMoreInfoUrl(String moreInfoUrl) {
@ -129,15 +136,18 @@ class DesignerPushUpdateDialog extends UIDialog {
public void updateNow() { public void updateNow() {
DesignerPushUpdateManager.getInstance().doUpdate(); DesignerPushUpdateManager.getInstance().doUpdate();
FocusPointManager.submit(FocusPointManager.OperateType.UPDATE);
exit(); exit();
} }
public void remindNextTime() { public void remindNextTime() {
FocusPointManager.submit(FocusPointManager.OperateType.REMIND_NEXT_TIME);
exit(); exit();
} }
public void skipThisVersion() { public void skipThisVersion() {
DesignerPushUpdateManager.getInstance().skipCurrentPushVersion(); DesignerPushUpdateManager.getInstance().skipCurrentPushVersion();
FocusPointManager.submit(FocusPointManager.OperateType.SKIP);
exit(); exit();
} }
@ -149,4 +159,28 @@ class DesignerPushUpdateDialog extends UIDialog {
DesignerPushUpdateDialog.this.dialogExit(); DesignerPushUpdateDialog.this.dialogExit();
} }
} }
private static class FocusPointManager {
private static final String ID = "com.fr.update.push";
private static final int SOURCE = Original.EMBED.toInt();
private static final String TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Push_Update_Focus_Point");
private enum OperateType {
UPDATE(1), REMIND_NEXT_TIME(2), SKIP(3);
private int index;
OperateType(int index) {
this.index = index;
}
private String toText() {
return String.valueOf(this.index);
}
}
private static void submit(OperateType opType) {
FocusPoint focusPoint = FocusPoint.create(ID, opType.toText(), SOURCE);
focusPoint.setTitle(TITLE);
MetricRegistry.getMetric().submit(focusPoint);
}
}
} }

7
designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java

@ -94,7 +94,7 @@ public class DesignerPushUpdateManager {
/** /**
* 检查更新如果有合适的更新版本则弹窗 * 检查更新如果有合适的更新版本则弹窗
*/ */
public void checkAndPop() { private void checkAndPop() {
new Thread() { new Thread() {
@Override @Override
public void run() { public void run() {
@ -111,11 +111,6 @@ public class DesignerPushUpdateManager {
private boolean shouldPopUp() { private boolean shouldPopUp() {
if (updateInfo == null) { if (updateInfo == null) {
String fullCurrentVersion = GeneralUtils.readFullBuildNO(); String fullCurrentVersion = GeneralUtils.readFullBuildNO();
// todo: 开发测试用
if (!fullCurrentVersion.contains(SPLIT_CHAR)) {
fullCurrentVersion = "stable-2019.01.03.17.01.05.257";
}
String fullLatestVersion = getFullLatestVersion(); String fullLatestVersion = getFullLatestVersion();
boolean isValidJarVersion = isValidJarVersion(fullCurrentVersion, fullLatestVersion); boolean isValidJarVersion = isValidJarVersion(fullCurrentVersion, fullLatestVersion);

46
designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.css

@ -5,18 +5,56 @@ body {
} }
.title { .title {
font-size: 30px; font-family: PingFangSC-Semibold;
font-size: 24px;
letter-spacing: 1.5px;
line-height: 24px;
} }
.version {
font-family: PingFangSC-Semibold;
font-size: 12px;
line-height: 14px;
margin-top: 6px;
}
.desc { .desc {
margin-top: 35px; margin-top: 40px;
font-family: PingFangSC-Regular;
font-size: 13px;
width: 540px;
margin-left: 19px;
text-indent: -19px;
overflow: visible !important;
}
.desc .bi-label {
overflow: visible !important;
} }
.moreInfo { .moreInfo {
margin-top: 15px; margin-top: 20px;
font-family: PingFangSC-Regular;
font-size: 13px;
text-decoration: underline;
} }
.buttonGroup { .buttonGroup {
margin-top: 35px; position: absolute !important;
bottom: 60px;
} }
.buttonGroup .bi-button {
font-family: PingFangSC-Medium;
font-size: 11px;
text-align: center;
line-height: 12px;
box-shadow: 0 2px 4px 0 rgba(0,82,169,0.20);
border-radius: 12px;
}
.button-ignore { .button-ignore {
background-color: white !important; background-color: white !important;
border: 1px solid white !important; border: 1px solid white !important;
color: #51A6FF;
} }

107
designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.js

@ -1,9 +1,33 @@
var MAX_DESC_NUM = 5; // 最多显示5条信息
function i18nText(key) { function i18nText(key) {
return Pool.data.i18nText(key); return Pool.data.i18nText(key);
} }
window.addEventListener("load", function (ev) { function getDescArea(descList) {
var title = BI.createWidget({ var descItems = [];
for (var i in descList) {
var num = parseInt(i) + 1;
if (num > MAX_DESC_NUM) {
break;
}
descItems.push({
type: "bi.label",
text: num + ")" + descList[i],
whiteSpace: "pre-wrap",
textAlign: "left"
})
}
return BI.createWidget({
type: "bi.vertical",
cls: "desc",
items: descItems
});
}
function getTitleArea() {
return BI.createWidget({
type: "bi.vertical", type: "bi.vertical",
items: [ items: [
{ {
@ -15,31 +39,15 @@ window.addEventListener("load", function (ev) {
{ {
type: "bi.label", type: "bi.label",
text: Pool.data.getVersion(), text: Pool.data.getVersion(),
cls: "version",
textAlign: "left" textAlign: "left"
} }
] ]
}); });
}
var desc = BI.createWidget({ function getButtonGroup() {
type: "bi.vertical", return BI.createWidget({
cls: "desc",
items: [
{
type: "bi.label",
text: Pool.data.getContent(),
textAlign: "left"
}
]
});
var moreInfo = BI.createWidget({
type: "bi.text_button",
text: i18nText("Fine-Design_Basic_More_Information"),
cls: "moreInfo",
textAlign: "left"
});
var buttonGroup = BI.createWidget({
type: 'bi.left', type: 'bi.left',
cls: "buttonGroup", cls: "buttonGroup",
items: [ items: [
@ -47,8 +55,8 @@ window.addEventListener("load", function (ev) {
type: 'bi.button', type: 'bi.button',
text: i18nText("Fine-Design_Update_Now"), text: i18nText("Fine-Design_Update_Now"),
level: 'common', level: 'common',
height: 30, height: 24,
handler: function() { handler: function () {
Pool.data.updateNow(); Pool.data.updateNow();
} }
}, },
@ -57,8 +65,8 @@ window.addEventListener("load", function (ev) {
type: 'bi.button', type: 'bi.button',
text: i18nText("Fine-Design_Remind_Me_Next_Time"), text: i18nText("Fine-Design_Remind_Me_Next_Time"),
level: 'ignore', level: 'ignore',
height: 30, height: 24,
handler: function() { handler: function () {
Pool.data.remindNextTime(); Pool.data.remindNextTime();
} }
}, },
@ -69,8 +77,8 @@ window.addEventListener("load", function (ev) {
type: 'bi.button', type: 'bi.button',
text: i18nText("Fine-Design_Skip_This_Version"), text: i18nText("Fine-Design_Skip_This_Version"),
level: 'ignore', level: 'ignore',
height: 30, height: 24,
handler: function() { handler: function () {
Pool.data.skipThisVersion(); Pool.data.skipThisVersion();
} }
}, },
@ -78,17 +86,48 @@ window.addEventListener("load", function (ev) {
} }
] ]
}); });
}
function getMoreInfo() {
return BI.createWidget({
type: "bi.text_button",
text: i18nText("Fine-Design_See_More_New_Features"),
cls: "moreInfo",
textAlign: "left",
handler: function () {
// 为了使用系统的浏览器,只能从 Java 那边打开网页
Pool.data.browseMoreInfoUrl();
}
});
}
function getShowItems() {
var title = getTitleArea();
var descList = Pool.data.getContent().split("\n");
var descArea = getDescArea(descList);
var moreInfo = getMoreInfo();
var buttonGroup = getButtonGroup();
var showItems = [title, descArea];
if (descList.length > MAX_DESC_NUM) {
showItems.push(moreInfo);
}
showItems.push(buttonGroup);
return showItems;
}
window.addEventListener("load", function (ev) {
var showItems = getShowItems();
var container = BI.createWidget({ var container = BI.createWidget({
type:"bi.vertical", type:"bi.vertical",
element: "body", element: "body",
cls: "container", cls: "container",
items: [ items: showItems
title,
desc,
moreInfo,
buttonGroup
]
}); });
container.element.css("background", "url(" + Pool.data.getBackgroundUrl() + ")"); container.element.css("background", "url(" + Pool.data.getBackgroundUrl() + ")");

2
designer-base/src/test/java/com/fr/design/update/push/DesignerPushUpdateDialogTest.java

@ -13,7 +13,7 @@ public class DesignerPushUpdateDialogTest {
JSONObject jo = JSONObject.create(); JSONObject jo = JSONObject.create();
jo.put("version", "2019.03.06.04.02.43.6"); jo.put("version", "2019.03.06.04.02.43.6");
jo.put("content", "test content"); jo.put("content", "设计器改进:去除右击弹框,让操作过程更流畅;增加报表块缩放功能,利于从全局角度整体设计报表\n插件重构:插件支持热部署,即装即用,不再需要重启服务器;\nsapbw:可用于bwcube和bwquery;\n私有云认证:可在客户本地部署私有云认证服务器,业务服务器可到此服务器进行认证;\n开放:打通简道云,可以在简道云里创建项目,并将数据同步到客户的私有库\nshould not display");
jo.put("more", "http://baidu.com"); jo.put("more", "http://baidu.com");
jo.put("background", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1555043827901&di=fc266992abef5a7e13b4e0cb98975a75&imgtype=0&src=http%3A%2F%2Fi5.3conline.com%2Fimages%2Fpiclib%2F201203%2F20%2Fbatch%2F1%2F130280%2F1332249463721rez0li5fg0_medium.jpg"); jo.put("background", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1555043827901&di=fc266992abef5a7e13b4e0cb98975a75&imgtype=0&src=http%3A%2F%2Fi5.3conline.com%2Fimages%2Fpiclib%2F201203%2F20%2Fbatch%2F1%2F130280%2F1332249463721rez0li5fg0_medium.jpg");
DesignerUpdateInfo mockUpdateInfo = new DesignerUpdateInfo("111.22.11", "2211.231.1", "11.23.1", jo); DesignerUpdateInfo mockUpdateInfo = new DesignerUpdateInfo("111.22.11", "2211.231.1", "11.23.1", jo);

Loading…
Cancel
Save