Added delete work server procedure

This commit is contained in:
Sergey Kalinin 2018-05-18 12:13:43 +03:00
parent 2ff4c174e3
commit 0baa0117e0
2 changed files with 90 additions and 21 deletions

View File

@ -1435,3 +1435,4 @@ profile Режим управления профилями безопас
--name=<name> --name=<name>
(обязательный) имя профиля безопасности (обязательный) имя профиля безопасности

View File

@ -16,14 +16,13 @@ proc TreePress {tree} {
set id [$tree selection] set id [$tree selection]
set values [$tree item [$tree selection] -values] set values [$tree item [$tree selection] -values]
set key [lindex [split $id "::"] 0] set key [lindex [split $id "::"] 0]
puts "$key, $id , $values"
Run::$key $tree $host $values Run::$key $tree $host $values
#RunCommand $root "infobase summary list --cluster=$cluster $host" #RunCommand $root "infobase summary list --cluster=$cluster $host"
} }
namespace eval Run {} {} namespace eval Run {} {}
# Получение данных по кластерам
proc Run::server {tree host values} { proc Run::server {tree host values} {
puts "Server info $host $values" puts "Server info $host $values"
set lst [RunCommand server::$host "cluster list $host"] set lst [RunCommand server::$host "cluster list $host"]
@ -121,7 +120,40 @@ proc Run::connections {tree host values} {
Run::List:Base $tree $host $values connection Run::List:Base $tree $host $values connection
} }
proc Run::servers {tree host values} { proc Run::servers {tree host values} {
Run::List $tree $host $values server global active_cluster
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "server list --cluster=$active_cluster $host"]
set l [split $lst "&"]
foreach i $l {
set server_list [split $i ":"]
#InsertItemsWorkList $server_list
if {[string trim [lindex $server_list 0]] eq "server"} {
set server_id [string trim [lindex $server_list 1]]
lappend server($server_id) $server_id
}
if {[string trim [lindex $server_list 0]] eq "name"} {
lappend server($server_id) [string trim [lindex $server_list 1]]
}
}
foreach x [array names server] {
set id [lindex $server($x) 0]
if { [$tree exists "work_server::$id"] == 0 } {
$tree insert "servers::$values" end -id "work_server::$id" -text "[lindex $server($x) 1]" -values "$id"
}
#InsertServerItems $tree $id
}
#Run::List $tree $host $values server
}
proc Run::work_server {tree host values} {
global active_cluster
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "server info --cluster=$active_cluster --server=$values $host"]
set l [split $lst "&"]
foreach i $l {
set base_list [split $i ":"]
InsertItemsWorkList $base_list
}
#Run::List $tree $host $values server
} }
proc Run::profiles {tree host values} { proc Run::profiles {tree host values} {
Run::List $tree $host $values profile Run::List $tree $host $values profile
@ -187,6 +219,18 @@ proc InsertBaseItems {tree id} {
$tree insert $parent end -id "connections::$id" -text "Соединения" -values "$id" $tree insert $parent end -id "connections::$id" -text "Соединения" -values "$id"
} }
} }
proc InsertServerstems {tree id} {
set parent "infobase::$id"
if { [$tree exists "sessions::$id"] == 0 } {
$tree insert $parent end -id "sessions::$id" -text "Сеансы" -values "$id"
}
if { [$tree exists "locks::$id"] == 0 } {
$tree insert $parent end -id "locks::$id" -text "Блокировки" -values "$id"
}
if { [$tree exists "connections::$id"] == 0 } {
$tree insert $parent end -id "connections::$id" -text "Соединения" -values "$id"
}
}
proc DebugInfo {widget f} { proc DebugInfo {widget f} {
if {[eof $f]} { if {[eof $f]} {
@ -204,4 +248,28 @@ proc DebugInfo {widget f} {
} }
} }
proc Del {} {
global active_cluster host
set id [.frm_tree.tree selection]
set values [.frm_tree.tree item [.frm_tree.tree selection] -values]
set key [lindex [split $id "::"] 0]
puts "$key, $id , $values"
Del::$key .frm_tree.tree $host $values
}
namespace eval Del {} {}
proc Del::work_server {tree host values} {
global active_cluster
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set answer [tk_messageBox -message "Удалить рабочий сервер $values?" \
-icon question -type yesno ]
switch -- $answer {
yes {
set lst [RunCommand infobase::$values "server remove --cluster=$active_cluster --server=$values $host"]
$tree delete "work_server::$values"
}
no {return}
}
}