mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 04:29:21 +03:00
Added Admin -> Config to view all the application.ini settings.
TODO: save changes
This commit is contained in:
parent
d7db182e5f
commit
f20a7c7b83
31 changed files with 263 additions and 80 deletions
47
dev/Settings/Admin/Config.js
Normal file
47
dev/Settings/Admin/Config.js
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import Remote from 'Remote/Admin/Fetch';
|
||||
|
||||
export class ConfigAdminSettings /*extends AbstractViewSettings*/ {
|
||||
|
||||
constructor() {
|
||||
this.config = ko.observableArray();
|
||||
}
|
||||
|
||||
onBeforeShow() {
|
||||
Remote.request('AdminSettingsGet', (iError, data) => {
|
||||
if (!iError) {
|
||||
const cfg = [],
|
||||
getInputType = value => {
|
||||
switch (typeof value)
|
||||
{
|
||||
case 'boolean': return 'checkbox';
|
||||
case 'number': return 'number';
|
||||
}
|
||||
return 'text';
|
||||
};
|
||||
Object.entries(data.Result).forEach(([key, items]) => {
|
||||
const section = {
|
||||
name: key,
|
||||
items: []
|
||||
};
|
||||
Object.entries(items).forEach(([skey, item]) => {
|
||||
section.items.push({
|
||||
key: `config[${key}][${skey}]`,
|
||||
name: skey,
|
||||
value: item[0],
|
||||
type: getInputType(item[0]),
|
||||
comment: item[1]
|
||||
});
|
||||
});
|
||||
cfg.push(section);
|
||||
});
|
||||
this.config(cfg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
saveConfig(form) {
|
||||
Remote.post('AdminSettingsSet', null, new FormData(form));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue