Stamp agent version into download name and collapse binary management UI
Append the staged agent version to the site-agent ZIP download name so DT operators see the build at a glance; the exe name inside the ZIP is unchanged so install.ps1 is untouched. Read the versioned name from Content-Disposition on the client. Group agent/tray binary management under a collapsed 'Upload New/Legacy Agents' section and default the key explainers to collapsed.
This commit is contained in:
@@ -568,8 +568,16 @@ def package_siteagent():
|
||||
archive.write(certpath, 'server.crt')
|
||||
|
||||
buffer.seek(0)
|
||||
# Stamp the staged agent version into the download filename so a DT operator
|
||||
# can see which agent build a package carries at a glance. This is cosmetic:
|
||||
# install.ps1 finds the exe by its fixed name inside the ZIP, so the download
|
||||
# name never affects the install. Falls back to the unversioned name when no
|
||||
# managed version is current (only a legacy flat file is staged).
|
||||
agentversion = agentstore.current_version('agent')
|
||||
download_name = ('shopdb-endpoint-agent-{0}.zip'.format(agentversion)
|
||||
if agentversion else 'shopdb-endpoint-agent.zip')
|
||||
return send_file(
|
||||
buffer,
|
||||
mimetype='application/zip',
|
||||
as_attachment=True,
|
||||
download_name='shopdb-endpoint-agent.zip')
|
||||
download_name=download_name)
|
||||
|
||||
@@ -106,7 +106,8 @@
|
||||
</div>
|
||||
|
||||
<div class="card form-card">
|
||||
<h4>How it works</h4>
|
||||
<details class="collapsible">
|
||||
<summary><h4>How it works</h4></summary>
|
||||
<ul class="field-hint info-list">
|
||||
<li>
|
||||
<strong>Generate</strong> mints a fresh key and, on the first
|
||||
@@ -127,8 +128,10 @@
|
||||
the kill switch.
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<h4>When to rotate</h4>
|
||||
<details class="collapsible">
|
||||
<summary><h4>When to rotate</h4></summary>
|
||||
<ul class="field-hint info-list">
|
||||
<li>
|
||||
<strong>An installer or agent left the secure environment.</strong>
|
||||
@@ -156,6 +159,7 @@
|
||||
regenerate and redeploy to known-good endpoints.
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -308,8 +312,10 @@
|
||||
and roll the current pointer back to a retained version. Staging
|
||||
only changes what a FUTURE download contains; it does not touch
|
||||
any running endpoint. Pushing to live endpoints is a separate,
|
||||
heavier grant handled elsewhere.
|
||||
============================================================= -->
|
||||
heavier grant handled elsewhere. Collapsed by default - binary
|
||||
management is infrequent next to building a package. -->
|
||||
<details class="collapsible binary-manager">
|
||||
<summary><h4>Upload New/Legacy Agents</h4></summary>
|
||||
<div
|
||||
v-for="binary in binaries"
|
||||
:key="binary.key"
|
||||
@@ -361,7 +367,7 @@
|
||||
roll back to. WARNING copy per intent: the version must be
|
||||
confirmed from the EXE properties before uploading. -->
|
||||
<label class="field-label">
|
||||
Upload legacy build for rollback, please confirm agent version
|
||||
Upload legacy build for rollback
|
||||
</label>
|
||||
<p class="field-warning">
|
||||
WARNING: confirm agent version before uploading from the EXE
|
||||
@@ -455,6 +461,7 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -555,6 +562,12 @@ function formatDate(value) {
|
||||
return Number.isNaN(parsed.getTime()) ? value : parsed.toLocaleString()
|
||||
}
|
||||
|
||||
function filenameFromResponse(response, fallback) {
|
||||
const disposition = response.headers?.['content-disposition'] || ''
|
||||
const match = /filename\*?=(?:UTF-8'')?"?([^";]+)"?/i.exec(disposition)
|
||||
return match ? decodeURIComponent(match[1]) : fallback
|
||||
}
|
||||
|
||||
function applyStatus(data) {
|
||||
key.value = data.key || null
|
||||
envkeyfallback.value = !!data.envkeyfallback
|
||||
@@ -716,7 +729,10 @@ async function buildSiteAgent() {
|
||||
const url = window.URL.createObjectURL(response.data)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = 'shopdb-endpoint-agent.zip'
|
||||
// Honor the server's versioned download name (shopdb-endpoint-agent-<ver>.zip)
|
||||
// from Content-Disposition so operators see the agent version in the file
|
||||
// name; fall back to the fixed name when the header is absent.
|
||||
link.download = filenameFromResponse(response, 'shopdb-endpoint-agent.zip')
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
link.remove()
|
||||
@@ -904,6 +920,25 @@ function editConfiguration() {
|
||||
}
|
||||
.binary-upload .form-control[type="text"] { max-width: 12rem; }
|
||||
.previous-versions { margin-top: 0.5rem; }
|
||||
.collapsible { margin: 0.5rem 0; }
|
||||
.collapsible > summary {
|
||||
cursor: pointer;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
user-select: none;
|
||||
}
|
||||
.collapsible > summary::-webkit-details-marker { display: none; }
|
||||
.collapsible > summary::before {
|
||||
content: "\25be";
|
||||
display: inline-block;
|
||||
transform: rotate(-90deg);
|
||||
transition: transform 0.15s ease;
|
||||
color: var(--color-text-muted, #888);
|
||||
}
|
||||
.collapsible[open] > summary::before { transform: rotate(0deg); }
|
||||
.collapsible > summary h4 { margin: 0; }
|
||||
.field-warning {
|
||||
margin: 0.25rem 0 0.5rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
|
||||
Reference in New Issue
Block a user