Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a39544136d | ||
|
|
b1c2c8154d | ||
|
|
ac4b6393d6 | ||
|
|
dfc86baacb | ||
|
|
86568d27c1 | ||
|
|
585f3c31e7 | ||
|
|
a0451be0ca | ||
|
|
1b0b0c9c7b | ||
|
|
dc6f0d6399 | ||
|
|
bb22262862 | ||
|
|
c92dd68bab | ||
|
|
22b189e40c | ||
|
|
2e8620aea2 | ||
|
|
229cf5a35d |
27
debian/changelog
vendored
27
debian/changelog
vendored
@ -1,3 +1,30 @@
|
||||
proxmox-widget-toolkit (2.6-2) buster; urgency=medium
|
||||
|
||||
* add EOL notice component
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 15 Mar 2022 17:29:26 +0100
|
||||
|
||||
proxmox-widget-toolkit (2.6-1) buster; urgency=medium
|
||||
|
||||
* combo grid: load: rework auto-selection and validity logic to ensure it's
|
||||
always shown if a (now) invalid value is configured
|
||||
|
||||
* cbind mixin: also descend in elements with an cbind property
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 25 Jun 2021 09:32:40 +0200
|
||||
|
||||
proxmox-widget-toolkit (2.5-6) buster; urgency=medium
|
||||
|
||||
* object grid: allow one to declaratively specify rows
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 21 May 2021 17:39:59 +0200
|
||||
|
||||
proxmox-widget-toolkit (2.5-5) pve pmg; urgency=medium
|
||||
|
||||
* disks: fix regression in S.M.A.R.T. window
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 14 May 2021 10:30:39 +0200
|
||||
|
||||
proxmox-widget-toolkit (2.5-4) pve pmg; urgency=medium
|
||||
|
||||
* info widget: set default usage warning threshold from 60% to 75%
|
||||
|
||||
@ -40,6 +40,7 @@ JSSRC= \
|
||||
button/HelpButton.js \
|
||||
grid/ObjectGrid.js \
|
||||
grid/PendingObjectGrid.js \
|
||||
panel/EOLNotice.js \
|
||||
panel/DiskList.js \
|
||||
panel/InputPanel.js \
|
||||
panel/InfoWidget.js \
|
||||
@ -88,6 +89,7 @@ all: ${SUBDIRS}
|
||||
check: lint
|
||||
lint: ${JSSRC}
|
||||
eslint --strict ${JSSRC}
|
||||
touch ".lint-incremental"
|
||||
|
||||
proxmoxlib.js: .lint-incremental ${JSSRC}
|
||||
# add the version as comment in the file
|
||||
|
||||
@ -43,6 +43,14 @@
|
||||
color: #FF6C59;
|
||||
}
|
||||
|
||||
.pwt-eol-icon {
|
||||
position: relative;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
font-size: 1.3em;
|
||||
color: #FF6C59;
|
||||
}
|
||||
|
||||
/* reduce chart legend space usage to something more sane */
|
||||
.x-legend-item {
|
||||
padding: 0.4em 0.8em 0.4em 1.8em;
|
||||
|
||||
@ -425,14 +425,12 @@ Ext.define('Proxmox.form.ComboGrid', {
|
||||
if (me.enableLoadMask) {
|
||||
delete me.enableLoadMask;
|
||||
|
||||
// if the picker exists,
|
||||
// we reset its minheight to the saved let/0
|
||||
// we have to update the layout, otherwise the height
|
||||
// gets not recalculated
|
||||
// if the picker exists, we reset its minHeight to the previous saved one or 0
|
||||
if (me.picker) {
|
||||
me.picker.setMinHeight(me.savedMinHeight || 0);
|
||||
Proxmox.Utils.setErrorMask(me.picker);
|
||||
delete me.savedMinHeight;
|
||||
// we have to update the layout, otherwise the height gets not recalculated
|
||||
me.picker.updateLayout();
|
||||
}
|
||||
}
|
||||
@ -447,15 +445,19 @@ Ext.define('Proxmox.form.ComboGrid', {
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
let rec = me.store.first();
|
||||
if (me.autoSelect && rec && rec.data) {
|
||||
def = rec.data[me.valueField];
|
||||
me.setValue(def, true);
|
||||
} else if (!me.allowBlank && !(Ext.isArray(def) ? def.length : def)) {
|
||||
me.setValue(def);
|
||||
if (!me.notFoundIsValid && !me.isDisabled()) {
|
||||
me.markInvalid(me.blankText);
|
||||
if (!(Ext.isArray(def) ? def.length : def)) {
|
||||
let rec = me.store.first();
|
||||
if (me.autoSelect && rec && rec.data) {
|
||||
def = rec.data[me.valueField];
|
||||
me.setValue(def, true);
|
||||
} else if (!me.allowBlank) {
|
||||
me.setValue(def);
|
||||
if (!me.isDisabled()) {
|
||||
me.markInvalid(me.blankText);
|
||||
}
|
||||
}
|
||||
} else if (!me.notFoundIsValid && !me.isDisabled()) {
|
||||
me.markInvalid(gettext('Invalid Value'));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -1,24 +1,53 @@
|
||||
/* Renders a list of key values objets
|
||||
/** Renders a list of key values objets
|
||||
|
||||
Mandatory Config Parameters:
|
||||
|
||||
mandatory config parameters:
|
||||
rows: an object container where each propery is a key-value object we want to render
|
||||
let rows = {
|
||||
keyboard: {
|
||||
header: gettext('Keyboard Layout'),
|
||||
editor: 'Your.KeyboardEdit',
|
||||
required: true
|
||||
},
|
||||
|
||||
optional:
|
||||
disabled: setting this parameter to true will disable selection and focus on the
|
||||
proxmoxObjectGrid as well as greying out input elements.
|
||||
Useful for a readonly tabular display
|
||||
rows: {
|
||||
keyboard: {
|
||||
header: gettext('Keyboard Layout'),
|
||||
editor: 'Your.KeyboardEdit',
|
||||
required: true
|
||||
},
|
||||
// ...
|
||||
},
|
||||
|
||||
Convenience Helper:
|
||||
|
||||
As alternative you can use the common add-row helper like `add_text_row`, but you need to
|
||||
call it in an overridden initComponent before `me.callParent(arguments)` gets executed.
|
||||
|
||||
For a declarative approach you can use the `gridRows` configuration to pass an array of
|
||||
objects with each having at least a `xtype` to match `add_XTYPE_row` and a field-name
|
||||
property, for example:
|
||||
|
||||
gridRows: [
|
||||
{
|
||||
xtype: 'text',
|
||||
name: 'http-proxy',
|
||||
text: gettext('HTTP proxy'),
|
||||
defaultValue: Proxmox.Utils.noneText,
|
||||
vtype: 'HttpProxy',
|
||||
deleteEmpty: true,
|
||||
},
|
||||
],
|
||||
|
||||
Optional Configs:
|
||||
|
||||
disabled:: setting this parameter to true will disable selection and focus on
|
||||
the proxmoxObjectGrid as well as greying out input elements. Useful for a
|
||||
readonly tabular display
|
||||
|
||||
*/
|
||||
|
||||
Ext.define('Proxmox.grid.ObjectGrid', {
|
||||
extend: 'Ext.grid.GridPanel',
|
||||
alias: ['widget.proxmoxObjectGrid'],
|
||||
|
||||
// can be used as declarative replacement over manually calling the add_XYZ_row helpers,
|
||||
// see top-level doc-comment above for details/example
|
||||
gridRows: [],
|
||||
|
||||
disabled: false,
|
||||
hideHeaders: true,
|
||||
|
||||
@ -80,8 +109,7 @@ Ext.define('Proxmox.grid.ObjectGrid', {
|
||||
name: name,
|
||||
deleteEmpty: !!opts.deleteEmpty,
|
||||
emptyText: opts.defaultValue,
|
||||
labelWidth: Proxmox.Utils.compute_min_label_width(
|
||||
text, opts.labelWidth),
|
||||
labelWidth: Proxmox.Utils.compute_min_label_width(text, opts.labelWidth),
|
||||
vtype: opts.vtype,
|
||||
fieldLabel: text,
|
||||
},
|
||||
@ -114,8 +142,7 @@ Ext.define('Proxmox.grid.ObjectGrid', {
|
||||
defaultValue: opts.defaultValue || 0,
|
||||
checked: !!opts.defaultValue,
|
||||
deleteDefaultValue: !!opts.deleteDefaultValue,
|
||||
labelWidth: Proxmox.Utils.compute_min_label_width(
|
||||
text, opts.labelWidth),
|
||||
labelWidth: Proxmox.Utils.compute_min_label_width(text, opts.labelWidth),
|
||||
fieldLabel: text,
|
||||
},
|
||||
},
|
||||
@ -148,8 +175,7 @@ Ext.define('Proxmox.grid.ObjectGrid', {
|
||||
emptyText: gettext('Default'),
|
||||
deleteEmpty: !!opts.deleteEmpty,
|
||||
value: opts.defaultValue,
|
||||
labelWidth: Proxmox.Utils.compute_min_label_width(
|
||||
text, opts.labelWidth),
|
||||
labelWidth: Proxmox.Utils.compute_min_label_width(text, opts.labelWidth),
|
||||
fieldLabel: text,
|
||||
},
|
||||
},
|
||||
@ -246,6 +272,17 @@ Ext.define('Proxmox.grid.ObjectGrid', {
|
||||
initComponent: function() {
|
||||
let me = this;
|
||||
|
||||
for (const rowdef of me.gridRows || []) {
|
||||
let addFn = me[`add_${rowdef.xtype}_row`];
|
||||
if (typeof addFn !== 'function') {
|
||||
throw `unknown object-grid row xtype '${rowdef.xtype}'`;
|
||||
} else if (typeof rowdef.name !== 'string') {
|
||||
throw `object-grid row need a valid name string-property!`;
|
||||
} else {
|
||||
addFn.call(me, rowdef.name, rowdef.text || rowdef.name, rowdef);
|
||||
}
|
||||
}
|
||||
|
||||
let rows = me.rows;
|
||||
|
||||
if (!me.rstore) {
|
||||
@ -269,13 +306,13 @@ Ext.define('Proxmox.grid.ObjectGrid', {
|
||||
});
|
||||
|
||||
if (rows) {
|
||||
Ext.Object.each(rows, function(key, rowdef) {
|
||||
for (const [key, rowdef] of Object.entries(rows)) {
|
||||
if (Ext.isDefined(rowdef.defaultValue)) {
|
||||
store.add({ key: key, value: rowdef.defaultValue });
|
||||
} else if (rowdef.required) {
|
||||
store.add({ key: key, value: undefined });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (me.sorterFn) {
|
||||
|
||||
@ -88,7 +88,7 @@ Ext.define('Proxmox.Mixin.CBind', {
|
||||
found = false;
|
||||
for (i = 0; i < arrayLength; i++) {
|
||||
el = org[i];
|
||||
if (el.constructor === Object && el.xtype) {
|
||||
if (el.constructor === Object && (el.xtype || el.cbind)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@ -99,7 +99,7 @@ Ext.define('Proxmox.Mixin.CBind', {
|
||||
copy = [];
|
||||
for (i = 0; i < arrayLength; i++) {
|
||||
el = org[i];
|
||||
if (el.constructor === Object && el.xtype) {
|
||||
if (el.constructor === Object && (el.xtype || el.cbind)) {
|
||||
elcopy = cloneTemplateObject(el);
|
||||
if (elcopy.cbind) {
|
||||
applyCBind(elcopy);
|
||||
@ -123,7 +123,7 @@ Ext.define('Proxmox.Mixin.CBind', {
|
||||
res[prop] = el;
|
||||
continue;
|
||||
}
|
||||
if (el.constructor === Object && el.xtype) {
|
||||
if (el.constructor === Object && (el.xtype || el.cbind)) {
|
||||
copy = cloneTemplateObject(el);
|
||||
if (copy.cbind) {
|
||||
applyCBind(copy);
|
||||
@ -146,7 +146,7 @@ Ext.define('Proxmox.Mixin.CBind', {
|
||||
el = me[prop];
|
||||
if (el === undefined || el === null) continue;
|
||||
if (typeof el === 'object' && el.constructor === Object) {
|
||||
if (el.xtype && prop !== 'config') {
|
||||
if ((el.xtype || el.cbind) && prop !== 'config') {
|
||||
me[prop] = cloneTemplateObject(el);
|
||||
}
|
||||
} else if (el.constructor === Array) {
|
||||
|
||||
33
src/panel/EOLNotice.js
Normal file
33
src/panel/EOLNotice.js
Normal file
@ -0,0 +1,33 @@
|
||||
// not realy a panel descendant, but its the best (existing) place for this
|
||||
Ext.define('Proxmox.EOLNotice', {
|
||||
extend: 'Ext.Component',
|
||||
alias: 'widget.proxmoxEOLNotice',
|
||||
|
||||
padding: '0 5',
|
||||
|
||||
config: {
|
||||
product: '',
|
||||
version: '',
|
||||
eolDate: '',
|
||||
href: '',
|
||||
},
|
||||
|
||||
autoEl: {
|
||||
tag: 'div',
|
||||
'data-qtip': gettext("You won't get any security fixes after the End-Of-Life date. Please consider upgrading."),
|
||||
},
|
||||
|
||||
initComponent: function() {
|
||||
let me = this;
|
||||
|
||||
let href = me.href.startsWith('http') ? me.href : `https://${me.href}`;
|
||||
let message = Ext.String.format(
|
||||
gettext('Support for {0} {1} ends on {2}'), me.product, me.version, me.eolDate);
|
||||
|
||||
me.html = `<i class="fa pwt-eol-icon fa-exclamation-triangle"></i>
|
||||
<a href="${href}" target="_blank">${message} <i class="fa fa-external-link"></i></a>
|
||||
`;
|
||||
|
||||
me.callParent();
|
||||
},
|
||||
});
|
||||
@ -136,7 +136,7 @@ Ext.define('Proxmox.window.DiskSmart', {
|
||||
me.down('#text').setVisible(true);
|
||||
} else {
|
||||
grid.setVisible(true);
|
||||
me.down('#textContainer').setVisible(false);
|
||||
me.down('#text').setVisible(false);
|
||||
grid.setStore(rec.attributes());
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user