optional Webhook column on the stacks list with a git stack's webhook id and copy-URL button

This commit is contained in:
Jarek Krochmalski committed 2026-08-27 07:34:37 +02:00
1 parent b04bc504f9
commit e82b1aea89
4 files changed
+91 -12

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
/**
* buildDockhandOverrideFile: the .env.dockhand contents shared by both git-stack
* deploy paths (local writeFileSync + Hawser stackFiles). A zero-var git stack must
* still produce a (header-only) file so a compose referencing env_file: .env.dockhand
* can resolve it (#1336).
*/
import { describe, it, expect } from 'bun:test';
import { buildDockhandOverrideFile } from '../src/lib/server/dockhand-override-file';
describe('buildDockhandOverrideFile', () => {
it('returns a header-only file (no trailing blank line) for ZERO vars', () => {
const out = buildDockhandOverrideFile({});
expect(out).toBe(
'# Auto-generated by Dockhand. Do not edit - changes will be overwritten on next deploy.\n'
);
// exactly one trailing newline - no empty value line that could clear a repo var
expect(out.endsWith('\n')).toBe(true);
expect(out.endsWith('\n\n')).toBe(false);
});
it('writes KEY=value lines under the header', () => {
const out = buildDockhandOverrideFile({ A: '1', B: 'two' });
expect(out).toContain('A=1');
expect(out).toContain('B=two');
expect(out.startsWith('# Auto-generated')).toBe(true);
expect(out.endsWith('\n')).toBe(true);
});
it('keeps values verbatim (including = and spaces)', () => {
const out = buildDockhandOverrideFile({ URL: 'https://x/y?a=b c' });
expect(out).toContain('URL=https://x/y?a=b c');
});
});
@@ -0,0 +1,29 @@
/**
* A column with defaultVisible:false is hidden by default (user can enable it in
* grid preferences); every other column stays visible. The stacks 'webhook' column
* relies on this so it does not clutter the list for users without git webhooks (#845).
*/
import { describe, it, expect } from 'bun:test';
import { getDefaultColumnPreferences, getConfigurableColumns } from '../src/lib/config/grid-columns';
describe('getDefaultColumnPreferences honors defaultVisible', () => {
it('hides a column marked defaultVisible:false', () => {
const prefs = getDefaultColumnPreferences('stacks');
const webhook = prefs.find((p) => p.id === 'webhook');
expect(webhook).toBeDefined();
expect(webhook!.visible).toBe(false);
});
it('leaves all other configurable columns visible', () => {
const prefs = getDefaultColumnPreferences('stacks');
for (const p of prefs) {
if (p.id === 'webhook') continue;
expect(p.visible).toBe(true);
}
});
it('the webhook column is configurable (user can toggle it), not fixed', () => {
const configurable = getConfigurableColumns('stacks').map((c) => c.id);
expect(configurable).toContain('webhook');
});
});