/
index.twig
331 lines (301 loc) · 12 KB
/
index.twig
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
<div class="container-fluid">
<div class="row">
<h2>
{{ get_image('s_db') }}
{% if has_statistics %}
{% trans 'Databases statistics' %}
{% else %}
{% trans 'Databases' %}
{% endif %}
</h2>
</div>
{% if is_create_database_shown %}
<div class="row">
<ul>
<li id="li_create_database" class="no_bullets">
{% if has_create_database_privileges %}
<form method="post" action="{{ url('/server/databases/create') }}" id="create_database_form" class="ajax">
<p>
<strong>
<label for="text_create_db">
{{ get_image('b_newdb') }}
{% trans 'Create database' %}
</label>
{{ show_mysql_docu('CREATE_DATABASE') }}
</strong>
</p>
{{ get_hidden_inputs('', '', 5) }}
<input type="hidden" name="reload" value="1">
{% if has_statistics %}
<input type="hidden" name="statistics" value="1">
{% endif %}
<input type="text" name="new_db" maxlength="64" class="textfield" value="
{{- database_to_create }}" id="text_create_db" placeholder="
{%- trans 'Database name' %}" required>
{% if charsets is not empty %}
<select lang="en" dir="ltr" name="db_collation">
<option value="">{% trans 'Collation' %}</option>
<option value=""></option>
{% for charset in charsets %}
<optgroup label="{{ charset.name }}" title="{{ charset.description }}">
{% for collation in charset.collations %}
<option value="{{ collation.name }}" title="{{ collation.description }}"{{ collation.is_selected ? ' selected' }}>
{{- collation.name -}}
</option>
{% endfor %}
</optgroup>
{% endfor %}
</select>
{% endif %}
<input id="buttonGo" class="btn btn-primary" type="submit" value="{% trans 'Create' %}">
</form>
{% else %}
<p>
<strong>
{{ get_image('b_newdb') }}
{% trans 'Create database' %}
{{ show_mysql_docu('CREATE_DATABASE') }}
</strong>
</p>
<span class="noPrivileges">
{{ get_image('s_error', '', {
'hspace': 2,
'border': 0,
'align': 'middle'
}) }}
{% trans 'No privileges to create databases' %}
</span>
{% endif %}
</li>
</ul>
</div>
{% endif %}
{% if database_count > 0 %}
{% include 'filter.twig' with {'filter_value': ''} only %}
<div id="tableslistcontainer row">
<div class="container-fluid">
{{ get_list_navigator(
database_count,
pos,
url_params,
url('/server/databases'),
'frame_content',
max_db_list
) }}
<form class="ajax" action="{{ url('/server/databases') }}" method="post" name="dbStatsForm" id="dbStatsForm">
{{ get_hidden_inputs(url_params) }}
<div class="responsivetable row">
<table id="tabledatabases" class="data">
<thead>
<tr>
{% if is_drop_allowed %}
<th></th>
{% endif %}
<th>
<a href="{{ url('/server/databases', url_params|merge({
'sort_by': 'SCHEMA_NAME',
'sort_order': url_params.sort_by == 'SCHEMA_NAME'
and url_params.sort_order == 'asc' ? 'desc' : 'asc'
})) }}">
{% trans 'Database' %}
{% if url_params.sort_by == 'SCHEMA_NAME' %}
{% if url_params.sort_order == 'asc' %}
{{ get_image('s_asc', 'Ascending'|trans) }}
{% else %}
{{ get_image('s_desc', 'Descending'|trans) }}
{% endif %}
{% endif %}
</a>
</th>
<th>
<a href="{{ url('/server/databases', url_params|merge({
'sort_by': 'DEFAULT_COLLATION_NAME',
'sort_order': url_params.sort_by == 'DEFAULT_COLLATION_NAME'
and url_params.sort_order == 'asc' ? 'desc' : 'asc'
})) }}">
{% trans 'Collation' %}
{% if url_params.sort_by == 'DEFAULT_COLLATION_NAME' %}
{% if url_params.sort_order == 'asc' %}
{{ get_image('s_asc', 'Ascending'|trans) }}
{% else %}
{{ get_image('s_desc', 'Descending'|trans) }}
{% endif %}
{% endif %}
</a>
</th>
{% if has_statistics %}
{% for name, statistic in header_statistics %}
<th{{ statistic.format == 'byte' ? ' colspan="2"' }}>
<a href="{{ url('/server/databases', url_params|merge({
'sort_by': name,
'sort_order': url_params.sort_by == name
and url_params.sort_order == 'asc' ? 'desc' : 'asc'
})) }}">
{{ statistic.title }}
{% if url_params.sort_by == name %}
{% if url_params.sort_order == 'asc' %}
{{ get_image('s_asc', 'Ascending'|trans) }}
{% else %}
{{ get_image('s_desc', 'Descending'|trans) }}
{% endif %}
{% endif %}
</a>
</th>
{% endfor %}
{% endif %}
{% if has_master_replication %}
<th>{% trans 'Master replication' %}</th>
{% endif %}
{% if has_slave_replication %}
<th>{% trans 'Slave replication' %}</th>
{% endif %}
<th>{% trans 'Action' %}</th>
</tr>
</thead>
<tbody>
{% for database in databases %}
<tr class="db-row{{ database.is_system_schema or database.is_pmadb ? ' noclick' }}" data-filter-row="{{ database.name|upper }}">
{% if is_drop_allowed %}
<td class="tool">
<input type="checkbox" name="selected_dbs[]" class="checkall" title="
{{- database.name }}" value="
{{- database.name }}"
{{- database.is_system_schema or database.is_pmadb ? ' disabled' }}>
</td>
{% endif %}
<td class="name">
<a href="{{ database.url }}" title="
{{- "Jump to database '%s'"|trans|format(database.name) }}">
{{ database.name }}
</a>
</td>
<td class="value">
<dfn title="{{ database.collation.description }}">
{{ database.collation.name }}
</dfn>
</td>
{% if has_statistics %}
{% for statistic in database.statistics %}
{% if statistic.format is same as('byte') %}
{% set value = format_byte_down(statistic.raw, 3, 1) %}
<td class="value">
<data value="{{ statistic.raw }}" title="{{ statistic.raw }}">
{{ value[0] }}
</data>
</td>
<td class="unit">{{ value[1] }}</td>
{% else %}
<td class="value">
<data value="{{ statistic.raw }}" title="{{ statistic.raw }}">
{{ format_number(statistic.raw, 0) }}
</data>
</td>
{% endif %}
{% endfor %}
{% endif %}
{% if database.replication.master.status %}
{% if database.replication.master.is_replicated %}
<td class="tool text-center">
{{ get_icon('s_success', 'Replicated'|trans) }}
</td>
{% else %}
<td class="tool text-center">
{{ get_icon('s_cancel', 'Not replicated'|trans) }}
</td>
{% endif %}
{% endif %}
{% if database.replication.slave.status %}
{% if database.replication.slave.is_replicated %}
<td class="tool text-center">
{{ get_icon('s_success', 'Replicated'|trans) }}
</td>
{% else %}
<td class="tool text-center">
{{ get_icon('s_cancel', 'Not replicated'|trans) }}
</td>
{% endif %}
{% endif %}
<td class="tool">
<a class="server_databases" data="
{{- database.name|js_format }}" href="{{ url('/server/privileges', {
'db': database.name,
'checkprivsdb': database.name
}) }}" title="
{{- 'Check privileges for database "%s".'|trans|format(database.name) }}">
{{ get_icon('s_rights', 'Check privileges'|trans) }}
</a>
</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th colspan="{{ is_drop_allowed ? '3' : '2' }}">
{% trans 'Total:' %}
<span id="filter-rows-count">
{{- database_count -}}
</span>
</th>
{% if has_statistics %}
{% for statistic in total_statistics %}
{% if statistic.format is same as('byte') %}
{% set value = format_byte_down(statistic.raw, 3, 1) %}
<th class="value">
<data value="{{ statistic.raw }}" title="{{ statistic.raw }}">
{{ value[0] }}
</data>
</th>
<th class="unit">{{ value[1] }}</th>
{% else %}
<th class="value">
<data value="{{ statistic.raw }}" title="{{ statistic.raw }}">
{{ format_number(statistic.raw, 0) }}
</data>
</th>
{% endif %}
{% endfor %}
{% endif %}
{% if has_master_replication %}
<th></th>
{% endif %}
{% if has_slave_replication %}
<th></th>
{% endif %}
<th></th>
</tr>
</tfoot>
</table>
</div>
{# Footer buttons #}
{% if is_drop_allowed %}
{% include 'select_all.twig' with {
'pma_theme_image': pma_theme_image,
'text_dir': text_dir,
'form_name': 'dbStatsForm'
} only %}
<button class="btn btn-link mult_submit ajax" type="submit" name="" value="Drop" title="{% trans 'Drop' %}">
{{ get_icon('b_deltbl', 'Drop'|trans) }}
</button>
{% endif %}
{# Enable statistics #}
{% if not has_statistics %}
<div class="row">
{{ 'Note: Enabling the database statistics here might cause heavy traffic between the web server and the MySQL server.'|trans|notice }}
</div>
<div class="row">
<ul>
<li class="li_switch_dbstats">
<a href="{{ url('/server/databases') }}" data-post="{{ get_common({'statistics': '1'}, '') }}" title="{% trans 'Enable statistics' %}">
<strong>{% trans 'Enable statistics' %}</strong>
</a>
</li>
</ul>
</div>
{% endif %}
</form>
</div>
</div>
</div>
{% else %}
<p>{{ 'No databases'|trans|notice }}</p>
{% endif %}