]> git.proxmox.com Git - proxmox-widget-toolkit.git/blob - src/panel/GotifyEditPanel.js
bump version to 4.2.3
[proxmox-widget-toolkit.git] / src / panel / GotifyEditPanel.js
1 Ext.define('Proxmox.panel.GotifyEditPanel', {
2 extend: 'Proxmox.panel.InputPanel',
3 xtype: 'pmxGotifyEditPanel',
4 mixins: ['Proxmox.Mixin.CBind'],
5 onlineHelp: 'notification_targets_gotify',
6
7 type: 'gotify',
8
9 items: [
10 {
11 xtype: 'pmxDisplayEditField',
12 name: 'name',
13 cbind: {
14 value: '{name}',
15 editable: '{isCreate}',
16 },
17 fieldLabel: gettext('Endpoint Name'),
18 allowBlank: false,
19 },
20 {
21 xtype: 'proxmoxcheckbox',
22 name: 'enable',
23 fieldLabel: gettext('Enable'),
24 allowBlank: false,
25 checked: true,
26 },
27 {
28 xtype: 'proxmoxtextfield',
29 fieldLabel: gettext('Server URL'),
30 name: 'server',
31 allowBlank: false,
32 },
33 {
34 xtype: 'proxmoxtextfield',
35 inputType: 'password',
36 fieldLabel: gettext('API Token'),
37 name: 'token',
38 cbind: {
39 emptyText: get => !get('isCreate') ? gettext('Unchanged') : '',
40 allowBlank: '{!isCreate}',
41 },
42 },
43 {
44 xtype: 'proxmoxtextfield',
45 name: 'comment',
46 fieldLabel: gettext('Comment'),
47 cbind: {
48 deleteEmpty: '{!isCreate}',
49 },
50 },
51 ],
52
53 onSetValues: (values) => {
54 values.enable = !values.disable;
55
56 delete values.disable;
57 return values;
58 },
59
60 onGetValues: function(values) {
61 let me = this;
62
63 if (values.enable) {
64 if (!me.isCreate) {
65 Proxmox.Utils.assemble_field_data(values, { 'delete': 'disable' });
66 }
67 } else {
68 values.disable = 1;
69 }
70
71 delete values.enable;
72
73 return values;
74 },
75 });