fix
Hedgehog_server_CI/ServerMonitorBot/pipeline/pr-master Build queued... Details
Hedgehog_server_CI/ServerMonitorBot/pipeline/head This commit looks good Details

feature/task-38-roles
L_DelOff 2024-11-24 17:56:15 +03:00
parent 68d0fb2ced
commit a648865083
2 changed files with 23 additions and 18 deletions

View File

@ -24,6 +24,7 @@ public class CpuTemp extends CommandTemplate {
@Override
public String executeCommandSpecificHost(String serverName) {
try {
Optional<SshServer> server = sshService.getAllSshServers()
.stream()
.filter(x -> x.getName().equals(serverName))
@ -39,5 +40,10 @@ public class CpuTemp extends CommandTemplate {
log.error("Ошибка при выполнении команды 'CPUtemp'. Искомый сервер ({}) не найден", serverName);
return null;
}
} catch (NumberFormatException e) {
log.error("Ошибка при выполнении команды 'CPUtemp'" ,e.getMessage());
return "Сервер " + serverName + " не поддерживает команду 'CPUtemp'";
}
}
}

View File

@ -45,10 +45,9 @@ public class TelegramBotKeyboard implements UiFormer {
private ArrayList<KeyboardRow> formKeyboard(User user) {
Role role = user.getRole();
Map<String, CommandTemplate> commands = applicationContext.getBeansOfType(CommandTemplate.class);
if (List.of(ADMIN, USER).contains(role)) {
commands.remove("/start");
commands.remove("Not found");
}
commands.remove("firstUseCommand");
commands.remove("switchToMainMenu");
int buttonOnLine = 3;
ArrayList<KeyboardRow> keyboardRows = new ArrayList<>();