<commit_before>frappe.ui.form.on("Hub Settings", {
	refresh: function(frm) {
		frm.add_custom_button(__('Logs'),
			() => frappe.set_route('List', 'Data Migration Run', {
				data_migration_plan: 'Hub Sync'
			}));

		frm.trigger("enabled");
		if (frm.doc.enabled) {
			frm.add_custom_button(__('View Hub'),
				() => frappe.set_route('Hub', 'Item'));
			frm.add_custom_button(__('Sync'),
				() => frm.call('sync'));
		}
	},
	onload: function(frm) {
		let token = frappe.urllib.get_arg("access_token");
		if(token) {
			let email = frm.get_field("user");
			console.log('token', frappe.urllib.get_arg("access_token"));

			get_user_details(frm, token, email);
			let row = frappe.model.add_child(frm.doc, "Hub Users", "users");
			row.user = frappe.session.user;
		}

		if(!frm.doc.country) {
			frm.set_value("country", frappe.defaults.get_default("Country"));
		}
		if(!frm.doc.company) {
			frm.set_value("company", frappe.defaults.get_default("Company"));<commit_msg>[hub] add hub settings access regardless<commit_after>frappe.ui.form.on("Hub Settings", {
	refresh: function(frm) {
		frm.add_custom_button(__('Logs'),
			() => frappe.set_route('List', 'Data Migration Run', {
				data_migration_plan: 'Hub Sync'
			}));

		frm.trigger("enabled");
		frm.add_custom_button(__('View Hub'),
			() => frappe.set_route('Hub', 'Item'));
		if (frm.doc.enabled) {
			frm.add_custom_button(__('Sync'),
				() => frm.call('sync'));
		}
	},
	onload: function(frm) {
		let token = frappe.urllib.get_arg("access_token");
		if(token) {
			let email = frm.get_field("user");
			console.log('token', frappe.urllib.get_arg("access_token"));

			get_user_details(frm, token, email);
			let row = frappe.model.add_child(frm.doc, "Hub Users", "users");
			row.user = frappe.session.user;
		}

		if(!frm.doc.country) {
			frm.set_value("country", frappe.defaults.get_default("Country"));
		}
		if(!frm.doc.company) {
			frm.set_value("company", frappe.defaults.get_default("Company"));
{'fraction_non_alphanumeric': 0.19705434230573896, 'fraction_numerical': 0.0, 'mean_word_length': 4.533707865168539, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7054677', 'n_tokens_mistral': 834, 'n_tokens_neox': 762, 'n_words': 102}