рефакторин методов связанных с компонентами.
This commit is contained in:
@@ -44,7 +44,7 @@ public class AddBugReport extends AddObjectPass<BugReport> {
|
||||
target.sender_address = Global.mainModule.getAccount().email;
|
||||
target.project_version = "";
|
||||
target.visualiser_version = Global.visualiser.version;
|
||||
target.sapfor_version = Global.Components.get(ComponentType.Sapfor_F).version;
|
||||
target.sapfor_version = Global.components.get(ComponentType.Sapfor_F).version;
|
||||
target.sapfor_settings = (Global.mainModule.getDb()).settings.getSapforSettingsText();
|
||||
target.percentage = 0;
|
||||
target.description = "Черновик отчёта об ошибке.\nЗаполните описание ошибочной ситуации, и нажмите 'Опубликовать'";
|
||||
@@ -72,7 +72,7 @@ public class AddBugReport extends AddObjectPass<BugReport> {
|
||||
logs.add(Utils_.MainLog.getLogFile());
|
||||
logs.add(Paths.get(Global.ComponentsDirectory.getAbsolutePath(), "Sapfor_log.txt").toFile());
|
||||
logs.add(Paths.get(Global.ComponentsDirectory.getAbsolutePath(), "Server_log.txt").toFile());
|
||||
logs.add(Global.Components.get(ComponentType.Visualizer_2).getLogFile());
|
||||
logs.add(Global.components.get(ComponentType.Visualizer_2).getLogFile());
|
||||
for (File file : logs) {
|
||||
if (file.exists())
|
||||
Files.copy(file.toPath(), Paths.get(attachementsDir.getAbsolutePath(), file.getName()), StandardCopyOption.REPLACE_EXISTING);
|
||||
|
||||
@@ -20,21 +20,21 @@ public class GetComponentsActualVersions extends ComponentsRepositoryPass {
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Vector<String> versions = new Vector<>();
|
||||
for (Component component : Global.Components.Data.values())
|
||||
for (Component component : Global.components.Data.values())
|
||||
//if (component.isVisible())
|
||||
versions.add(component.getComponentType().toString());
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.GetComponentsVersions, String.join("\n", versions)));
|
||||
LinkedHashMap<ComponentType, String> response_actual_versions = (LinkedHashMap<ComponentType, String>) response.object;
|
||||
for (ComponentType componentType : response_actual_versions.keySet()) {
|
||||
Global.Components.get(componentType).unpackActualVersion(response_actual_versions.get(componentType));
|
||||
Global.components.get(componentType).unpackActualVersion(response_actual_versions.get(componentType));
|
||||
}
|
||||
//-- получить актуальные версии с сервера.
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.GetComponentsMinimalVersions, String.join("\n", versions)));
|
||||
LinkedHashMap<ComponentType, String> response_minimal_versions = (LinkedHashMap<ComponentType, String>) response.object;
|
||||
for (ComponentType componentType : response_minimal_versions.keySet()) {
|
||||
Global.Components.get(componentType).unpackMinimalVersion(response_minimal_versions.get(componentType));
|
||||
Global.components.get(componentType).unpackMinimalVersion(response_minimal_versions.get(componentType));
|
||||
}
|
||||
for (Component component : Global.Components.Data.values()) {
|
||||
for (Component component : Global.components.Data.values()) {
|
||||
if (component.CanBeUpdated())
|
||||
component.CheckIfNeedsUpdateOrPublish();
|
||||
}
|
||||
|
||||
@@ -48,6 +48,6 @@ public class InstallComponentFromFolder extends CurrentComponentPass {
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
Global.RefreshUpdatesStatus();
|
||||
Global.components.RefreshUpdatesStatus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class PublishComponent extends ComponentsRepositoryPass<Component> {
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
Global.RefreshUpdatesStatus();
|
||||
Global.components.RefreshUpdatesStatus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,6 @@ public class ResurrectComponent extends CurrentComponentPass {
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
Global.RefreshUpdatesStatus();
|
||||
Global.components.RefreshUpdatesStatus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,6 +116,6 @@ public class ResurrectComponentFromServer extends CurrentComponentPass {
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
Global.RefreshUpdatesStatus();
|
||||
Global.components.RefreshUpdatesStatus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class ShowInstruction extends Pass<File> {
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = Global.Components.get(ComponentType.Instruction).getFile();
|
||||
target = Global.components.get(ComponentType.Instruction).getFile();
|
||||
if (!target.exists()) {
|
||||
Log.Writeln("файл инструкции:\n" + target.getAbsolutePath() + "\nне найден! Обновите компонент 'Инструкция'");
|
||||
return false;
|
||||
|
||||
@@ -43,6 +43,6 @@ public class UpdateComponent extends Pass<Component> {
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
Global.RefreshUpdatesStatus();
|
||||
Global.components.RefreshUpdatesStatus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,18 +22,18 @@ public class UpdateSelectedComponents extends Pass<Vector<Component>> {
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = new Vector<>();
|
||||
//------------------------
|
||||
if (Global.Components.getUI().getSelectedCount() == 0) {
|
||||
if (Global.components.getUI().getSelectedCount() == 0) {
|
||||
Log.Writeln_("Не отмечено ни одного компонента!");
|
||||
return false;
|
||||
}
|
||||
target = Global.Components.getUI().getSelectedItems();
|
||||
target = Global.components.getUI().getSelectedItems();
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public String getStartDescription() {
|
||||
Vector<String> question = new Vector<>();
|
||||
question.add("Обновить компоненты");
|
||||
for (Component component : Global.Components.getUI().getSelectedItems()) {
|
||||
for (Component component : Global.components.getUI().getSelectedItems()) {
|
||||
question.add(component.getComponentType().getDescription());
|
||||
}
|
||||
return String.join("\n", question);
|
||||
@@ -41,7 +41,7 @@ public class UpdateSelectedComponents extends Pass<Vector<Component>> {
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
for (Component component : target) {
|
||||
Global.Components.getUI().SetCurrentByPK(component.getPK());
|
||||
Global.components.getUI().SetCurrentByPK(component.getPK());
|
||||
Global.mainModule.getPass(PassCode.UpdateComponent).Do();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user