]> git.proxmox.com Git - proxmox-backup.git/blob - www/DataStorePruneAndGC.js
replace Userid with Authid
[proxmox-backup.git] / www / DataStorePruneAndGC.js
1 Ext.define('PBS.DataStorePruneAndGC', {
2 extend: 'Proxmox.grid.ObjectGrid',
3 alias: 'widget.pbsDataStorePruneAndGC',
4 mixins: ['Proxmox.Mixin.CBind'],
5
6 cbindData: function(initial) {
7 let me = this;
8
9 me.datastore = encodeURIComponent(me.datastore);
10 me.url = `/api2/json/config/datastore/${me.datastore}`;
11 me.editorConfig = {
12 url: `/api2/extjs/config/datastore/${me.datastore}`,
13 };
14 return {};
15 },
16
17 controller: {
18 xclass: 'Ext.app.ViewController',
19
20 edit: function() { this.getView().run_editor(); },
21
22 garbageCollect: function() {
23 let me = this;
24 let view = me.getView();
25 Proxmox.Utils.API2Request({
26 url: `/admin/datastore/${view.datastore}/gc`,
27 method: 'POST',
28 failure: function(response) {
29 Ext.Msg.alert(gettext('Error'), response.htmlStatus);
30 },
31 success: function(response, options) {
32 Ext.create('Proxmox.window.TaskViewer', {
33 upid: response.result.data,
34 }).show();
35 },
36 });
37 },
38 },
39
40 tbar: [
41 {
42 xtype: 'proxmoxButton',
43 text: gettext('Edit'),
44 disabled: true,
45 handler: 'edit',
46 },
47 '-',
48 {
49 xtype: 'proxmoxButton',
50 text: gettext('Start Garbage Collection'),
51 selModel: null,
52 handler: 'garbageCollect',
53 },
54 ],
55
56 listeners: {
57 activate: function() { this.rstore.startUpdate(); },
58 destroy: function() { this.rstore.stopUpdate(); },
59 deactivate: function() { this.rstore.stopUpdate(); },
60 itemdblclick: 'edit',
61 },
62
63 rows: {
64 "gc-schedule": {
65 required: true,
66 defaultValue: Proxmox.Utils.NoneText,
67 header: gettext('Garbage Collection Schedule'),
68 editor: {
69 xtype: 'proxmoxWindowEdit',
70 title: gettext('GC Schedule'),
71 items: {
72 xtype: 'pbsCalendarEvent',
73 name: 'gc-schedule',
74 fieldLabel: gettext("GC Schedule"),
75 emptyText: Proxmox.Utils.noneText,
76 deleteEmpty: true,
77 },
78 },
79 },
80 "prune-schedule": {
81 required: true,
82 defaultValue: Proxmox.Utils.NoneText,
83 header: gettext('Prune Schedule'),
84 editor: {
85 xtype: 'proxmoxWindowEdit',
86 title: gettext('Prune Schedule'),
87 items: {
88 xtype: 'pbsCalendarEvent',
89 name: 'prune-schedule',
90 fieldLabel: gettext("Prune Schedule"),
91 emptyText: Proxmox.Utils.noneText,
92 deleteEmpty: true,
93 },
94 },
95 },
96 "keep-last": {
97 required: true,
98 header: gettext('Keep Last'),
99 editor: {
100 xtype: 'proxmoxWindowEdit',
101 title: gettext('Prune Options'),
102 items: {
103 xtype: 'pbsPruneInputPanel',
104 isCreate: false,
105 },
106 },
107 },
108 "keep-hourly": {
109 required: true,
110 header: gettext('Keep Hourly'),
111 editor: {
112 xtype: 'proxmoxWindowEdit',
113 title: gettext('Prune Options'),
114 items: {
115 xtype: 'pbsPruneInputPanel',
116 },
117 },
118 },
119 "keep-daily": {
120 required: true,
121 header: gettext('Keep Daily'),
122 editor: {
123 xtype: 'proxmoxWindowEdit',
124 title: gettext('Prune Options'),
125 items: {
126 xtype: 'pbsPruneInputPanel',
127 },
128 },
129 },
130 "keep-weekly": {
131 required: true,
132 header: gettext('Keep Weekly'),
133 editor: {
134 xtype: 'proxmoxWindowEdit',
135 title: gettext('Prune Options'),
136 items: {
137 xtype: 'pbsPruneInputPanel',
138 },
139 },
140 },
141 "keep-monthly": {
142 required: true,
143 header: gettext('Keep Monthly'),
144 editor: {
145 xtype: 'proxmoxWindowEdit',
146 title: gettext('Prune Options'),
147 items: {
148 xtype: 'pbsPruneInputPanel',
149 },
150 },
151 },
152 "keep-yearly": {
153 required: true,
154 header: gettext('Keep Yearly'),
155 editor: {
156 xtype: 'proxmoxWindowEdit',
157 title: gettext('Prune Options'),
158 items: {
159 xtype: 'pbsPruneInputPanel',
160 },
161 },
162 },
163 },
164 });