1
0
mirror of https://bitbucket.org/svk28/rac-gui synced 2024-11-11 00:16:53 +00:00
This commit is contained in:
Sergey Kalinin 2018-07-02 16:49:55 +03:00
commit a597995503

View File

@ -64,7 +64,7 @@ proc InsertItemsWorkList {lst} {
incr work_list_row_count incr work_list_row_count
} }
proc RunCommand {root par} { proc RunCommand {par} {
global dir rac_cmd cluster work_list_row_count \ global dir rac_cmd cluster work_list_row_count \
agent_user agent_pwd cluster_user cluster_pwd agent_user agent_pwd cluster_user cluster_pwd
@ -230,7 +230,7 @@ proc GetInfobases {cluster host} {
} else { } else {
set auth "" set auth ""
} }
set lst [RunCommand "" "infobase summary --cluster=$cluster $auth list $host"] set lst [RunCommand "infobase summary --cluster=$cluster $auth list $host"]
set return_list "" set return_list ""
foreach info_bases_list $lst { foreach info_bases_list $lst {
foreach i $info_bases_list { foreach i $info_bases_list {
@ -277,11 +277,31 @@ proc SaveMainServer {host port} {
return "$host:$port" return "$host:$port"
} }
proc GetWorkTreeItems {par} {
set work_tree_id [.frm_work.tree_work selection]
set work_tree_values [.frm_work.tree_work item $work_tree_id -values]
#puts ">$work_tree_id >$work_tree_values"
set id [.frm_tree.tree selection]
#set values [.frm_tree.tree item $id -values]
set key [lindex [split $id "::"] 0]
set column_list [.frm_work.tree_work cget -columns]
set i 0
# проверка соответсвия колонки в таблице и ключа в дереве
foreach l $column_list {
if {$l eq $par } {
set item_id [lindex $work_tree_values $i]
set tree .frm_work.tree_work
}
incr i
}
return $item_id
}
namespace eval Run {} {} namespace eval Run {} {}
# Получение данных по кластерам # Получение данных по кластерам
proc Run::server {tree host values} { proc Run::server {tree host values} {
set lst [RunCommand server::$host "cluster list $host"] set lst [RunCommand "cluster list $host"]
if {$lst eq ""} {return} if {$lst eq ""} {return}
set l [lindex $lst 0] set l [lindex $lst 0]
#puts $lst #puts $lst
@ -316,7 +336,7 @@ proc Run::server {tree host values} {
proc Run::cluster {tree host values} { proc Run::cluster {tree host values} {
global active_cluster global active_cluster
set active_cluster $values set active_cluster $values
RunCommand cluster::$values "cluster info --cluster=$values $host" RunCommand "cluster info --cluster=$values $host"
} }
proc Run::cluster_managers {tree host values} { proc Run::cluster_managers {tree host values} {
@ -336,7 +356,7 @@ proc Run::infobases {tree host values} {
} else { } else {
set auth "" set auth ""
} }
set lst [RunCommand infobase::$values "infobase summary --cluster=$active_cluster $auth list $host"] set lst [RunCommand "infobase summary --cluster=$active_cluster $auth list $host"]
puts $lst puts $lst
foreach info_bases_list $lst { foreach info_bases_list $lst {
foreach i $info_bases_list { foreach i $info_bases_list {
@ -369,7 +389,7 @@ proc Run::infobase {tree host values} {
set auth "" set auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "infobase info --cluster=$active_cluster $auth --infobase=$values $host"] set lst [RunCommand "infobase info --cluster=$active_cluster $auth --infobase=$values $host"]
foreach l $lst { foreach l $lst {
InsertItemsWorkList $l InsertItemsWorkList $l
@ -385,7 +405,7 @@ proc Run::List:Base {tree host values par} {
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "$par list --cluster=$active_cluster $auth --infobase=$values $host"] set lst [RunCommand "$par list --cluster=$active_cluster $auth --infobase=$values $host"]
foreach l $lst { foreach l $lst {
InsertItemsWorkList $l InsertItemsWorkList $l
@ -400,7 +420,7 @@ proc Run::List {tree host values par} {
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "$par list --cluster=$active_cluster $auth $host"] set lst [RunCommand "$par list --cluster=$active_cluster $auth $host"]
foreach l $lst { foreach l $lst {
InsertItemsWorkList $l InsertItemsWorkList $l
} }
@ -425,7 +445,7 @@ proc Run::servers {tree host values} {
set auth "" set auth ""
} }
set lst [RunCommand infobase::$values "server list --cluster=$active_cluster $auth $host"] set lst [RunCommand "server list --cluster=$active_cluster $auth $host"]
if {$lst eq ""} {return} if {$lst eq ""} {return}
foreach l $lst { foreach l $lst {
@ -462,7 +482,7 @@ proc Run::work_server {tree host values} {
set auth "" set auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "server info --cluster=$active_cluster --server=$values $auth $host"] set lst [RunCommand "server info --cluster=$active_cluster --server=$values $auth $host"]
foreach l $lst { foreach l $lst {
InsertItemsWorkList $l InsertItemsWorkList $l
} }
@ -478,7 +498,7 @@ proc Run::profiles {tree host values} {
set auth "" set auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand "" "profile list --cluster=$active_cluster $auth $host"] set lst [RunCommand "profile list --cluster=$active_cluster $auth $host"]
foreach l $lst { foreach l $lst {
foreach i $l { foreach i $l {
@ -513,7 +533,7 @@ proc Run::work_server_processes {tree host values} {
set auth "" set auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand work_server_processes::$values "process list --cluster=$active_cluster $auth --server=$values $host"] set lst [RunCommand "process list --cluster=$active_cluster $auth --server=$values $host"]
foreach l $lst { foreach l $lst {
InsertItemsWorkList $l InsertItemsWorkList $l
} }
@ -526,7 +546,7 @@ proc Run::work_server_licenses {tree host values} {
set auth "" set auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand work_server_processes::$values "process list --cluster=$active_cluster $auth --server=$values --licenses $host"] set lst [RunCommand "process list --cluster=$active_cluster $auth --server=$values --licenses $host"]
foreach l $lst { foreach l $lst {
InsertItemsWorkList $l InsertItemsWorkList $l
} }
@ -541,7 +561,7 @@ proc Run::managers {tree host values} {
set auth "" set auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand cluster::$values "manager list --cluster=$active_cluster $auth $host"] set lst [RunCommand "manager list --cluster=$active_cluster $auth $host"]
foreach l $lst { foreach l $lst {
foreach i $l { foreach i $l {
set server_list [split $i ":"] set server_list [split $i ":"]
@ -576,7 +596,7 @@ proc Run::manager {tree host values} {
set auth "" set auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand "" "service list --cluster=$active_cluster $auth $host"] set lst [RunCommand "service list --cluster=$active_cluster $auth $host"]
foreach l $lst { foreach l $lst {
#puts $l #puts $l
foreach i $l { foreach i $l {
@ -598,11 +618,10 @@ proc Run::agent_admins {tree host values} {
set agent_auth "" set agent_auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand "" "agent admin list $agent_auth $host"] set lst [RunCommand "agent admin list $agent_auth $host"]
foreach l $lst { foreach l $lst {
InsertItemsWorkList $l InsertItemsWorkList $l
} }
return
} }
proc Run::admins {tree host values} { proc Run::admins {tree host values} {
@ -614,13 +633,11 @@ proc Run::admins {tree host values} {
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [ set lst [
RunCommand "" \ RunCommand "cluster admin list $auth --cluster=$active_cluster $host"
"cluster admin list $auth --cluster=$active_cluster $host"
] ]
foreach l $lst { foreach l $lst {
InsertItemsWorkList $l InsertItemsWorkList $l
} }
return
} }
proc Run::rule {tree host values} { proc Run::rule {tree host values} {
@ -631,7 +648,7 @@ proc Run::rule {tree host values} {
set auth "" set auth ""
} }
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand "" "rule list --cluster=$active_cluster $auth --server=$values $host"] set lst [RunCommand "rule list --cluster=$active_cluster $auth --server=$values $host"]
foreach l $lst { foreach l $lst {
#puts $l #puts $l
@ -711,7 +728,7 @@ proc Add::agent_admin {tree host value} {
grid rowconfigure $frm 0 -weight 1 grid rowconfigure $frm 0 -weight 1
#set frm_btn [frame .add.frm_btn -border 0] #set frm_btn [frame .add.frm_btn -border 0]
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "agent admin register \ RunCommand "agent admin register \
--name=[.add.frm.ent_name get] \ --name=[.add.frm.ent_name get] \
--pwd=[.add.frm.ent_pwd get] \ --pwd=[.add.frm.ent_pwd get] \
--descr=[.add.frm.ent_descr get] \ --descr=[.add.frm.ent_descr get] \
@ -736,7 +753,7 @@ proc Add::admin {tree host value} {
wm title .add "Добавление администратора кластера" wm title .add "Добавление администратора кластера"
.add.frm configure -text "Добавление администратора кластера" .add.frm configure -text "Добавление администратора кластера"
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "cluster admin register \ RunCommand "cluster admin register \
--name=[.add.frm.ent_name get] \ --name=[.add.frm.ent_name get] \
--pwd=[.add.frm.ent_pwd get] \ --pwd=[.add.frm.ent_pwd get] \
--descr=[.add.frm.ent_descr get] \ --descr=[.add.frm.ent_descr get] \
@ -850,7 +867,7 @@ proc Add::servers {tree host values} {
grid $frm.check_using -row 11 -column 1 -sticky nw -padx 5 -pady 5 grid $frm.check_using -row 11 -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 \
--agent-host=[.add.frm.ent_agent_host get] \ --agent-host=[.add.frm.ent_agent_host get] \
--agent-port=[.add.frm.ent_agent_port get] \ --agent-port=[.add.frm.ent_agent_port get] \
--port-range=[.add.frm.ent_port_range get] \ --port-range=[.add.frm.ent_port_range get] \
@ -967,7 +984,7 @@ proc Add::infobases {tree host values} {
set db_create "" set db_create ""
} }
RunCommand "" "infobase create $db_create \ RunCommand "infobase create $db_create \
--name=[.add.frm.ent_name get] \ --name=[.add.frm.ent_name get] \
--dbms=$dbms \ --dbms=$dbms \
--db-server=[.add.frm.ent_db_server get] \ --db-server=[.add.frm.ent_db_server get] \
@ -1065,7 +1082,7 @@ proc Add::cluster {tree host values} {
grid $frm.check_kill_problem_processes -row 12 -column 1 -sticky nw -padx 5 -pady 5 grid $frm.check_kill_problem_processes -row 12 -column 1 -sticky nw -padx 5 -pady 5
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "cluster insert \ RunCommand "cluster insert \
--host=[.add.frm.ent_host get] \ --host=[.add.frm.ent_host get] \
--port=[.add.frm.ent_port get] \ --port=[.add.frm.ent_port get] \
--name=[.add.frm.ent_name get] \ --name=[.add.frm.ent_name get] \
@ -1129,7 +1146,7 @@ proc Add::rule {tree host values} {
grid $frm.ent_priority -row 4 -column 1 -sticky nsew -padx 5 -pady 5 grid $frm.ent_priority -row 4 -column 1 -sticky nsew -padx 5 -pady 5
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "rule insert \ RunCommand "rule insert \
--cluster=$active_cluster $auth \ --cluster=$active_cluster $auth \
--server=$server \ --server=$server \
--position=0 \ --position=0 \
@ -1208,7 +1225,7 @@ proc Add::profile {tree host values} {
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "profile update \ RunCommand "profile update \
--cluster=$active_cluster $auth \ --cluster=$active_cluster $auth \
--name=[.add.frm.ent_name get] \ --name=[.add.frm.ent_name get] \
--descr=[.add.frm.ent_descr get] \ --descr=[.add.frm.ent_descr get] \
@ -1221,7 +1238,7 @@ proc Add::profile {tree host values} {
--modules-available-for-extension=$modules_available_for_extension \ --modules-available-for-extension=$modules_available_for_extension \
--modules-not-available-for-extension=$modules_not_available_for_extension \ --modules-not-available-for-extension=$modules_not_available_for_extension \
$host" $host"
Run::profiles $tree $host $server Run::profiles $tree $host $active_cluster
destroy .add destroy .add
} }
return $frm return $frm
@ -1298,7 +1315,7 @@ proc Edit::cluster {tree host values} {
$frm configure -text "Редактирование кластера" $frm configure -text "Редактирование кластера"
set active_cluster $values set active_cluster $values
set lst [RunCommand cluster::$values "cluster info --cluster=$active_cluster $host"] set lst [RunCommand "cluster info --cluster=$active_cluster $host"]
FormFieldsDataInsert $frm $lst FormFieldsDataInsert $frm $lst
@ -1306,7 +1323,7 @@ proc Edit::cluster {tree host values} {
$frm.ent_port configure -state disable $frm.ent_port configure -state disable
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "cluster update \ RunCommand "cluster update \
--cluster=$active_cluster $auth \ --cluster=$active_cluster $auth \
--name=[.add.frm.ent_name get] \ --name=[.add.frm.ent_name get] \
--expiration-timeout=$expiration_timeout \ --expiration-timeout=$expiration_timeout \
@ -1325,20 +1342,7 @@ proc Edit::cluster {tree host values} {
} }
} }
proc Edit::infobases {tree host values} { proc Edit::infobases {tree host values} {
set work_tree_id [.frm_work.tree_work selection] set infobase [GetWorkTreeItems "infobase"]
set work_tree_values [.frm_work.tree_work item $work_tree_id -values]
set id [.frm_tree.tree selection]
#set values [.frm_tree.tree item $id -values]
set key [lindex [split $id "::"] 0]
set column_list [.frm_work.tree_work cget -columns]
set i 0
# проверка соответсвия колонки в таблице и ключа в дереве
foreach l $column_list {
if {$l eq "infobase" } {
set infobase [lindex $work_tree_values $i]
}
incr i
}
if {[info exists infobase] == 0 || $infobase eq ""} { if {[info exists infobase] == 0 || $infobase eq ""} {
return return
} }
@ -1415,11 +1419,11 @@ proc Edit::infobase {tree host values} {
grid $frm.lbl_external_session_manager_required -row 9 -column 2 -sticky nw -padx 5 -pady 5 grid $frm.lbl_external_session_manager_required -row 9 -column 2 -sticky nw -padx 5 -pady 5
grid $frm.check_external_session_manager_required -row 9 -column 3 -sticky nw -padx 5 -pady 5 grid $frm.check_external_session_manager_required -row 9 -column 3 -sticky nw -padx 5 -pady 5
set lst [RunCommand infobase::$values "infobase info --cluster=$active_cluster --infobase=$values $auth $host"] set lst [RunCommand "infobase info --cluster=$active_cluster --infobase=$values $auth $host"]
FormFieldsDataInsert $frm $lst FormFieldsDataInsert $frm $lst
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "infobase update \ RunCommand "infobase update \
--infobase=$infobase \ --infobase=$infobase \
--infobase-user= \ --infobase-user= \
--infobase-pwd= \ --infobase-pwd= \
@ -1447,20 +1451,7 @@ proc Edit::infobase {tree host values} {
} }
} }
proc Edit::servers {tree host values} { proc Edit::servers {tree host values} {
set work_tree_id [.frm_work.tree_work selection] set work_server [GetWorkTreeItems "server"]
set work_tree_values [.frm_work.tree_work item $work_tree_id -values]
set id [.frm_tree.tree selection]
#set values [.frm_tree.tree item $id -values]
set key [lindex [split $id "::"] 0]
set column_list [.frm_work.tree_work cget -columns]
set i 0
# проверка соответсвия колонки в таблице и ключа в дереве
foreach l $column_list {
if {$l eq "server" } {
set work_server [lindex $work_tree_values $i]
}
incr i
}
if {[info exists work_server] == 0 || $work_server eq ""} { if {[info exists work_server] == 0 || $work_server eq ""} {
return return
} }
@ -1480,7 +1471,7 @@ proc Edit::work_server {tree host values} {
set frm [Add::work_server $tree $host $values] set frm [Add::work_server $tree $host $values]
$frm configure -text "Редактирование рабочего сервера" $frm configure -text "Редактирование рабочего сервера"
set lst [RunCommand cluster::$values "server info --cluster=$active_cluster $auth --server=$server $host"] set lst [RunCommand "server info --cluster=$active_cluster $auth --server=$server $host"]
FormFieldsDataInsert $frm $lst FormFieldsDataInsert $frm $lst
$frm.lbl_agent_port configure -state disable $frm.lbl_agent_port configure -state disable
@ -1493,7 +1484,7 @@ proc Edit::work_server {tree host values} {
$frm.ent_cluster_port configure -state disable $frm.ent_cluster_port configure -state disable
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "server update \ RunCommand "server update \
--server=$server \ --server=$server \
--using=$using \ --using=$using \
--infobases-limit=[.add.frm.ent_infobases_limit get] \ --infobases-limit=[.add.frm.ent_infobases_limit get] \
@ -1515,21 +1506,8 @@ proc Edit::rule {tree host values} {
} else { } else {
set auth "" set auth ""
} }
set rule [GetWorkTreeItems "rule"]
set work_tree_id [.frm_work.tree_work selection]
set work_tree_values [.frm_work.tree_work item $work_tree_id -values]
set id [.frm_tree.tree selection]
#set values [.frm_tree.tree item $id -values]
set key [lindex [split $id "::"] 0]
set column_list [.frm_work.tree_work cget -columns]
set i 0
# проверка соответсвия колонки в таблице и ключа в дереве
foreach l $column_list {
if {$l eq "rule" } {
set rule [lindex $work_tree_values $i]
}
incr i
}
if {[info exists rule] == 0 || $rule eq ""} { if {[info exists rule] == 0 || $rule eq ""} {
return return
} }
@ -1538,12 +1516,12 @@ proc Edit::rule {tree host values} {
$frm configure -text "Редактирование требования назначения функциональности" $frm configure -text "Редактирование требования назначения функциональности"
set lst [RunCommand "" "rule info --cluster=$active_cluster $auth --server=$server --rule=$rule $host"] set lst [RunCommand "rule info --cluster=$active_cluster $auth --server=$server --rule=$rule $host"]
FormFieldsDataInsert $frm $lst FormFieldsDataInsert $frm $lst
.add.frm_btn.btn_ok configure -command { .add.frm_btn.btn_ok configure -command {
RunCommand "" "rule update \ RunCommand "rule update \
--cluster=$active_cluster $auth \ --cluster=$active_cluster $auth \
--server=$server \ --server=$server \
--rule=$rule \ --rule=$rule \
@ -1557,7 +1535,63 @@ proc Edit::rule {tree host values} {
destroy .add destroy .add
} }
} }
proc Edit::profile {tree host values} {
global default active_cluster server agent_user agent_pwd cluster_user cluster_pwd auth
global config priv crypto right_extension right_extension_definition_roles \
all_modules_extension modules_available_for_extension modules_not_available_for_extension
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
set frm [Add::profile $tree $host $values]
$frm configure -text "Редактирование профиля безопасности: $values"
set work_tree_id [.frm_work.tree_work selection]
puts "$work_tree_id"
set work_tree_values_list [.frm_work.tree_work item $work_tree_id -values]
set column_list [.frm_work.tree_work cget -columns]
set l1 [llength $column_list]
set l2 [llength $work_tree_values_list]
if {$l1 == $l2} {
for {set i 0} {$i <= $l1 } {incr i} {
lappend lst "[lindex $column_list $i] : [lindex $work_tree_values_list $i]"
}
} else {
return
}
FormFieldsDataInsert $frm [list $lst]
.add.frm.ent_name configure -state disable
.add.frm_btn.btn_ok configure -command {
RunCommand "profile update \
--cluster=$active_cluster $auth \
--name=[.add.frm.ent_name get] \
--descr=[.add.frm.ent_descr get] \
--config=$config \
--priv=$priv \
--crypto=$crypto \
--right-extension=$right_extension \
--right-extension-definition-roles=$right_extension_definition_roles \
--all-modules-extension=$all_modules_extension \
--modules-available-for-extension=$modules_available_for_extension \
--modules-not-available-for-extension=$modules_not_available_for_extension \
$host"
Run::profiles $tree $host $active_cluster
destroy .add
}
}
proc Edit::profiles {tree host values} {
return
}
proc Del {} { proc Del {} {
global active_cluster host global active_cluster host
set tree .frm_tree.tree set tree .frm_tree.tree
@ -1598,7 +1632,7 @@ proc Del::admin {tree host values} {
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
set lst [RunCommand "" "cluster admin remove --name=$values --cluster=$active_cluster $auth $host"] set lst [RunCommand "cluster admin remove --name=$values --cluster=$active_cluster $auth $host"]
#.frm_tree.tree delete "admin::$values" #.frm_tree.tree delete "admin::$values"
set cluster_user "" set cluster_user ""
set cluster_pwd "" set cluster_pwd ""
@ -1608,24 +1642,7 @@ proc Del::admin {tree host values} {
} }
} }
proc Del::admins {tree host values} { proc Del::admins {tree host values} {
global active_cluster Del::admin $tree $host [GetWorkTreeItems "name"]
set work_tree_id [.frm_work.tree_work selection]
set work_tree_values [.frm_work.tree_work item $work_tree_id -values]
#puts ">$work_tree_id >$work_tree_values"
set id [.frm_tree.tree selection]
#set values [.frm_tree.tree item $id -values]
set key [lindex [split $id "::"] 0]
set column_list [.frm_work.tree_work cget -columns]
set i 0
# проверка соответсвия колонки в таблице и ключа в дереве
foreach l $column_list {
if {$l eq "name" } {
set admin_id [lindex $work_tree_values $i]
set tree .frm_work.tree_work
}
incr i
}
Del::admin $tree $host $admin_id
} }
proc Del::agent_admin {tree host values} { proc Del::agent_admin {tree host values} {
@ -1640,7 +1657,7 @@ proc Del::agent_admin {tree host values} {
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
set lst [RunCommand "" "agent admin remove --name=$values $agent_auth $host"] set lst [RunCommand "agent admin remove --name=$values $agent_auth $host"]
#.frm_tree.tree delete "admin::$values" #.frm_tree.tree delete "admin::$values"
set agent_user "" set agent_user ""
set agent_pwd "" set agent_pwd ""
@ -1651,24 +1668,7 @@ proc Del::agent_admin {tree host values} {
} }
proc Del::agent_admins {tree host values} { proc Del::agent_admins {tree host values} {
global active_cluster Del::agent_admin $tree $host [GetWorkTreeItems "name"]
set work_tree_id [.frm_work.tree_work selection]
set work_tree_values [.frm_work.tree_work item $work_tree_id -values]
#puts ">$work_tree_id >$work_tree_values"
set id [.frm_tree.tree selection]
#set values [.frm_tree.tree item $id -values]
set key [lindex [split $id "::"] 0]
set column_list [.frm_work.tree_work cget -columns]
set i 0
# проверка соответсвия колонки в таблице и ключа в дереве
foreach l $column_list {
if {$l eq "name" } {
set admin_id [lindex $work_tree_values $i]
set tree .frm_work.tree_work
}
incr i
}
Del::agent_admin $tree $host $admin_id
} }
@ -1679,38 +1679,22 @@ proc Del::work_server {tree host values} {
} else { } else {
set auth "" set auth ""
} }
set answer [tk_messageBox -message "Удалить рабочий сервер $values?" \ set answer [tk_messageBox -message "Удалить рабочий сервер $values?" \
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
set lst [RunCommand infobase::$values "server remove --cluster=$active_cluster $auth --server=$values $host"] set lst [RunCommand "server remove --cluster=$active_cluster $auth --server=$values $host"]
.frm_tree.tree delete "work_server::$values" .frm_tree.tree delete "work_server::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
} }
no {return} no {return}
} }
} }
proc Del::servers {tree host values} { proc Del::servers {tree host values} {
global active_cluster Del::work_server $tree $host [GetWorkTreeItems "server"]
set work_tree_id [.frm_work.tree_work selection]
set work_tree_values [.frm_work.tree_work item $work_tree_id -values]
#puts ">$work_tree_id >$work_tree_values"
set id [.frm_tree.tree selection]
#set values [.frm_tree.tree item $id -values]
set key [lindex [split $id "::"] 0]
set column_list [.frm_work.tree_work cget -columns]
set i 0
# проверка соответсвия колонки в таблице и ключа в дереве
foreach l $column_list {
if {$l eq "server" } {
set work_server_id [lindex $work_tree_values $i]
set tree .frm_work.tree_work
}
incr i
}
Del::work_server $tree $host $work_server_id
} }
proc Del::cluster {tree host values} { proc Del::cluster {tree host values} {
global agent_user agent_pwd cluster_user cluster_pwd auth global agent_user agent_pwd cluster_user cluster_pwd auth
if {$cluster_user ne "" && $cluster_pwd ne ""} { if {$cluster_user ne "" && $cluster_pwd ne ""} {
@ -1718,12 +1702,11 @@ proc Del::cluster {tree host values} {
} else { } else {
set auth "" set auth ""
} }
set answer [tk_messageBox -message "Удалить кластер $values?" \ set answer [tk_messageBox -message "Удалить кластер $values?" \
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
set lst [RunCommand infobase::$values "cluster remove --cluster=$values $auth $host"] set lst [RunCommand "cluster remove --cluster=$values $auth $host"]
$tree delete "cluster::$values" $tree delete "cluster::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
} }
@ -1741,7 +1724,7 @@ proc Del::infobase {tree host values} {
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
set lst [RunCommand infobase::$values "infobase drop --infobase=$values --cluster=$active_cluster $auth $host"] set lst [RunCommand "infobase drop --infobase=$values --cluster=$active_cluster $auth $host"]
$tree delete "infobase::$values" $tree delete "infobase::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
} }
@ -1749,27 +1732,9 @@ proc Del::infobase {tree host values} {
} }
} }
proc Del::infobases {tree host values} { proc Del::infobases {tree host values} {
global active_cluster Del::infobase $tree $host [GetWorkTreeItems "infobase"]
set work_tree_id [.frm_work.tree_work selection]
set work_tree_values [.frm_work.tree_work item $work_tree_id -values]
#puts ">$work_tree_id >$work_tree_values"
set id [.frm_tree.tree selection]
#set values [.frm_tree.tree item $id -values]
set key [lindex [split $id "::"] 0]
set column_list [.frm_work.tree_work cget -columns]
set i 0
# проверка соответсвия колонки в таблице и ключа в дереве
foreach l $column_list {
if {$l eq "infobase" } {
set values [lindex $work_tree_values $i]
set tree .frm_work.tree_work
}
incr i
} }
#puts "$tree $host $values"
Del::infobase $tree $host $values
}
proc Del::connections {tree host values} { proc Del::connections {tree host values} {
global active_cluster agent_user agent_pwd cluster_user cluster_pwd auth global active_cluster agent_user agent_pwd cluster_user cluster_pwd auth
if {$cluster_user ne "" && $cluster_pwd ne ""} { if {$cluster_user ne "" && $cluster_pwd ne ""} {
@ -1778,32 +1743,14 @@ proc Del::connections {tree host values} {
set auth "" set auth ""
} }
set work_tree_id [.frm_work.tree_work selection] set connection_id [GetWorkTreeItems "connection"]
set work_tree_values [.frm_work.tree_work item $work_tree_id -values] set process_id [GetWorkTreeItems "process"]
#puts ">$work_tree_id >$work_tree_values"
set id [.frm_tree.tree selection]
#set values [.frm_tree.tree item $id -values]
set key [lindex [split $id "::"] 0]
set column_list [.frm_work.tree_work cget -columns]
set i 0
# проверка соответсвия колонки в таблице и ключа в дереве
foreach l $column_list {
if {$l eq "connection" } {
set connection_id [lindex $work_tree_values $i]
}
if {$l eq "process" } {
set process_id [lindex $work_tree_values $i]
}
incr i
}
#puts "$connection_id $process_id"
set answer [tk_messageBox -message "Удалить соединение $connection_id?" \ set answer [tk_messageBox -message "Удалить соединение $connection_id?" \
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
set lst [RunCommand infobase::$values "connection disconnect --process=$process_id --connection=$connection_id --cluster=$active_cluster $auth $host"] set lst [RunCommand "connection disconnect --process=$process_id --connection=$connection_id --cluster=$active_cluster $auth $host"]
#$tree delete "infobase::$values" #$tree delete "infobase::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
} }
@ -1818,26 +1765,13 @@ proc Del::sessions {tree host values} {
} else { } else {
set auth "" set auth ""
} }
set work_tree_id [.frm_work.tree_work selection] set session_id [GetWorkTreeItems "session"]
set work_tree_values [.frm_work.tree_work item $work_tree_id -values]
set id [.frm_tree.tree selection]
set values [.frm_tree.tree item $id -values]
set key [lindex [split $id "::"] 0]
set column_list [.frm_work.tree_work cget -columns]
set i 0
# проверка соответсвия колонки в таблице и ключа в дереве
foreach l $column_list {
if {$l eq "session" } {
set session_id [lindex $work_tree_values $i]
}
incr i
}
set answer [tk_messageBox -message "Прервать сессию $session_id?" \ set answer [tk_messageBox -message "Прервать сессию $session_id?" \
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
set lst [RunCommand infobase::$values "session terminate --session=$session_id --cluster=$active_cluster $auth $host"] set lst [RunCommand "session terminate --session=$session_id --cluster=$active_cluster $auth $host"]
#$tree delete "infobase::$values" #$tree delete "infobase::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
} }
@ -1853,21 +1787,8 @@ proc Del::rule {tree host values} {
} else { } else {
set auth "" set auth ""
} }
set rule_id [GetWorkTreeItems "rule"]
set work_tree_id [.frm_work.tree_work selection]
set work_tree_values [.frm_work.tree_work item $work_tree_id -values]
set id [.frm_tree.tree selection]
#set values [.frm_tree.tree item $id -values]
set key [lindex [split $id "::"] 0]
set column_list [.frm_work.tree_work cget -columns]
set i 0
# проверка соответсвия колонки в таблице и ключа в дереве
foreach l $column_list {
if {$l eq "rule" } {
set rule_id [lindex $work_tree_values $i]
}
incr i
}
if {[info exists rule_id] == 0 || $rule_id eq ""} { if {[info exists rule_id] == 0 || $rule_id eq ""} {
return return
} }
@ -1876,7 +1797,7 @@ proc Del::rule {tree host values} {
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
set lst [RunCommand infobase::$values "rule remove --server=$server --rule=$rule_id --cluster=$active_cluster $auth $host"] set lst [RunCommand "rule remove --server=$server --rule=$rule_id --cluster=$active_cluster $auth $host"]
#$tree delete "infobase::$values" #$tree delete "infobase::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}] .frm_work.tree_work delete [ .frm_work.tree_work children {}]
} }
@ -1890,12 +1811,10 @@ proc Del::server {tree host values} {
-icon question -type yesno ] -icon question -type yesno ]
switch -- $answer { switch -- $answer {
yes { yes {
#set lst [RunCommand infobase::$values "cluster remove --cluster=$values $host"]
file copy [file join $dir(work) 1c_srv.cfg] [file join $dir(work) 1c_srv.cfg.bak] file copy [file join $dir(work) 1c_srv.cfg] [file join $dir(work) 1c_srv.cfg.bak]
set orig_file [open [file join $dir(work) 1c_srv.cfg.bak] "r"] set orig_file [open [file join $dir(work) 1c_srv.cfg.bak] "r"]
set file [open [file join $dir(work) 1c_srv.cfg] "w"] set file [open [file join $dir(work) 1c_srv.cfg] "w"]
while {[gets $orig_file line] >=0 } { while {[gets $orig_file line] >=0 } {
#puts $line
if { $line ne "" && $line ne "$values"} { if { $line ne "" && $line ne "$values"} {
puts $file $line puts $file $line
} }
@ -1910,6 +1829,33 @@ proc Del::server {tree host values} {
no {return} no {return}
} }
} }
proc Del::profile {tree host values} {
global active_cluster agent_user agent_pwd cluster_user cluster_pwd auth
if {$cluster_user ne "" && $cluster_pwd ne ""} {
set auth "--cluster-user=$cluster_user --cluster-pwd=$cluster_pwd"
} else {
set auth ""
}
if {$agent_user ne "" && $agent_pwd ne ""} {
set agent_auth "--agent-user=$agent_user --agent-pwd=$agent_pwd"
} else {
set agent_auth ""
}
set answer [tk_messageBox -message "Удалить профиль безопасности $values?" \
-icon question -type yesno ]
switch -- $answer {
yes {
set lst [RunCommand "profile remove --name=$values --cluster=$active_cluster $auth $host"]
.frm_tree.tree delete "profile::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
Run::profiles $tree $host $active_cluster
}
no {return}
}
}
proc Del::profiles {tree host values} {
Del::profile $tree $host [GetWorkTreeItems "name"]
}