1
0
mirror of https://bitbucket.org/svk28/rac-gui synced 2024-11-13 00:56:54 +00:00

Добавлен ввод вывод и удаление требований

This commit is contained in:
Sergey Kalinin 2018-06-07 14:16:25 +03:00
parent 0a34af045a
commit 495c846b82
4 changed files with 266 additions and 28 deletions

View File

@ -11,7 +11,7 @@ proc Quit {} {
}
proc TreePress {tree} {
global host
global host server
set id [$tree selection]
set values [$tree item [$tree selection] -values]
@ -20,8 +20,10 @@ proc TreePress {tree} {
set host $values
} elseif {$key eq ""} {
return
}
puts "$id $host $values"
} elseif {$key eq "work_server"} {
set server $values
}
#puts "$id $host $values"
Run::$key $tree $host $values
#RunCommand $root "infobase summary list --cluster=$cluster $host"
}
@ -54,12 +56,21 @@ proc Run::server {tree host values} {
}
}
proc Run::cluster {$tree host values} {
proc Run::cluster {tree host values} {
global active_cluster
set active_cluster $values
RunCommand cluster::$values "cluster info --cluster=$values $host"
}
proc Run::cluster_managers {tree host values} {
}
proc Run::services {tree host values} {
global active_cluster
Run::List $tree $host $active_cluster service
}
proc Run::infobases {tree host values} {
global active_cluster
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
@ -142,17 +153,18 @@ proc Run::servers {tree host values} {
lappend server($server_id) [string trim [lindex $server_list 1]]
}
}
puts $l
#puts $l
InsertItemsWorkList $l
}
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"
$tree insert "servers::$values" end -id "work_server::$id" \
-text "[lindex $server($x) 1]" -values "$id"
}
InsertWorkServerItems $tree $id
}
#Run::List $tree $host $values server
}
#Run::List $tree $host $values server
}
proc Run::work_server {tree host values} {
global active_cluster work_list_row_count
@ -186,16 +198,67 @@ proc Run::work_server_licenses {tree host values} {
}
proc Run::managers {tree host values} {
Run::List $tree $host $values manager
#Run::List $tree $host $values manager
global active_cluster
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand cluster::$values "manager list --cluster=$active_cluster $host"]
foreach l $lst {
foreach i $l {
set server_list [split $i ":"]
#InsertItemsWorkList $server_list
if {[string trim [lindex $server_list 0]] eq "manager"} {
set server_id [string trim [lindex $server_list 1]]
lappend server($server_id) $server_id
}
if {[string trim [lindex $server_list 0]] eq "host"} {
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 "manager::$id"] == 0 } {
$tree insert "managers::$values" end -id "manager::$id" \
-text "[lindex $server($x) 1]" -values "$id"
}
#InsertWorkServerItems $tree $id
}
#Run::List $tree $host $values server
}
proc Run::manager {tree host values} {
#Run::List $tree $host $values service
global active_cluster
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand "" "service list --cluster=$active_cluster $host"]
foreach l $lst {
#puts $l
foreach i $l {
set temp_lst [split $i ":"]
if {[string trim [lindex $temp_lst 0]] eq "manager" && [string match "*$values*" [string trim [lindex $temp_lst 1]]] == 1 } {
InsertItemsWorkList $l
}
}
}
}
proc Run::admins {tree host values} {
global active_cluster
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand infobase::$values "agent admin list $host"]
#set l [split $lst "&"]
foreach l $lst {
#set base_list [split $i ":"]
InsertItemsWorkList $l
}
}
proc Run::rule {tree host values} {
global active_cluster
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
set lst [RunCommand "" "rule list --cluster=$active_cluster --server=$values $host"]
foreach l $lst {
puts $l
InsertItemsWorkList $l
}
}
@ -208,9 +271,9 @@ proc InsertItemsWorkList {lst} {
set tag light
}
foreach i $lst {
if [regexp -nocase -all -- {(\D+)(\s*?|)(:)(\s*?|)(.+)} $i match param v2 v3 v4 value] {
lappend column_list $param
lappend value_list $value
if [regexp -nocase -all -- {(\D+)(\s*?|)(:)(\s*?|)(.*)} $i match param v2 v3 v4 value] {
lappend column_list [string trim $param]
lappend value_list [string trim $value]
}
}
.frm_work.tree_work configure -columns $column_list -displaycolumns $column_list
@ -249,7 +312,7 @@ proc InsertClusterItems {tree id} {
$tree insert $parent end -id "infobases::$id" -text "Информационные базы" -values "$id"
$tree insert $parent end -id "servers::$id" -text "Рабочие серверы" -values "$id"
$tree insert $parent end -id "admins::$id" -text "Администраторы" -values "$id"
$tree insert $parent end -id "managers::$id" -text "Менеджеры кластера" -values "managers-all"
$tree insert $parent end -id "managers::$id" -text "Менеджеры кластера" -values $id
$tree insert $parent end -id "processes::$id" -text "Рабочие процессы" -values "workprocess-all"
$tree insert $parent end -id "sessions::$id" -text "Сеансы" -values "sessions-all"
$tree insert $parent end -id "locks::$id" -text "Блокировки" -values "blocks-all"
@ -278,8 +341,11 @@ proc InsertWorkServerItems {tree id} {
if { [$tree exists "work_server_licenses::$id"] == 0 } {
$tree insert $parent end -id "work_server_licenses::$id" -text "Лицензии" -values "$id"
}
if { [$tree exists "connections::$id"] == 0 } {
#$tree insert $parent end -id "connections::$id" -text "Соединения" -values "$id"
if { [$tree exists "rule::$id"] == 0 } {
$tree insert $parent end -id "rule::$id" -text "Требования назначения функциональности" -values "$id"
}
if { [$tree exists "services::$id"] == 0 } {
# $tree insert $parent end -id "services::$id" -text "Сервисы" -values "$id"
}
}
@ -300,10 +366,24 @@ proc DebugInfo {widget f} {
proc Del {} {
global active_cluster host
set tree .frm_tree.tree
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 [.frm_tree.tree selection] -values]
set values [.frm_tree.tree item $id -values]
set key [lindex [split $id "::"] 0]
Del::$key .frm_tree.tree $host $values
set column_list [.frm_work.tree_work cget -columns]
set i 0
# проверка соответсвия колонки в таблице и ключа в дереве
foreach l $column_list {
if {$l eq $key } {
set values [lindex $work_tree_values $i]
set tree .frm_work.tree_work
}
incr i
}
Del::$key $tree $host $values
}
namespace eval Del {} {}
@ -345,6 +425,18 @@ proc Del::infobase {tree host values} {
no {return}
}
}
proc Del::rule {tree host values} {
global active_cluster server
set answer [tk_messageBox -message "Удалить требование $values?" \
-icon question -type yesno ]
switch -- $answer {
yes {
set lst [RunCommand infobase::$values "rule remove --server=$server --rule=$values --cluster=$active_cluster $host"]
Run::rule $tree $host $server
}
no {return}
}
}
proc Del::server {tree host values} {
global dir
set answer [tk_messageBox -message "Удалить сервер $values?" \
@ -648,13 +740,78 @@ proc Add::cluster {tree host values} {
Run::server $tree $host ""
destroy .add
}
# ttk::button $frm_btn.btn_cancel -command {destroy .add} -image quit_grey_24
# grid .add.lbl -row 0 -column 0 -sticky nw -padx 5 -pady 10
# grid $frm -row 0 -column 1 -sticky nw -padx 5 -pady 5
# grid $frm_btn -row 1 -column 1 -sticky se -padx 5 -pady 5
# pack $frm_btn.btn_cancel -side right
# pack $frm_btn.btn_ok -side right -padx 10
# ttk::button $frm_btn.btn_cancel -command {destroy .add} -image quit_grey_24
# grid .add.lbl -row 0 -column 0 -sticky nw -padx 5 -pady 10
# grid $frm -row 0 -column 1 -sticky nw -padx 5 -pady 5
# grid $frm_btn -row 1 -column 1 -sticky se -padx 5 -pady 5
# pack $frm_btn.btn_cancel -side right
# pack $frm_btn.btn_ok -side right -padx 10
}
proc Add::rule {tree host values} {
global default active_cluster object infobase type server
set server $values
set frm [AddToplevel "Требование назначения функциональности" functional_grey_64]
set type [lindex $default(type) 0]
label $frm.lbl_object -text "Объект требования"
set combo_object [ttk::combobox $frm.cb_object \
-textvariable object -values $default(object)]
label $frm.lbl_type -text "Тип требования"
set combo_type [ttk::combobox $frm.cb_type \
-textvariable type -values $default(type)]
label $frm.lbl_infobase -text "Имя ИБ"
set combo_infobase [ttk::combobox $frm.cb_infobase \
-textvariable infobase -values [GetInfobases $active_cluster $host]]
label $frm.lbl_par -text "Значение доп. параметра"
entry $frm.ent_par
label $frm.lbl_priority -text "Приоритет"
entry $frm.ent_priority
$frm.ent_priority insert end $default(priority)
grid $frm.lbl_object -row 0 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.cb_object -row 0 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_type -row 1 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.cb_type -row 1 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_infobase -row 2 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.cb_infobase -row 2 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_par -row 3 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_par -row 3 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_priority -row 4 -column 0 -sticky nw -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 {
RunCommand "" "rule insert \
--cluster=$active_cluster \
--server=$server \
--position=0 \
--object-type=$object \
--infobase-name=$infobase \
--rule-type=$type \
--application-ext=[.add.frm.ent_par get] \
--priority=[.add.frm.ent_priority get] $host"
Run::rule $tree $host $server
destroy .add
}
}
proc GetInfobases {cluster host} {
set lst [RunCommand "" "infobase summary --cluster=$cluster list $host"]
set return_list ""
foreach info_bases_list $lst {
foreach i $info_bases_list {
set i [split $i ":"]
if {[string trim [lindex $i 0]] eq "name"} {
lappend return_list [string trim [lindex $i 1]]
}
}
}
return $return_list
}
proc SaveMainServer {host port} {
global dir
set file [open [file join $dir(work) 1c_srv.cfg] "a+"]
@ -662,3 +819,4 @@ proc SaveMainServer {host port} {
close $file
return "$host:$port"
}

View File

@ -94,3 +94,4 @@ pack $frm_tree $frm_work -side left -expand true -fill both

View File

@ -310,4 +310,38 @@ image create photo ok_grey_24 -data {
t8PeL7qFMNlAnJd06rCgyVJEKX5gSOuclmlLIJglZ9nNInU1FWLyWC84AzNsDQBrCeWUkU+mIlHt
k3ZtdTwf6y/SqfVpjKc5gQAAAABJRU5ErkJggg==
}
image create photo functional_grey_64 -data {
iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAAAmJ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JI6UpJXxz7ZUuttRcZFdRfaV7Wah
OKFulct1P10DViZ7GtYLmQlAN63mCXbRXqcwHPiL05SYbe/mBWmuXpZzzJE8l6fvIZ8VDHcFzW5S
ZZ6anMxtWMLzer7nP3bzUXBTSpYr5HDUyZelKs4nGwHg64Qy/EHZD6DruR4L2MAUP9qql8Rpx0Da
URC98ZfkYi/JPMaP1CLx7eFWlrGUi2Skp1VbB+EnslnNA7JDChnDJLE00h9h/wOGHvYXgTBjIgAA
AABJRU5ErkJggg==
}

View File

@ -27,13 +27,58 @@ set default(ram_max) 0
set default(ram_sec) 0
# Объём памяти рабочих процессов, до которого сервер считается производительным
set default(ram_work) 0
set default(dbms) [list PostgreSQL MSSQLServer IBMDB2 OracleDatabase]
set default(dbms) {
PostgreSQL
MSSQLServer
IBMDB2
OracleDatabase
}
# Уровни безопасности соединения:
# 0 - выключено
# 1 - только соединение
# 2 - постоянно
set default(secure_level) [list 0 1 2]
set default(date_offset) [list 0 2000]
# Объект требования
set default(object) {
LicenseService
EventLogService
OpenID2ProviderContextService
TimestampService
SessionReuseService
SessionDataService
ExternalSessionManagerService
FulltextSearchService
TransactionLockService
DebugService
ClusterConfigService
ClientTestingService
ClusterLockService
JobService
ExternalDataSourceXMLAService
SettingsService
ExternalDataSourceODBCService
NumerationService
DatabaseTableNumberingService
{Table name and database field numbering service}
DataEditLockService
AuxiliaryService
DataBaseConfigurationUpdateService
}
# тип правила распределения:
# auto - отсутствие правила (по-умолчанию)
# always - распределять только на данный сервер
# never - не распределять на данный сервер
set default(type) {
auto
always
never
}
# Приоритет
set default(priority) 0
# цвета строк в таблице
set color(dark_table_bg) "#e2e2e2"
set color(light_table_bg) "#ffffff"