mirror of
https://git.proxmox.com/git/pmg-gui
synced 2025-08-14 12:31:49 +00:00
add email combobox to black/whitelist
so that we can show it in the admin interface too Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
8e89b895fe
commit
7d51f9ff94
@ -16,21 +16,30 @@ Ext.define('PMG.UserBlackWhiteList', {
|
|||||||
|
|
||||||
onAddAddress: function() {
|
onAddAddress: function() {
|
||||||
var me = this.getView();
|
var me = this.getView();
|
||||||
|
var params = me.getStore().getProxy().getExtraParams() || {};
|
||||||
|
|
||||||
var url = '/quarantine/' + me.listname;
|
var url = '/quarantine/' + me.listname;
|
||||||
|
|
||||||
|
var items = [{
|
||||||
|
xtype: 'proxmoxtextfield',
|
||||||
|
name: 'address',
|
||||||
|
fieldLabel: gettext("Address")
|
||||||
|
}];
|
||||||
|
|
||||||
|
Ext.Object.each(params, function(key, value) {
|
||||||
|
items.push({
|
||||||
|
xtype: 'hidden',
|
||||||
|
name: key,
|
||||||
|
value: value,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: url,
|
url: url,
|
||||||
create: true,
|
create: true,
|
||||||
isAdd: true,
|
isAdd: true,
|
||||||
items: [
|
items: items
|
||||||
{
|
|
||||||
xtype: 'proxmoxtextfield',
|
|
||||||
name: 'address',
|
|
||||||
fieldLabel: gettext("Address")
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (me.listname === 'blacklist') {
|
if (me.listname === 'blacklist') {
|
||||||
@ -51,10 +60,11 @@ Ext.define('PMG.UserBlackWhiteList', {
|
|||||||
var rec = me.selModel.getSelection()[0];
|
var rec = me.selModel.getSelection()[0];
|
||||||
if (!rec) return;
|
if (!rec) return;
|
||||||
|
|
||||||
|
var params = me.getStore().getProxy().getExtraParams() || {};
|
||||||
var url = '/quarantine/' + me.listname + '/' + rec.getId();
|
var url = '/quarantine/' + me.listname + '/' + rec.getId();
|
||||||
|
|
||||||
Proxmox.Utils.API2Request({
|
Proxmox.Utils.API2Request({
|
||||||
url: url,
|
url: url + '?' + Ext.Object.toQueryString(params),
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
waitMsgTarget: me,
|
waitMsgTarget: me,
|
||||||
callback: function(options, success, response) {
|
callback: function(options, success, response) {
|
||||||
@ -64,10 +74,52 @@ Ext.define('PMG.UserBlackWhiteList', {
|
|||||||
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
changeEmail: function(combobox, value) {
|
||||||
|
var view = this.getView();
|
||||||
|
view.getStore().getProxy().setExtraParams({
|
||||||
|
pmail: value
|
||||||
|
});
|
||||||
|
view.getStore().load();
|
||||||
|
},
|
||||||
|
|
||||||
|
init: function() {
|
||||||
|
var view = this.getView();
|
||||||
|
|
||||||
|
if (PMG.view === 'quarantine') {
|
||||||
|
this.lookupReference('email').setVisible(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
control: {
|
||||||
|
'combobox':{
|
||||||
|
change: {
|
||||||
|
fn: 'changeEmail',
|
||||||
|
buffer: 500
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
tbar: [
|
tbar: [
|
||||||
|
{
|
||||||
|
xtype: 'combobox',
|
||||||
|
displayField: 'mail',
|
||||||
|
valueField: 'mail',
|
||||||
|
store: {
|
||||||
|
proxy: {
|
||||||
|
type: 'proxmox',
|
||||||
|
url: '/api2/json/quarantine/quarusers'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
queryParam: false,
|
||||||
|
queryCaching: false,
|
||||||
|
editable: true,
|
||||||
|
reference: 'email',
|
||||||
|
name: 'email',
|
||||||
|
fieldLabel: 'E-Mail',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: gettext('Add'),
|
text: gettext('Add'),
|
||||||
handler: 'onAddAddress'
|
handler: 'onAddAddress'
|
||||||
|
Loading…
Reference in New Issue
Block a user