]>
git.proxmox.com Git - proxmox-backup.git/blob - www/datastore/Summary.js
1 Ext
.define('pve-rrd-datastore', {
2 extend
: 'Ext.data.Model',
12 name
: 'io_delay', calculate: function(data
) {
14 if (data
.read_ios
!== undefined) { ios
+= data
.read_ios
; }
15 if (data
.write_ios
!== undefined) { ios
+= data
.write_ios
; }
16 if (data
.io_ticks
=== undefined) {
18 } else if (ios
=== 0) {
21 return (data
.io_ticks
*1000.0)/ios
;
24 { type
: 'date', dateFormat
: 'timestamp', name
: 'time' },
28 Ext
.define('PBS.DataStoreInfo', {
29 extend
: 'Ext.panel.Panel',
30 alias
: 'widget.pbsDataStoreInfo',
42 xclass
: 'Ext.app.ViewController',
44 onLoad: function(store
, data
, success
) {
47 let vm
= me
.getViewModel();
49 let counts
= store
.getById('counts').data
.value
;
50 let total
= store
.getById('total').data
.value
;
51 let used
= store
.getById('used').data
.value
;
53 let usage
= PBS
.Utils
.render_size_usage(used
, total
);
54 vm
.set('usagetext', usage
);
55 vm
.set('usage', used
/total
);
57 let gcstatus
= store
.getById('gc-status').data
.value
;
59 let dedup
= PBS
.Utils
.calculate_dedup_factor(gcstatus
);
61 let countstext = function(count
) {
63 return `${count.groups || 0} ${gettext('Groups')}, ${count.snapshots || 0} ${gettext('Snapshots')}`;
66 vm
.set('ctcount', countstext(counts
.ct
));
67 vm
.set('vmcount', countstext(counts
.vm
));
68 vm
.set('hostcount', countstext(counts
.host
));
69 vm
.set('deduplication', dedup
.toFixed(2));
70 vm
.set('stillbad', gcstatus
['still-bad']);
73 startStore: function() { this.store
.startUpdate(); },
74 stopStore: function() { this.store
.stopUpdate(); },
76 init: function(view
) {
78 let datastore
= encodeURIComponent(view
.datastore
);
79 me
.store
= Ext
.create('Proxmox.data.ObjectStore', {
81 url
: `/api2/json/admin/datastore/${datastore}/status/?verbose=true`,
83 me
.store
.on('load', me
.onLoad
, me
);
88 activate
: 'startStore',
89 beforedestroy
: 'stopStore',
90 deactivate
: 'stopStore',
94 xtype
: 'pmxInfoWidget',
101 iconCls
: 'fa fa-fw fa-hdd-o',
102 title
: gettext('Usage'),
112 html
: `<b>${gettext('Backup Count')}</b>`,
116 iconCls
: 'fa fa-fw fa-cube',
117 title
: gettext('CT'),
126 iconCls
: 'fa fa-fw fa-building',
127 title
: gettext('Host'),
136 iconCls
: 'fa fa-fw fa-desktop',
137 title
: gettext('VM'),
147 html
: `<b>${gettext('Stats from last Garbage Collection')}</b>`,
151 iconCls
: 'fa fa-fw fa-compress',
152 title
: gettext('Deduplication Factor'),
156 text
: '{deduplication}',
161 iconCls
: 'fa critical fa-fw fa-exclamation-triangle',
162 title
: gettext('Bad Chunks'),
168 visible
: '{stillbad}',
174 Ext
.define('PBS.DataStoreSummary', {
175 extend
: 'Ext.panel.Panel',
176 alias
: 'widget.pbsDataStoreSummary',
177 mixins
: ['Proxmox.Mixin.CBind'],
188 tbar
: ['->', { xtype
: 'proxmoxRRDTypeSelector' }],
200 xtype
: 'pbsDataStoreInfo',
204 title
: '{datastore}',
205 datastore
: '{datastore}',
209 xtype
: 'pbsDataStoreNotes',
212 datastore
: '{datastore}',
218 xtype
: 'proxmoxRRDChart',
219 title
: gettext('Storage usage (bytes)'),
220 fields
: ['total', 'used'],
221 fieldTitles
: [gettext('Total'), gettext('Storage usage')],
224 xtype
: 'proxmoxRRDChart',
225 title
: gettext('Transfer Rate (bytes/second)'),
226 fields
: ['read_bytes', 'write_bytes'],
227 fieldTitles
: [gettext('Read'), gettext('Write')],
230 xtype
: 'proxmoxRRDChart',
231 title
: gettext('Input/Output Operations per Second (IOPS)'),
232 fields
: ['read_ios', 'write_ios'],
233 fieldTitles
: [gettext('Read'), gettext('Write')],
236 xtype
: 'proxmoxRRDChart',
237 title
: gettext('IO Delay (ms)'),
238 fields
: ['io_delay'],
239 fieldTitles
: [gettext('IO Delay')],
244 activate: function() { this.rrdstore
.startUpdate(); },
245 deactivate: function() { this.rrdstore
.stopUpdate(); },
246 destroy: function() { this.rrdstore
.stopUpdate(); },
249 initComponent: function() {
252 me
.rrdstore
= Ext
.create('Proxmox.data.RRDStore', {
253 rrdurl
: "/api2/json/admin/datastore/" + me
.datastore
+ "/rrd",
254 model
: 'pve-rrd-datastore',
259 Proxmox
.Utils
.API2Request({
260 url
: `/config/datastore/${me.datastore}`,
261 waitMsgTarget
: me
.down('pbsDataStoreInfo'),
262 success: function(response
) {
263 let path
= Ext
.htmlEncode(response
.result
.data
.path
);
264 me
.down('pbsDataStoreInfo').setTitle(`${me.datastore} (${path})`);
265 me
.down('pbsDataStoreNotes').setNotes(response
.result
.data
.comment
);
267 failure: function(response
) {
268 // fallback if e.g. we have no permissions to the config
269 let rec
= Ext
.getStore('pbs-datastore-list')
270 .findRecord('store', me
.datastore
, 0, false, true, true);
272 me
.down('pbsDataStoreNotes').setNotes(rec
.data
.comment
|| "");
277 me
.query('proxmoxRRDChart').forEach((chart
) => {
278 chart
.setStore(me
.rrdstore
);
281 me
.down('pbsDataStoreInfo').relayEvents(me
, ['activate', 'deactivate']);