Browse Source

Merge branch 'release/10.0' of https://cloud.finedevelop.com/scm/~hades/design into release/10.0

bugfix/10.0
Hades 6 years ago
parent
commit
c7453bffb5
  1. 4
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 26
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  3. 74
      designer-base/src/main/java/com/fr/env/TestConnectionResult.java

4
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -22,9 +22,9 @@ import com.fr.start.server.ServerTray;
import com.fr.workspace.WorkContext;
import com.fr.workspace.WorkContextCallback;
import com.fr.workspace.Workspace;
import com.fr.workspace.connect.AuthException;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
import com.fr.workspace.engine.exception.WorkspaceAuthException;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
@ -120,7 +120,7 @@ public class EnvChangeEntrance {
}
});
} catch (AuthException | RegistEditionException e) {
} catch (WorkspaceAuthException | RegistEditionException e) {
// String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed");
// String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote");
strategy.showTip(new PopTip() {

26
designer-base/src/main/java/com/fr/env/RemoteEnvPane.java vendored

@ -19,8 +19,8 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.third.guava.base.Strings;
import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.AuthException;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.exception.WorkspaceAuthException;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
@ -523,7 +523,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
DesignerEnvManager.getEnvManager().setCertificatePass(connection.getCertSecretKey());
try {
return WorkContext.getConnector().testConnection(connection);
} catch (AuthException ignored) {
} catch (WorkspaceAuthException ignored) {
return null;
}
}
@ -532,27 +532,9 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
protected void done() {
okButton.setEnabled(true);
try {
TestConnectionResult result = TestConnectionResult.parse(get(), connection);
if (result == TestConnectionResult.Fully_Success) {
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Successful"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon"));
}
if (result == TestConnectionResult.Partly_Sucess) {
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistence_Test"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.warningIcon"));
}
if (result == TestConnectionResult.Fully_Failed) {
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
}
if (result == TestConnectionResult.Auth_Failed) {
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
}
message.setText(result.getText());
uiLabel.setIcon(result.getIcon());
} catch (InterruptedException | ExecutionException e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed"));

74
designer-base/src/main/java/com/fr/env/TestConnectionResult.java vendored

@ -1,62 +1,104 @@
package com.fr.env;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.AssistUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
import javax.swing.Icon;
import javax.swing.UIManager;
/**
* 测试连接的结果
* 不改变原有逻辑的情况下加入一层转化
* 根据这里的转化结果判断需要提示哪些内容
*
* <p>
* created by Harrison on 2018/12/20
**/
public enum TestConnectionResult {
/**
* 完全成功, 版本匹配测试连接成功
*/
Fully_Success,
FULLY_SUCCESS {
@Override
public Icon getIcon() {
return UIManager.getIcon("OptionPane.informationIcon");
}
@Override
public String getText() {
return Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Successful");
}
},
/**
* 不完全成功版本不匹配但测试连接成功
*/
Partly_Sucess,
PARTLY_SUCCESS {
@Override
public Icon getIcon() {
return UIManager.getIcon("OptionPane.warningIcon");
}
@Override
public String getText() {
return Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistence_Test");
}
},
/**
* 完全失败直接没连上
*/
Fully_Failed,
FULLY_FAILED {
@Override
public Icon getIcon() {
return UIManager.getIcon("OptionPane.errorIcon");
}
@Override
public String getText() {
return Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed");
}
},
/**
* 验证 Token 失败
*/
Auth_Failed;
AUTH_FAILED {
@Override
public Icon getIcon() {
return UIManager.getIcon("OptionPane.errorIcon");
}
@Override
public String getText() {
return Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed");
}
};
public abstract Icon getIcon();
public abstract String getText();
public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) {
if (value == null) {
return Auth_Failed;
return AUTH_FAILED;
}
if (!value) {
return Fully_Failed;
return FULLY_FAILED;
}
try {
String serverVersion = new FunctionalHttpRequest(info).getServerVersion();
if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) {
return Fully_Success;
return FULLY_SUCCESS;
}
return Partly_Sucess;
return PARTLY_SUCCESS;
} catch (Exception e) {
// 发生异常,说明没连接上。返回完全失败。
FineLoggerFactory.getLogger().error(e.getMessage());
return Fully_Failed;
return FULLY_FAILED;
}
}
}

Loading…
Cancel
Save