// Copyright (c) 2022, JINGROW
// For license information, please see license.txt

jingrow.ui.form.on('Add On Settings', {
	refresh: function (frm) {
		create_custom_button(frm, 'Reset etcd Admin Data', 'init_etcd_data');
	},
});

function create_custom_button(frm, title, method) {
	return frm.add_custom_button(
		__(title),
		() => {
			jingrow.prompt(
				{
					fieldtype: 'Data',
					label: 'Proxy Server Name',
					fieldname: 'proxy_server',
					reqd: 1,
				},
				({ proxy_server }) => {
					frm.call(method, { proxy_server: proxy_server });
				},
			);
		},
		'Actions',
	);
}
