2020-07-25 18:10:06 +00:00
|
|
|
Ext.define('PBS.data.PermissionPathsStore', {
|
|
|
|
extend: 'Ext.data.Store',
|
|
|
|
alias: 'store.pbsPermissionPaths',
|
|
|
|
fields: ['value'],
|
|
|
|
autoLoad: false,
|
|
|
|
data: [
|
|
|
|
{ 'value': '/' },
|
|
|
|
{ 'value': '/access' },
|
|
|
|
{ 'value': '/access/acl' },
|
|
|
|
{ 'value': '/access/users' },
|
2021-07-09 11:44:01 +00:00
|
|
|
{ 'value': '/access/domains' },
|
2022-05-16 06:44:49 +00:00
|
|
|
{ 'value': '/access/openid' },
|
2020-07-25 18:10:06 +00:00
|
|
|
{ 'value': '/datastore' },
|
|
|
|
{ 'value': '/remote' },
|
|
|
|
{ 'value': '/system' },
|
2022-05-16 06:44:49 +00:00
|
|
|
{ 'value': '/system/certificates' },
|
2020-07-25 18:10:06 +00:00
|
|
|
{ 'value': '/system/disks' },
|
|
|
|
{ 'value': '/system/log' },
|
|
|
|
{ 'value': '/system/network' },
|
|
|
|
{ 'value': '/system/network/dns' },
|
|
|
|
{ 'value': '/system/network/interfaces' },
|
|
|
|
{ 'value': '/system/services' },
|
|
|
|
{ 'value': '/system/status' },
|
|
|
|
{ 'value': '/system/tasks' },
|
|
|
|
{ 'value': '/system/time' },
|
2021-03-04 07:33:26 +00:00
|
|
|
{ 'value': '/tape' },
|
2021-03-05 09:06:19 +00:00
|
|
|
{ 'value': '/tape/device' },
|
2021-03-04 07:33:26 +00:00
|
|
|
{ 'value': '/tape/pool' },
|
|
|
|
{ 'value': '/tape/job' },
|
2020-07-25 18:10:06 +00:00
|
|
|
],
|
|
|
|
|
|
|
|
constructor: function(config) {
|
|
|
|
let me = this;
|
|
|
|
|
|
|
|
config = config || {};
|
|
|
|
me.callParent([config]);
|
|
|
|
|
2022-05-14 10:28:01 +00:00
|
|
|
// TODO: this is but a HACK until we have some sort of resource storage like PVE
|
2020-07-25 18:10:06 +00:00
|
|
|
let datastores = Ext.data.StoreManager.lookup('pbs-datastore-list');
|
|
|
|
|
|
|
|
if (datastores) {
|
|
|
|
let donePaths = {};
|
|
|
|
me.suspendEvents();
|
|
|
|
datastores.each(function(record) {
|
|
|
|
let path = `/datastore/${record.data.store}`;
|
|
|
|
if (path !== undefined && !donePaths[path]) {
|
|
|
|
me.add({ value: path });
|
|
|
|
donePaths[path] = 1;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
me.resumeEvents();
|
|
|
|
|
|
|
|
me.fireEvent('refresh', me);
|
|
|
|
me.fireEvent('datachanged', me);
|
|
|
|
}
|
|
|
|
|
|
|
|
me.sort({
|
|
|
|
property: 'value',
|
|
|
|
direction: 'ASC',
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
Ext.define('PBS.form.PermissionPathSelector', {
|
|
|
|
extend: 'Ext.form.field.ComboBox',
|
|
|
|
xtype: 'pbsPermissionPathSelector',
|
2020-10-30 15:30:57 +00:00
|
|
|
mixins: ['Proxmox.Mixin.CBind'],
|
2020-07-25 18:10:06 +00:00
|
|
|
|
|
|
|
valueField: 'value',
|
|
|
|
displayField: 'value',
|
2020-10-30 15:30:57 +00:00
|
|
|
cbind: {
|
|
|
|
typeAhead: '{editable}',
|
|
|
|
},
|
2020-07-25 18:10:06 +00:00
|
|
|
anyMatch: true,
|
|
|
|
queryMode: 'local',
|
|
|
|
|
|
|
|
store: {
|
|
|
|
type: 'pbsPermissionPaths',
|
|
|
|
},
|
|
|
|
regexText: gettext('Invalid permission path.'),
|
|
|
|
regex: /\/((access|datastore|remote|system)\/.*)?/,
|
|
|
|
});
|