forked from proxmox-mirrors/proxmox-backup

Use `proxmox-biome format --write`, which is a small wrapper around [Biome] that sets the desired config options for matching the Proxmox style guide as close as possible. Note that the space between function key word and parameter parenthesis for anonymous functions or function names and parameter parenthesis for named functions is rather odd and not per our style guide, but this is not configurable and while it would be relatively simple to change in the formatter code of biome, we would like to avoid doing so for both maintenance reason and as this is seemingly the default in the "web" industry, as prettier–one of the most popular formatters for web projects–uses this and Biome copied the style mostly from there. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> [TL: add commit message with some background] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
108 lines
3.0 KiB
JavaScript
108 lines
3.0 KiB
JavaScript
Ext.define('PBS.window.NamespaceEdit', {
|
|
extend: 'Proxmox.window.Edit',
|
|
xtype: 'pbsNamespaceEdit', // for now rather "NamespaceAdd"
|
|
mixins: ['Proxmox.Mixin.CBind'],
|
|
|
|
onlineHelp: 'storage-namespaces',
|
|
|
|
isCreate: true,
|
|
subject: gettext('Namespace'),
|
|
// avoid that the trigger of the combogrid fields open on window show
|
|
defaultFocus: 'proxmoxtextfield[name=name]',
|
|
|
|
cbind: {
|
|
url: '/api2/extjs/admin/datastore/{datastore}/namespace',
|
|
},
|
|
method: 'POST',
|
|
|
|
width: 450,
|
|
fieldDefaults: {
|
|
labelWidth: 120,
|
|
},
|
|
|
|
items: {
|
|
xtype: 'inputpanel',
|
|
onGetValues: function (values) {
|
|
if (values.parent === '') {
|
|
delete values.parent;
|
|
}
|
|
return values;
|
|
},
|
|
items: [
|
|
{
|
|
xtype: 'pbsNamespaceSelector',
|
|
name: 'parent',
|
|
fieldLabel: gettext('Parent Namespace'),
|
|
cbind: {
|
|
value: '{namespace}',
|
|
datastore: '{datastore}',
|
|
},
|
|
},
|
|
{
|
|
xtype: 'proxmoxtextfield',
|
|
name: 'name',
|
|
fieldLabel: gettext('Namespace Name'),
|
|
value: '',
|
|
allowBlank: false,
|
|
maxLength: 31,
|
|
regex: PBS.Utils.SAFE_ID_RE,
|
|
regexText: gettext("Only alpha numerical, '_' and '-' (if not at start) allowed"),
|
|
},
|
|
],
|
|
},
|
|
});
|
|
|
|
Ext.define('PBS.window.NamespaceDelete', {
|
|
extend: 'Proxmox.window.SafeDestroy',
|
|
xtype: 'pbsNamespaceDelete',
|
|
mixins: ['Proxmox.Mixin.CBind'],
|
|
|
|
viewModel: {},
|
|
|
|
autoShow: true,
|
|
taskName: 'delete-namespace',
|
|
|
|
cbind: {
|
|
url: '/api2/extjs/admin/datastore/{datastore}/namespace',
|
|
},
|
|
additionalItems: [
|
|
{
|
|
xtype: 'proxmoxcheckbox',
|
|
name: 'delete-groups',
|
|
reference: 'rmGroups',
|
|
boxLabel: gettext('Delete all Backup Groups'),
|
|
value: false,
|
|
listeners: {
|
|
change: function (field, value) {
|
|
let win = field.up('proxmoxSafeDestroy');
|
|
if (value) {
|
|
win.params['delete-groups'] = value;
|
|
} else {
|
|
delete win.params['delete-groups'];
|
|
}
|
|
},
|
|
},
|
|
},
|
|
{
|
|
xtype: 'box',
|
|
padding: '5 0 0 0',
|
|
html:
|
|
`<span class="pmx-hint">${gettext('Note')}</span>: ` +
|
|
gettext(
|
|
'This will permanently remove all backups from the current namespace and all namespaces below it!',
|
|
),
|
|
bind: {
|
|
hidden: '{!rmGroups.checked}',
|
|
},
|
|
},
|
|
],
|
|
|
|
initComponent: function () {
|
|
let me = this;
|
|
me.title = Ext.String.format(gettext("Destroy Namespace '{0}'"), me.namespace);
|
|
me.params = { ns: me.namespace };
|
|
|
|
me.callParent();
|
|
},
|
|
});
|