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}',
|
|
|
|
},
|
|
|
|
bodyPadding: 10,
|
|
|
|
|
2020-11-09 18:26:13 +00:00
|
|
|
controller: {
|
|
|
|
xclass: 'Ext.app.ViewController',
|
|
|
|
},
|
2020-11-09 15:01:29 +00:00
|
|
|
viewModel: {
|
|
|
|
data: {
|
|
|
|
full: "N/A",
|
|
|
|
history: [],
|
|
|
|
},
|
|
|
|
|
|
|
|
stores: {
|
|
|
|
historystore: {
|
|
|
|
data: [],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
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);
|
|
|
|
let last = 0;
|
|
|
|
let data = statusData.history.map((val) => {
|
|
|
|
if (val === null) {
|
|
|
|
val = last;
|
|
|
|
} else {
|
|
|
|
last = val;
|
|
|
|
}
|
|
|
|
return val;
|
|
|
|
});
|
|
|
|
let historyStore = vm.getStore('historystore');
|
|
|
|
historyStore.setData([
|
|
|
|
{
|
|
|
|
history: data,
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
xtype: 'container',
|
|
|
|
layout: {
|
|
|
|
type: 'hbox',
|
|
|
|
align: 'stretch',
|
|
|
|
},
|
|
|
|
|
|
|
|
defaults: {
|
|
|
|
padding: 5,
|
|
|
|
},
|
|
|
|
|
|
|
|
items: [
|
|
|
|
{
|
2020-11-09 18:26:13 +00:00
|
|
|
xtype: 'panel',
|
|
|
|
border: false,
|
|
|
|
flex: 1,
|
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'),
|
2020-11-09 18:26:13 +00:00
|
|
|
width: 230,
|
2020-11-09 15:01:29 +00:00
|
|
|
printBar: false,
|
|
|
|
bind: {
|
|
|
|
data: {
|
|
|
|
text: '{full}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// we cannot autosize a sparklineline widget,
|
|
|
|
// abuse a grid with a single column/row to do it for us
|
|
|
|
xtype: 'grid',
|
|
|
|
hideHeaders: true,
|
2020-11-09 16:50:46 +00:00
|
|
|
minHeight: 70,
|
2020-11-09 15:01:29 +00:00
|
|
|
border: false,
|
|
|
|
bodyBorder: false,
|
|
|
|
rowLines: false,
|
|
|
|
disableSelection: true,
|
|
|
|
viewConfig: {
|
|
|
|
trackOver: false,
|
|
|
|
},
|
|
|
|
bind: {
|
|
|
|
store: '{historystore}',
|
|
|
|
},
|
|
|
|
columns: [{
|
|
|
|
xtype: 'widgetcolumn',
|
|
|
|
flex: 1,
|
|
|
|
dataIndex: 'history',
|
|
|
|
widget: {
|
|
|
|
xtype: 'sparklineline',
|
|
|
|
bind: '{record.history}',
|
|
|
|
spotRadius: 0,
|
|
|
|
fillColor: '#ddd',
|
|
|
|
lineColor: '#555',
|
|
|
|
lineWidth: 0,
|
|
|
|
chartRangeMin: 0,
|
|
|
|
chartRangeMax: 1,
|
|
|
|
tipTpl: '{y:number("0.00")*100}%',
|
2020-11-09 16:50:46 +00:00
|
|
|
height: 60,
|
2020-11-09 15:01:29 +00:00
|
|
|
},
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
{
|
2020-11-09 18:26:13 +00:00
|
|
|
xtype: 'container',
|
|
|
|
layout: {
|
|
|
|
type: 'hbox',
|
|
|
|
align: 'stretch',
|
|
|
|
},
|
|
|
|
|
|
|
|
defaults: {
|
|
|
|
padding: 5,
|
2020-11-09 15:01:29 +00:00
|
|
|
},
|
2020-11-09 18:26:13 +00:00
|
|
|
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxGauge',
|
|
|
|
warningThreshold: 0.8,
|
|
|
|
criticalThreshold: 0.95,
|
|
|
|
flex: 1,
|
|
|
|
reference: 'usage',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'container',
|
|
|
|
flex: 2,
|
|
|
|
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
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|