1
0
mirror of https://bitbucket.org/svk28/rac-gui synced 2024-12-04 18:46:52 +00:00

Добавлена работа сновыми опциями RAC при добавлении и редактировании основного сервера.

--critical-total-memory
--temporary-allowed-total-memory
--temporary-allowed-total-memory-time-limit

Добавлены значения по умолчанию в конфиг.
Добавлены переводы новых опций и адаптированы переводы заголовков соответствующих таблиц.
Добавлена проверка путей расположения файлов и вывод сообщений о копировании и перемещении конфигов.
This commit is contained in:
Sergey 2019-09-02 20:58:15 +03:00
parent a54c5b4136
commit dd20452625
5 changed files with 145 additions and 52 deletions

View File

@ -137,3 +137,44 @@ proc GetDictFromString {str indent} {
} }
} }
# Проверка установки переменных в конфиге
proc CheckVariablesSet {} {
global default dir
set lst_vars {
rac_dir
critical_total_memory
temporary_allowed_total_memory
temporary_allowed_total_memory_time_limit
}
set result [::msgcat::mc "The default variables is undefinied:"]
set var ""
foreach item $lst_vars {
if {![info exists default($item)]} {
append var "\ndefault($item)"
}
}
puts $var
append result $var "\n" [::msgcat::mc "New config file will be copying from RAC GUI distributive."]
if {$var ne ""} {
set answer [tk_messageBox -message $result \
-icon warning -type yesno ]
switch -- $answer {
no return
yes {
CopyNewConfig
source [file join $dir(work) rac_gui.cfg]
}
}
}
}
proc CopyNewConfig {} {
global dir
if {[file exists [file join $dir(work) rac_gui.cfg]] ==1} {
file rename -force [file join $dir(work) rac_gui.cfg] [file join $dir(work) rac_gui.cfg.old]
file copy [file join $dir(root) rac_gui.cfg] [file join $dir(work) rac_gui.cfg]
}
}

View File

@ -367,6 +367,25 @@ proc GetWorkTreeRow {} {
} }
return $lst return $lst
} }
# Диалог указания пути до RAC
proc SetRacCommand {} {
global env tcl_platform default
if {$tcl_platform(os) eq "Windows NT"} {
set init_dir $env(COMMONPROGRAMFILES)
} elseif {$tcl_platform(os) eq "Linux"} {
set init_dir $default(rac_dir)
} else {
set init_dir $env(HOME)
}
set rac_cmd "[tk_getOpenFile -initialdir $init_dir -parent .add \
-title [::msgcat::mc "Show where is a RAC command"] -initialfile rac]"
if {$rac_cmd eq ""} {
return
} else {
return $rac_cmd
}
}
namespace eval Run {} {} namespace eval Run {} {}
@ -927,16 +946,23 @@ proc Add::server {} {
ttk::entry $frm.ent_port ttk::entry $frm.ent_port
ttk::label $frm.lbl_path_to_rac -text [::msgcat::mc "Path to RAC"] ttk::label $frm.lbl_path_to_rac -text [::msgcat::mc "Path to RAC"]
ttk::entry $frm.ent_path_to_rac ttk::entry $frm.ent_path_to_rac
ttk::button $frm.btn_path_to_rac -text "..." -width 3
$frm.ent_port insert end $default(port) $frm.ent_port insert end $default(port)
grid $frm.lbl_host -row 0 -column 0 -sticky nw -padx 5 -pady 5 grid $frm.lbl_host -row 0 -column 0 -sticky nsw -padx 5 -pady 5
grid $frm.ent_host -row 0 -column 1 -sticky new -padx 5 -pady 5 grid $frm.ent_host -row 0 -column 1 -columnspan 2 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_port -row 1 -column 0 -sticky nw -padx 5 -pady 5 grid $frm.lbl_port -row 1 -column 0 -sticky nsw -padx 5 -pady 5
grid $frm.ent_port -row 1 -column 1 -sticky new -padx 5 -pady 5 grid $frm.ent_port -row 1 -column 1 -columnspan 2 -sticky nesw -padx 5 -pady 5
grid $frm.lbl_path_to_rac -row 2 -column 0 -sticky nw -padx 5 -pady 5 grid $frm.lbl_path_to_rac -row 2 -column 0 -sticky nsw -padx 5 -pady 5
grid $frm.ent_path_to_rac -row 2 -column 1 -sticky new -padx 5 -pady 5 grid $frm.ent_path_to_rac -row 2 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.btn_path_to_rac -row 2 -column 2 -sticky new -padx 5 -pady 5
grid columnconfigure $frm 0 -weight 1 grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1 grid rowconfigure $frm 0 -weight 1
#set frm_btn [frame .add.frm_btn -border 0]
$frm.btn_path_to_rac configure -command {
.add.frm.ent_path_to_rac delete 0 end
.add.frm.ent_path_to_rac insert end [SetRacCommand]
}
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
set host [SaveMainServer [.add.frm.ent_host get] [.add.frm.ent_port get] [.add.frm.ent_path_to_rac get]] set host [SaveMainServer [.add.frm.ent_host get] [.add.frm.ent_port get] [.add.frm.ent_path_to_rac get]]
set rac_cmd_for_host($host) [.add.frm.ent_path_to_rac get] set rac_cmd_for_host($host) [.add.frm.ent_path_to_rac get]
@ -947,7 +973,8 @@ proc Add::server {} {
return $frm return $frm
} }
proc Add::servers {tree host values} { proc Add::servers {tree host values} {
global default dedicate_managers using active_cluster cluster_user cluster_pwd auth global default dedicate_managers using active_cluster cluster_user cluster_pwd auth \
if {$cluster_user ne "" && $cluster_pwd ne ""} { if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd" set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else { } else {
@ -985,14 +1012,28 @@ proc Add::servers {tree host values} {
ttk::label $frm.lbl_connections_limit -text [::msgcat::mc "Connections limit"] ttk::label $frm.lbl_connections_limit -text [::msgcat::mc "Connections limit"]
ttk::entry $frm.ent_connections_limit ttk::entry $frm.ent_connections_limit
$frm.ent_connections_limit insert end $default(connections_limit) $frm.ent_connections_limit insert end $default(connections_limit)
ttk::label $frm.lbl_cluster_port -text [::msgcat::mc "Main cluster manager port number"] ttk::label $frm.lbl_cluster_port -text [::msgcat::mc "Сluster port"]
ttk::entry $frm.ent_cluster_port ttk::entry $frm.ent_cluster_port
$frm.ent_cluster_port insert end $default(port) $frm.ent_cluster_port insert end $default(port)
ttk::label $frm.lbl_dedicate_managers -text [::msgcat::mc "Dedicated managers"] ttk::label $frm.lbl_dedicate_managers -text [::msgcat::mc "Dedicate managers"]
ttk::checkbutton $frm.check_dedicate_managers -variable dedicate_managers -onvalue all -offvalue none ttk::checkbutton $frm.check_dedicate_managers -variable dedicate_managers -onvalue all -offvalue none
ttk::label $frm.lbl_using -text [::msgcat::mc "Working server use variant"] ttk::label $frm.lbl_using -text [::msgcat::mc "Working server use variant"]
ttk::checkbutton $frm.check_using -variable using -onvalue main -offvalue normal ttk::checkbutton $frm.check_using -variable using -onvalue main -offvalue normal
ttk::label $frm.lbl_critical_total_memory -text [::msgcat::mc "Critical total memory"]
ttk::entry $frm.ent_critical_total_memory
$frm.ent_critical_total_memory insert end $default(critical_total_memory)
ttk::label $frm.lbl_temporary_allowed_total_memory \
-text [::msgcat::mc "Temporary allowed total memory"]
ttk::entry $frm.ent_temporary_allowed_total_memory
$frm.ent_temporary_allowed_total_memory insert end $default(temporary_allowed_total_memory)
ttk::label $frm.lbl_temporary_allowed_total_memory_time_limit \
-text [::msgcat::mc "Temporary allowed total memory time limit"]
ttk::entry $frm.ent_temporary_allowed_total_memory_time_limit
$frm.ent_temporary_allowed_total_memory_time_limit insert end $default(temporary_allowed_total_memory_time_limit)
grid $frm.lbl_name -row 0 -column 0 -sticky nw -padx 5 -pady 5 grid $frm.lbl_name -row 0 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_name -row 0 -column 1 -sticky nsew -padx 5 -pady 5 grid $frm.ent_name -row 0 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_agent_host -row 1 -column 0 -sticky nw -padx 5 -pady 5 grid $frm.lbl_agent_host -row 1 -column 0 -sticky nw -padx 5 -pady 5
@ -1001,8 +1042,12 @@ proc Add::servers {tree host values} {
grid $frm.ent_agent_port -row 2 -column 1 -sticky new -padx 5 -pady 5 grid $frm.ent_agent_port -row 2 -column 1 -sticky new -padx 5 -pady 5
grid $frm.lbl_port_range -row 3 -column 0 -sticky nw -padx 5 -pady 5 grid $frm.lbl_port_range -row 3 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_port_range -row 3 -column 1 -sticky nsew -padx 5 -pady 5 grid $frm.ent_port_range -row 3 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_safe_working_processes_memory_limit -row 4 -column 0 -sticky nw -padx 5 -pady 5 grid $frm.lbl_cluster_port -row 12 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_safe_working_processes_memory_limit -row 4 -column 1 -sticky nsew -padx 5 -pady 5 grid $frm.ent_cluster_port -row 12 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_safe_working_processes_memory_limit \
-row 4 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_safe_working_processes_memory_limit \
-row 4 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_safe_call_memory_limit -row 5 -column 0 -sticky nw -padx 5 -pady 5 grid $frm.lbl_safe_call_memory_limit -row 5 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_safe_call_memory_limit -row 5 -column 1 -sticky nsew -padx 5 -pady 5 grid $frm.ent_safe_call_memory_limit -row 5 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_memory_limit -row 6 -column 0 -sticky nw -padx 5 -pady 5 grid $frm.lbl_memory_limit -row 6 -column 0 -sticky nw -padx 5 -pady 5
@ -1011,12 +1056,20 @@ proc Add::servers {tree host values} {
grid $frm.ent_infobases_limit -row 7 -column 1 -sticky nsew -padx 5 -pady 5 grid $frm.ent_infobases_limit -row 7 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_connections_limit -row 8 -column 0 -sticky nw -padx 5 -pady 5 grid $frm.lbl_connections_limit -row 8 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_connections_limit -row 8 -column 1 -sticky nsew -padx 5 -pady 5 grid $frm.ent_connections_limit -row 8 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_cluster_port -row 9 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_cluster_port -row 9 -column 1 -sticky nsew -padx 5 -pady 5 grid $frm.lbl_critical_total_memory -row 9 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.lbl_dedicate_managers -row 10 -column 0 -sticky nw -padx 5 -pady 5 grid $frm.ent_critical_total_memory -row 9 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.check_dedicate_managers -row 10 -column 1 -sticky nw -padx 5 -pady 5 grid $frm.lbl_temporary_allowed_total_memory -row 10 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.lbl_using -row 11 -column 0 -sticky nw -padx 5 -pady 5 grid $frm.ent_temporary_allowed_total_memory -row 10 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.check_using -row 11 -column 1 -sticky nw -padx 5 -pady 5 grid $frm.lbl_temporary_allowed_total_memory_time_limit \
-row 11 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_temporary_allowed_total_memory_time_limit \
-row 11 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_dedicate_managers -row 13 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.check_dedicate_managers -row 13 -column 1 -sticky nw -padx 5 -pady 5
grid $frm.lbl_using -row 14 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.check_using -row 14 -column 1 -sticky nw -padx 5 -pady 5
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "server insert \ RunCommand "server insert \
@ -1032,6 +1085,9 @@ proc Add::servers {tree host values} {
--dedicate-managers=$dedicate_managers \ --dedicate-managers=$dedicate_managers \
--safe-working-processes-memory-limit=[.add.frm.ent_safe_working_processes_memory_limit get] \ --safe-working-processes-memory-limit=[.add.frm.ent_safe_working_processes_memory_limit get] \
--safe-call-memory-limit=[.add.frm.ent_safe_call_memory_limit get] \ --safe-call-memory-limit=[.add.frm.ent_safe_call_memory_limit get] \
--critical-total-memory=[.add.frm.ent_critical_total_memory get] \
--temporary-allowed-total-memory=[.add.frm.ent_temporary_allowed_total_memory get] \
--temporary-allowed-total-memory-time-limit=[.add.frm.ent_temporary_allowed_total_memory_time_limit get] \
--cluster=$active_cluster $auth $host" --cluster=$active_cluster $auth $host"
Run::servers $tree $host $active_cluster Run::servers $tree $host $active_cluster
destroy .add destroy .add
@ -2000,6 +2056,9 @@ proc Edit::work_server {tree host values} {
--dedicate-managers=$dedicate_managers \ --dedicate-managers=$dedicate_managers \
--safe-working-processes-memory-limit=[.add.frm.ent_safe_working_processes_memory_limit get] \ --safe-working-processes-memory-limit=[.add.frm.ent_safe_working_processes_memory_limit get] \
--safe-call-memory-limit=[.add.frm.ent_safe_call_memory_limit get] \ --safe-call-memory-limit=[.add.frm.ent_safe_call_memory_limit get] \
--critical-total-memory=[.add.frm.ent_critical_total_memory get] \
--temporary-allowed-total-memory=[.add.frm.ent_temporary_allowed_total_memory get] \
--temporary-allowed-total-memory-time-limit=[.add.frm.ent_temporary_allowed_total_memory_time_limit get] \
--cluster=$active_cluster $auth $host" --cluster=$active_cluster $auth $host"
Run::servers $tree $host $active_cluster Run::servers $tree $host $active_cluster
destroy .add destroy .add

View File

@ -44,8 +44,8 @@
::msgcat::mcset ru "Memory limit" "Предел использования памяти рабочим процессом" ::msgcat::mcset ru "Memory limit" "Предел использования памяти рабочим процессом"
::msgcat::mcset ru "Infobases limit" "Количество ИБ на процесс" ::msgcat::mcset ru "Infobases limit" "Количество ИБ на процесс"
::msgcat::mcset ru "Connections limit" "Количество соединений на процесс" ::msgcat::mcset ru "Connections limit" "Количество соединений на процесс"
::msgcat::mcset ru "Main cluster manager port number" "Порт главного менеджера кластера" ::msgcat::mcset ru "Сluster port" "Порт главного менеджера кластера"
::msgcat::mcset ru "Dedicated managers" "Менеджер под каждый сервис" ::msgcat::mcset ru "Dedicate managers" "Менеджер под каждый сервис"
::msgcat::mcset ru "Working server use variant" "Вариант использования рабочего сервера" ::msgcat::mcset ru "Working server use variant" "Вариант использования рабочего сервера"
::msgcat::mcset ru "Work servers" "Рабочие серверы" ::msgcat::mcset ru "Work servers" "Рабочие серверы"
::msgcat::mcset ru "Work server" "Рабочий сервер" ::msgcat::mcset ru "Work server" "Рабочий сервер"
@ -122,3 +122,8 @@
::msgcat::mcset ru "Temporary allowed total memory" "Предел превышения допустимого объёма памяти процессов (сек.)" ::msgcat::mcset ru "Temporary allowed total memory" "Предел превышения допустимого объёма памяти процессов (сек.)"
::msgcat::mcset ru "Temporary allowed total memory time limit" "Допустимый объем памяти процессов рабочего сервера" ::msgcat::mcset ru "Temporary allowed total memory time limit" "Допустимый объем памяти процессов рабочего сервера"
::msgcat::mcset ru "Server" "Сервер" ::msgcat::mcset ru "Server" "Сервер"
::msgcat::mcset ru "Main server" "Основной сервер"
::msgcat::mcset ru "The default variables is undefinied:" "Не установлены значения по умолчанию для следующих перменных:"
::msgcat::mcset ru "New config file will be copying from RAC GUI distributive." "Скопирать новый файл настроек из дистрибутива программы?"
::msgcat::mcset ru "All files from old working dir will be moved into new location:" "Все файлы из текущего рабочего каталога перенсены в:"

View File

@ -10,7 +10,7 @@
# #
###################################################### ######################################################
set rac_cmd "/opt/1C/v8.3/x86_64/rac" set default(rac_dir) "/opt/1C/v8.3/x86_64"
set default(locale) "ru" set default(locale) "ru"
# Порт RAS # Порт RAS
@ -108,12 +108,24 @@ set default(load_balancing_mode) {
memory memory
} }
set default(auth) { set default(auth) {
pwd pwd
os os
} }
# максимальный объем памяти процессов рабочего сервера
set default(critical_total_memory) 0
# допустимый объем памяти процессов рабочего сервера <bytes>
set default(temporary_allowed_total_memory) 0
# предел превышения (секунд) допустимого объема памяти процессов <seconds>
set default(temporary_allowed_total_memory_time_limit) 300
## Раскоментировать строки и прописать свои значения если ## Раскоментировать строки и прописать свои значения если
## для Информационных Баз используются эти параметры ## для Информационных Баз используются эти параметры
#set default(infobase_user) "ib_user" #set default(infobase_user) "ib_user"
@ -124,3 +136,4 @@ set default(auth) {
set default(theme) dark set default(theme) dark

View File

@ -45,9 +45,11 @@ if {[file exists [file join $env(HOME) .rac_gui]] ==1 && $dir(work) ne [file joi
cd $env(HOME) cd $env(HOME)
#file rename -force [file join $env(HOME) .rac_gui] [file join $env(HOME) .rac_gui.old] #file rename -force [file join $env(HOME) .rac_gui] [file join $env(HOME) .rac_gui.old]
file delete -force [file join $env(HOME) .rac_gui] file delete -force [file join $env(HOME) .rac_gui]
tk_messageBox -message "[::msgcat::mc "All files from old working dir will be moved into new location:"]\n$dir(work)" -icon info -type ok
} }
puts "Work dir is $dir(work)" puts "Work dir is $dir(work)"
# каталог с модулями # каталог с модулями
@ -62,36 +64,6 @@ source [file join $dir(work) rac_gui.cfg]
::msgcat::mclocale $default(locale) ::msgcat::mclocale $default(locale)
::msgcat::mcload [file join $dir(lib) msg] ::msgcat::mcload [file join $dir(lib) msg]
# Код проверки наличия rac и правильности указания пути в конфиге
# если программа не найдена то будет выведен диалог для указанием корректного пути
# и этот путь будет записан в пользовательский конфиг
if {[file exists $rac_cmd] == 0} {
set rac_cmd "[tk_getOpenFile -initialdir $env(HOME) -parent . \
-title [::msgcat::mc "Show where is a RAC command"] -initialfile rac]"
if {$rac_cmd eq ""} {exit}
file copy [file join $dir(work) rac_gui.cfg] [file join $dir(work) rac_gui.cfg.bak]
set orig_file [open [file join $dir(work) rac_gui.cfg.bak] "r"]
set file [open [file join $dir(work) rac_gui.cfg] "w"]
while {[gets $orig_file line] >=0 } {
if {[string match "set rac_cmd*" $line]} {
puts $file "set rac_cmd \"$rac_cmd\""
} else {
puts $file $line
}
}
#puts $rac_cmd
close $file
close $orig_file
#return "$host:$port"
file delete [file join $dir(work) rac_gui.cfg.bak]
if {$tcl_platform(platform) == "windows"} {
tk_messageBox -message "[::msgcat::mc "Reexecute the programm"]!" \
-icon info -type ok
exit
}
} else {
puts "Found $rac_cmd"
}
set cluster_user "" set cluster_user ""
set cluster_pwd "" set cluster_pwd ""
@ -108,6 +80,8 @@ foreach modFile [lsort [glob -nocomplain [file join $dir(lib) *.tcl]]] {
source [file join $dir(lib) gui.tcl] source [file join $dir(lib) gui.tcl]
source [file join $dir(work) rac_gui.cfg] source [file join $dir(work) rac_gui.cfg]
CheckVariablesSet
# Читаем файл со списком серверов 1С # Читаем файл со списком серверов 1С
#set serversList [dict create servers] #set serversList [dict create servers]
@ -137,3 +111,4 @@ if [file exists [file join $dir(work) 1c_srv_new.cfg]] {