]>
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',
43 xclass
: 'Ext.app.ViewController',
45 onLoad: function(store
, data
, success
) {
48 let vm
= me
.getViewModel();
50 let counts
= store
.getById('counts').data
.value
;
51 let total
= store
.getById('total').data
.value
;
52 let used
= store
.getById('used').data
.value
;
54 let usage
= PBS
.Utils
.render_size_usage(used
, total
);
55 vm
.set('usagetext', usage
);
56 vm
.set('usage', used
/total
);
58 let gcstatus
= store
.getById('gc-status').data
.value
;
60 let dedup
= PBS
.Utils
.calculate_dedup_factor(gcstatus
);
62 let countstext = function(count
) {
64 return `${count.groups || 0} ${gettext('Groups')}, ${count.snapshots || 0} ${gettext('Snapshots')}`;
67 vm
.set('ctcount', countstext(counts
.ct
));
68 vm
.set('vmcount', countstext(counts
.vm
));
69 vm
.set('hostcount', countstext(counts
.host
));
70 vm
.set('deduplication', dedup
.toFixed(2));
71 vm
.set('stillbad', gcstatus
['still-bad']);
72 vm
.set('removedbytes', Proxmox
.Utils
.format_size(gcstatus
['removed-bytes']));
75 startStore: function() { this.store
.startUpdate(); },
76 stopStore: function() { this.store
.stopUpdate(); },
78 init: function(view
) {
80 let datastore
= encodeURIComponent(view
.datastore
);
81 me
.store
= Ext
.create('Proxmox.data.ObjectStore', {
83 url
: `/api2/json/admin/datastore/${datastore}/status`,
85 me
.store
.on('load', me
.onLoad
, me
);
90 activate
: 'startStore',
92 deactivate
: 'stopStore',
96 xtype
: 'pmxInfoWidget',
103 iconCls
: 'fa fa-fw fa-hdd-o',
104 title
: gettext('Usage'),
114 html
: `<b>${gettext('Backup Count')}</b>`,
118 iconCls
: 'fa fa-fw fa-cube',
119 title
: gettext('CT'),
128 iconCls
: 'fa fa-fw fa-building',
129 title
: gettext('Host'),
138 iconCls
: 'fa fa-fw fa-desktop',
139 title
: gettext('VM'),
149 html
: `<b>${gettext('Stats from last Garbage Collection')}</b>`,
153 iconCls
: 'fa fa-fw fa-compress',
154 title
: gettext('Deduplication Factor'),
158 text
: '{deduplication}',
163 iconCls
: 'fa fa-fw fa-trash-o',
164 title
: gettext('Removed Bytes'),
168 text
: '{removedbytes}',
173 iconCls
: 'fa critical fa-fw fa-exclamation-triangle',
174 title
: gettext('Bad Chunks'),
180 visible
: '{stillbad}',
186 Ext
.define('PBS.DataStoreSummary', {
187 extend
: 'Ext.panel.Panel',
188 alias
: 'widget.pbsDataStoreSummary',
189 mixins
: ['Proxmox.Mixin.CBind'],
200 tbar
: ['->', { xtype
: 'proxmoxRRDTypeSelector' }],
212 xtype
: 'pbsDataStoreInfo',
216 title
: '{datastore}',
217 datastore
: '{datastore}',
221 xtype
: 'pbsDataStoreNotes',
224 datastore
: '{datastore}',
230 xtype
: 'proxmoxRRDChart',
231 title
: gettext('Storage usage (bytes)'),
232 fields
: ['total', 'used'],
233 fieldTitles
: [gettext('Total'), gettext('Storage usage')],
236 xtype
: 'proxmoxRRDChart',
237 title
: gettext('Transfer Rate (bytes/second)'),
238 fields
: ['read_bytes', 'write_bytes'],
239 fieldTitles
: [gettext('Read'), gettext('Write')],
242 xtype
: 'proxmoxRRDChart',
243 title
: gettext('Input/Output Operations per Second (IOPS)'),
244 fields
: ['read_ios', 'write_ios'],
245 fieldTitles
: [gettext('Read'), gettext('Write')],
248 xtype
: 'proxmoxRRDChart',
249 title
: gettext('IO Delay (ms)'),
250 fields
: ['io_delay'],
251 fieldTitles
: [gettext('IO Delay')],
256 activate: function() { this.rrdstore
.startUpdate(); },
257 deactivate: function() { this.rrdstore
.stopUpdate(); },
258 destroy: function() { this.rrdstore
.stopUpdate(); },
261 initComponent: function() {
264 me
.rrdstore
= Ext
.create('Proxmox.data.RRDStore', {
265 rrdurl
: "/api2/json/admin/datastore/" + me
.datastore
+ "/rrd",
266 model
: 'pve-rrd-datastore',
271 Proxmox
.Utils
.API2Request({
272 url
: `/config/datastore/${me.datastore}`,
273 waitMsgTarget
: me
.down('pbsDataStoreInfo'),
274 success: function(response
) {
275 let path
= Ext
.htmlEncode(response
.result
.data
.path
);
276 me
.down('pbsDataStoreInfo').setTitle(`${me.datastore} (${path})`);
277 me
.down('pbsDataStoreNotes').setNotes(response
.result
.data
.comment
);
281 me
.query('proxmoxRRDChart').forEach((chart
) => {
282 chart
.setStore(me
.rrdstore
);
285 me
.down('pbsDataStoreInfo').relayEvents(me
, ['activate', 'deactivate']);