feat: add new profiles over ota & updater url via app config

This commit is contained in:
Ian Chua
2026-08-31 17:45:29 +08:00
parent c4fea8ad24
commit b585d9f3d9
8 changed files with 523 additions and 27 deletions

View File

@@ -415,7 +415,9 @@ img.ModelThumbnail {
border-width: 1px;
border-style: solid;
border-radius: 4px;
background-color: inherit;
border-color: var(--border-color);
background-color: var(--bg-color);
color: var(--fg-color-text);
position: absolute;
left: 50%;
top: 200px;
@@ -423,13 +425,17 @@ img.ModelThumbnail {
}
#NoticeBar {
background-color:#00f0d8;
background-color: var(--main-color);
height: 40px;
line-height: 40px;
color: #fff;
text-align: center;
}
#NoticeBar.notice-error {
background-color: var(--button-bg-alert);
}
#NoticeContent {
padding: 4mm 10mm;
}

View File

@@ -37,6 +37,34 @@ function HandleStudio( pVal )
{
HandleModelList(pVal['response']);
}
else if(strCmd=='check_new_printers_result')
{
let button = document.getElementById("CheckNewPrintersBtn");
if (button) {
button.style.pointerEvents = "auto";
button.style.opacity = "1";
}
let noticeBar = document.getElementById("NoticeBar");
let noticeText = document.getElementById("NoticeText");
let hasError = pVal.hasOwnProperty("error");
noticeBar.classList.toggle("notice-error", hasError);
if (hasError) {
noticeBar.textContent = "Error";
noticeText.textContent = pVal["error"];
} else if (pVal["vendors"] && pVal["vendors"].length > 0) {
noticeBar.textContent = "New printers found";
noticeText.textContent = "New printer vendors installed: " + pVal["vendors"].join(", ");
} else if (pVal["declined"]) {
noticeBar.textContent = "Information";
noticeText.textContent = "New printer vendors were found, but installation was cancelled.";
} else {
noticeBar.textContent = "Information";
noticeText.textContent = "No new printers found.";
}
ShowNotice(1);
}
}
function HandleModelList( pVal )
@@ -78,9 +106,13 @@ function HandleModelList( pVal )
}
//Update Nozzel Html Append
// ORCA: HandleModelList can now be called more than once per dialog (e.g. after a new vendor
// is installed via "check for new printers"). pModel always holds the full, current list, so
// clear each vendor's printer area before repopulating instead of appending on top of a
// previous render.
for( let key in ModelHtml )
{
$(".OneVendorBlock[vendor='"+key+"'] .PrinterArea").append( ModelHtml[key] );
$(".OneVendorBlock[vendor='"+key+"'] .PrinterArea").empty().append( ModelHtml[key] );
}
//Update Checkbox
@@ -343,6 +375,9 @@ function OnExit()
let nTotal=ModelSelect.length;
if( nTotal==0 ) {
let noticeBar = document.getElementById("NoticeBar");
noticeBar.classList.add("notice-error");
noticeBar.textContent = "Error";
ShowNotice(1);
return 0;
}

View File

@@ -36,6 +36,22 @@ function ConfirmSelect()
}
}
function CheckForNewPrinters()
{
var tSend={};
tSend['sequence_id']=Math.round(new Date() / 1000);
tSend['command']="check_for_new_printers";
tSend['data']={};
var button = document.getElementById("CheckNewPrintersBtn");
if (button) {
button.style.pointerEvents = "none";
button.style.opacity = "0.6";
}
SendWXMessage( JSON.stringify(tSend) );
}
function CreateNewPrinter()
{
var tSend={};

View File

@@ -82,7 +82,8 @@
</div>
<div id="AcceptArea">
<div class="ButtonStyleRegular ButtonTypeChoice trans" id="CreateBtn" onclick="CreateNewPrinter()">Create</div>
<div class="ButtonStyleConfirm ButtonTypeChoice trans" tid="t39" id="AcceptBtn" onclick="ConfirmSelect()">Confirm</div>
<div class="ButtonStyleRegular ButtonTypeChoice" id="CheckNewPrintersBtn" onclick="CheckForNewPrinters()">Check for new printers</div>
<div class="ButtonStyleConfirm ButtonTypeChoice trans" tid="t39" id="AcceptBtn" onclick="ConfirmSelect()">Confirm</div>
<div class="ButtonStyleRegular ButtonTypeChoice trans" tid="t38" id="PreBtn" onclick="CancelSelect()">Cancel</div>
</div>