Make Parsing text for Table list
This commit is contained in:
parent
8d11556947
commit
2d767190af
118
lib/function.tcl
118
lib/function.tcl
|
@ -21,15 +21,16 @@ proc TreePress {tree} {
|
|||
} elseif {$key eq ""} {
|
||||
return
|
||||
}
|
||||
puts "$id $host $values"
|
||||
#puts "$id $host $values"
|
||||
Run::$key $tree $host $values
|
||||
#RunCommand $root "infobase summary list --cluster=$cluster $host"
|
||||
}
|
||||
|
||||
namespace eval Run {} {}
|
||||
# Получение данных по кластерам
|
||||
proc Run::server {tree host values} {
|
||||
proc Run::server_ {tree host values} {
|
||||
set lst [RunCommand server::$host "cluster list $host"]
|
||||
|
||||
set l [split $lst "&"]
|
||||
foreach i $l {
|
||||
set cluster_list [split $i ":"]
|
||||
|
@ -49,6 +50,31 @@ proc Run::server {tree host values} {
|
|||
}
|
||||
}
|
||||
}
|
||||
proc Run::server {tree host values} {
|
||||
set lst [RunCommand server::$host "cluster list $host"]
|
||||
set l [lindex $lst 0]
|
||||
foreach cluster_list $lst {
|
||||
foreach i $cluster_list {
|
||||
puts $i
|
||||
set cluster_list [split $i ":"]
|
||||
if {[string trim [lindex $cluster_list 0]] eq "cluster"} {
|
||||
set cluster_id [string trim [lindex $cluster_list 1]]
|
||||
lappend cluster($cluster_id) $cluster_id
|
||||
}
|
||||
if {[string trim [lindex $cluster_list 0]] eq "name"} {
|
||||
lappend cluster($cluster_id) [string trim [lindex $cluster_list 1]]
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach x [array names cluster] {
|
||||
set id [lindex $cluster($x) 0]
|
||||
if { [$tree exists "cluster::$id"] == 0 } {
|
||||
$tree insert "server::$host" end -id "cluster::$id" -text "[lindex $cluster($x) 1]" -values "$id"
|
||||
InsertClusterItems $tree $id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc Run::cluster {$tree host values} {
|
||||
global active_cluster
|
||||
set active_cluster $values
|
||||
|
@ -60,9 +86,8 @@ proc Run::infobases {tree host values} {
|
|||
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
|
||||
|
||||
set lst [RunCommand infobase::$values "infobase summary --cluster=$active_cluster list $host"]
|
||||
set l [split $lst "&"]
|
||||
puts $lst
|
||||
foreach i $l {
|
||||
foreach info_bases_list $lst {
|
||||
foreach i $info_bases_list {
|
||||
set base_list [split $i ":"]
|
||||
if {[string trim [lindex $base_list 0]] eq "infobase"} {
|
||||
set base_id [string trim [lindex $base_list 1]]
|
||||
|
@ -71,7 +96,9 @@ proc Run::infobases {tree host values} {
|
|||
if {[string trim [lindex $base_list 0]] eq "name"} {
|
||||
lappend base($base_id) [string trim [lindex $base_list 1]]
|
||||
}
|
||||
InsertItemsWorkList $base_list
|
||||
#InsertItemsWorkList $base_list
|
||||
}
|
||||
InsertItemsWorkList $info_bases_list
|
||||
}
|
||||
foreach x [array names base] {
|
||||
set id [lindex $base($x) 0]
|
||||
|
@ -81,37 +108,44 @@ proc Run::infobases {tree host values} {
|
|||
InsertBaseItems $tree $id
|
||||
}
|
||||
}
|
||||
|
||||
proc Run::infobase {tree host values} {
|
||||
global active_cluster
|
||||
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
|
||||
set lst [RunCommand infobase::$values "infobase info --cluster=$active_cluster --infobase=$values $host"]
|
||||
|
||||
set l [split $lst "&"]
|
||||
foreach l $lst {
|
||||
foreach i $l {
|
||||
set base_list [split $i ":"]
|
||||
InsertItemsWorkList $base_list
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc Run::List:Base {tree host values par} {
|
||||
global active_cluster
|
||||
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
|
||||
set lst [RunCommand infobase::$values "$par list --cluster=$active_cluster --infobase=$values $host"]
|
||||
puts $lst
|
||||
set l [split $lst "&"]
|
||||
|
||||
foreach l $lst {
|
||||
foreach i $l {
|
||||
set base_list [split $i ":"]
|
||||
InsertItemsWorkList $base_list
|
||||
}
|
||||
puts "--$l"
|
||||
InsertItemsWorkList $l
|
||||
}
|
||||
}
|
||||
proc Run::List {tree host values par} {
|
||||
global active_cluster
|
||||
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
|
||||
set lst [RunCommand infobase::$values "$par list --cluster=$active_cluster $host"]
|
||||
set l [split $lst "&"]
|
||||
foreach l $lst {
|
||||
foreach i $l {
|
||||
set base_list [split $i ":"]
|
||||
InsertItemsWorkList $base_list
|
||||
#InsertItemsWorkList $base_list
|
||||
}
|
||||
InsertItemsWorkList $l
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,7 +163,7 @@ proc Run::servers {tree host values} {
|
|||
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 l $lst {
|
||||
foreach i $l {
|
||||
set server_list [split $i ":"]
|
||||
#InsertItemsWorkList $server_list
|
||||
|
@ -141,6 +175,9 @@ proc Run::servers {tree host values} {
|
|||
lappend server($server_id) [string trim [lindex $server_list 1]]
|
||||
}
|
||||
}
|
||||
puts $l
|
||||
InsertItemsWorkList $l
|
||||
}
|
||||
foreach x [array names server] {
|
||||
set id [lindex $server($x) 0]
|
||||
if { [$tree exists "work_server::$id"] == 0 } {
|
||||
|
@ -154,10 +191,13 @@ 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 l $lst {
|
||||
foreach i $l {
|
||||
set base_list [split $i ":"]
|
||||
InsertItemsWorkList $base_list
|
||||
InsertItemsWorkList_ $base_list
|
||||
}
|
||||
#puts $l
|
||||
#InsertItemsWorkList $l
|
||||
}
|
||||
#Run::List $tree $host $values server
|
||||
}
|
||||
|
@ -182,24 +222,68 @@ proc Run::admins {tree host values} {
|
|||
}
|
||||
}
|
||||
|
||||
proc InsertItemsWorkList {lst} {
|
||||
proc InsertItemsWorkList_ {lst} {
|
||||
#.frm_work.tree_work configure -columns "par val" -displaycolumns "par val"
|
||||
.frm_work.tree_work insert {} end -values $lst
|
||||
# .frm_work.tree_work column [lindex $lst 0] -id [lindex $lst 0]
|
||||
# .frm_work.tree_work heading [lindex $lst 0] -text [lindex $lst 0]
|
||||
# .frm_work.tree_work insert [lindex $lst 0] end -values [lindex $lst 1]
|
||||
#.frm_work.tree_work insert val end -text [lindex $lst 1] -values [lindex $lst 1]
|
||||
#puts [.frm_work.tree_work cget -columns]
|
||||
#puts [.frm_work.tree_work column par]
|
||||
|
||||
}
|
||||
proc RunCommand {root par} {
|
||||
proc InsertItemsWorkList {lst} {
|
||||
foreach i $lst {
|
||||
set l [split $i ":"]
|
||||
lappend column_list [lindex $l 0]
|
||||
lappend value_list [lindex $l 1]
|
||||
}
|
||||
.frm_work.tree_work configure -columns $column_list -displaycolumns $column_list
|
||||
.frm_work.tree_work insert {} end -values $value_list
|
||||
foreach j $column_list {
|
||||
.frm_work.tree_work heading $j -text $j
|
||||
}
|
||||
}
|
||||
|
||||
proc RunCommand_ {root par} {
|
||||
global dir rac_cmd cluster
|
||||
puts $par
|
||||
#puts $par
|
||||
set pipe [open "|$rac_cmd $par" "r"]
|
||||
set lst ""
|
||||
while {[gets $pipe line]>=0} {
|
||||
#puts "$line"
|
||||
if {$line eq ""} {
|
||||
append lst "----&"
|
||||
} else {
|
||||
append lst "$line&"
|
||||
}
|
||||
}
|
||||
close $pipe
|
||||
return $lst
|
||||
# fileevent $pipe readable [list DebugInfo .frm_work.tree_work $pipe]
|
||||
# fconfigure $pipe -buffering none -blocking no
|
||||
}
|
||||
proc RunCommand {root par} {
|
||||
global dir rac_cmd cluster
|
||||
#puts $par
|
||||
set pipe [open "|$rac_cmd $par" "r"]
|
||||
set lst ""
|
||||
set l ""
|
||||
while {[gets $pipe line]>=0} {
|
||||
if {$line eq ""} {
|
||||
lappend l $lst
|
||||
set lst ""
|
||||
} else {
|
||||
lappend lst $line
|
||||
}
|
||||
}
|
||||
close $pipe
|
||||
return $l
|
||||
|
||||
# fileevent $pipe readable [list DebugInfo .frm_work.tree_work $pipe]
|
||||
# fconfigure $pipe -buffering none -blocking no
|
||||
}
|
||||
|
||||
proc InsertClusterItems {tree id} {
|
||||
set parent "cluster::$id"
|
||||
|
|
Loading…
Reference in New Issue
Block a user