File: server_instance_editor.h

package info (click to toggle)
mysql-workbench 6.3.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 113,932 kB
  • ctags: 87,814
  • sloc: ansic: 955,521; cpp: 427,465; python: 59,728; yacc: 59,129; xml: 54,204; sql: 7,091; objc: 965; makefile: 638; sh: 613; java: 237; perl: 30; ruby: 6; php: 1
file content (161 lines) | stat: -rw-r--r-- 4,790 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
/* 
 * Copyright (c) 2009, 2015, 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 "grtui/grtdb_connect_panel.h"

#include "grt/grt_manager.h"

#include "mforms/form.h"
#include "mforms/box.h"
#include "mforms/textentry.h"
#include "mforms/treenodeview.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_Connection> _connections;
  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::TreeNodeView _stored_connection_list;
  
  mforms::TabView _tabview;

  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::Panel _details_panel;
  mforms::TextEntry _start_cmd;
  mforms::TextEntry _stop_cmd;
  mforms::CheckBox _sudo_check;
  mforms::Label _sudo_description;
  mforms::Box _custom_sudo_box;
  mforms::TextEntry _sudo_prefix;
  
  grtui::DbConnectPanel *_connect_panel;
  
//  mforms::Button _save_preset_button;
//  mforms::Button _delete_preset_button;
  
  mforms::Box _bottom_hbox;
  mforms::Box _remote_admin_box;
  mforms::Button _close_button;
  mforms::Button _test_button;
  
  std::map<std::string, std::vector<std::pair<std::string,grt::DictRef> > > _presets;

  db_mgmt_ConnectionRef selected_connection();
  db_mgmt_ServerInstanceRef selected_instance();
  
  void autodetect_system();
  void test_settings();
    
  void toggle_administration();

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

//  void button_clicked(mforms::Button *button);
  void browse_file();
  void show_connection();
  void show_instance_info(db_mgmt_ConnectionRef connection, db_mgmt_ServerInstanceRef instance);
  void add_instance();
  void delete_instance();
  void duplicate_instance();
  void reorder_instance(bool up);

  void system_type_changed();
  void profile_changed();
    
  void refresh_profile_list();
  void refresh_connection_list();

  void tab_changed();

  void driver_changed_cb(const db_mgmt_DriverRef &driver);

  void set_password(bool clear);
  
  void run_filechooser(mforms::TextEntry* entry);
  void run_filechooser_wrapper(mforms::TextEntry* entry); // Allows to run local or remote file selector

  void reset_setup_pending();
public:
  ServerInstanceEditor(bec::GRTManager *grtm, const db_mgmt_ManagementRef &mgmt);
  virtual ~ServerInstanceEditor();
  
  db_mgmt_ServerInstanceRef run(db_mgmt_ConnectionRef select_connection = db_mgmt_ConnectionRef(), bool select_admin = false);
};


#endif /* _SERVER_INSTANCE_EDITOR_H_ */