]> git.proxmox.com Git - proxmox-widget-toolkit.git/blame - Utils.js
task view, progress: add taskDone callback
[proxmox-widget-toolkit.git] / Utils.js
CommitLineData
0bb29d35
DM
1Ext.ns('Proxmox');
2Ext.ns('Proxmox.Setup');
3
757cc58a
DM
4if (!Ext.isDefined(Proxmox.Setup.auth_cookie_name)) {
5 throw "Proxmox library not initialized";
0bb29d35
DM
6}
7
8// avoid errors related to Accessible Rich Internet Applications
9// (access for people with disabilities)
10// TODO reenable after all components are upgraded
11Ext.enableAria = false;
12Ext.enableAriaButtons = false;
13Ext.enableAriaPanels = false;
14
15// avoid errors when running without development tools
16if (!Ext.isDefined(Ext.global.console)) {
17 var console = {
18 dir: function() {},
19 log: function() {}
20 };
21}
22
23Ext.Ajax.defaultHeaders = {
24 'Accept': 'application/json'
25};
26
27Ext.Ajax.on('beforerequest', function(conn, options) {
28 if (Proxmox.CSRFPreventionToken) {
29 if (!options.headers) {
30 options.headers = {};
31 }
32 options.headers.CSRFPreventionToken = Proxmox.CSRFPreventionToken;
33 }
34});
35
36Ext.define('Proxmox.Utils', { utilities: {
37
38 // this singleton contains miscellaneous utilities
39
30f885cb
DM
40 yesText: gettext('Yes'),
41 noText: gettext('No'),
42 enabledText: gettext('Enabled'),
43 disabledText: gettext('Disabled'),
44 noneText: gettext('none'),
45 errorText: gettext('Error'),
a58001dd 46 unknownText: gettext('Unknown'),
30f885cb
DM
47 defaultText: gettext('Default'),
48 daysText: gettext('days'),
49 dayText: gettext('day'),
50 runningText: gettext('running'),
51 stoppedText: gettext('stopped'),
52 neverText: gettext('never'),
53 totalText: gettext('Total'),
54 usedText: gettext('Used'),
55 directoryText: gettext('Directory'),
56 stateText: gettext('State'),
57 groupText: gettext('Group'),
58
f6f0066a 59 language_map: {
f97a2a34
DC
60 zh_CN: 'Chinese',
61 ca: 'Catalan',
62 da: 'Danish',
f6f0066a 63 en: 'English',
f97a2a34 64 eu: 'Euskera (Basque)',
f6f0066a
DM
65 fr: 'French',
66 de: 'German',
67 it: 'Italian',
f97a2a34
DC
68 es: 'Spanish',
69 ja: 'Japanese',
70 nb: 'Norwegian (Bokmal)',
71 nn: 'Norwegian (Nynorsk)',
72 fa: 'Persian (Farsi)',
73 pl: 'Polish',
74 pt_BR: 'Portuguese (Brazil)',
75 ru: 'Russian',
76 sl: 'Slovenian',
77 sv: 'Swedish',
78 tr: 'Turkish'
f6f0066a
DM
79 },
80
81 render_language: function (value) {
82 if (!value) {
83 return Proxmox.Utils.defaultText + ' (English)';
84 }
85 var text = Proxmox.Utils.language_map[value];
86 if (text) {
87 return text + ' (' + value + ')';
88 }
89 return value;
90 },
91
92 language_array: function() {
93 var data = [['__default__', Proxmox.Utils.render_language('')]];
94 Ext.Object.each(Proxmox.Utils.language_map, function(key, value) {
95 data.push([key, Proxmox.Utils.render_language(value)]);
96 });
97
98 return data;
99 },
100
5f93e010
DM
101 getNoSubKeyHtml: function(url) {
102 // url http://www.proxmox.com/products/proxmox-ve/subscription-service-plans
103 return Ext.String.format('You do not have a valid subscription for this server. Please visit <a target="_blank" href="{0}">www.proxmox.com</a> to get a list of available options.', url || 'http://www.proxmox.com');
104 },
105
b0d9b5d1
DM
106 format_boolean_with_default: function(value) {
107 if (Ext.isDefined(value) && value !== '__default__') {
108 return value ? Proxmox.Utils.yesText : Proxmox.Utils.noText;
109 }
110 return Proxmox.Utils.defaultText;
111 },
112
113 format_boolean: function(value) {
114 return value ? Proxmox.Utils.yesText : Proxmox.Utils.noText;
115 },
116
117 format_neg_boolean: function(value) {
118 return !value ? Proxmox.Utils.yesText : Proxmox.Utils.noText;
119 },
a58001dd 120
0e49da6d
DM
121 format_enabled_toggle: function(value) {
122 return value ? Proxmox.Utils.enabledText : Proxmox.Utils.disabledText;
123 },
124
2d0153a5
DM
125 format_expire: function(date) {
126 if (!date) {
127 return Proxmox.Utils.neverText;
128 }
129 return Ext.Date.format(date, "Y-m-d");
130 },
131
452892df
DM
132 format_duration_long: function(ut) {
133
134 var days = Math.floor(ut / 86400);
135 ut -= days*86400;
136 var hours = Math.floor(ut / 3600);
137 ut -= hours*3600;
138 var mins = Math.floor(ut / 60);
139 ut -= mins*60;
140
141 var hours_str = '00' + hours.toString();
142 hours_str = hours_str.substr(hours_str.length - 2);
143 var mins_str = "00" + mins.toString();
144 mins_str = mins_str.substr(mins_str.length - 2);
145 var ut_str = "00" + ut.toString();
146 ut_str = ut_str.substr(ut_str.length - 2);
147
148 if (days) {
149 var ds = days > 1 ? Proxmox.Utils.daysText : Proxmox.Utils.dayText;
150 return days.toString() + ' ' + ds + ' ' +
151 hours_str + ':' + mins_str + ':' + ut_str;
152 } else {
153 return hours_str + ':' + mins_str + ':' + ut_str;
154 }
155 },
156
02ef30c9
DM
157 format_subscription_level: function(level) {
158 if (level === 'c') {
8f5a1a08 159 return 'Community';
02ef30c9 160 } else if (level === 'b') {
8f5a1a08 161 return 'Basic';
02ef30c9 162 } else if (level === 's') {
8f5a1a08 163 return 'Standard';
02ef30c9 164 } else if (level === 'p') {
8f5a1a08 165 return 'Premium';
02ef30c9
DM
166 } else {
167 return Proxmox.Utils.noneText;
168 }
169 },
170
28e54f37
DM
171 compute_min_label_width: function(text, width) {
172
173 if (width === undefined) { width = 100; }
174
175 var tm = new Ext.util.TextMetrics();
176 var min = tm.getWidth(text + ':');
177
178 return min < width ? width : min;
179 },
180
0bb29d35
DM
181 authOK: function() {
182 return (Proxmox.UserName !== '') && Ext.util.Cookies.get(Proxmox.Setup.auth_cookie_name);
183 },
184
185 authClear: function() {
186 Ext.util.Cookies.clear(Proxmox.Setup.auth_cookie_name);
187 },
188
189 // comp.setLoading() is buggy in ExtJS 4.0.7, so we
190 // use el.mask() instead
191 setErrorMask: function(comp, msg) {
192 var el = comp.el;
193 if (!el) {
194 return;
195 }
196 if (!msg) {
197 el.unmask();
198 } else {
199 if (msg === true) {
200 el.mask(gettext("Loading..."));
201 } else {
202 el.mask(msg);
203 }
204 }
205 },
206
5b4b3ffd
DM
207 monStoreErrors: function(me, store, clearMaskBeforeLoad) {
208 if (clearMaskBeforeLoad) {
209 me.mon(store, 'beforeload', function(s, operation, eOpts) {
210 Proxmox.Utils.setErrorMask(me, false);
e94c0767 211 });
5b4b3ffd
DM
212 } else {
213 me.mon(store, 'beforeload', function(s, operation, eOpts) {
214 if (!me.loadCount) {
215 me.loadCount = 0; // make sure it is numeric
216 Proxmox.Utils.setErrorMask(me, true);
217 }
218 });
219 }
0bb29d35
DM
220
221 // only works with 'proxmox' proxy
222 me.mon(store.proxy, 'afterload', function(proxy, request, success) {
223 me.loadCount++;
224
225 if (success) {
226 Proxmox.Utils.setErrorMask(me, false);
227 return;
228 }
229
230 var msg;
231 /*jslint nomen: true */
232 var operation = request._operation;
233 var error = operation.getError();
234 if (error.statusText) {
235 msg = error.statusText + ' (' + error.status + ')';
236 } else {
237 msg = gettext('Connection error');
238 }
239 Proxmox.Utils.setErrorMask(me, msg);
240 });
241 },
242
243 extractRequestError: function(result, verbose) {
244 var msg = gettext('Successful');
245
246 if (!result.success) {
247 msg = gettext("Unknown error");
248 if (result.message) {
249 msg = result.message;
250 if (result.status) {
251 msg += ' (' + result.status + ')';
252 }
253 }
254 if (verbose && Ext.isObject(result.errors)) {
255 msg += "<br>";
256 Ext.Object.each(result.errors, function(prop, desc) {
257 msg += "<br><b>" + Ext.htmlEncode(prop) + "</b>: " +
258 Ext.htmlEncode(desc);
259 });
260 }
261 }
262
263 return msg;
264 },
265
266 // Ext.Ajax.request
267 API2Request: function(reqOpts) {
268
269 var newopts = Ext.apply({
270 waitMsg: gettext('Please wait...')
271 }, reqOpts);
272
273 if (!newopts.url.match(/^\/api2/)) {
274 newopts.url = '/api2/extjs' + newopts.url;
275 }
276 delete newopts.callback;
277
278 var createWrapper = function(successFn, callbackFn, failureFn) {
279 Ext.apply(newopts, {
280 success: function(response, options) {
281 if (options.waitMsgTarget) {
5812914c
DC
282 if (Proxmox.Utils.toolkit === 'touch') {
283 options.waitMsgTarget.setMasked(false);
284 } else {
285 options.waitMsgTarget.setLoading(false);
286 }
0bb29d35
DM
287 }
288 var result = Ext.decode(response.responseText);
289 response.result = result;
290 if (!result.success) {
291 response.htmlStatus = Proxmox.Utils.extractRequestError(result, true);
292 Ext.callback(callbackFn, options.scope, [options, false, response]);
293 Ext.callback(failureFn, options.scope, [response, options]);
294 return;
295 }
296 Ext.callback(callbackFn, options.scope, [options, true, response]);
297 Ext.callback(successFn, options.scope, [response, options]);
298 },
299 failure: function(response, options) {
300 if (options.waitMsgTarget) {
5812914c
DC
301 if (Proxmox.Utils.toolkit === 'touch') {
302 options.waitMsgTarget.setMasked(false);
303 } else {
304 options.waitMsgTarget.setLoading(false);
305 }
0bb29d35
DM
306 }
307 response.result = {};
308 try {
309 response.result = Ext.decode(response.responseText);
310 } catch(e) {}
311 var msg = gettext('Connection error') + ' - server offline?';
312 if (response.aborted) {
313 msg = gettext('Connection error') + ' - aborted.';
314 } else if (response.timedout) {
315 msg = gettext('Connection error') + ' - Timeout.';
316 } else if (response.status && response.statusText) {
317 msg = gettext('Connection error') + ' ' + response.status + ': ' + response.statusText;
318 }
319 response.htmlStatus = msg;
320 Ext.callback(callbackFn, options.scope, [options, false, response]);
321 Ext.callback(failureFn, options.scope, [response, options]);
322 }
323 });
324 };
325
326 createWrapper(reqOpts.success, reqOpts.callback, reqOpts.failure);
327
328 var target = newopts.waitMsgTarget;
329 if (target) {
5812914c
DC
330 if (Proxmox.Utils.toolkit === 'touch') {
331 target.setMasked({ xtype: 'loadmask', message: newopts.waitMsg} );
332 } else {
333 // Note: ExtJS bug - this does not work when component is not rendered
334 target.setLoading(newopts.waitMsg);
335 }
0bb29d35
DM
336 }
337 Ext.Ajax.request(newopts);
338 },
339
5f93e010
DM
340 checked_command: function(orig_cmd) {
341 Proxmox.Utils.API2Request({
342 url: '/nodes/localhost/subscription',
343 method: 'GET',
344 //waitMsgTarget: me,
345 failure: function(response, opts) {
346 Ext.Msg.alert(gettext('Error'), response.htmlStatus);
347 },
348 success: function(response, opts) {
349 var data = response.result.data;
350
351 if (data.status !== 'Active') {
352 Ext.Msg.show({
353 title: gettext('No valid subscription'),
354 icon: Ext.Msg.WARNING,
355 msg: Proxmox.Utils.getNoSubKeyHtml(data.url),
356 buttons: Ext.Msg.OK,
357 callback: function(btn) {
358 if (btn !== 'ok') {
359 return;
360 }
361 orig_cmd();
362 }
363 });
364 } else {
365 orig_cmd();
366 }
367 }
368 });
369 },
370
06694509
DM
371 assemble_field_data: function(values, data) {
372 if (Ext.isObject(data)) {
373 Ext.Object.each(data, function(name, val) {
374 if (values.hasOwnProperty(name)) {
375 var bucket = values[name];
376 if (!Ext.isArray(bucket)) {
377 bucket = values[name] = [bucket];
378 }
379 if (Ext.isArray(val)) {
380 values[name] = bucket.concat(val);
381 } else {
382 bucket.push(val);
383 }
384 } else {
385 values[name] = val;
386 }
387 });
388 }
389 },
390
391 dialog_title: function(subject, create, isAdd) {
392 if (create) {
393 if (isAdd) {
394 return gettext('Add') + ': ' + subject;
395 } else {
396 return gettext('Create') + ': ' + subject;
397 }
398 } else {
399 return gettext('Edit') + ': ' + subject;
400 }
401 },
402
a58001dd
DM
403 network_iface_types: {
404 eth: gettext("Network Device"),
405 bridge: 'Linux Bridge',
406 bond: 'Linux Bond',
407 OVSBridge: 'OVS Bridge',
408 OVSBond: 'OVS Bond',
409 OVSPort: 'OVS Port',
410 OVSIntPort: 'OVS IntPort'
411 },
412
413 render_network_iface_type: function(value) {
414 return Proxmox.Utils.network_iface_types[value] ||
415 Proxmox.Utils.unknownText;
416 },
417
ab7fac0b
DC
418 task_desc_table: {
419 diskinit: [ 'Disk', gettext('Initialize Disk with GPT') ],
420 vncproxy: [ 'VM/CT', gettext('Console') ],
421 spiceproxy: [ 'VM/CT', gettext('Console') + ' (Spice)' ],
422 vncshell: [ '', gettext('Shell') ],
423 spiceshell: [ '', gettext('Shell') + ' (Spice)' ],
424 qmsnapshot: [ 'VM', gettext('Snapshot') ],
425 qmrollback: [ 'VM', gettext('Rollback') ],
426 qmdelsnapshot: [ 'VM', gettext('Delete Snapshot') ],
427 qmcreate: [ 'VM', gettext('Create') ],
428 qmrestore: [ 'VM', gettext('Restore') ],
429 qmdestroy: [ 'VM', gettext('Destroy') ],
430 qmigrate: [ 'VM', gettext('Migrate') ],
431 qmclone: [ 'VM', gettext('Clone') ],
432 qmmove: [ 'VM', gettext('Move disk') ],
433 qmtemplate: [ 'VM', gettext('Convert to template') ],
434 qmstart: [ 'VM', gettext('Start') ],
435 qmstop: [ 'VM', gettext('Stop') ],
436 qmreset: [ 'VM', gettext('Reset') ],
437 qmshutdown: [ 'VM', gettext('Shutdown') ],
438 qmsuspend: [ 'VM', gettext('Suspend') ],
439 qmresume: [ 'VM', gettext('Resume') ],
440 qmconfig: [ 'VM', gettext('Configure') ],
441 vzsnapshot: [ 'CT', gettext('Snapshot') ],
442 vzrollback: [ 'CT', gettext('Rollback') ],
443 vzdelsnapshot: [ 'CT', gettext('Delete Snapshot') ],
444 vzcreate: ['CT', gettext('Create') ],
445 vzrestore: ['CT', gettext('Restore') ],
446 vzdestroy: ['CT', gettext('Destroy') ],
447 vzmigrate: [ 'CT', gettext('Migrate') ],
448 vzclone: [ 'CT', gettext('Clone') ],
449 vztemplate: [ 'CT', gettext('Convert to template') ],
450 vzstart: ['CT', gettext('Start') ],
451 vzstop: ['CT', gettext('Stop') ],
452 vzmount: ['CT', gettext('Mount') ],
453 vzumount: ['CT', gettext('Unmount') ],
454 vzshutdown: ['CT', gettext('Shutdown') ],
455 vzsuspend: [ 'CT', gettext('Suspend') ],
456 vzresume: [ 'CT', gettext('Resume') ],
457 hamigrate: [ 'HA', gettext('Migrate') ],
458 hastart: [ 'HA', gettext('Start') ],
459 hastop: [ 'HA', gettext('Stop') ],
460 srvstart: ['SRV', gettext('Start') ],
461 srvstop: ['SRV', gettext('Stop') ],
462 srvrestart: ['SRV', gettext('Restart') ],
463 srvreload: ['SRV', gettext('Reload') ],
464 cephcreatemon: ['Ceph Monitor', gettext('Create') ],
465 cephdestroymon: ['Ceph Monitor', gettext('Destroy') ],
466 cephcreateosd: ['Ceph OSD', gettext('Create') ],
467 cephdestroyosd: ['Ceph OSD', gettext('Destroy') ],
468 cephcreatepool: ['Ceph Pool', gettext('Create') ],
469 cephdestroypool: ['Ceph Pool', gettext('Destroy') ],
470 imgcopy: ['', gettext('Copy data') ],
471 imgdel: ['', gettext('Erase data') ],
472 download: ['', gettext('Download') ],
473 vzdump: ['', gettext('Backup') ],
474 aptupdate: ['', gettext('Update package database') ],
475 startall: [ '', gettext('Start all VMs and Containers') ],
476 stopall: [ '', gettext('Stop all VMs and Containers') ],
477 migrateall: [ '', gettext('Migrate all VMs and Containers') ]
478 },
479
53ac9bca 480 format_task_description: function(type, id) {
ab7fac0b
DC
481 var farray = Proxmox.Utils.task_desc_table[type];
482 if (!farray) {
483 var text = type;
484 if (id) {
485 type += ' ' + id;
486 }
487 return text;
488 }
489 var prefix = farray[0];
490 var text = farray[1];
491 if (prefix) {
492 return prefix + ' ' + id + ' - ' + text;
493 }
494 return text;
53ac9bca
DM
495 },
496
b91c7ce2
DC
497 format_size: function(size) {
498 /*jslint confusion: true */
499
500 var units = ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'];
501 var num = 0;
502
503 while (size >= 1024 && ((num++)+1) < units.length) {
504 size = size / 1024;
505 }
506
507 return size.toFixed((num > 0)?2:0) + " " + units[num] + "B";
508 },
509
53ac9bca
DM
510 render_upid: function(value, metaData, record) {
511 var type = record.data.type;
512 var id = record.data.id;
513
514 return Proxmox.Utils.format_task_description(type, id);
515 },
516
452892df
DM
517 render_uptime: function(value) {
518
519 var uptime = value;
520
521 if (uptime === undefined) {
522 return '';
523 }
524
525 if (uptime <= 0) {
526 return '-';
527 }
528
529 return Proxmox.Utils.format_duration_long(uptime);
530 },
531
06694509
DM
532 parse_task_upid: function(upid) {
533 var task = {};
534
535 var res = upid.match(/^UPID:(\S+):([0-9A-Fa-f]{8}):([0-9A-Fa-f]{8,9}):([0-9A-Fa-f]{8}):([^:\s]+):([^:\s]*):([^:\s]+):$/);
536 if (!res) {
537 throw "unable to parse upid '" + upid + "'";
538 }
539 task.node = res[1];
540 task.pid = parseInt(res[2], 16);
541 task.pstart = parseInt(res[3], 16);
542 task.starttime = parseInt(res[4], 16);
543 task.type = res[5];
544 task.id = res[6];
545 task.user = res[7];
546
53ac9bca
DM
547 task.desc = Proxmox.Utils.format_task_description(task.type, task.id);
548
06694509
DM
549 return task;
550 },
551
552 render_timestamp: function(value, metaData, record, rowIndex, colIndex, store) {
553 var servertime = new Date(value * 1000);
554 return Ext.Date.format(servertime, 'Y-m-d H:i:s');
881c9c0c
DC
555 },
556
557 openXtermJsViewer: function(vmtype, vmid, nodename, vmname) {
558 var url = Ext.urlEncode({
559 console: vmtype, // kvm, lxc, upgrade or shell
560 xtermjs: 1,
561 vmid: vmid,
562 vmname: vmname,
563 node: nodename
564 });
565 var nw = window.open("?" + url, '_blank', 'toolbar=no,location=no,status=no,menubar=no,resizable=yes,width=800,height=420');
566 nw.focus();
e94c0767 567 }
06694509 568
881c9c0c 569},
5ffef550 570
0bb29d35
DM
571 singleton: true,
572 constructor: function() {
573 var me = this;
574 Ext.apply(me, me.utilities);
575
576 var IPV4_OCTET = "(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])";
577 var IPV4_REGEXP = "(?:(?:" + IPV4_OCTET + "\\.){3}" + IPV4_OCTET + ")";
578 var IPV6_H16 = "(?:[0-9a-fA-F]{1,4})";
579 var IPV6_LS32 = "(?:(?:" + IPV6_H16 + ":" + IPV6_H16 + ")|" + IPV4_REGEXP + ")";
580
581
582 me.IP4_match = new RegExp("^(?:" + IPV4_REGEXP + ")$");
583 me.IP4_cidr_match = new RegExp("^(?:" + IPV4_REGEXP + ")\/([0-9]{1,2})$");
584
585 var IPV6_REGEXP = "(?:" +
586 "(?:(?:" + "(?:" + IPV6_H16 + ":){6})" + IPV6_LS32 + ")|" +
587 "(?:(?:" + "::" + "(?:" + IPV6_H16 + ":){5})" + IPV6_LS32 + ")|" +
588 "(?:(?:(?:" + IPV6_H16 + ")?::" + "(?:" + IPV6_H16 + ":){4})" + IPV6_LS32 + ")|" +
589 "(?:(?:(?:(?:" + IPV6_H16 + ":){0,1}" + IPV6_H16 + ")?::" + "(?:" + IPV6_H16 + ":){3})" + IPV6_LS32 + ")|" +
590 "(?:(?:(?:(?:" + IPV6_H16 + ":){0,2}" + IPV6_H16 + ")?::" + "(?:" + IPV6_H16 + ":){2})" + IPV6_LS32 + ")|" +
591 "(?:(?:(?:(?:" + IPV6_H16 + ":){0,3}" + IPV6_H16 + ")?::" + "(?:" + IPV6_H16 + ":){1})" + IPV6_LS32 + ")|" +
592 "(?:(?:(?:(?:" + IPV6_H16 + ":){0,4}" + IPV6_H16 + ")?::" + ")" + IPV6_LS32 + ")|" +
593 "(?:(?:(?:(?:" + IPV6_H16 + ":){0,5}" + IPV6_H16 + ")?::" + ")" + IPV6_H16 + ")|" +
594 "(?:(?:(?:(?:" + IPV6_H16 + ":){0,7}" + IPV6_H16 + ")?::" + ")" + ")" +
595 ")";
596
597 me.IP6_match = new RegExp("^(?:" + IPV6_REGEXP + ")$");
598 me.IP6_cidr_match = new RegExp("^(?:" + IPV6_REGEXP + ")\/([0-9]{1,3})$");
599 me.IP6_bracket_match = new RegExp("^\\[(" + IPV6_REGEXP + ")\\]");
600
601 me.IP64_match = new RegExp("^(?:" + IPV6_REGEXP + "|" + IPV4_REGEXP + ")$");
602
603 var DnsName_REGEXP = "(?:(([a-zA-Z0-9]([a-zA-Z0-9\\-]*[a-zA-Z0-9])?)\\.)*([A-Za-z0-9]([A-Za-z0-9\\-]*[A-Za-z0-9])?))";
604 me.DnsName_match = new RegExp("^" + DnsName_REGEXP + "$");
605
606 me.HostPort_match = new RegExp("^(" + IPV4_REGEXP + "|" + DnsName_REGEXP + ")(:\\d+)?$");
607 me.HostPortBrackets_match = new RegExp("^\\[(?:" + IPV6_REGEXP + "|" + IPV4_REGEXP + "|" + DnsName_REGEXP + ")\\](:\\d+)?$");
608 me.IP6_dotnotation_match = new RegExp("^" + IPV6_REGEXP + "(\\.\\d+)?$");
609 }
610});