@app-vitals/agent-lib 1.13.0 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-vitals/agent-lib",
3
- "version": "1.13.0",
3
+ "version": "1.15.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/app-vitals/agent.git",
package/web/toolbar.ts CHANGED
@@ -27,6 +27,11 @@ export interface ShipwrightToolbarOptions {
27
27
  * Defaults to false so other services sharing this toolbar never show it.
28
28
  */
29
29
  showAccount?: boolean;
30
+ /**
31
+ * Render the admin-only "Settings" nav entry (enterprise GitHub apps,
32
+ * GHE-1.4). Defaults to false.
33
+ */
34
+ showSettings?: boolean;
30
35
  }
31
36
 
32
37
  export function baseStyles(): string {
@@ -230,7 +235,7 @@ export function renderShipwrightToolbar(
230
235
  <a href="${adminBase}/admin/prs" class="vos-nav-link${active("/admin/prs")}">PRs</a>
231
236
  <a href="${adminBase}/admin/chat" class="vos-nav-link${active("/admin/chat")}">Chat</a>
232
237
  <a href="${adminBase}/admin/queue-activity" class="vos-nav-link${isQueueActivity ? " active" : ""}">Queue &amp; Activity</a>
233
- ${opts.showAccount ? `<a href="${adminBase}/admin/account" class="vos-nav-link${active("/admin/account")}">Account</a>\n ` : ""}<a href="${metricsUrl}" class="vos-nav-link${active(metricsUrl)}">Metrics</a>
238
+ ${opts.showAccount ? `<a href="${adminBase}/admin/account" class="vos-nav-link${active("/admin/account")}">Account</a>\n ` : ""}${opts.showSettings ? `<a href="${adminBase}/admin/settings/github-enterprise" class="vos-nav-link${active("/admin/settings")}">Settings</a>\n ` : ""}<a href="${metricsUrl}" class="vos-nav-link${active(metricsUrl)}">Metrics</a>
234
239
  </div>
235
240
  <div class="vos-user">
236
241
  <span class="vos-username">${escapeHtml(userName)}</span>
@@ -241,3 +241,25 @@ describe("renderShipwrightToolbar Account entry (SSP-3.2)", () => {
241
241
  expect(html).not.toContain("/admin/account");
242
242
  });
243
243
  });
244
+
245
+ describe("renderShipwrightToolbar Settings entry (GHE-1.4)", () => {
246
+ const base = {
247
+ userName: "a@x.com",
248
+ activePath: "/admin/settings/github-enterprise",
249
+ logoutAction: "/admin/logout",
250
+ };
251
+ test("omitted by default", () => {
252
+ expect(renderShipwrightToolbar(base)).not.toContain("/admin/settings");
253
+ });
254
+ test("rendered and active when showSettings is true", () => {
255
+ const html = renderShipwrightToolbar({ ...base, showSettings: true });
256
+ expect(html).toContain(
257
+ 'href="/admin/settings/github-enterprise" class="vos-nav-link active">Settings</a>',
258
+ );
259
+ });
260
+ test("readOnly never renders it", () => {
261
+ expect(
262
+ renderShipwrightToolbar({ ...base, readOnly: true, showSettings: true }),
263
+ ).not.toContain("/admin/settings");
264
+ });
265
+ });