File: server_instance_editor.h

package info (click to toggle)
mysql-workbench 5.2.40%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 53,880 kB
  • sloc: cpp: 419,850; yacc: 74,784; xml: 54,510; python: 31,455; sh: 9,423; ansic: 4,736; makefile: 2,442; php: 529; java: 237
file content (165 lines) | stat: -rw-r--r-- 4,675 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/* 
 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; version 2 of the
 * License.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301  USA
 */

#ifndef _SERVER_INSTANCE_EDITOR_H_
#define _SERVER_INSTANCE_EDITOR_H_


#include "workbench/wb_backend_public_interface.h"
#include "grts/structs.db.mgmt.h"

#include "grt/grt_manager.h"

#include "mforms/form.h"
#include "mforms/box.h"
#include "mforms/textentry.h"
#include "mforms/treeview.h"
#include "mforms/selector.h"
#include "mforms/button.h"
#include "mforms/tabview.h"
#include "mforms/radiobutton.h"
#include "mforms/checkbox.h"
#include "mforms/label.h"
#include "mforms/textbox.h"

class MYSQLWBBACKEND_PUBLIC_FUNC ServerInstanceEditor : public mforms::Form 
{ 
  bec::GRTManager *_grtm;
  
  db_mgmt_ManagementRef _mgmt;
  grt::ListRef<db_mgmt_ServerInstance> _instances;
  
  
  mforms::Box _top_vbox;
  mforms::Box _top_hbox;
  
  mforms::TextEntry _name_entry;
  
  mforms::Box _content_box;
  
  mforms::Box    _inst_list_buttons_hbox;
  mforms::Button _add_inst_button;
  mforms::Button _del_inst_button;
  mforms::Button _dup_inst_button;
  mforms::Button _move_up_button;
  mforms::Button _move_down_button;
  mforms::TreeView _stored_instance_list;
  
  mforms::TabView _tabview;
  mforms::Box _conn_box;
  
  mforms::Selector _connection_selector;
  mforms::TextEntry _server_version;

  mforms::RadioButton _no_remote_admin;
  mforms::RadioButton _win_remote_admin;
  mforms::RadioButton _ssh_remote_admin;

  mforms::Box _remote_param_box;
  mforms::TextEntry _remote_host;  
  mforms::TextEntry _ssh_port;
  mforms::TextEntry _remote_user;
  mforms::Box _password_box;
  mforms::Button _password_set;
  mforms::Button _password_clear;
  mforms::CheckBox _ssh_usekey;
  mforms::TextEntry _ssh_keypath;

  mforms::Button _autodetect_button;
  
  mforms::Box _sys_box;
  mforms::Selector _os_type;
  mforms::Selector _sys_profile_type;
  mforms::TextEntry _sys_config_path;
  mforms::TextEntry _sys_myini_section;
  mforms::Label *_sys_win_service_name_label;
  mforms::TextEntry _sys_win_service_name;
  mforms::Button _sys_config_path_browse;
  mforms::Label _sys_win_hint_label;
  
  mforms::Label _details_description;
  mforms::TabView _details_tabview;
  mforms::TextEntry _start_cmd;
  mforms::TextEntry _stop_cmd;
  mforms::TextEntry _status_cmd;
  mforms::CheckBox _sudo_check;
  mforms::CheckBox _sudo_status_check;
  mforms::Selector _sudo_cmd;
  
  mforms::TextBox _script_text;
  
//  mforms::Button _save_preset_button;
//  mforms::Button _delete_preset_button;
  
  mforms::Box _bottom_hbox;
  mforms::Button _ok_button;
  mforms::Button _test_button;
  
  std::map<std::string, std::vector<std::pair<std::string,grt::DictRef> > > _presets;
  
  db_mgmt_ServerInstanceRef selected_instance();
  
  void open_editor(bool edit_selected);
  void autodetect_system();
  void test_settings();
  
  void check_version();
  
  void toggle_administration();

  grt::DictRef get_preset(const std::string& system, const std::string& preset_name);
  
  void entry_changed(mforms::TextEntry *sender);
  void selector_changed(mforms::Selector *sender);
  void check_changed(mforms::CheckBox *check);
  void text_changed(mforms::TextBox *text);

//  void button_clicked(mforms::Button *button);
  void browse_file();
  void show_instance();
  void add_instance();
  void delete_instance();
  void duplicate_instance();
  void reorder_instance(bool up);
  
  void instance_changed();

  void system_type_changed();
  void connection_changed();
  void profile_changed();
  
  void refresh_options();
  
  void refresh_profile_list();
  void refresh_instance_list();

  void set_password(bool clear);
  
  void show_filter_help();
  void run_filters_debugger();
  void run_filechooser(mforms::TextEntry* entry);
  void run_filechooser_wrapper(mforms::TextEntry* entry); // Allows to run local or remote file selector
public:
  ServerInstanceEditor(bec::GRTManager *grtm, const db_mgmt_ManagementRef &mgmt);
  
  db_mgmt_ServerInstanceRef run();
};


#endif /* _SERVER_INSTANCE_EDITOR_H_ */