feat: rename farmer to resource provider in JS functions and structs

This commit is contained in:
mik-tf
2025-09-07 09:35:04 -04:00
parent c8e28cf8ed
commit 63c0e936d6
4 changed files with 22 additions and 22 deletions

View File

@@ -9,7 +9,7 @@ if (window.resourceProviderDashboardInitialized) {
console.log('🚜 ResourceProvider Dashboard JavaScript loaded - Automatic Slice System');
// Initialize dashboard
initializeFarmerDashboard();
initializeResourceProviderDashboard();
initializeAutomaticSliceManagement(); // NEW: Initialize automatic slice management
initializeNodeManagement();
initializeStakingManagement();
@@ -1175,11 +1175,11 @@ function createSimpleIndividualPricingForms() {
/**
* Initialize resource_provider dashboard functionality
*/
function initializeFarmerDashboard() {
function initializeResourceProviderDashboard() {
console.log('🚜 Initializing resource_provider dashboard');
// Load resource_provider data
loadFarmerData();
loadResourceProviderData();
// Load slice templates
loadSliceTemplates();
@@ -1188,7 +1188,7 @@ function initializeFarmerDashboard() {
loadNodeGroups();
// Set up periodic data refresh
setInterval(loadFarmerData, 30000); // Refresh every 30 seconds
setInterval(loadResourceProviderData, 30000); // Refresh every 30 seconds
setInterval(loadSliceTemplates, 60000); // Refresh slice templates every minute
setInterval(loadNodeGroups, 60000); // Refresh node groups every minute
}
@@ -2913,7 +2913,7 @@ function resetSliceConfigurationForm() {
/**
* Load resource_provider data from API
*/
async function loadFarmerData() {
async function loadResourceProviderData() {
try {
const data = await window.apiJson('/api/dashboard/resource_provider-data');
console.log('🚜 Loaded resource_provider data:', data);
@@ -3968,7 +3968,7 @@ async function addGridNodes() {
// Reload resource_provider data and node groups with small delay for backend processing
setTimeout(async () => {
await loadFarmerData();
await loadResourceProviderData();
await loadNodeGroups(); // FARMER FIX: Refresh node groups table after adding new nodes
await loadWalletBalance(); // Refresh wallet balance after staking
await updateStakingDisplay(); // Refresh staking statistics after staking
@@ -4157,7 +4157,7 @@ async function confirmNodeDeletion() {
// Reload resource_provider data and node groups with small delay for backend processing
setTimeout(() => {
loadFarmerData();
loadResourceProviderData();
loadNodeGroups(); // FARMER FIX: Refresh node groups table after node deletion
}, 100);
@@ -4927,7 +4927,7 @@ async function saveNodeConfiguration() {
// Reload resource_provider data and node groups with small delay for backend processing
setTimeout(async () => {
await loadFarmerData();
await loadResourceProviderData();
await loadNodeGroups(); // FARMER FIX: Refresh node groups table after node configuration changes
await loadWalletBalance(); // Refresh wallet balance after staking changes
await updateStakingDisplay(); // Refresh staking statistics after staking changes
@@ -6587,7 +6587,7 @@ async function deleteCustomNodeGroup(groupId) {
console.log('📦 Custom group deleted:', result);
showNotification('Custom node group deleted successfully', 'success');
modal.hide();
setTimeout(() => { loadNodeGroups(); try { loadExistingGroups(); } catch (_) {} loadFarmerData(); }, 100);
setTimeout(() => { loadNodeGroups(); try { loadExistingGroups(); } catch (_) {} loadResourceProviderData(); }, 100);
} catch (error) {
console.error('📦 Error deleting custom group:', error);
showNotification('Failed to delete custom group', 'error');
@@ -6727,7 +6727,7 @@ async function assignNodeToGroup(nodeId, groupId) {
// FARMER FIX: Add small delay to ensure backend processing is complete
setTimeout(() => {
loadFarmerData(); // Reload to show updated assignments
loadResourceProviderData(); // Reload to show updated assignments
loadNodeGroups(); // Reload to update group statistics
}, 100);
@@ -7658,7 +7658,7 @@ async function stakeOnNode(nodeId, modal) {
modal.hide();
// Refresh resource_provider data to show updated staking
await loadFarmerData();
await loadResourceProviderData();
// Update wallet balance display
await loadWalletBalance();
@@ -7713,7 +7713,7 @@ async function unstakeFromNode(nodeId) {
showNotification(`Successfully unstaked ${returnedAmount} TFP from node`, 'success');
// Refresh resource_provider data to show updated staking
await loadFarmerData();
await loadResourceProviderData();
// Update wallet balance display
await loadWalletBalance();
@@ -7848,7 +7848,7 @@ async function updateNodeStaking(nodeId, modal) {
modal.hide();
// Refresh resource_provider data to show updated staking
await loadFarmerData();
await loadResourceProviderData();
// Update wallet balance display
await loadWalletBalance();