@crestron/ch5-shell-utilities-cli
Advanced tools
Comparing version 2.4.1 to 2.5.0
@@ -410,4 +410,3 @@ { | ||
"tokenSource": "", | ||
"tokenUrl": "", | ||
"licenseExpirationWarning": 60 | ||
"tokenUrl": "" | ||
} | ||
@@ -423,4 +422,3 @@ }, | ||
"tokenSource": "", | ||
"tokenUrl": "", | ||
"licenseExpirationWarning": 60 | ||
"tokenUrl": "" | ||
}, | ||
@@ -472,8 +470,2 @@ "description": "The details of Control system to connect.", | ||
"pattern": "^(?!\\s*$).+" | ||
}, | ||
"licenseExpirationWarning": { | ||
"default": 60, | ||
"type": "integer", | ||
"title": "licenseExpirationWarning", | ||
"description": "Show a warning that a license will expire a set number of days prior to expiration. Set to 0 to avoid showing a warning. The default value is 60 days." | ||
} | ||
@@ -480,0 +472,0 @@ }, |
@@ -72,4 +72,3 @@ { | ||
"ipid": "IPID:", | ||
"roomid": "Room ID:", | ||
"license": "License" | ||
"roomid": "Room ID:" | ||
}, | ||
@@ -76,0 +75,0 @@ "diagnostics": { |
@@ -30,3 +30,2 @@ // Copyright (C) 2022 to the present, Crestron Electronics, Inc. | ||
var WARN_DAYS_BEFORE = 0; | ||
var status; | ||
@@ -65,5 +64,2 @@ var pcConfig = config; | ||
pcConfig.tokenUrl = projectConfig.config.controlSystem.tokenUrl || config.tokenUrl; | ||
// if undefined, assign 60 days as default | ||
WARN_DAYS_BEFORE = projectConfig.config.controlSystem.licenseExpirationWarning || 60; | ||
} | ||
@@ -162,55 +158,2 @@ } | ||
// Display License errors | ||
WebXPanel.default.addEventListener(WebXPanel.WebXPanelEvents.LICENSE_WS, ({ detail }) => { | ||
updateDialogLicenseInfo(detail); | ||
}); | ||
function updateDialogLicenseInfo(detail) { | ||
const controlSystemSupportsLicense = detail.controlSystemSupportsLicense; // boolean | ||
const licenseApplied = detail.licenseApplied; // optional boolean | ||
const licenseDaysRemaining = detail.licenseDaysRemaining; // optional number | ||
const licenseHasExpiry = detail.licenseHasExpiry; // optional boolean | ||
const trialPeriod = detail.trialPeriod; // optional boolean | ||
const trialPeriodDaysRemaining = detail.trialPeriodDaysRemaining; // optional number | ||
const resourceAvailable = detail.resourceAvailable; // boolean | ||
const licenseNotRequired = detail.licenseNotRequired; // optional boolean | ||
let licenseMessage = ""; | ||
if (!controlSystemSupportsLicense) { | ||
licenseMessage = translateModule.translateInstant("app.webxpanel.license.csmobilitysupport"); | ||
} else if (!resourceAvailable) { | ||
licenseMessage = translateModule.translateInstant("app.webxpanel.license.mobilitylicenserequired"); | ||
} else if (licenseApplied) { | ||
if (!licenseHasExpiry) { | ||
licenseMessage = translateModule.translateInstant("app.webxpanel.license.mobilitylicensevalid"); | ||
} else { | ||
// Display warning | ||
displayLicenseWarning(WARN_DAYS_BEFORE, licenseDaysRemaining); | ||
licenseMessage = translateModule.translateInstant("app.webxpanel.license.mobilitylicensewarning", { licenseDaysRemaining }); | ||
const updatedDetail = detail; | ||
updatedDetail.licenseDaysRemaining = licenseDaysRemaining - 1; | ||
setTimeout(updateDialogLicenseInfo, 24 * 60 * 60 * 1000, updatedDetail); | ||
} | ||
} else if (trialPeriod) { | ||
licenseMessage = translateModule.translateInstant("app.webxpanel.license.mobilitylicensetrial", { trialPeriodDaysRemaining }); | ||
// Display warning | ||
displayLicenseWarning(WARN_DAYS_BEFORE, trialPeriodDaysRemaining); | ||
const updatedDetail = detail; | ||
updatedDetail.trialPeriodDaysRemaining = trialPeriodDaysRemaining - 1; | ||
setTimeout(updateDialogLicenseInfo, 24 * 60 * 60 * 1000, updatedDetail); | ||
} else if (licenseNotRequired) { | ||
licenseMessage = translateModule.translateInstant("app.webxpanel.license.mobilitylicensenotrequired"); | ||
} | ||
if (isVersionInfoDisplayed()) { | ||
const licenseText = document.getElementById("lic"); | ||
licenseText.textContent = licenseMessage; | ||
} | ||
} | ||
// Authorization | ||
@@ -276,23 +219,2 @@ WebXPanel.default.addEventListener(WebXPanel.WebXPanelEvents.NOT_AUTHORIZED, ({ detail }) => { | ||
/** | ||
* Show the badge on the info icon for license expiry warning. | ||
*/ | ||
function displayLicenseWarning(warnDays, remainingDays) { | ||
if (!isVersionInfoDisplayed()) { | ||
return; | ||
} | ||
// 0 means no license warning messages | ||
if (WARN_DAYS_BEFORE !== 0) { | ||
if (warnDays >= remainingDays) { | ||
let classArr = document.getElementById("infobtn").classList; | ||
if (classArr) { | ||
classArr.add("warn"); | ||
} | ||
} else { | ||
return false; | ||
} | ||
} | ||
} | ||
/** | ||
* Show WebXPanel connection status | ||
@@ -299,0 +221,0 @@ */ |
{ | ||
"name": "shell-template", | ||
"version": "2.4.1", | ||
"version": "2.5.0", | ||
"main": "index.js", | ||
@@ -47,3 +47,3 @@ "license": "SEE LICENSE IN LICENSE.txt", | ||
"devDependencies": { | ||
"@crestron/ch5-shell-utilities-cli": "^2.4.1", | ||
"@crestron/ch5-shell-utilities-cli": "^2.5.0", | ||
"@crestron/ch5-utilities-cli": "^2.0.0", | ||
@@ -74,5 +74,5 @@ "browser-sync": "^2.27.5", | ||
"dependencies": { | ||
"@crestron/ch5-crcomlib": "^2.4.1", | ||
"@crestron/ch5-theme": "^2.4.1", | ||
"@crestron/ch5-webxpanel": "^2.0.0" | ||
"@crestron/ch5-crcomlib": "^2.5.0", | ||
"@crestron/ch5-theme": "^2.5.0", | ||
"@crestron/ch5-webxpanel": "^2.5.0" | ||
}, | ||
@@ -79,0 +79,0 @@ "files": [ |
@@ -20,3 +20,3 @@ { | ||
], | ||
"version": "2.4.1", | ||
"version": "2.5.0", | ||
"dependencies": { | ||
@@ -23,0 +23,0 @@ "zip-lib": "^0.7.2", |
Sorry, the diff of this file is not supported yet
3981887
36403