]>
git.proxmox.com Git - pmg-gui.git/blob - js/RegexTester.js
2 Ext
.define('PMG.RegexTester', {
3 extend
: 'Ext.form.FieldContainer',
4 alias
: 'widget.pmgRegexTester',
6 // the field reference which holds the regex value
7 // has to be a sibling of the RegexTester component
8 regexFieldReference
: undefined,
10 // if true, wraps the regex with ^ and $
20 isDirty: function () { return false; },
28 var regexField
= me
.up().down('field[reference=' + me
.regexFieldReference
+']');
32 regex
= '^' + regexField
.getValue() + '$';
34 regex
= regexField
.getValue();
37 Proxmox
.Utils
.API2Request({
38 url
: '/api2/extjs/config/regextest',
39 waitMsgTarget
: me
.up('window'),
42 text
: me
.down('textfield[name=teststring]').getValue()
45 success: function(response
) {
47 title
: gettext('Success'),
48 message
: gettext('OK') +
50 response
.result
.data
+ 'ms' + ')',
52 icon
: Ext
.MessageBox
.INFO
55 failure: function(response
, opts
) {
56 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
62 initComponent: function() {
65 if (!me
.regexFieldReference
) {
66 throw "No regex field reference given";