mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-06-26 06:29:51 +00:00

In PBS, we obviously don't have "Proxmox VE" as a default sender, so we need a mechanism to change the default author. Signed-off-by: Lukas Wagner <l.wagner@proxmox.com> Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
59 lines
1021 B
JavaScript
59 lines
1021 B
JavaScript
Ext.define('Proxmox.window.EndpointEditBase', {
|
|
extend: 'Proxmox.window.Edit',
|
|
|
|
isAdd: true,
|
|
|
|
fieldDefaults: {
|
|
labelWidth: 120,
|
|
},
|
|
|
|
width: 700,
|
|
|
|
initComponent: function() {
|
|
let me = this;
|
|
|
|
me.isCreate = !me.name;
|
|
|
|
if (!me.baseUrl) {
|
|
throw "baseUrl not set";
|
|
}
|
|
|
|
if (me.type === 'group') {
|
|
me.url = `/api2/extjs${me.baseUrl}/groups`;
|
|
} else {
|
|
me.url = `/api2/extjs${me.baseUrl}/endpoints/${me.type}`;
|
|
}
|
|
|
|
if (me.isCreate) {
|
|
me.method = 'POST';
|
|
} else {
|
|
me.url += `/${me.name}`;
|
|
me.method = 'PUT';
|
|
}
|
|
|
|
let endpointConfig = Proxmox.Schema.notificationEndpointTypes[me.type];
|
|
if (!endpointConfig) {
|
|
throw 'unknown endpoint type';
|
|
}
|
|
|
|
me.subject = endpointConfig.name;
|
|
|
|
Ext.apply(me, {
|
|
items: [{
|
|
name: me.name,
|
|
xtype: endpointConfig.ipanel,
|
|
isCreate: me.isCreate,
|
|
baseUrl: me.baseUrl,
|
|
type: me.type,
|
|
defaultMailAuthor: endpointConfig.defaultMailAuthor,
|
|
}],
|
|
});
|
|
|
|
me.callParent();
|
|
|
|
if (!me.isCreate) {
|
|
me.load();
|
|
}
|
|
},
|
|
});
|