2020-11-09 15:01:29 +00:00
|
|
|
// Summary Panel for a single datastore in overview
|
|
|
|
Ext.define('PBS.datastore.DataStoreListSummary', {
|
|
|
|
extend: 'Ext.panel.Panel',
|
|
|
|
alias: 'widget.pbsDataStoreListSummary',
|
|
|
|
mixins: ['Proxmox.Mixin.CBind'],
|
|
|
|
|
|
|
|
cbind: {
|
|
|
|
title: '{datastore}',
|
|
|
|
},
|
2020-11-10 09:18:08 +00:00
|
|
|
|
|
|
|
referenceHolder: true,
|
2020-11-09 15:01:29 +00:00
|
|
|
bodyPadding: 10,
|
|
|
|
|
2020-11-10 09:18:08 +00:00
|
|
|
layout: {
|
|
|
|
type: 'hbox',
|
|
|
|
align: 'stretch',
|
2020-11-09 18:26:13 +00:00
|
|
|
},
|
2020-11-10 09:18:08 +00:00
|
|
|
|
2020-11-09 15:01:29 +00:00
|
|
|
viewModel: {
|
|
|
|
data: {
|
|
|
|
full: "N/A",
|
2020-11-10 09:18:08 +00:00
|
|
|
stillbad: 0,
|
|
|
|
deduplication: 1.0,
|
2020-11-09 15:01:29 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
setTasks: function(taskdata, since) {
|
|
|
|
let me = this;
|
|
|
|
me.down('pbsTaskSummary').updateTasks(taskdata, since);
|
|
|
|
},
|
|
|
|
|
|
|
|
setStatus: function(statusData) {
|
|
|
|
let me = this;
|
|
|
|
let vm = me.getViewModel();
|
2020-11-09 18:26:13 +00:00
|
|
|
|
|
|
|
let usage = statusData.used/statusData.total;
|
|
|
|
let usagetext = Ext.String.format(gettext('{0} of {1}'),
|
|
|
|
Proxmox.Utils.format_size(statusData.used),
|
|
|
|
Proxmox.Utils.format_size(statusData.total),
|
|
|
|
);
|
|
|
|
|
|
|
|
let usagePanel = me.lookup('usage');
|
|
|
|
usagePanel.updateValue(usage, usagetext);
|
|
|
|
|
2020-11-09 15:01:29 +00:00
|
|
|
let estimate = PBS.Utils.render_estimate(statusData['estimated-full-date']);
|
|
|
|
vm.set('full', estimate);
|
2020-11-10 09:18:08 +00:00
|
|
|
vm.set('deduplication', PBS.Utils.calculate_dedup_factor(statusData['gc-status']).toFixed(2));
|
|
|
|
vm.set('stillbad', statusData['gc-status']['still-bad']);
|
|
|
|
|
2020-11-09 15:01:29 +00:00
|
|
|
let last = 0;
|
2020-11-10 09:18:08 +00:00
|
|
|
let time = statusData['history-start'];
|
|
|
|
let delta = statusData['history-delta'];
|
2020-11-09 15:01:29 +00:00
|
|
|
let data = statusData.history.map((val) => {
|
|
|
|
if (val === null) {
|
|
|
|
val = last;
|
|
|
|
} else {
|
|
|
|
last = val;
|
|
|
|
}
|
2020-11-10 09:18:08 +00:00
|
|
|
let entry = {
|
|
|
|
time: time*1000, // js Dates are ms since epoch
|
|
|
|
val,
|
|
|
|
};
|
|
|
|
|
|
|
|
time += delta;
|
|
|
|
return entry;
|
2020-11-09 15:01:29 +00:00
|
|
|
});
|
2020-11-10 09:18:08 +00:00
|
|
|
|
|
|
|
me.lookup('historychart').setData(data);
|
2020-11-09 15:01:29 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
xtype: 'container',
|
|
|
|
layout: {
|
2020-11-10 09:18:08 +00:00
|
|
|
type: 'vbox',
|
2020-11-09 15:01:29 +00:00
|
|
|
align: 'stretch',
|
|
|
|
},
|
|
|
|
|
2020-11-10 09:18:08 +00:00
|
|
|
width: 350,
|
|
|
|
padding: 10,
|
2020-11-09 15:01:29 +00:00
|
|
|
|
|
|
|
items: [
|
|
|
|
{
|
2020-11-10 09:18:08 +00:00
|
|
|
xtype: 'proxmoxGauge',
|
|
|
|
warningThreshold: 0.8,
|
|
|
|
criticalThreshold: 0.95,
|
2020-11-09 18:26:13 +00:00
|
|
|
flex: 1,
|
2020-11-10 09:18:08 +00:00
|
|
|
reference: 'usage',
|
2020-11-09 15:01:29 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'pmxInfoWidget',
|
2020-11-09 16:48:53 +00:00
|
|
|
iconCls: 'fa fa-fw fa-line-chart',
|
2020-11-09 15:01:29 +00:00
|
|
|
title: gettext('Estimated Full'),
|
|
|
|
printBar: false,
|
|
|
|
bind: {
|
|
|
|
data: {
|
|
|
|
text: '{full}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-11-10 09:18:08 +00:00
|
|
|
{
|
|
|
|
xtype: 'pmxInfoWidget',
|
|
|
|
iconCls: 'fa fa-fw fa-compress',
|
|
|
|
title: gettext('Deduplication Factor'),
|
|
|
|
printBar: false,
|
|
|
|
bind: {
|
|
|
|
data: {
|
|
|
|
text: '{deduplication}',
|
|
|
|
},
|
|
|
|
},
|
2020-11-09 15:01:29 +00:00
|
|
|
},
|
2020-11-10 09:18:08 +00:00
|
|
|
{
|
|
|
|
xtype: 'pmxInfoWidget',
|
|
|
|
iconCls: 'fa critical fa-fw fa-exclamation-triangle',
|
|
|
|
title: gettext('Bad Chunks'),
|
|
|
|
printBar: false,
|
|
|
|
hidden: true,
|
|
|
|
bind: {
|
|
|
|
data: {
|
|
|
|
text: '{stillbad}',
|
|
|
|
},
|
|
|
|
visible: '{stillbad}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2020-11-09 15:01:29 +00:00
|
|
|
},
|
|
|
|
{
|
2020-11-09 18:26:13 +00:00
|
|
|
xtype: 'container',
|
|
|
|
layout: {
|
2020-11-10 09:18:08 +00:00
|
|
|
type: 'vbox',
|
2020-11-09 18:26:13 +00:00
|
|
|
align: 'stretch',
|
|
|
|
},
|
|
|
|
|
2020-11-10 09:18:08 +00:00
|
|
|
flex: 1,
|
2020-11-09 18:26:13 +00:00
|
|
|
|
|
|
|
items: [
|
|
|
|
{
|
2020-11-10 09:18:08 +00:00
|
|
|
padding: 5,
|
|
|
|
xtype: 'pbsUsageChart',
|
|
|
|
reference: 'historychart',
|
|
|
|
title: gettext('Usage History'),
|
|
|
|
height: 100,
|
2020-11-09 18:26:13 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'container',
|
2020-11-10 09:18:08 +00:00
|
|
|
flex: 1,
|
2020-11-09 18:26:13 +00:00
|
|
|
layout: {
|
|
|
|
type: 'vbox',
|
|
|
|
align: 'stretch',
|
|
|
|
},
|
|
|
|
|
|
|
|
defaults: {
|
|
|
|
padding: 5,
|
|
|
|
},
|
|
|
|
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
xtype: 'label',
|
|
|
|
text: gettext('Task Summary')
|
|
|
|
+ ` (${Ext.String.format(gettext('{0} days'), 30)})`,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'pbsTaskSummary',
|
|
|
|
border: false,
|
|
|
|
header: false,
|
|
|
|
subPanelModal: true,
|
|
|
|
flex: 2,
|
|
|
|
bodyPadding: 0,
|
|
|
|
minHeight: 0,
|
|
|
|
cbind: {
|
|
|
|
datastore: '{datastore}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2020-11-09 15:01:29 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|