From 45657850935dba6ed76b4c1f6e4fc5f9fac033eb Mon Sep 17 00:00:00 2001 From: Sergey Kalinin Date: Wed, 23 May 2018 13:17:15 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80?= =?UTF-8?q?=D1=8B=20=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3.=20?= =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD=20?= =?UTF-8?q?=D0=B4=D0=B8=D0=B0=D0=BB=D0=BE=D0=B3=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B8=D0=BD=D1=84.?= =?UTF-8?q?=D0=B1=D0=B0=D0=B7=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/CHANGELOG | 4 ++ lib/function.tcl | 118 +++++++++++++++++++++++++++++++---------------- rac_gui.cfg | 5 +- rac_gui.tcl | 1 + 4 files changed, 86 insertions(+), 42 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 7fc7ad2..52939fc 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -4,6 +4,9 @@ # Author: Sergey Kalinin svk@nuk-svk.ru # Home page: https://bitbucket.org/svk28/rac-gui ###################################################### +22/05/2018 +- Реализована полнофункциональная форма добавления информационной базы + 22/05/2018 - Реализована форма добавления рабочего сервера @@ -20,3 +23,4 @@ + diff --git a/lib/function.tcl b/lib/function.tcl index 398fafc..bfe4ec9 100644 --- a/lib/function.tcl +++ b/lib/function.tcl @@ -18,7 +18,9 @@ proc TreePress {tree} { set key [lindex [split $id "::"] 0] if {$key eq "server"} { set host $values - } + } elseif {$key eq ""} { + return + } #puts "$id $host $values" Run::$key $tree $host $values #RunCommand $root "infobase summary list --cluster=$cluster $host" @@ -362,7 +364,6 @@ proc Add::server {} { pack $frm $frm_btn -padx 5 -pady 5 -expand true -fill x pack $frm_btn.btn_cancel -side right pack $frm_btn.btn_ok -side right -padx 10 - puts $host } proc Add::servers {tree host values} { global default dedicate_manager using_central_server @@ -373,48 +374,36 @@ proc Add::servers {tree host values} { wm title .add "Добавление рабочего сервера" ttk::label .add.lbl -image server_grey_64 set frm [ttk::labelframe .add.frm -text "Добавление рабочего сервера" -labelanchor nw] - label $frm.lbl_server_desc -text "Описание сервера" entry $frm.ent_server_desc - label $frm.lbl_host -text "Адрес сервера" entry $frm.ent_host - label $frm.lbl_port -text "Порт" entry $frm.ent_port $frm.ent_port insert end $default(port) - label $frm.lbl_ports_range -text "Диапазон портов" entry $frm.ent_ports_range $frm.ent_ports_range insert end $default(ports_range) - label $frm.lbl_ram_max -text "Максимальный объём памяти раб. процессов" entry $frm.ent_ram_max $frm.ent_ram_max insert end $default(ram_max) - label $frm.lbl_ram_sec -text "Безопасный расход памяти за вызов" entry $frm.ent_ram_sec $frm.ent_ram_sec insert end $default(ram_sec) - label $frm.lbl_ram_work -text "Объём памяти рабочих процессов" entry $frm.ent_ram_work $frm.ent_ram_work insert end $default(ram_work) - label $frm.lbl_base_on_process -text "Количество ИБ на процесс" entry $frm.ent_base_on_process $frm.ent_base_on_process insert end $default(base_on_process) - label $frm.lbl_connection_on_process -text "Количество соединений на процесс" entry $frm.ent_connection_on_process $frm.ent_connection_on_process insert end $default(connection_on_process) - label $frm.lbl_manager_port -text "Порт главного менеджера кластера" entry $frm.ent_manager_port $frm.ent_manager_port insert end $default(port) - label $frm.lbl_manager_each_service -text "Менеджер под каждый сервис" checkbutton $frm.ent_manager_each_service -variable dedicate_manager -onvalue all -offvalue none - label $frm.lbl_central_server -text "Центральный сервер" checkbutton $frm.ent_central_server -variable using_central_server -onvalue main -offvalue normal @@ -481,49 +470,91 @@ proc Add::infobase {tree host values} { } proc Add::infobases {tree host values} { global default active_cluster + global secure_level dbms block_shedule create_db license_distribution date_offset db_create + set active_cluster $values + # установка значений по умолчанию + set license_distribution deny + set secure_level [lindex $default(secure_level) 0] + set date_offset [lindex $default(date_offset) 0] + set dbms [lindex $default(dbms) 0] + set block_shedule on + toplevel .add wm title .add "Добавление информационной базы" ttk::label .add.lbl -image add_database_grey_64 set frm [ttk::labelframe .add.frm -text "Добавление информационной базы" -labelanchor nw] - - label $frm.lbl_host -text "Адрес сервера баз даннных" - entry $frm.ent_host - label $frm.lbl_db_user -text "Имя пользователя базы даннных" - entry $frm.ent_db_user + label $frm.lbl_infobase_name -text "Имя информационной базы" + entry $frm.ent_infobase_name + label $frm.lbl_infobase_descr -text "Описание" + entry $frm.ent_infobase_descr + label $frm.lbl_secure_connect -text "Защищённое соединение" + set combo_secure_level [ttk::combobox $frm.cb_secure_level\ + -textvariable secure_level -values $default(secure_level)]] + label $frm.lbl_host -text "Адрес сервера баз данных" + entry $frm.ent_host + label $frm.lbl_base_type -text "Тип СУБД" + ttk::combobox $frm.cb_base_type -textvariable dbms -values $default(dbms)] + label $frm.lbl_base_name -text "База данных" + entry $frm.ent_base_name + label $frm.lbl_db_user -text "Имя пользователя базы данных" + entry $frm.ent_db_user label $frm.lbl_db_pass -text "Пароль" - entry $frm.ent_db_pass + entry $frm.ent_db_pass #$frm.ent_host insert end $host label $frm.lbl_locale -text "Язык базы данных" entry $frm.ent_locale $frm.ent_locale insert end $default(locale) - label $frm.lbl_infobase_name -text "Имя информационной базы" - entry $frm.ent_infobase_name - label $frm.lbl_base_name -text "Имя базы данных" - entry $frm.ent_base_name - label $frm.lbl_base_type -text "Тип СУБД" - set combo [ttk::combobox $frm.cb_base_type -textvariable dbms -values $default(dbms)]] - grid $frm.lbl_host -row 0 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.ent_host -row 0 -column 1 -sticky nsew -padx 5 -pady 5 - grid $frm.lbl_db_user -row 1 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.ent_db_user -row 1 -column 1 -sticky nsew -padx 5 -pady 5 - grid $frm.lbl_db_pass -row 2 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.ent_db_pass -row 2 -column 1 -sticky nsew -padx 5 -pady 5 - grid $frm.lbl_locale -row 3 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.ent_locale -row 3 -column 1 -sticky nsew -padx 5 -pady 5 - grid $frm.lbl_infobase_name -row 4 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.ent_infobase_name -row 4 -column 1 -sticky nsew -padx 5 -pady 5 + label $frm.lbl_date_offset -text "Смещение дат" + set combo_date_offset [ttk::combobox $frm.cb_date_offset \ + -textvariable date_offset -values $default(date_offset)]] + label $frm.lbl_license_distribution -justify left -anchor nw -text "Разрешить выдачу лицензий\nсервером 1С" + checkbutton $frm.cb_license_distribution -variable license_distribution -onvalue allow -offvalue deny + label $frm.lbl_create_db -text "Создать БД в случае её отсутствия" + checkbutton $frm.cb_create_db -variable create_db -onvalue true -offvalue false + label $frm.lbl_block_shedule -text "Блокировка регламентных заданий" + checkbutton $frm.cb_block_shedule -variable block_shedule -onvalue on -offvalue off + + grid $frm.lbl_infobase_name -row 0 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_infobase_name -row 0 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_infobase_descr -row 1 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_infobase_descr -row 1 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_secure_connect -row 2 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.cb_secure_level -row 2 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_host -row 3 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_host -row 3 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_base_type -row 4 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.cb_base_type -row 4 -column 1 -sticky nsew -padx 5 -pady 5 grid $frm.lbl_base_name -row 5 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.ent_base_name -row 5 -column 1 -sticky nsew -padx 5 -pady 5 - grid $frm.lbl_base_type -row 6 -column 0 -sticky nw -padx 5 -pady 5 - grid $frm.cb_base_type -row 6 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.ent_base_name -row 5 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_db_user -row 6 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_db_user -row 6 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_db_pass -row 7 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_db_pass -row 7 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_locale -row 8 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.ent_locale -row 8 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_date_offset -row 9 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.cb_date_offset -row 9 -column 1 -sticky nsew -padx 5 -pady 5 + grid $frm.lbl_license_distribution -row 10 -column 0 -sticky nsew -padx 5 -pady 5 + grid $frm.cb_license_distribution -row 10 -column 1 -sticky nw -padx 5 -pady 5 + grid $frm.lbl_create_db -row 11 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.cb_create_db -row 11 -column 1 -sticky nw -padx 5 -pady 5 + grid $frm.lbl_block_shedule -row 12 -column 0 -sticky nw -padx 5 -pady 5 + grid $frm.cb_block_shedule -row 12 -column 1 -sticky nw -padx 5 -pady 5 + grid columnconfigure $frm 0 -weight 1 grid rowconfigure $frm 0 -weight 1 set active_cluster $values + # Проверяем значение чекбокса и выставляем соответсвющую опцию + if {$create_db eq "true"} { + set db_create "--create-database" + } else { + set db_create "" + } set frm_btn [frame .add.frm_btn -border 0] ttk::button $frm_btn.btn_ok -image add_grey_24 -command { - RunCommand "" "infobase create --create-database \ + RunCommand "" "infobase create $db_create \ --name=[.add.frm.ent_infobase_name get] \ --dbms=$dbms \ --db-server=[.add.frm.ent_host get] \ @@ -531,7 +562,13 @@ proc Add::infobases {tree host values} { --locale=[.add.frm.ent_locale get] \ --db-user=[.add.frm.ent_db_user get] \ --db-pwd=[.add.frm.ent_db_pass get] \ + --descr=[.add.frm.ent_infobase_descr get] \ + --date-offset=$date_offset + --security-level=$secure_level + --scheduled-jobs-deny=$block_shedule + --license-distribution=$license_distribution --cluster=$active_cluster $host" + Run::infobases $tree $host $active_cluster destroy .add } ttk::button $frm_btn.btn_cancel -command {destroy .add} -image quit_grey_24 @@ -589,3 +626,4 @@ proc SaveMainServer {host port} { close $file return "$host:$port" } + diff --git a/rac_gui.cfg b/rac_gui.cfg index e686688..8606e2a 100644 --- a/rac_gui.cfg +++ b/rac_gui.cfg @@ -22,5 +22,6 @@ set default(ram_max) 0 set default(ram_sec) 0 # Объём памяти рабочих процессов, до которого сервер считается производительным set default(ram_work) 0 -set default(dbms) [list MSSQLServer PostgreSQL IBMDB2 OracleDatabase] - +set default(dbms) [list PostgreSQL MSSQLServer IBMDB2 OracleDatabase] +set default(secure_level) [list выключено "только соединение" постоянно] +set default(date_offset) [list 0 2000] diff --git a/rac_gui.tcl b/rac_gui.tcl index f674c29..741c19a 100755 --- a/rac_gui.tcl +++ b/rac_gui.tcl @@ -56,3 +56,4 @@ if [file exists [file join $dir(work) 1c_srv.cfg]] { .frm_tree.tree insert {} end -id "server::$line" -text "$line" -values "$line" } } +