]>
git.proxmox.com Git - proxmox-backup.git/blob - www/datastore/DataStoreListSummary.js
1 // Summary Panel for a single datastore in overview
2 Ext
.define('PBS.datastore.DataStoreListSummary', {
3 extend
: 'Ext.panel.Panel',
4 alias
: 'widget.pbsDataStoreListSummary',
5 mixins
: ['Proxmox.Mixin.CBind'],
11 referenceHolder
: true,
28 setTasks: function(taskdata
, since
) {
30 me
.down('pbsTaskSummary').updateTasks(taskdata
, since
);
33 setStatus: function(statusData
) {
35 let vm
= me
.getViewModel();
37 if (statusData
.error
!== undefined) {
38 Proxmox
.Utils
.API2Request({
39 url
: `/config/datastore/${statusData.store}`,
40 success
: (response
) => {
41 const config
= response
.result
.data
;
42 if (config
['maintenance-mode']) {
43 const [_type
, msg
] = PBS
.Utils
.parseMaintenanceMode(config
['maintenance-mode']);
44 vm
.set('maintenance', `${gettext('Datastore is in maintenance mode')}${msg ? ': ' + msg : ''}`);
48 vm
.set('error', statusData
.error
);
52 vm
.set('maintenance', '');
58 if (Object
.hasOwn(statusData
, 'avail') && Object
.hasOwn(statusData
, 'used')) {
59 let total
= statusData
.avail
+ statusData
.used
;
60 usage
= statusData
.used
/ total
;
61 usagetext
= Ext
.String
.format(gettext('{0} of {1}'),
62 Proxmox
.Utils
.format_size(statusData
.used
, true),
63 Proxmox
.Utils
.format_size(total
, true),
66 usagetext
= Ext
.String
.format(gettext('{0} of {1}'), 0, 0);
70 let usagePanel
= me
.lookup('usage');
71 usagePanel
.updateValue(usage
, usagetext
);
73 let estimate
= PBS
.Utils
.render_estimate(statusData
['estimated-full-date'], null, { data
: statusData
});
75 vm
.set('full', estimate
);
76 vm
.set('deduplication', PBS
.Utils
.calculate_dedup_factor(statusData
['gc-status']).toFixed(2));
77 vm
.set('stillbad', statusData
['gc-status']['still-bad']);
80 let time
= statusData
['history-start'];
81 let delta
= statusData
['history-delta'];
82 let data
= statusData
.history
.map((val
) => {
89 time
: time
*1000, // js Dates are ms since epoch
97 me
.lookup('historychart').setData(data
);
121 `<h3>${gettext("Error")}</h3>`,
122 '<i class="fa fa-5x fa-exclamation-circle critical"></i>',
128 visible
: '{error && !maintenance}',
139 `<h3>${gettext("Maintenance mode")}</h3>`,
140 '<i class="fa fa-5x fa-wrench"></i>',
146 visible
: '{maintenance}',
148 text
: '{maintenance}',
153 xtype
: 'proxmoxGauge',
154 warningThreshold
: 0.8,
155 criticalThreshold
: 0.95,
163 xtype
: 'pmxInfoWidget',
164 iconCls
: 'fa fa-fw fa-line-chart',
165 title
: gettext('Estimated Full'),
175 xtype
: 'pmxInfoWidget',
176 iconCls
: 'fa fa-fw fa-compress',
177 title
: gettext('Deduplication Factor'),
181 text
: '{deduplication}',
187 xtype
: 'pmxInfoWidget',
188 iconCls
: 'fa critical fa-fw fa-exclamation-triangle',
189 title
: gettext('Bad Chunks'),
196 visible
: '{stillbad}',
213 xtype
: 'pbsUsageChart',
214 reference
: 'historychart',
215 title
: gettext('Usage History'),
236 text
: gettext('Task Summary')
237 + ` (${Ext.String.format(gettext('{0} days'), 30)})`,
240 xtype
: 'pbsTaskSummary',
248 datastore
: '{datastore}',