смена ключей багов на численнные.
This commit is contained in:
2025-12-16 02:32:20 +03:00
parent f104335bfe
commit 6da9698285
19 changed files with 81 additions and 47 deletions

View File

@@ -1,4 +1,5 @@
package _VisualDVM.Passes.All;
import Common.CommonConstants;
import Common.Database.Database;
import Common.Passes.AddObjectPass;
import Common.Utils.Utils_;
@@ -30,6 +31,10 @@ public class AddBugReport extends AddObjectPass<BugReport> {
Log.Writeln_("Для создания отчёта требуется регистрация");
return false;
}
if (getDb().getTable(BugReport.class).containsKey(CommonConstants.Nan)){
Log.Writeln_("Может существовать не более одного черновика одновременно!");
return false;
}
if (Global.mainModule.HasProject()) {
String version = Global.mainModule.getProject().Home.getAbsolutePath().substring(Global.mainModule.getRoot().Home.getParent().length());
if (version.toCharArray()[0] == '\\') version = version.substring(1);
@@ -39,7 +44,7 @@ public class AddBugReport extends AddObjectPass<BugReport> {
} else {
if (UI.Warning("Создать отчёт об ошибке без прикрепления проекта.")) {
target = new BugReport();
target.genName();
target.id = CommonConstants.Nan;
target.sender_name = Global.mainModule.getAccount().name;
target.sender_address = Global.mainModule.getAccount().email;
target.project_version = "";
@@ -62,10 +67,12 @@ public class AddBugReport extends AddObjectPass<BugReport> {
}
@Override
protected void body() throws Exception {
super.body();
//--
Utils_.CheckAndCleanDirectory(target.getHome());
//--
if (!target.project_version.isEmpty()) {
Global.mainModule.getRoot().cleanDepAndGCOVR(); //удаление депов и гкова
//логи во вложения.
//логи во вложения. todo переделать в полноценные вложения.
File attachementsDir = Global.mainModule.getProject().getAttachmentsDirectory();
Vector<File> logs = new Vector<>();
logs.add(Utils_.MainLog.getLogFile());
@@ -80,6 +87,7 @@ public class AddBugReport extends AddObjectPass<BugReport> {
Global.mainModule.getPass(PassCode.ZipFolderPass).Do(Global.mainModule.getRoot().Home.getAbsolutePath(),
target.getArchiveFile().getAbsolutePath());
}
getDb().getTable(BugReport.class).put(target.id, target);
}
@Override
protected boolean validate() {

View File

@@ -76,6 +76,7 @@ public class AppendBugReportField extends ComponentsServerPass<BugReport> {
message_header + " " + Utils_.Brackets(Global.mainModule.getAccount().name),
message_text
);
Global.mainModule.getPass(PassCode.Email).Do(
message,
Global.componentsServer.db.recipients.getSelectedMails());

View File

@@ -1,6 +1,7 @@
package _VisualDVM.Passes.All;
import Common.Database.Database;
import Common.Passes.DeleteObjectPass;
import Common.Utils.Utils_;
import _VisualDVM.ComponentsServer.BugReport.BugReport;
import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;
@@ -15,6 +16,7 @@ public class DeleteBugReport extends DeleteObjectPass<BugReport> {
@Override
protected void performDone() throws Exception {
super.performDone();
Utils_.forceDeleteWithCheck(target.getHome());
Global.mainModule.getPass(PassCode.DeleteBugReportFromServer).Do(target);
}
@Override

View File

@@ -11,6 +11,7 @@ import org.apache.commons.io.FileUtils;
import java.io.File;
import java.nio.file.Paths;
public class DownloadAllBugReportsArchives extends ComponentsServerPass<File> {
//упраздненный временно проход.
@Override
public String getIconPath() {
return "/icons/DownloadAll.png";
@@ -19,7 +20,6 @@ public class DownloadAllBugReportsArchives extends ComponentsServerPass<File> {
protected void performPreparation() throws Exception {
Global.mainModule.getPass(PassCode.CloseCurrentProject).Do();
Global.mainModule.set(Current.Root, null); //чтобы гарантированно не существовало корня.
Utils.CleanDirectory(Global.BugReportsDirectory_OLD);
Utils.CleanDirectory(Global.BugReportsDirectory);
}
@Override
@@ -46,10 +46,12 @@ public class DownloadAllBugReportsArchives extends ComponentsServerPass<File> {
//теперь скопировать это в папку Bugs, с нормальными именами через zip
File t2 = Paths.get(tempFolder.getAbsolutePath(), "Bugs").toFile();
File[] archives = t2.listFiles();
/*
if (archives != null) {
for (File file : archives) {
FileUtils.moveFile(file, Paths.get(Global.BugReportsDirectory_OLD.getAbsolutePath(), file.getName() + ".zip").toFile());
}
}
*/
}
}

View File

@@ -8,15 +8,15 @@ public class DownloadBugReport extends ComponentsServerPass<BugReport> {
@Override
protected boolean canStart(Object... args) {
target = (BugReport) args[0];
return !target.getArchiveFile().exists() && SendRequest(ServerCode.ReceiveBugReport, target.id);
return !target.getArchiveFile().exists() && SendRequest(ServerCode.ReceiveBugReport, String.valueOf(target.id));
}
@Override
protected void performPreparation() throws Exception {
Utils_.CheckDirectory(Global.BugReportsDirectory_OLD);
Utils_.CheckDirectory(Global.BugReportsDirectory);
}
@Override
protected void body() throws Exception {
Utils_.CheckAndCleanDirectory(target.getHome());
Utils_.bytesToFile((byte[]) request.server_response.object, target.getArchiveFile());
}
@Override

View File

@@ -23,7 +23,7 @@ public class OpenBugReportTestProject extends Pass<BugReport> {
if (Global.componentsServer.db.CheckCurrent(Log, BugReport.class) &&
(target = Global.componentsServer.db.bugReports.getUI().getCurrent()).CheckNotDraft(Log)) {
if (!target.project_version.isEmpty()) {
root = new File(Global.visualiser.getDownloadsDirectory(), target.id);
root = new File(Global.visualiser.getDownloadsDirectory(), String.valueOf(target.id));
project = new File(root,
Utils_.isWindows() ? Utils_.toW(target.project_version) : Utils_.toU(target.project_version)
);

View File

@@ -124,6 +124,7 @@ public class UpdateBugReportField extends ComponentsServerPass<BugReport> {
message_header + " " + Utils_.Brackets(Global.mainModule.getAccount().name),
message_text
);
Global.mainModule.getPass(PassCode.Email).Do(
message,
Global.componentsServer.db.recipients.getSelectedMails());