File: database_manager.html

package info (click to toggle)
oca-core 11.0.20180730-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 509,684 kB
  • sloc: xml: 258,806; python: 164,081; sql: 217; sh: 92; makefile: 16
file content (357 lines) | stat: -rw-r--r-- 15,652 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
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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <title>Odoo</title>
  <link rel="shortcut icon" href="/web/static/src/img/favicon.ico" type="image/x-icon">
  <link rel="stylesheet" href="/web/static/lib/fontawesome/css/font-awesome.css">
  <link rel="stylesheet" href="/web/static/lib/bootstrap/css/bootstrap.css">
  <script src="/web/static/lib/jquery/jquery.js" type="text/javascript"></script>
  <script src="/web/static/lib/bootstrap/js/modal.js"></script>
  <script src="/web/static/lib/bootstrap/js/tooltip.js"></script>
  <script src="/web/static/lib/bootstrap/js/dropdown.js"></script>
  <script type="text/javascript">
  $(function() {
      // Little eye
      $('body').on('mousedown','.o_little_eye',function(ev) {
          $(ev.target).siblings('input').prop('type','text');
      });
      $('body').on('mouseup','.o_little_eye',function(ev) {
          $(ev.target).siblings('input').prop('type','password');
      });
      // db modal
      $('body').on('click','.o_database_action', function(ev) {
          ev.preventDefault();
          var db = $(ev.currentTarget).data('db');
          var target = $(ev.currentTarget).data('target');
          $(target).find('input[name=name]').val(db);
          $(target).modal();
      });
      // close modal on submit
      $('.modal').on('click','input[type="submit"]', function(ev) {
          var modal  = $(this).parentsUntil('body', '.modal');
          if (modal.hasClass('o_database_backup')) {
            $(modal).modal('hide');
            if (!$('.alert-backup-long').length) {
              $('.list-group').before("<div class='alert alert-info alert-backup-long'>The backup may take some time before being ready</div>");              
            }
          }
      });
  });
  </script>
</head>

{% macro master_input() -%}
  <div class="form-group">
    {% if insecure %}
      <input type="hidden" name="master_pwd" class="form-control" value="admin"/>
    {% else %}
      <label for="master_pwd" class="control-label">Master Password</label>
      <input id="master_pwd" type="password" name="master_pwd" class="form-control" required="required" autofocus="autofocus"/>
    {% endif %}
  </div>
{%- endmacro %}

{% macro create_form() -%}
  <p>Odoo is up and running! <br />
  Fill out this form to create a new database. You will install your first app afterwards.</p>
  {{ master_input() }}
  <div class="form-group">
    <div class="row">
      <div class="col-md-12">
        <label for="name" class="control-label">Database Name</label>
        <input id="name" type="text" name="name" class="form-control" required="required" autocomplete="off" pattern="{{ pattern }}" title="Only alphanumerical characters, underscore, hyphen and dot are allowed"/>
      </div>
    </div>
  </div>
  <div class="form-group">
    <div class="row">
      <div class="col-md-12">
        <label for="login" class="control-label">Email</label>
        <input id="login" type="text" name="login" class="form-control" required="required" autocomplete="off"/>
      </div>
    </div>
  </div>
  <div class="form-group has-feedback">
    <label for="password" class="control-label">Password</label>
    <input id="password" type="password" name="password" class="form-control" required="required" autocomplete="off"/>
    <span class="fa fa-eye o_little_eye form-control-feedback" aria-hidden="true" style="cursor: pointer; pointer-events: auto"></span>
  </div>
  <div class="form-group">
    <div class="row">
      <div class="col-md-6">
        <label for="lang" class="control-label">Language</label>
        <select id="lang" name="lang" class="form-control" required="required" autocomplete="off">
          {% for lang in langs %}
              <option {% if lang[0] == "en_US" %}selected="selected" {% endif %}value="{{ lang[0] }}">{{ lang[1] }}</option>
          {% endfor %}
        </select>
      </div>
      <div class="col-md-6">
          <label for="country" class="control-label">Country</label>
          <select id="country" name="country_code" class="form-control" autocomplete="off">
              <option value=""></option>
            {% for country in countries %}
              <option value="{{ country[0] }}">{{ country[1] }}</option>
            {% endfor %}
            </select>
        </div>
    </div>
  </div>
  <div class="form-group">
    <div class="checkbox">
      <label>
        <input name="demo" type="checkbox" class="pull-right" value="1">
        <span>Load demonstration data</span>
        <span class="text-muted"> (Check this box to evaluate Odoo)</span>
      </label>
    </div>
  </div>
{%- endmacro %}

<body class="container">
  <!-- Database List -->
  <div class="row">
    <div class="col-md-6 col-md-offset-3 o_database_list">
      <div class="text-center">
        <img src="/web/static/src/img/logo2.png" class="img-responsive center-block"/>
      </div>
      {% if not list_db %}
      <div class="alert alert-danger text-center">
      The database manager has been disabled by the administrator
      </div>
      {% elif insecure and databases %}
      <div class="alert alert-warning">
      Warning, your Odoo database manager is not protected.
      Please <a href="#" data-toggle="modal" data-target=".o_database_master">set a master password</a>
      to secure it.
      </div>
      {% endif %}
      {% if error %}
      <div class="alert alert-danger">{{ error }}</div>
      {% endif %}
      {% if list_db and databases %}
        <div class="list-group">
          {% for db in databases %}
          <a href="/web?db={{ db }}" class="list-group-item" >
            {% if db in incompatible_databases %}
              <i class="icon fa fa-warning pull-right text-warning" title="This database may not be compatible"></i>
            {% endif %}
            {{ db }}
            {% if manage %}
            <div class="text-right pull-right">
            <span data-db="{{ db }}" data-target=".o_database_backup" class="o_database_action btn-link"><i class="fa fa-floppy-o fa-fw"></i> Backup</span>
            <span data-db="{{ db }}" data-target=".o_database_duplicate" class="o_database_action btn-link"><i class="fa fa-files-o fa-fw"></i> Duplicate</span>
            <span data-db="{{ db }}" data-target=".o_database_delete" class="o_database_action btn-link"><i class="fa fa-trash-o fa-fw"></i> Delete</span>
            </div>
            {% endif %}
          </a>
          {% endfor %}
        </div>
        {% if manage %}
        <div class="text-left">
          <button type="button" data-toggle="modal" data-target=".o_database_create" class="btn btn-sm btn-primary">
            Create Database
          </button>
          <button type="button" data-toggle="modal" data-target=".o_database_restore" class="btn btn-sm btn-primary">
            Restore Database
          </button>
          <button type="button" data-toggle="modal" data-target=".o_database_master" class="btn btn-sm btn-primary">
            Set Master Password
          </button>
        </div>
        {% else %}
        <div class="text-center">
          <a href="/web/database/manager">Manage databases</a>
        </div>
        {% endif %}
      {% elif list_db %}
        <form role="form" action="/web/database/create" method="post">
          {{ create_form() }}
          <input type="submit" value="Create database" class="btn btn-primary pull-left"/>
        </form>
        <a role="button" data-toggle="modal" data-target=".o_database_restore" class="btn btn-link">
          or restore a database
        </a>
      {% endif %}
    </div>
  </div>

  <!-- Create -->
  <div class="modal fade o_database_create" role="dialog">
    <div class="modal-dialog">
      <div class="modal-content">
        <form role="form" action="/web/database/create" method="post">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title">Create Database</h4>
          </div>
          <div class="modal-body">
            {{ create_form() }}
          </div>
          <div class="modal-footer">
            <input type="submit" value="Continue" class="btn btn-primary pull-right"/>
          </div>
        </form>
      </div>
    </div>
  </div>

  <!-- Restore -->
  <div class="modal fade o_database_restore" role="dialog">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h4 class="modal-title">Restore Database</h4>
        </div>
        <form id="form_restore_db" role="form" action="/web/database/restore" method="post" enctype="multipart/form-data">
          <div class="modal-body">
            {{ master_input() }}
            <div class="form-group">
              <label for="backup_file" class="control-label">File</label>
              <input id="backup_file" type="file" name="backup_file" class="required"/>
            </div>
            <div class="form-group">
              <label for="name" class="control-label">Database Name</label>
              <input id="name" type="text" name="name" class="form-control" required="required" pattern="{{ pattern }}" title="Only alphanumerical characters, underscore, hyphen and dot are allowed"/>
            </div>
            <div class="form-group">
                <label for="copy">This database might have been moved or copied.</label>
                <p class="help-block">In order to avoid conflicts between databases, Odoo needs to know if this database was moved or copied.
                If you don't know, answer "This database is a copy".</p>
              <div class="radio">
                <label>
                  <input name="copy" type="radio" class="pull-right" value="true" checked="1">
                  This database is a copy
                </label>
              </div>
              <div class="radio">
                <label>
                  <input name="copy" type="radio" class="pull-right" value="false">
                  This database was moved
                </label>
              </div>
            </div>
          </div>
          <div class="modal-footer">
            <input type="submit" value="Continue" class="btn btn-primary pull-right"/>
          </div>
        </form>
      </div>
    </div>
  </div>


  <!-- Master password -->
  <div class="modal fade o_database_master" role="dialog">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h4 class="modal-title">Set Master Password</h4>
        </div>
        <form id="form_change_pwd" role="form" action="/web/database/change_password" method="post">
          <div class="modal-body">
            <p>The master password is required to create, delete, dump or restore databases.</p>
            {{ master_input() }}
            <div class="form-group has-feedback">
              <label for="master_pwd_new" class="control-label">New Master Password</label>
              <input id="master_pwd_new" type="password" name="master_pwd_new" class="form-control" required="required" autocomplete="off"/>
              <span class="fa fa-eye o_little_eye form-control-feedback" aria-hidden="true" style="cursor: pointer; pointer-events: auto"></span>
            </div>
          </div>
          <div class="modal-footer">
            <input type="submit" value="Continue" class="btn btn-primary pull-right"/>
          </div>
        </form>
      </div>
    </div>
  </div>


  <!-- Duplicate DB -->
  <div class="modal fade o_database_duplicate" role="dialog">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">Duplicate Database</h4>
        </div>
        <form id="form-duplicate-db" role="form" action="/web/database/duplicate" method="post">
          <div class="modal-body">
            {{ master_input() }}
            <div class="form-group">
              <label for="name" class="control-label">Database Name</label>
              <input id="name" type="text" name="name" class="form-control" required="required" readonly="readonly"/>
            </div>
            <div class="form-group">
              <label for="new_name" class="control-label">New Name</label>
              <input id="new_name" type="text" name="new_name" class="form-control" required="required" pattern="{{ pattern }}" title="Only alphanumerical characters, underscore, hyphen and dot are allowed"/>
            </div>
          </div>
          <div class="modal-footer">
          <input type="submit" value="Continue" class="btn btn-primary pull-right"/>
          </div>
        </form>
      </div>
    </div>
  </div>

  <!-- Drop DB -->
  <div class="modal fade o_database_delete" role="dialog">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h4 class="modal-title">Delete Database</h4>
        </div>
        <form id="form_drop_db" role="form" action="/web/database/drop" method="post">
          <div class="modal-body">
            {{ master_input() }}
            <div class="form-group">
              <label for="name" class="control-label">Database</label>
              <input id="name" type="text" name="name" class="form-control" required="required" readonly="readonly"/>
            </div>
          </div>
          <div class="modal-footer">
            <input type="submit" value="Delete" class="btn btn-primary pull-right"/>
          </div>
        </form>
      </div>
    </div>
  </div>

  <!-- Backup DB -->
  <div class="modal fade o_database_backup" role="dialog">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">Backup Database</h4>
        </div>
        <form id="form_backup_db" role="form" action="/web/database/backup" method="post">
          <div class="modal-body">
            {{ master_input() }}
            <div class="form-group">
              <label for="name" class="control-label">Database Name</label>
              <input id="name" type="text" name="name" class="form-control" required="required" readonly="readonly"/>
            </div>
            <div class="form-group">
              <label for="backup_format" class="control-label">Backup Format</label>
              <select id="backup_format" name="backup_format" class="form-control" required="required">
                <option value="zip">zip (includes filestore)</option>
                <option value="dump">pg_dump custom format (without filestore)</option>
              </select>
            </div>
          </div>
          <div class="modal-footer">
          <input type="submit" value="Backup" class="btn btn-primary pull-right"/>
          </div>
        </form>
      </div>
    </div>
  </div>

</body>
</html>