]> git.proxmox.com Git - proxmox-backup.git/blame - www/window/DataStoreEdit.js
ui: add DataStorePruneAndGC panel and add it to datastore panel
[proxmox-backup.git] / www / window / DataStoreEdit.js
CommitLineData
3ea14859
DC
1Ext.define('PBS.panel.PruneInputPanel', {
2 extend: 'Proxmox.panel.InputPanel',
3 xtype: 'pbsPruneInputPanel',
4
5 mixins: ['Proxmox.Mixin.CBind'],
6
7 cbindData: function() {
8 let me = this;
9 me.isCreate = !!me.isCreate;
10 return {};
11 },
12
13 column1: [
14 {
15 xtype: 'proxmoxintegerfield',
16 fieldLabel: gettext('Keep Last'),
17 name: 'keep-last',
18 cbind: {
19 deleteEmpty: '{!isCreate}',
20 },
21 minValue: 1,
22 allowBlank: true,
23 },
24 {
25 xtype: 'proxmoxintegerfield',
26 fieldLabel: gettext('Keep Daily'),
27 name: 'keep-daily',
28 cbind: {
29 deleteEmpty: '{!isCreate}',
30 },
31 minValue: 1,
32 allowBlank: true,
33 },
34 {
35 xtype: 'proxmoxintegerfield',
36 fieldLabel: gettext('Keep Monthly'),
37 name: 'keep-monthly',
38 cbind: {
39 deleteEmpty: '{!isCreate}',
40 },
41 minValue: 1,
42 allowBlank: true,
43 },
44 ],
45 column2: [
46 {
47 xtype: 'proxmoxintegerfield',
48 fieldLabel: gettext('Keep Hourly'),
49 name: 'keep-hourly',
50 cbind: {
51 deleteEmpty: '{!isCreate}',
52 },
53 minValue: 1,
54 allowBlank: true,
55 },
56 {
57 xtype: 'proxmoxintegerfield',
58 fieldLabel: gettext('Keep Weekly'),
59 name: 'keep-weekly',
60 cbind: {
61 deleteEmpty: '{!isCreate}',
62 },
63 minValue: 1,
64 allowBlank: true,
65 },
66 {
67 xtype: 'proxmoxintegerfield',
68 fieldLabel: gettext('Keep Yearly'),
69 name: 'keep-yearly',
70 cbind: {
71 deleteEmpty: '{!isCreate}',
72 },
73 minValue: 1,
74 allowBlank: true,
75 },
76 ],
77
78});
98ad58fb
DC
79Ext.define('PBS.DataStoreEdit', {
80 extend: 'Proxmox.window.Edit',
81 alias: 'widget.pbsDataStoreEdit',
82 mixins: ['Proxmox.Mixin.CBind'],
83
84 subject: gettext('Datastore'),
85 isAdd: true,
86
1278aeec
DC
87 bodyPadding: 0,
88
98ad58fb
DC
89 cbindData: function(initialConfig) {
90 var me = this;
91
92 let name = initialConfig.name;
93 let baseurl = '/api2/extjs/config/datastore';
94
95 me.isCreate = !name;
41e43880
TL
96 if (!me.isCreate) {
97 me.defaultFocus = 'textfield[name=comment]';
98 }
98ad58fb
DC
99 me.url = name ? baseurl + '/' + name : baseurl;
100 me.method = name ? 'PUT' : 'POST';
101 me.autoLoad = !!name;
102 return {};
103 },
104
67042466
TL
105 items: {
106 xtype: 'tabpanel',
107 bodyPadding: 10,
4c3efb53
OB
108 listeners: {
109 tabchange: function(tb, newCard) {
110 Ext.GlobalEvents.fireEvent('proxmoxShowHelp', newCard.onlineHelp);
38f5cb5b 111 },
4c3efb53 112 },
67042466
TL
113 items: [
114 {
115 title: gettext('General'),
116 xtype: 'inputpanel',
4c3efb53 117 onlineHelp: 'datastore_intro',
67042466
TL
118 column1: [
119 {
120 xtype: 'pmxDisplayEditField',
121 cbind: {
122 editable: '{isCreate}',
1278aeec 123 },
67042466
TL
124 name: 'name',
125 allowBlank: false,
126 fieldLabel: gettext('Name'),
127 },
128 {
129 xtype: 'pmxDisplayEditField',
130 cbind: {
131 editable: '{isCreate}',
1278aeec 132 },
67042466
TL
133 name: 'path',
134 allowBlank: false,
135 fieldLabel: gettext('Backing Path'),
136 emptyText: gettext('An absolute path'),
137 },
138 ],
139 column2: [
140 {
41e43880 141 xtype: 'pbsCalendarEvent',
67042466
TL
142 name: 'gc-schedule',
143 fieldLabel: gettext("GC Schedule"),
41e43880 144 emptyText: gettext('none'),
67042466
TL
145 cbind: {
146 deleteEmpty: '{!isCreate}',
1278aeec 147 },
67042466
TL
148 },
149 {
41e43880 150 xtype: 'pbsCalendarEvent',
67042466
TL
151 name: 'prune-schedule',
152 fieldLabel: gettext("Prune Schedule"),
41e43880 153 emptyText: gettext('none'),
67042466
TL
154 cbind: {
155 deleteEmpty: '{!isCreate}',
1278aeec 156 },
67042466
TL
157 },
158 ],
159 columnB: [
160 {
161 xtype: 'textfield',
162 name: 'comment',
163 fieldLabel: gettext('Comment'),
164 },
165 ],
166 },
167 {
168 title: gettext('Prune Options'),
3ea14859
DC
169 xtype: 'pbsPruneInputPanel',
170 cbind: {
171 isCreate: '{isCreate}',
172 },
4c3efb53 173 onlineHelp: 'backup_pruning',
67042466
TL
174 },
175 ],
176 },
98ad58fb 177});