]>
git.proxmox.com Git - proxmox-backup.git/blob - www/DataStoreSummary.js
525486a5183a4aca6ad24ec1414df089e7a49df3
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 storage
= store
.getById('storage').data
.value
;
53 let used
= Proxmox
.Utils
.format_size(storage
.used
);
54 let total
= Proxmox
.Utils
.format_size(storage
.total
);
55 let percent
= 100*storage
.used
/storage
.total
;
56 if (storage
.total
=== 0) {
59 let used_percent
= `${percent.toFixed(2)}%`;
61 let usage
= used_percent
+ ' (' +
62 Ext
.String
.format(gettext('{0} of {1}'),
64 vm
.set('usagetext', usage
);
65 vm
.set('usage', storage
.used
/storage
.total
);
67 let gcstatus
= store
.getById('gc-status').data
.value
;
69 let dedup
= (gcstatus
['index-data-bytes'] || 0)/
70 (gcstatus
['disk-bytes'] || Infinity
);
72 let countstext = function(count
) {
73 return `${count[0]} ${gettext('Groups')}, ${count[1]} ${gettext('Snapshots')}`;
76 vm
.set('ctcount', countstext(counts
.ct
|| [0, 0]));
77 vm
.set('vmcount', countstext(counts
.vm
|| [0, 0]));
78 vm
.set('hostcount', countstext(counts
.host
|| [0, 0]));
79 vm
.set('deduplication', dedup
.toFixed(2));
80 vm
.set('stillbad', gcstatus
['still-bad']);
81 vm
.set('removedbytes', Proxmox
.Utils
.format_size(gcstatus
['removed-bytes']));
84 startStore: function() { this.store
.startUpdate(); },
85 stopStore: function() { this.store
.stopUpdate(); },
87 init: function(view
) {
89 let datastore
= encodeURIComponent(view
.datastore
);
90 me
.store
= Ext
.create('Proxmox.data.ObjectStore', {
92 url
: `/api2/json/admin/datastore/${datastore}/status`,
94 me
.store
.on('load', me
.onLoad
, me
);
99 activate
: 'startStore',
100 destroy
: 'stopStore',
101 deactivate
: 'stopStore',
105 xtype
: 'pmxInfoWidget',
112 iconCls
: 'fa fa-fw fa-hdd-o',
113 title
: gettext('Usage'),
123 html
: `<b>${gettext('Backup Count')}</b>`,
127 iconCls
: 'fa fa-fw fa-cube',
128 title
: gettext('CT'),
137 iconCls
: 'fa fa-fw fa-building',
138 title
: gettext('Host'),
147 iconCls
: 'fa fa-fw fa-desktop',
148 title
: gettext('VM'),
158 html
: `<b>${gettext('Stats from last Garbage Collection')}</b>`,
162 iconCls
: 'fa fa-fw fa-compress',
163 title
: gettext('Deduplication Factor'),
167 text
: '{deduplication}',
172 iconCls
: 'fa fa-fw fa-trash-o',
173 title
: gettext('Removed Bytes'),
177 text
: '{removedbytes}',
182 iconCls
: 'fa critical fa-fw fa-exclamation-triangle',
183 title
: gettext('Bad Chunks'),
189 visible
: '{stillbad}',
195 Ext
.define('PBS.DataStoreSummary', {
196 extend
: 'Ext.panel.Panel',
197 alias
: 'widget.pbsDataStoreSummary',
198 mixins
: ['Proxmox.Mixin.CBind'],
209 tbar
: ['->', { xtype
: 'proxmoxRRDTypeSelector' }],
221 xtype
: 'pbsDataStoreInfo',
225 title
: '{datastore}',
226 datastore
: '{datastore}',
230 xtype
: 'pbsDataStoreNotes',
233 datastore
: '{datastore}',
239 xtype
: 'proxmoxRRDChart',
240 title
: gettext('Storage usage (bytes)'),
241 fields
: ['total', 'used'],
242 fieldTitles
: [gettext('Total'), gettext('Storage usage')],
245 xtype
: 'proxmoxRRDChart',
246 title
: gettext('Transfer Rate (bytes/second)'),
247 fields
: ['read_bytes', 'write_bytes'],
248 fieldTitles
: [gettext('Read'), gettext('Write')],
251 xtype
: 'proxmoxRRDChart',
252 title
: gettext('Input/Output Operations per Second (IOPS)'),
253 fields
: ['read_ios', 'write_ios'],
254 fieldTitles
: [gettext('Read'), gettext('Write')],
257 xtype
: 'proxmoxRRDChart',
258 title
: gettext('IO Delay (ms)'),
259 fields
: ['io_delay'],
260 fieldTitles
: [gettext('IO Delay')],
265 activate: function() { this.rrdstore
.startUpdate(); },
266 deactivate: function() { this.rrdstore
.stopUpdate(); },
267 destroy: function() { this.rrdstore
.stopUpdate(); },
270 initComponent: function() {
273 me
.rrdstore
= Ext
.create('Proxmox.data.RRDStore', {
274 rrdurl
: "/api2/json/admin/datastore/" + me
.datastore
+ "/rrd",
275 model
: 'pve-rrd-datastore',
280 Proxmox
.Utils
.API2Request({
281 url
: `/config/datastore/${me.datastore}`,
282 waitMsgTarget
: me
.down('pbsDataStoreInfo'),
283 success: function(response
) {
284 let path
= Ext
.htmlEncode(response
.result
.data
.path
);
285 me
.down('pbsDataStoreInfo').setTitle(`${me.datastore} (${path})`);
286 me
.down('pbsDataStoreNotes').setNotes(response
.result
.data
.comment
);
290 me
.query('proxmoxRRDChart').forEach((chart
) => {
291 chart
.setStore(me
.rrdstore
);
294 me
.down('pbsDataStoreInfo').relayEvents(me
, ['activate', 'deactivate']);