Добавлена функция GetWorkTreeItems
This commit is contained in:
parent
c8151f3b16
commit
234ad208fb
200
lib/function.tcl
200
lib/function.tcl
|
@ -277,6 +277,26 @@ 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 {} {}
|
||||||
# Получение данных по кластерам
|
# Получение данных по кластерам
|
||||||
|
|
||||||
|
@ -1319,20 +1339,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
|
||||||
}
|
}
|
||||||
|
@ -1441,20 +1448,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
|
||||||
}
|
}
|
||||||
|
@ -1509,21 +1503,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
|
||||||
}
|
}
|
||||||
|
@ -1602,24 +1583,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} {
|
||||||
|
@ -1645,24 +1609,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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1673,7 +1620,6 @@ 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 {
|
||||||
|
@ -1685,26 +1631,11 @@ proc Del::work_server {tree host values} {
|
||||||
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 ""} {
|
||||||
|
@ -1712,7 +1643,6 @@ 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 {
|
||||||
|
@ -1743,27 +1673,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 ""} {
|
||||||
|
@ -1772,26 +1684,8 @@ 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 ]
|
||||||
|
@ -1812,20 +1706,7 @@ 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 ]
|
||||||
|
@ -1847,21 +1728,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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user