1
0
mirror of https://bitbucket.org/svk28/rac-gui synced 2024-12-04 18:46:52 +00:00

Реализован диалог добавления рабочего сервера

This commit is contained in:
Sergey Kalinin 2018-05-22 12:39:17 +03:00
parent f494b66883
commit 42b61f7780
6 changed files with 408 additions and 235 deletions

View File

@ -4,9 +4,12 @@
# Author: Sergey Kalinin svk@nuk-svk.ru
# Home page: https://bitbucket.org/svk28/rac-gui
######################################################
22/05/2018
- Реализована форма добавления рабочего сервера
20/05/2018
- Добавлены процедуры работы (добавления, удаления) с кластером (базой, сервера)
- Добавлен диалог добавления базы
- Добавлены процедуры работы (добавления, удаления) с кластером (базой, сервером)
- Сделан диалог добавления базы (только обязательные параметры)
15/05/2018
- Добавлен вывод списка кластеров, серверов, баз и т.д
@ -16,3 +19,4 @@
- Beginning the project

View File

@ -0,0 +1,36 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:cc='http://creativecommons.org/ns#' xmlns:dc='http://purl.org/dc/elements/1.1/' sodipodi:docname='document-new-symbolic.svg' inkscape:export-filename='/home/sam/dev/RESOURCES/gnome-icon-theme-symbolic/src/gnome-stencils.png' inkscape:export-xdpi='90' inkscape:export-ydpi='90' height='16.000099' id='svg7384' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:osb='http://www.openswatchbook.org/uri/2009/osb' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:svg='http://www.w3.org/2000/svg' version='1.1' inkscape:version='0.92pre3 r' viewBox='0 0 16 16.000099' width='16' xmlns='http://www.w3.org/2000/svg'>
<metadata id='metadata90'>
<rdf:RDF>
<cc:Work rdf:about=''>
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage'/>
<dc:title>Gnome Symbolic Icon Theme</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview inkscape:bbox-nodes='true' inkscape:bbox-paths='true' bordercolor='#666666' borderopacity='1' inkscape:current-layer='layer12' inkscape:cx='-6.2696536' inkscape:cy='11.09041' inkscape:document-units='px' gridtolerance='10' inkscape:guide-bbox='true' guidetolerance='10' id='namedview88' inkscape:measure-end='0,0' inkscape:measure-start='0,0' inkscape:object-nodes='true' inkscape:object-paths='false' objecttolerance='10' pagecolor='#3a3b39' inkscape:pageopacity='1' inkscape:pageshadow='2' showborder='false' showgrid='false' showguides='true' inkscape:snap-bbox='true' inkscape:snap-bbox-midpoints='false' inkscape:snap-global='true' inkscape:snap-grids='true' inkscape:snap-nodes='true' inkscape:snap-others='false' inkscape:snap-to-guides='true' inkscape:window-height='1016' inkscape:window-maximized='1' inkscape:window-width='1920' inkscape:window-x='0' inkscape:window-y='27' inkscape:zoom='16'>
<inkscape:grid dotted='false' empspacing='2' enabled='true' id='grid4866' originx='-180.06251' originy='590.00009' snapvisiblegridlinesonly='true' spacingx='1px' spacingy='1px' type='xygrid' visible='true'/>
</sodipodi:namedview>
<title id='title9167'>Gnome Symbolic Icon Theme</title>
<defs id='defs7386'>
<linearGradient gradientTransform='matrix(-2.7365795,0.28202934,-0.18908311,-0.99988321,239.54008,-879.45557)' id='linearGradient19282' osb:paint='solid'>
<stop id='stop19284' offset='0' style='stop-color:#666666;stop-opacity:1;'/>
</linearGradient>
</defs>
<g inkscape:groupmode='layer' id='layer9' inkscape:label='status' style='display:inline' transform='translate(-421.06271,-807)'/>
<g inkscape:groupmode='layer' id='layer10' inkscape:label='devices' style='display:inline' transform='translate(-421.06271,-807)'/>
<g inkscape:groupmode='layer' id='layer11' inkscape:label='apps' transform='translate(-421.06271,-807)'/>
<g inkscape:groupmode='layer' id='layer13' inkscape:label='places' style='display:inline' transform='translate(-421.06271,-807)'/>
<g inkscape:groupmode='layer' id='layer14' inkscape:label='mimetypes' transform='translate(-421.06271,-807)'/>
<g inkscape:groupmode='layer' id='layer15' inkscape:label='emblems' style='display:inline' transform='translate(-421.06271,-807)'/>
<g inkscape:groupmode='layer' id='g71291' inkscape:label='emotes' style='display:inline' transform='translate(-421.06271,-807)'/>
<g inkscape:groupmode='layer' id='g4953' inkscape:label='categories' style='display:inline' transform='translate(-421.06271,-807)'/>
<g inkscape:groupmode='layer' id='layer12' inkscape:label='actions' style='display:inline' transform='translate(-421.06271,-807)'>
<path inkscape:connector-curvature='0' d='m 424,808 a 1.0001,1.0001 0 0 0 -1,1 v 13 a 1.0001,1.0001 0 0 0 1,1 h 4 a 1.0001,1.0001 0 1 0 0,-2 h -3 v -11 h 5.58594 L 433,812.41406 V 815 a 1.0001,1.0001 0 1 0 2,0 v -3 a 1.0001,1.0001 0 0 0 -0.29297,-0.70703 l -3,-3 A 1.0001,1.0001 0 0 0 431,808 Z' id='path9936' style='color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#bebebe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate'/>
<path inkscape:connector-curvature='0' d='M 432.0002,817.00327 V 819 h -2 v 1.99673 h 2 v 1.99674 h 2 v -1.99674 h 2 V 819 h -2 v -1.99673 z' id='path9951' style='display:inline;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:0.99918258'/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -0,0 +1,26 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:cc='http://creativecommons.org/ns#' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:svg='http://www.w3.org/2000/svg' id='svg7384' version='1.1' height='16' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns='http://www.w3.org/2000/svg' width='16'>
<title id='title9167'>Gnome Symbolic Icon Theme</title>
<metadata id='metadata90'>
<rdf:RDF>
<cc:Work rdf:about=''>
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage'/>
<dc:title>Gnome Symbolic Icon Theme</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs id='defs7386'/>
<g transform='translate(-40,-518)' id='layer9' style='display:inline'/>
<g transform='translate(-40,-518)' id='layer10'/>
<g transform='translate(-40,-518)' id='layer11'/>
<g transform='translate(-40,-518)' id='layer12'>
<path inkscape:connector-curvature='0' d='m 48,519.03125 c -3.85327,0 -6.96875,3.11547 -6.96875,6.96875 0,3.85327 3.11548,6.96875 6.96875,6.96875 3.85327,0 6.96875,-3.11548 6.96875,-6.96875 0,-3.85328 -3.11548,-6.96875 -6.96875,-6.96875 z M 45,523 l 1,0 c 0.01037,-1.2e-4 0.02079,-4.6e-4 0.03125,0 0.254951,0.0112 0.50987,0.12858 0.6875,0.3125 L 48,524.59375 49.3125,523.3125 C 49.578125,523.082 49.759172,523.007 50,523 l 1,0 0,1 c 0,0.28647 -0.03434,0.55065 -0.25,0.75 l -1.28125,1.28125 1.25,1.25 C 50.906938,527.46942 50.999992,527.7347 51,528 l 0,1 -1,0 c -0.265301,-10e-6 -0.530586,-0.0931 -0.71875,-0.28125 L 48,527.4375 46.71875,528.71875 C 46.530586,528.90694 46.26529,529 46,529 l -1,0 0,-1 c -3e-6,-0.26529 0.09306,-0.53058 0.28125,-0.71875 l 1.28125,-1.25 L 45.28125,524.75 C 45.070508,524.55537 44.97809,524.28075 45,524 l 0,-1 z' id='path10839' style='font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#bebebe;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.78124988;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new;font-family:Andale Mono;-inkscape-font-specification:Andale Mono'/>
</g>
<g transform='translate(-40,-518)' id='layer13'/>
<g transform='translate(-40,-518)' id='layer14'/>
<g transform='translate(-40,-518)' id='layer15'/>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,31 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:cc='http://creativecommons.org/ns#' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:svg='http://www.w3.org/2000/svg' id='svg7384' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' sodipodi:docname='system-shutdown-symbolic.svg' version='1.1' inkscape:version='0.48.0 r9654' height='16.02426' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns='http://www.w3.org/2000/svg' width='16'>
<metadata id='metadata90'>
<rdf:RDF>
<cc:Work rdf:about=''>
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage'/>
<dc:title>Gnome Symbolic Icon Theme</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview inkscape:cy='-1.3922' pagecolor='#555753' borderopacity='1' showborder='false' inkscape:bbox-paths='false' guidetolerance='10' inkscape:window-width='1310' showguides='true' inkscape:object-nodes='true' inkscape:snap-bbox='true' inkscape:pageshadow='2' inkscape:guide-bbox='true' inkscape:snap-nodes='false' bordercolor='#666666' objecttolerance='10' id='namedview88' showgrid='false' inkscape:window-maximized='0' inkscape:window-x='54' inkscape:snap-global='true' inkscape:window-y='26' gridtolerance='10' inkscape:window-height='690' inkscape:snap-to-guides='true' inkscape:current-layer='layer12' inkscape:zoom='5.6568542' inkscape:cx='37.47387' inkscape:snap-grids='true' inkscape:pageopacity='1'>
<inkscape:grid spacingx='1px' spacingy='1px' id='grid4866' empspacing='2' enabled='true' type='xygrid' snapvisiblegridlinesonly='true' visible='true'/>
</sodipodi:namedview>
<title id='title9167'>Gnome Symbolic Icon Theme</title>
<defs id='defs7386'/>
<g inkscape:label='status' transform='translate(-100,-685.97574)' inkscape:groupmode='layer' id='layer9' style='display:inline'/>
<g inkscape:label='devices' transform='translate(-100,-685.97574)' inkscape:groupmode='layer' id='layer10'/>
<g inkscape:label='apps' transform='translate(-100,-685.97574)' inkscape:groupmode='layer' id='layer11'/>
<g inkscape:label='actions' transform='translate(-100,-685.97574)' inkscape:groupmode='layer' id='layer12'>
<path inkscape:connector-curvature='0' d='m 104.84002,687.8125 a 0.99998337,1.0002168 0 0 0 -0.34813,0.13393 c -1.05343,0.60965 -1.93145,1.46598 -2.54405,2.51786 -1.93955,3.33036 -0.81232,7.64928 2.51727,9.58928 3.32959,1.94001 7.64749,0.8125 9.58705,-2.51786 1.93955,-3.33035 0.81232,-7.64927 -2.51727,-9.58928 a 1.0081498,1.0083851 0 1 0 -1.01762,1.74107 c 2.39572,1.39588 3.18978,4.43408 1.79422,6.83036 -1.39555,2.39628 -4.43303,3.19052 -6.82876,1.79464 -2.38544,-1.38989 -3.19179,-4.41207 -1.821,-6.80357 l 0.0268,-0.0268 c 0.43759,-0.75138 1.06851,-1.38594 1.821,-1.82142 a 0.99998337,1.0002168 0 0 0 -0.66949,-1.84822 z' id='path3869-2' style='font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:2.333606;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans'/>
<path inkscape:connector-curvature='0' d='M 107.78125,686 A 1.0001,1.0001 0 0 0 107,687 l 0,5 a 1.0001,1.0001 0 1 0 2,0 l 0,-5 a 1.0001,1.0001 0 0 0 -1.21875,-1 z' id='path4710' style='font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans'/>
</g>
<g inkscape:label='places' transform='translate(-100,-685.97574)' inkscape:groupmode='layer' id='layer13'/>
<g inkscape:label='mimetypes' transform='translate(-100,-685.97574)' inkscape:groupmode='layer' id='layer14'/>
<g inkscape:label='emblems' transform='translate(-100,-685.97574)' inkscape:groupmode='layer' id='layer15' style='display:inline'/>
<g inkscape:label='categories' transform='translate(-100,-685.97574)' inkscape:groupmode='layer' id='g4953' style='display:inline'/>
</svg>

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -6,7 +6,6 @@
# https://bitbucket.org/svk28/rac-gui
######################################################
proc Quit {} {
exit
}
@ -20,6 +19,7 @@ proc TreePress {tree} {
if {$key eq "server"} {
set host $values
}
#puts "$id $host $values"
Run::$key $tree $host $values
#RunCommand $root "infobase summary list --cluster=$cluster $host"
}
@ -27,7 +27,6 @@ proc TreePress {tree} {
namespace eval Run {} {}
# Получение данных по кластерам
proc Run::server {tree host values} {
puts "Server info $host $values"
set lst [RunCommand server::$host "cluster list $host"]
set l [split $lst "&"]
foreach i $l {
@ -51,8 +50,7 @@ proc Run::server {tree host values} {
proc Run::cluster {$tree host values} {
global active_cluster
set active_cluster $values
puts "Server info $host $values"
puts [RunCommand cluster::$values "cluster info --cluster=$values $host"]
RunCommand cluster::$values "cluster info --cluster=$values $host"
}
proc Run::infobases {tree host values} {
@ -256,77 +254,74 @@ proc Del {} {
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 work_server {tree host values} {
global active_cluster
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"
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
}
no {return}
namespace eval Del {} {}
proc Del::work_server {tree host values} {
global active_cluster
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"
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
}
no {return}
}
proc cluster {tree host values} {
set answer [tk_messageBox -message "Удалить кластер $values?" \
-icon question -type yesno ]
switch -- $answer {
yes {
set lst [RunCommand infobase::$values "cluster remove --cluster=$values $host"]
$tree delete "cluster::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
}
no {return}
}
}
proc infobase {tree host values} {
global active_cluster
set answer [tk_messageBox -message "Удалить информационную базу $values?" \
-icon question -type yesno ]
switch -- $answer {
yes {
set lst [RunCommand infobase::$values "infobase drop --infobase=$values --cluster=$active_cluster $host"]
$tree delete "infobase::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
}
no {return}
}
}
proc server {tree host values} {
global dir
set answer [tk_messageBox -message "Удалить сервер $values?" \
-icon question -type yesno ]
switch -- $answer {
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]
set orig_file [open [file join $dir(work) 1c_srv.cfg.bak] "r"]
set file [open [file join $dir(work) 1c_srv.cfg] "w"]
while {[gets $orig_file line] >=0 } {
puts $line
if { $line ne "" && $line ne "$values"} {
puts $file $line
}
}
close $file
close $orig_file
#return "$host:$port"
$tree delete "server::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
file delete [file join $dir(work) 1c_srv.cfg.bak]
}
no {return}
}
}
}
proc Del::cluster {tree host values} {
set answer [tk_messageBox -message "Удалить кластер $values?" \
-icon question -type yesno ]
switch -- $answer {
yes {
set lst [RunCommand infobase::$values "cluster remove --cluster=$values $host"]
$tree delete "cluster::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
}
no {return}
}
}
proc Del::infobase {tree host values} {
global active_cluster
set answer [tk_messageBox -message "Удалить информационную базу $values?" \
-icon question -type yesno ]
switch -- $answer {
yes {
set lst [RunCommand infobase::$values "infobase drop --infobase=$values --cluster=$active_cluster $host"]
$tree delete "infobase::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
}
no {return}
}
}
proc Del::server {tree host values} {
global dir
set answer [tk_messageBox -message "Удалить сервер $values?" \
-icon question -type yesno ]
switch -- $answer {
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]
set orig_file [open [file join $dir(work) 1c_srv.cfg.bak] "r"]
set file [open [file join $dir(work) 1c_srv.cfg] "w"]
while {[gets $orig_file line] >=0 } {
puts $line
if { $line ne "" && $line ne "$values"} {
puts $file $line
}
}
close $file
close $orig_file
#return "$host:$port"
$tree delete "server::$values"
.frm_work.tree_work delete [ .frm_work.tree_work children {}]
file delete [file join $dir(work) 1c_srv.cfg.bak]
}
no {return}
}
}
proc Add {} {
global active_cluster host
set id [.frm_tree.tree selection]
@ -339,160 +334,253 @@ proc Add {} {
Add::$key .frm_tree.tree $host $values
}
namespace eval Add {} {
proc server {} {
global default
toplevel .add
set frm [ttk::labelframe .add.frm -text "Добавление основного сервера" -labelanchor nw]
label $frm.lbl_host -text "Адрес сервера"
entry $frm.ent_host
label $frm.lbl_port -text "Порт"
entry $frm.ent_port
$frm.ent_port insert end $default(port)
grid $frm.lbl_host -row 0 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_host -row 0 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_port -row 1 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_port -row 1 -column 1 -sticky nsew -padx 5 -pady 5
#grid $frm.btn_ok -row 2 -column 1 -sticky nw -padx 5 -pady 5
#grid $frm.btn_cancel -row 2 -column 1 -sticky se -padx 5 -pady 5
grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1
set frm_btn [frame .add.frm_btn -border 0]
ttk::button $frm_btn.btn_ok -image add_grey_24 -command {
set host [SaveMainServer [.add.frm.ent_host get] [.add.frm.ent_port get]]
.frm_tree.tree insert {} end -id "server::$host" -text "$host" -values "$host"
destroy .add
return $host
}
ttk::button $frm_btn.btn_cancel -command {destroy .add} -image quit_grey_24
pack $frm $frm_btn -padx 5 -pady 5 -expand true -fill x
pack $frm_btn.btn_cancel -side right
pack $frm_btn.btn_ok -side right -padx 10
puts $host
}
proc work_server {tree host values} {
}
proc infobase {tree host values} {
Add::infobases $tree $host $values
}
proc infobases {tree host values} {
global default active_cluster
toplevel .add
wm title .add "Добавление информационной базы"
ttk::label .add.lbl -image add_database_grey_64
set frm [ttk::labelframe .add.frm -text "Добавление информационной базы" -labelanchor nw]
label $frm.lbl_host -text "Адрес сервера баз даннных"
entry $frm.ent_host
label $frm.lbl_db_user -text "Имя пользователя базы даннных"
entry $frm.ent_db_user
label $frm.lbl_db_pass -text "Пароль"
entry $frm.ent_db_pass
#$frm.ent_host insert end $host
label $frm.lbl_locale -text "Язык базы данных"
entry $frm.ent_locale
$frm.ent_locale insert end $default(locale)
label $frm.lbl_infobase_name -text "Имя информационной базы"
entry $frm.ent_infobase_name
label $frm.lbl_base_name -text "Имя базы данных"
entry $frm.ent_base_name
label $frm.lbl_base_type -text "Тип СУБД"
set combo [ttk::combobox $frm.cb_base_type -textvariable dbms -values $default(dbms)]]
grid $frm.lbl_host -row 0 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_host -row 0 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_db_user -row 1 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_db_user -row 1 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_db_pass -row 2 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_db_pass -row 2 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_locale -row 3 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_locale -row 3 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_infobase_name -row 4 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_infobase_name -row 4 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_base_name -row 5 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_base_name -row 5 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_base_type -row 6 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.cb_base_type -row 6 -column 1 -sticky nsew -padx 5 -pady 5
# grid $frm.lbl_host $frm.ent_host -sticky nwse -padx 5 -pady 5
# grid $frm.lbl_db_user $frm.ent_db_user -sticky nwse -padx 5 -pady 5
# grid $frm.lbl_db_pass $frm.ent_db_pass -sticky nwse -padx 5 -pady 5
# grid $frm.lbl_locale $frm.ent_locale -sticky nwse -padx 5 -pady 5
# grid $frm.lbl_infobase_name $frm.ent_infobase_name -sticky nwse -padx 5 -pady 5
# grid $frm.lbl_base_name $frm.ent_base_name -sticky nwse -padx 5 -pady 5
# grid $frm.lbl_base_type $frm.cb_base_type -sticky nwse -padx 5 -pady 5
#
grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1
set active_cluster $values
set frm_btn [frame .add.frm_btn -border 0]
ttk::button $frm_btn.btn_ok -image add_grey_24 -command {
#puts [RunCommand "" "cluster insert --host=[.add.frm.ent_host get] --port=[.add.frm.ent_port get] --name=[.add.frm.ent_cluster_name get] $host"]
RunCommand "" "infobase create --create-database \
--name=[.add.frm.ent_infobase_name get] \
--dbms=$dbms \
--db-server=[.add.frm.ent_host get] \
--db-name=[.add.frm.ent_base_name get] \
--locale=[.add.frm.ent_locale get] \
--db-user=[.add.frm.ent_db_user get] \
--db-pwd=[.add.frm.ent_db_pass get] \
--cluster=$active_cluster $host"
#SaveCluster [.add.frm.ent_host get] [.add.frm.ent_port get]]
#.frm_tree.tree insert "server::$host" end -id "er::$host" -text "$host" -values "$host"
destroy .add
#return $host
}
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 .add.lbl -side left
# pack $frm -padx 5 -pady 5 -expand true -fill x -side left
# pack $frm_btn -padx 5 -pady 5 -expand true -fill x
pack $frm_btn.btn_cancel -side right
pack $frm_btn.btn_ok -side right -padx 10
}
namespace eval Add {} {}
proc Add::server {} {
global default
toplevel .add
set frm [ttk::labelframe .add.frm -text "Добавление основного сервера" -labelanchor nw]
proc cluster {tree host values} {
global default
toplevel .add
set frm [ttk::labelframe .add.frm -text "Добавление кластера" -labelanchor nw]
label $frm.lbl_host -text "Адрес основного сервера"
entry $frm.ent_host
#$frm.ent_host insert end $host
label $frm.lbl_port -text "Порт"
entry $frm.ent_port
$frm.ent_port insert end $default(port)
label $frm.lbl_cluster_name -text "Название кластера"
entry $frm.ent_cluster_name
grid $frm.lbl_host -row 0 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_host -row 0 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_port -row 1 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_port -row 1 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_cluster_name -row 2 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_cluster_name -row 2 -column 1 -sticky nsew -padx 5 -pady 5
grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1
set frm_btn [frame .add.frm_btn -border 0]
ttk::button $frm_btn.btn_ok -image add_grey_24 -command {
puts [RunCommand "" "cluster insert --host=[.add.frm.ent_host get] --port=[.add.frm.ent_port get] --name=[.add.frm.ent_cluster_name get] $host"]
#SaveCluster [.add.frm.ent_host get] [.add.frm.ent_port get]]
#.frm_tree.tree insert "server::$host" end -id "er::$host" -text "$host" -values "$host"
destroy .add
#return $host
}
ttk::button $frm_btn.btn_cancel -command {destroy .add} -image quit_grey_24
pack $frm $frm_btn -padx 5 -pady 5 -expand true -fill x
pack $frm_btn.btn_cancel -side right
pack $frm_btn.btn_ok -side right -padx 10
puts $host
label $frm.lbl_host -text "Адрес сервера"
entry $frm.ent_host
label $frm.lbl_port -text "Порт"
entry $frm.ent_port
$frm.ent_port insert end $default(port)
grid $frm.lbl_host -row 0 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_host -row 0 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_port -row 1 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_port -row 1 -column 1 -sticky nsew -padx 5 -pady 5
grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1
set frm_btn [frame .add.frm_btn -border 0]
ttk::button $frm_btn.btn_ok -image add_grey_24 -command {
set host [SaveMainServer [.add.frm.ent_host get] [.add.frm.ent_port get]]
.frm_tree.tree insert {} end -id "server::$host" -text "$host" -values "$host"
destroy .add
return $host
}
ttk::button $frm_btn.btn_cancel -command {destroy .add} -image quit_grey_24
pack $frm $frm_btn -padx 5 -pady 5 -expand true -fill x
pack $frm_btn.btn_cancel -side right
pack $frm_btn.btn_ok -side right -padx 10
puts $host
}
proc Add::servers {tree host values} {
global default dedicate_manager using_central_server
set dedicate_manager "none"
set using_central_server "normal"
set active_cluster $values
toplevel .add
wm title .add "Добавление рабочего сервера"
ttk::label .add.lbl -image server_grey_64
set frm [ttk::labelframe .add.frm -text "Добавление рабочего сервера" -labelanchor nw]
label $frm.lbl_server_desc -text "Описание сервера"
entry $frm.ent_server_desc
label $frm.lbl_host -text "Адрес сервера"
entry $frm.ent_host
label $frm.lbl_port -text "Порт"
entry $frm.ent_port
$frm.ent_port insert end $default(port)
label $frm.lbl_ports_range -text "Диапазон портов"
entry $frm.ent_ports_range
$frm.ent_ports_range insert end $default(ports_range)
label $frm.lbl_ram_max -text "Максимальный объём памяти раб. процессов"
entry $frm.ent_ram_max
$frm.ent_ram_max insert end $default(ram_max)
label $frm.lbl_ram_sec -text "Безопасный расход памяти за вызов"
entry $frm.ent_ram_sec
$frm.ent_ram_sec insert end $default(ram_sec)
label $frm.lbl_ram_work -text "Объём памяти рабочих процессов"
entry $frm.ent_ram_work
$frm.ent_ram_work insert end $default(ram_work)
label $frm.lbl_base_on_process -text "Количество ИБ на процесс"
entry $frm.ent_base_on_process
$frm.ent_base_on_process insert end $default(base_on_process)
label $frm.lbl_connection_on_process -text "Количество соединений на процесс"
entry $frm.ent_connection_on_process
$frm.ent_connection_on_process insert end $default(connection_on_process)
label $frm.lbl_manager_port -text "Порт главного менеджера кластера"
entry $frm.ent_manager_port
$frm.ent_manager_port insert end $default(port)
label $frm.lbl_manager_each_service -text "Менеджер под каждый сервис"
checkbutton $frm.ent_manager_each_service -variable dedicate_manager -onvalue all -offvalue none
label $frm.lbl_central_server -text "Центральный сервер"
checkbutton $frm.ent_central_server -variable using_central_server -onvalue main -offvalue normal
grid $frm.lbl_server_desc -row 0 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_server_desc -row 0 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_host -row 1 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_host -row 1 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_port -row 2 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_port -row 2 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_ports_range -row 3 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_ports_range -row 3 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_ram_max -row 4 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_ram_max -row 4 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_ram_sec -row 5 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_ram_sec -row 5 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_ram_work -row 6 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_ram_work -row 6 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_base_on_process -row 7 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_base_on_process -row 7 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_connection_on_process -row 8 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_connection_on_process -row 8 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_manager_port -row 9 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_manager_port -row 9 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_manager_each_service -row 10 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_manager_each_service -row 10 -column 1 -sticky nw -padx 5 -pady 5
grid $frm.lbl_central_server -row 11 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_central_server -row 11 -column 1 -sticky nw -padx 5 -pady 5
#grid $frm.btn_ok -row 2 -column 1 -sticky nw -padx 5 -pady 5
#grid $frm.btn_cancel -row 2 -column 1 -sticky se -padx 5 -pady 5
grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1
set frm_btn [frame .add.frm_btn -border 0]
ttk::button $frm_btn.btn_ok -image add_grey_24 -command {
RunCommand "" "server insert \
--agent-host=[.add.frm.ent_host get] \
--agent-port=[.add.frm.ent_port get] \
--port-range=[.add.frm.ent_ports_range get] \
--name=[.add.frm.ent_server_desc get] \
--using=$using_central_server \
--infobases-limit=[.add.frm.ent_base_on_process get] \
--memory-limit=[.add.frm.ent_ram_work get] \
--connections-limit=[.add.frm.ent_connection_on_process get] \
--cluster-port=[.add.frm.ent_manager_port get] \
--dedicate-managers=$dedicate_manager \
--safe-working-processes-memory-limit=[.add.frm.ent_ram_max get] \
--safe-call-memory-limit=[.add.frm.ent_ram_sec get] \
--cluster=$active_cluster $host"
Run::servers $tree $host $active_cluster
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
}
proc Add::work_server {tree host values} {
Add::servers $tree $host $values
}
proc Add::infobase {tree host values} {
Add::infobases $tree $host $values
}
proc Add::infobases {tree host values} {
global default active_cluster
toplevel .add
wm title .add "Добавление информационной базы"
ttk::label .add.lbl -image add_database_grey_64
set frm [ttk::labelframe .add.frm -text "Добавление информационной базы" -labelanchor nw]
label $frm.lbl_host -text "Адрес сервера баз даннных"
entry $frm.ent_host
label $frm.lbl_db_user -text "Имя пользователя базы даннных"
entry $frm.ent_db_user
label $frm.lbl_db_pass -text "Пароль"
entry $frm.ent_db_pass
#$frm.ent_host insert end $host
label $frm.lbl_locale -text "Язык базы данных"
entry $frm.ent_locale
$frm.ent_locale insert end $default(locale)
label $frm.lbl_infobase_name -text "Имя информационной базы"
entry $frm.ent_infobase_name
label $frm.lbl_base_name -text "Имя базы данных"
entry $frm.ent_base_name
label $frm.lbl_base_type -text "Тип СУБД"
set combo [ttk::combobox $frm.cb_base_type -textvariable dbms -values $default(dbms)]]
grid $frm.lbl_host -row 0 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_host -row 0 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_db_user -row 1 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_db_user -row 1 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_db_pass -row 2 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_db_pass -row 2 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_locale -row 3 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_locale -row 3 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_infobase_name -row 4 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_infobase_name -row 4 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_base_name -row 5 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_base_name -row 5 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_base_type -row 6 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.cb_base_type -row 6 -column 1 -sticky nsew -padx 5 -pady 5
grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1
set active_cluster $values
set frm_btn [frame .add.frm_btn -border 0]
ttk::button $frm_btn.btn_ok -image add_grey_24 -command {
RunCommand "" "infobase create --create-database \
--name=[.add.frm.ent_infobase_name get] \
--dbms=$dbms \
--db-server=[.add.frm.ent_host get] \
--db-name=[.add.frm.ent_base_name get] \
--locale=[.add.frm.ent_locale get] \
--db-user=[.add.frm.ent_db_user get] \
--db-pwd=[.add.frm.ent_db_pass get] \
--cluster=$active_cluster $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
}
proc Add::cluster {tree host values} {
global default
toplevel .add
wm title .add "Добавление кластера"
ttk::label .add.lbl -image cluster_grey_64
set frm [ttk::labelframe .add.frm -text "Добавление кластера" -labelanchor nw]
label $frm.lbl_host -text "Адрес основного сервера"
entry $frm.ent_host
#$frm.ent_host insert end $host
label $frm.lbl_port -text "Порт"
entry $frm.ent_port
$frm.ent_port insert end $default(port)
label $frm.lbl_cluster_name -text "Название кластера"
entry $frm.ent_cluster_name
grid $frm.lbl_host -row 0 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_host -row 0 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_port -row 1 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_port -row 1 -column 1 -sticky nsew -padx 5 -pady 5
grid $frm.lbl_cluster_name -row 2 -column 0 -sticky nw -padx 5 -pady 5
grid $frm.ent_cluster_name -row 2 -column 1 -sticky nsew -padx 5 -pady 5
grid columnconfigure $frm 0 -weight 1
grid rowconfigure $frm 0 -weight 1
set frm_btn [frame .add.frm_btn -border 0]
ttk::button $frm_btn.btn_ok -image add_grey_24 -command {
RunCommand "" "cluster insert \
--host=[.add.frm.ent_host get] \
--port=[.add.frm.ent_port get] \
--name=[.add.frm.ent_cluster_name get] $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
}
proc SaveMainServer {host port} {
global dir
@ -501,5 +589,3 @@ proc SaveMainServer {host port} {
close $file
return "$host:$port"
}

View File

@ -53,16 +53,6 @@ source [file join $dir(work) rac_gui.cfg]
if [file exists [file join $dir(work) 1c_srv.cfg]] {
set f [open [file join $dir(work) 1c_srv.cfg] "RDONLY"]
while {[gets $f line] >=0} {
#puts $line
.frm_tree.tree insert {} end -id "server::$line" -text "$line" -values "$line"
}
} else {
#Add::main_server
}
#.frm_tree.tree insert {} end -id "server::$host" -text "$host" -values "$host:$port"
#.frm_tree.tree insert {} end -id "$host" -text "$host" -values "$host"
#RunCommand $host "cluster list $host $port"