Browse Source

Pull request #12555: REPORT-98345 版本管理三期 修复bug

Merge in DESIGN/design from ~DESTINY.LIN/design:final/11.0 to final/11.0

* commit '9ef4cb3b40ec2de48905b1280d41f1ec52a29ec8':
  REPORT-101740 【版本管理三期】版本中心打开被锁定的模板,没有提示
  REPORT-101740 【版本管理三期】版本中心打开被锁定的模板,没有提示
  REPORT-87551 对模板进行重命名后,版本管理仍存在,但是每个版本内容都是一样的
new-design
parent
commit
d4c99d4c25
  1. 17
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  2. 14
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java
  3. 31
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java

17
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -239,11 +239,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
String reportPath = reportletsTree.getSelectedTemplatePath(); String reportPath = reportletsTree.getSelectedTemplatePath();
final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, reportPath); final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, reportPath);
String lock = node.getLock(); String lock = node.getLock();
boolean showLockInfo = LockInfoUtils.isCompatibleOperator() boolean showLockInfo = needShowLockInfo(lock, selectedFilePath, node);
|| LockInfoUtils.unableGetLockInfo()
|| WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(selectedFilePath)
? (lock != null && !lock.equals(node.getUserID()))
: WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath);
if (showLockInfo) { if (showLockInfo) {
UserInfo userInfo = WorkContext.getCurrent().get(LockInfoOperator.class).getUserInfo(selectedFilePath); UserInfo userInfo = WorkContext.getCurrent().get(LockInfoOperator.class).getUserInfo(selectedFilePath);
node.setLock(UUID.randomUUID().toString()); node.setLock(UUID.randomUUID().toString());
@ -257,6 +253,17 @@ public class TemplateTreePane extends JPanel implements FileOperations {
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false))); DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(selectedFilePath, false)));
} }
/**
* 是否需要展示锁定信息
*/
public static boolean needShowLockInfo(String lock, String selectedFilePath, FileNode node) {
return LockInfoUtils.isCompatibleOperator()
|| LockInfoUtils.unableGetLockInfo()
|| WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(selectedFilePath)
? (lock != null && !lock.equals(node.getUserID()))
: WorkContext.getCurrent().get(LockInfoOperator.class).isTplLocked(selectedFilePath);
}
private void checkDevelopForBiddenTemplate(String selectedFilePath) { private void checkDevelopForBiddenTemplate(String selectedFilePath) {
JTemplate<?, ?> template = getOpenedTemplate(selectedFilePath); JTemplate<?, ?> template = getOpenedTemplate(selectedFilePath);
if (template != null && template.isForbidden()) { if (template != null && template.isForbidden()) {

14
designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java

@ -255,13 +255,17 @@ public class VcsHelper implements JTemplateActionListener {
VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class); VcsOperator operator = WorkContext.getCurrent().get(VcsOperator.class);
String oldPath = oldName.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY); String oldPath = oldName.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY);
List<VcsEntity> oldVcsEntities = operator.getVersions(oldPath); List<VcsEntity> oldVcsEntities = operator.getVersions(oldPath);
String replaceName = newName.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY);
for (VcsEntity oldVcsEntity : oldVcsEntities) { for (VcsEntity oldVcsEntity : oldVcsEntities) {
operator.saveVersion(oldVcsEntity.getUsername(), newName.replaceFirst(VCS_FILE_SLASH, StringUtils.EMPTY), oldVcsEntity.getCommitMsg(), oldVcsEntity.getVersion()); if (!VcsHelper.getInstance().isLegacyMode()) {
operator.deleteVersion(oldPath, oldVcsEntity.getVersion()); operator.renameVersion(oldVcsEntity, replaceName);
} else {
operator.saveVersion(oldVcsEntity.getUsername(), replaceName, oldVcsEntity.getCommitMsg(), oldVcsEntity.getVersion());
operator.deleteVersion(oldPath, oldVcsEntity.getVersion());
}
} }
FineLoggerFactory.getLogger().debug("moveVcs success. from {} to {}", oldName, newName); FineLoggerFactory.getLogger().debug("moveVcs success. from {} to {}", oldName, replaceName);
if (GcConfig.getInstance().isGcEnable()) { if (GcConfig.getInstance().isGcEnable() && VcsHelper.getInstance().isLegacyMode()) {
operator.gc(); operator.gc();
} }
} }

31
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsCenterPane.java

@ -4,8 +4,10 @@ import com.fr.base.svg.IconUtils;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.lock.LockInfoUtils;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.vcs.VcsOperatorWorker; import com.fr.design.mainframe.vcs.VcsOperatorWorker;
@ -15,6 +17,7 @@ import com.fr.design.mainframe.vcs.common.VcsCloseTemplateHelper;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.report.entity.VcsEntity; import com.fr.report.entity.VcsEntity;
import com.fr.report.lock.LockInfoOperator;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
@ -25,10 +28,13 @@ import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutionException;
/** /**
@ -148,12 +154,35 @@ public class VcsCenterPane extends VcsNewPane {
if (o instanceof VcsTableEntity) { if (o instanceof VcsTableEntity) {
VcsEntity entity = ((VcsTableEntity) o).getEntity(); VcsEntity entity = ((VcsTableEntity) o).getEntity();
saveSettingAndCloseDialog(); saveSettingAndCloseDialog();
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(new FileNode(getTemplateTruePath(entity.getFilename()), false))); showTemplate(entity.getFilename(), new FileNode(getTemplateTruePath(entity.getFilename()), false));
} }
} }
}); });
} }
private void showTemplate(String filename, FileNode node) {
new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() throws Exception {
String selectedFilePath = getTemplateTruePath(filename);
String lock = node.getLock();
return TemplateTreePane.needShowLockInfo(lock, selectedFilePath, node);
}
@Override
protected void done() {
try {
if (!get()) {
DesignerContext.getDesignerFrame().openTemplate(new FileNodeFILE(node));
} else {
FineJOptionPane.showMessageDialog(VcsCenterPane.this, Toolkit.i18nText("Fine-Design_Vcs_Open_Lock_Tip"), UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.ERROR_MESSAGE);
}
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
}
}.execute();
}
private void initManagerListener() { private void initManagerListener() {
manager.addMouseListener(new MouseAdapter() { manager.addMouseListener(new MouseAdapter() {
@Override @Override

Loading…
Cancel
Save