Browse Source

REPORT-76068【迭代】【起始页】埋点没记

更改埋点方案,在主 JAR 中记录
feature/x
Harrison 2 years ago
parent
commit
a3f21099d5
  1. 6
      designer-base/src/main/java/com/fr/startup/metric/DesignerMetrics.java
  2. 172
      designer-base/src/main/java/com/fr/startup/metric/DesignerStartupPageStatistic.java
  3. 5
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java
  4. 12
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java

6
designer-base/src/main/java/com/fr/startup/metric/DesignerMetrics.java

@ -7,6 +7,8 @@ public class DesignerMetrics {
private DesignerStartupModel model = new DesignerStartupModel();
private DesignerStartupPageStatistic statistic = new DesignerStartupPageStatistic();
public DesignerMetrics() {
}
@ -14,4 +16,8 @@ public class DesignerMetrics {
return model;
}
public DesignerStartupPageStatistic getStatistic() {
return statistic;
}
}

172
designer-base/src/main/java/com/fr/startup/metric/DesignerStartupPageStatistic.java

@ -0,0 +1,172 @@
package com.fr.startup.metric;
import com.fr.start.common.DesignerStartupContext;
import com.fr.startup.ui.StartupPageModel;
import java.util.ArrayDeque;
import java.util.Deque;
/**
* 设计器启动页使用数据
*
* created by Harrison on 2022/08/12
**/
public class DesignerStartupPageStatistic {
private final Deque<Operation> operations = new ArrayDeque<>();
public void recordOpenEmptyTemplate() {
Operation operation = OperationType.DO_OPEN_EMPTY_TEMPLATE.create();
StartupPageModel pageModel = DesignerStartupContext.getInstance().getStartupPageModel();
operation.setWorkspace(pageModel.getSelectWorkspaceInfo().getName());
operation.setWorkspaceNum(pageModel.getWorkspaceInfos().size());
pushOperation(operation);
}
public void recordSwitchWorkspace() {
Operation operation = OperationType.DO_SWITCH_WORKSPACE.create();
StartupPageModel pageModel = DesignerStartupContext.getInstance().getStartupPageModel();
operation.setWorkspace(pageModel.getSelectWorkspaceInfo().getName());
operation.setWorkspaceNum(pageModel.getWorkspaceInfos().size());
pushOperation(operation);
}
public void recordShowAllAction() {
Operation operation = OperationType.DO_SHOW_ALL_ACTION.create();
StartupPageModel pageModel = DesignerStartupContext.getInstance().getStartupPageModel();
operation.setWorkspaceNum(pageModel.getWorkspaceInfos().size());
pushOperation(operation);
}
public void recordOpenLastTemplate(String lastOpenFile) {
Operation operation = OperationType.DO_OPEN_LAST_TEMPLATE_ACTION.create();
StartupPageModel pageModel = DesignerStartupContext.getInstance().getStartupPageModel();
operation.setWorkspaceNum(pageModel.getWorkspaceInfos().size());
operation.setTemplate(lastOpenFile);
pushOperation(operation);
}
public void pushOperation(Operation operation) {
this.operations.push(operation);
}
public Deque<Operation> getOperations() {
return this.operations;
}
public enum OperationType {
/**
* 双击工作目录进入 点击蓝色箭头进入
*/
DO_OPEN_EMPTY_TEMPLATE(0),
/**
* 切换其他工作目录
*/
DO_SWITCH_WORKSPACE(1),
/**
* 点击展开全部
*/
DO_SHOW_ALL_ACTION(2),
/**
* 点击工作目录中的模版直接打开 直接点击蓝色箭头进入
*/
DO_OPEN_LAST_TEMPLATE_ACTION(3);
private final int sign;
OperationType(int sign) {
this.sign = sign;
}
public int getSign() {
return sign;
}
public Operation create() {
Operation operation = new Operation();
operation.setOperateType(this);
return operation;
}
}
public static class Operation {
/**
* operate0-双击工作目录进入 点击蓝色箭头进入1-切换其他工作目录2-点击展开全部3-点击工作目录中的模版直接打开 直接点击蓝色箭头进入
*/
private int operate;
/**
* workplace工作目录名称当operate为 0或1时记录
*/
private String workspace;
/**
* workplaceNumber工作目录的个数当operate为 0或1或2或3时记录
*/
private int workspaceNum;
/**
* template模板名称当operate为 3时记录
*/
private String template;
public Operation(int operate, String workspace, int workspaceNum, String template) {
this.operate = operate;
this.workspace = workspace;
this.workspaceNum = workspaceNum;
this.template = template;
}
public Operation() {
}
public int getOperate() {
return operate;
}
public void setOperateType(OperationType operateType) {
this.operate = operateType.getSign();
}
public void setOperate(int operate) {
this.operate = operate;
}
public String getWorkspace() {
return workspace;
}
public void setWorkspace(String workspace) {
this.workspace = workspace;
}
public int getWorkspaceNum() {
return workspaceNum;
}
public void setWorkspaceNum(int workspaceNum) {
this.workspaceNum = workspaceNum;
}
public String getTemplate() {
return template;
}
public void setTemplate(String template) {
this.template = template;
}
}
}

5
designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java

@ -18,6 +18,8 @@ import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ProductConstants;
import com.fr.stable.collections.CollectionUtils;
import com.fr.start.common.DesignerStartupContext;
import com.fr.startup.metric.DesignerMetrics;
import org.jetbrains.annotations.NotNull;
import javax.swing.BorderFactory;
@ -392,6 +394,9 @@ public class StartupPageWindow extends JFrame {
DesignerEnvManager.getEnvManager().setLastOpenFile(recentFile);
pageModel.getOpenLastTemplateRunnable().run();
DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics();
designerMetrics.getStatistic().recordOpenLastTemplate(recentFile);
}
}

12
designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java

@ -7,6 +7,8 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.ColorUtils;
import com.fr.start.common.DesignerStartupContext;
import com.fr.startup.metric.DesignerMetrics;
import com.fr.third.guava.collect.Lists;
import org.jetbrains.annotations.NotNull;
@ -539,12 +541,19 @@ public class StartupPageWorkspacePanel extends JPanel {
pageModel.setSelectWorkspaceInfo(workspaceInfo);
openEmptyTemplateRunnable.run();
DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics();
designerMetrics.getStatistic().recordOpenEmptyTemplate();
}
private void doSwitchWorkspace(StartupWorkspaceBean workspaceInfo) {
// selectWorkspaceRunnable
pageModel.setSelectWorkspaceInfo(workspaceInfo);
selectWorkspaceRunnable.run();
DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics();
designerMetrics.getStatistic().recordSwitchWorkspace();
}
private void doShowAllAction(UILabel fontLabel, UILabel iconLabel) {
@ -560,6 +569,9 @@ public class StartupPageWorkspacePanel extends JPanel {
showLessContent();
showMore = !showMore;
}
DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics();
designerMetrics.getStatistic().recordShowAllAction();
repaintAll();
}

Loading…
Cancel
Save