diff --git a/apps/pusher_app_prem/appserver/static/license_validation.js b/apps/pusher_app_prem/appserver/static/license_validation.js index a9e250af..b668a4a8 100644 --- a/apps/pusher_app_prem/appserver/static/license_validation.js +++ b/apps/pusher_app_prem/appserver/static/license_validation.js @@ -13,12 +13,103 @@ function initializeLicense() { if (storedLicense) { // Valider la licence stockée validateStoredLicense(storedLicense); + // Afficher les infos de licence + displayLicenseInfo(storedLicense); } else { // Afficher la page de licence showLicenseModal(); } } +function displayLicenseInfo(license) { + console.log("Displaying license info..."); + + // Chercher le container du badge + const container = document.getElementById('license-badge-container'); + if (!container) { + console.error("license-badge-container not found"); + return; + } + + // Créer le badge + const badge = document.createElement('div'); + badge.id = 'license-badge'; + badge.style.cssText = ` + background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); + color: white; + padding: 12px 20px; + border-radius: 8px; + font-size: 12px; + font-weight: 600; + box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3); + cursor: pointer; + transition: all 0.3s ease; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + text-align: center; + min-width: 200px; + `; + + let badgeText = '✓ Licence Activée'; + + // Si c'est une licence d'essai + if (license.startsWith('TRIAL-')) { + const daysRemaining = getTrialDaysRemaining(license); + + if (daysRemaining <= 0) { + badgeText = '⏱️ Essai expiré'; + badge.style.background = 'linear-gradient(135deg, #f44336 0%, #da190b 100%)'; + } else if (daysRemaining <= 2) { + badgeText = `⚠️ ${daysRemaining} jour${daysRemaining > 1 ? 's' : ''} restant${daysRemaining > 1 ? 's' : ''}`; + badge.style.background = 'linear-gradient(135deg, #ff9800 0%, #f57c00 100%)'; + } else { + badgeText = `⏱️ Essai: ${daysRemaining} jours`; + } + } + + badge.textContent = badgeText; + badge.onclick = function() { + alert('Licence: ' + license.substring(0, 50) + '...\n\nClique sur le logo pour gérer ta licence.'); + }; + + container.appendChild(badge); + + // Ajouter un hover effect + badge.addEventListener('mouseenter', function() { + this.style.transform = 'translateY(-3px)'; + this.style.boxShadow = '0 6px 25px rgba(102, 126, 234, 0.5)'; + }); + + badge.addEventListener('mouseleave', function() { + this.style.transform = 'translateY(0)'; + this.style.boxShadow = '0 4px 15px rgba(102, 126, 234, 0.3)'; + }); +} + +function getTrialDaysRemaining(trialLicense) { + // Extraire le timestamp du license (format: TRIAL-timestamp) + const parts = trialLicense.split('-'); + if (parts.length !== 2) return 0; + + const timestamp = parseInt(parts[1]); + if (isNaN(timestamp)) return 0; + + // Créer la date de création + const createdDate = new Date(timestamp); + + // Ajouter 7 jours + const expirationDate = new Date(createdDate.getTime() + (7 * 24 * 60 * 60 * 1000)); + + // Calculer les jours restants + const now = new Date(); + const daysRemaining = Math.ceil((expirationDate - now) / (1000 * 60 * 60 * 24)); + + console.log("Trial created:", createdDate); + console.log("Trial expires:", expirationDate); + console.log("Days remaining:", daysRemaining); + + return Math.max(0, daysRemaining); +} + function showLicenseModal() { console.log("Showing license modal"); @@ -161,6 +252,8 @@ function validateLicenseInput() { setTimeout(() => { closeLicenseModal(); + // Afficher les infos de licence + displayLicenseInfo(licenseInput); }, 1500); } else { showLicenseMessage('Format de licence invalide', 'error'); @@ -168,7 +261,7 @@ function validateLicenseInput() { } function skipLicense() { - // Créer une licence d'essai valide 7 jours + // Créer une licence d'essai avec timestamp (format: TRIAL-timestamp) const trialLicense = 'TRIAL-' + Date.now(); setCookie(LICENSE_STORAGE_KEY, trialLicense, 7); @@ -181,6 +274,8 @@ function skipLicense() { setTimeout(() => { closeLicenseModal(); + // Afficher les infos de licence + displayLicenseInfo(trialLicense); }, 1500); } diff --git a/apps/pusher_app_prem/local/data/ui/views/git_pusher_-_deploy_applications.xml b/apps/pusher_app_prem/local/data/ui/views/git_pusher_-_deploy_applications.xml index 04a32942..292fbe8f 100644 --- a/apps/pusher_app_prem/local/data/ui/views/git_pusher_-_deploy_applications.xml +++ b/apps/pusher_app_prem/local/data/ui/views/git_pusher_-_deploy_applications.xml @@ -2,6 +2,15 @@ Modern interface to push Splunk applications to Git repository + + + + + +
+ +
+
| rest /services/apps/local | search disabled=0 | fields name, label, description | sort label diff --git a/apps/pusher_app_prem/metadata/local.meta b/apps/pusher_app_prem/metadata/local.meta index dbe36808..d8e71ee3 100644 --- a/apps/pusher_app_prem/metadata/local.meta +++ b/apps/pusher_app_prem/metadata/local.meta @@ -23,4 +23,4 @@ access = read : [ * ], write : [ * ] export = none owner = admin version = 10.0.2 -modtime = 1769372397.743890000 +modtime = 1769373002.573917000