@chisquare-tech/origine-ngx-apps-code 0.8.0 → 0.9.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.
|
@@ -349,6 +349,10 @@ const TOKEN_CSS = `
|
|
|
349
349
|
:host ::ng-deep .tk-nb, :host ::ng-deep .tk-nt, :host ::ng-deep .tk-bp{color:var(--o-tk-p)}
|
|
350
350
|
:host ::ng-deep .tk-gi{color:var(--o-add)} :host ::ng-deep .tk-gd{color:var(--o-bad-tx)}
|
|
351
351
|
`;
|
|
352
|
+
/** Why a signed commit is not verified (DEV-31). */
|
|
353
|
+
function verifyWhy(reason) {
|
|
354
|
+
return { unknown_key: 'Signed with a key that is not the committer’s signing key', bad_signature: 'The signature does not match the commit' }[reason] ?? 'Not verified';
|
|
355
|
+
}
|
|
352
356
|
|
|
353
357
|
/**
|
|
354
358
|
* What every page under /code/:repo shares: the project, the repository named in the URL (loaded
|
|
@@ -366,6 +370,7 @@ class RepoPage {
|
|
|
366
370
|
this.error = signal('', ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
367
371
|
this.note = signal('', ...(ngDevMode ? [{ debugName: "note" }] : /* istanbul ignore next */ []));
|
|
368
372
|
this.people = computed(() => new People(this.host.people()), ...(ngDevMode ? [{ debugName: "people" }] : /* istanbul ignore next */ []));
|
|
373
|
+
this.verifyWhy = verifyWhy;
|
|
369
374
|
this.canWrite = computed(() => !this.repo()?.archivedAt && (this.repo()?.capabilities ?? []).includes('code.write'), ...(ngDevMode ? [{ debugName: "canWrite" }] : /* istanbul ignore next */ []));
|
|
370
375
|
this.canAdmin = computed(() => (this.repo()?.capabilities ?? []).includes('resources.manage'), ...(ngDevMode ? [{ debugName: "canAdmin" }] : /* istanbul ignore next */ []));
|
|
371
376
|
/** Repository settings short of a rename, the visibility and deletion: Maintainers, and maintain collaborators. */
|
|
@@ -1687,7 +1692,8 @@ class CommitBox {
|
|
|
1687
1692
|
this.toNew = signal(false, ...(ngDevMode ? [{ debugName: "toNew" }] : /* istanbul ignore next */ []));
|
|
1688
1693
|
this.newBranch = signal('', ...(ngDevMode ? [{ debugName: "newBranch" }] : /* istanbul ignore next */ []));
|
|
1689
1694
|
this.rules = signal([], ...(ngDevMode ? [{ debugName: "rules" }] : /* istanbul ignore next */ []));
|
|
1690
|
-
|
|
1695
|
+
/** Direct commits are refused: the rules block direct pushes, or require signed commits (a browser commit is unsigned). */
|
|
1696
|
+
this.blocked = computed(() => this.rules().some((r) => (r.blockDirectPush || r.requireSignedCommits) && matchesPattern(r.pattern, this.branch())), ...(ngDevMode ? [{ debugName: "blocked" }] : /* istanbul ignore next */ []));
|
|
1691
1697
|
effect(() => {
|
|
1692
1698
|
const m = this.defaultMessage();
|
|
1693
1699
|
untracked(() => this.message.set(m));
|
|
@@ -2139,6 +2145,7 @@ class CommitsPage extends RepoPage {
|
|
|
2139
2145
|
@for (k of c.keys; track k) {<a class="o-chip o-blu" [routerLink]="host.link('issues/' + k)">{{ k }}</a>}
|
|
2140
2146
|
</span>
|
|
2141
2147
|
</div>
|
|
2148
|
+
@if (c.verification; as v) {<span class="o-chip" [class.o-grn]="v.verified" [attr.title]="v.verified ? 'Signed with a key of ' + people().name(v.signer) : verifyWhy(v.reason)" [attr.data-testid]="'verify-' + c.short">{{ v.verified ? 'Verified' : 'Unverified' }}</span>}
|
|
2142
2149
|
<a class="o-btn o-sm o-mono" [routerLink]="link('commit/' + c.oid)">{{ c.short }}</a>
|
|
2143
2150
|
<a class="o-btn o-sm" [routerLink]="link()" [queryParams]="{ ref: c.oid }" title="Browse files at this commit" [attr.aria-label]="'Browse files at ' + c.short">‹›</a>
|
|
2144
2151
|
</div>
|
|
@@ -2179,6 +2186,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
2179
2186
|
@for (k of c.keys; track k) {<a class="o-chip o-blu" [routerLink]="host.link('issues/' + k)">{{ k }}</a>}
|
|
2180
2187
|
</span>
|
|
2181
2188
|
</div>
|
|
2189
|
+
@if (c.verification; as v) {<span class="o-chip" [class.o-grn]="v.verified" [attr.title]="v.verified ? 'Signed with a key of ' + people().name(v.signer) : verifyWhy(v.reason)" [attr.data-testid]="'verify-' + c.short">{{ v.verified ? 'Verified' : 'Unverified' }}</span>}
|
|
2182
2190
|
<a class="o-btn o-sm o-mono" [routerLink]="link('commit/' + c.oid)">{{ c.short }}</a>
|
|
2183
2191
|
<a class="o-btn o-sm" [routerLink]="link()" [queryParams]="{ ref: c.oid }" title="Browse files at this commit" [attr.aria-label]="'Browse files at ' + c.short">‹›</a>
|
|
2184
2192
|
</div>
|
|
@@ -2228,6 +2236,7 @@ class CommitPage extends RepoPage {
|
|
|
2228
2236
|
@if (c.body) {<span class="o-mut o-lh" style="white-space:pre-wrap">{{ c.body }}</span>}
|
|
2229
2237
|
<div class="o-flex o-wrap o-sm">
|
|
2230
2238
|
<span class="o-av" aria-hidden="true">{{ initials(c.author.name) }}</span><b class="o-b5">{{ c.author.name }}</b><span class="o-faint">committed {{ ago(c.committer.when) }}</span>
|
|
2239
|
+
@if (c.verification; as v) {<span class="o-chip" [class.o-grn]="v.verified" [attr.title]="v.verified ? 'Signed with a key of ' + people().name(v.signer) : verifyWhy(v.reason)" data-testid="commit-verified">{{ v.verified ? 'Verified' : 'Unverified' }}</span>}
|
|
2231
2240
|
@for (k of c.keys; track k) {<a class="o-chip o-blu" [routerLink]="host.link('issues/' + k)">{{ k }}</a>}
|
|
2232
2241
|
<span class="o-r o-mono o-faint">commit {{ c.oid.slice(0, 10) }}@for (p of c.parents; track p) { · parent <a [routerLink]="link('commit/' + p)">{{ p.slice(0, 7) }}</a>}</span>
|
|
2233
2242
|
</div>
|
|
@@ -2259,6 +2268,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
2259
2268
|
@if (c.body) {<span class="o-mut o-lh" style="white-space:pre-wrap">{{ c.body }}</span>}
|
|
2260
2269
|
<div class="o-flex o-wrap o-sm">
|
|
2261
2270
|
<span class="o-av" aria-hidden="true">{{ initials(c.author.name) }}</span><b class="o-b5">{{ c.author.name }}</b><span class="o-faint">committed {{ ago(c.committer.when) }}</span>
|
|
2271
|
+
@if (c.verification; as v) {<span class="o-chip" [class.o-grn]="v.verified" [attr.title]="v.verified ? 'Signed with a key of ' + people().name(v.signer) : verifyWhy(v.reason)" data-testid="commit-verified">{{ v.verified ? 'Verified' : 'Unverified' }}</span>}
|
|
2262
2272
|
@for (k of c.keys; track k) {<a class="o-chip o-blu" [routerLink]="host.link('issues/' + k)">{{ k }}</a>}
|
|
2263
2273
|
<span class="o-r o-mono o-faint">commit {{ c.oid.slice(0, 10) }}@for (p of c.parents; track p) { · parent <a [routerLink]="link('commit/' + p)">{{ p.slice(0, 7) }}</a>}</span>
|
|
2264
2274
|
</div>
|
|
@@ -3057,7 +3067,7 @@ class PullPage extends RepoPage {
|
|
|
3057
3067
|
@case ('commits') {
|
|
3058
3068
|
<div class="o-card">
|
|
3059
3069
|
@for (c of cmp()?.commits ?? []; track c.oid) {
|
|
3060
|
-
<div class="o-row"><span class="o-av" aria-hidden="true">{{ initials(c.author.name) }}</span><a class="o-ell" style="flex:1;color:var(--o-tx)" [routerLink]="link('commit/' + c.oid)">{{ c.subject }}</a
|
|
3070
|
+
<div class="o-row"><span class="o-av" aria-hidden="true">{{ initials(c.author.name) }}</span><a class="o-ell" style="flex:1;color:var(--o-tx)" [routerLink]="link('commit/' + c.oid)">{{ c.subject }}</a>@if (c.verification; as v) {<span class="o-chip" [class.o-grn]="v.verified" [attr.title]="v.verified ? 'Signed with a key of ' + people().name(v.signer) : verifyWhy(v.reason)" [attr.data-testid]="'verify-' + c.short">{{ v.verified ? 'Verified' : 'Unverified' }}</span>}<a class="o-mono o-sm o-faint" [routerLink]="link('commit/' + c.oid)">{{ c.short }}</a></div>
|
|
3061
3071
|
} @empty {<div class="o-empty">{{ cmp() ? 'No commits.' : 'Loading…' }}</div>}
|
|
3062
3072
|
</div>
|
|
3063
3073
|
}
|
|
@@ -3240,7 +3250,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
3240
3250
|
@case ('commits') {
|
|
3241
3251
|
<div class="o-card">
|
|
3242
3252
|
@for (c of cmp()?.commits ?? []; track c.oid) {
|
|
3243
|
-
<div class="o-row"><span class="o-av" aria-hidden="true">{{ initials(c.author.name) }}</span><a class="o-ell" style="flex:1;color:var(--o-tx)" [routerLink]="link('commit/' + c.oid)">{{ c.subject }}</a
|
|
3253
|
+
<div class="o-row"><span class="o-av" aria-hidden="true">{{ initials(c.author.name) }}</span><a class="o-ell" style="flex:1;color:var(--o-tx)" [routerLink]="link('commit/' + c.oid)">{{ c.subject }}</a>@if (c.verification; as v) {<span class="o-chip" [class.o-grn]="v.verified" [attr.title]="v.verified ? 'Signed with a key of ' + people().name(v.signer) : verifyWhy(v.reason)" [attr.data-testid]="'verify-' + c.short">{{ v.verified ? 'Verified' : 'Unverified' }}</span>}<a class="o-mono o-sm o-faint" [routerLink]="link('commit/' + c.oid)">{{ c.short }}</a></div>
|
|
3244
3254
|
} @empty {<div class="o-empty">{{ cmp() ? 'No commits.' : 'Loading…' }}</div>}
|
|
3245
3255
|
</div>
|
|
3246
3256
|
}
|
|
@@ -3329,7 +3339,7 @@ function writePref(key, value) {
|
|
|
3329
3339
|
}
|
|
3330
3340
|
}
|
|
3331
3341
|
|
|
3332
|
-
const BLANK = { id: '', pattern: '', blockDirectPush: true, blockForcePush: true, blockDeletion: true, requiredApprovals: 1, dismissStaleApprovals: true, requireUpToDate: false, requireCodeOwnerReview: false, requiredChecks: [] };
|
|
3342
|
+
const BLANK = { id: '', pattern: '', blockDirectPush: true, blockForcePush: true, blockDeletion: true, requiredApprovals: 1, dismissStaleApprovals: true, requireUpToDate: false, requireCodeOwnerReview: false, requireSignedCommits: false, requireLinearHistory: false, bypass: [], requiredChecks: [] };
|
|
3333
3343
|
// /{org}/{project}/code/{repo}/settings?section= (prototype "code_settings"): general settings and
|
|
3334
3344
|
// merge methods, branch protection rules, and the danger zone (archive, delete).
|
|
3335
3345
|
class RepoSettingsPage extends RepoPage {
|
|
@@ -3352,7 +3362,10 @@ class RepoSettingsPage extends RepoPage {
|
|
|
3352
3362
|
{ key: 'dismissStaleApprovals', label: 'Dismiss stale approvals', hint: 'A new commit dismisses approvals given on an older one.' },
|
|
3353
3363
|
{ key: 'requireUpToDate', label: 'Require branches to be up to date', hint: 'The branch must contain the target’s latest commit before it merges.' },
|
|
3354
3364
|
{ key: 'requireCodeOwnerReview', label: 'Require review from CODEOWNERS', hint: 'Owners of changed paths are requested automatically; one of them approves each owned file.' },
|
|
3365
|
+
{ key: 'requireSignedCommits', label: 'Require signed commits', hint: 'Verified against members’ signing keys, on push and at merge.' },
|
|
3366
|
+
{ key: 'requireLinearHistory', label: 'Require linear history', hint: 'No merge commits: squash or rebase only.' },
|
|
3355
3367
|
];
|
|
3368
|
+
this.bypassRoles = [{ id: 'owner', label: 'Owners' }, { id: 'admin', label: 'Admins' }, { id: 'maintainer', label: 'Maintainers' }];
|
|
3356
3369
|
this.collabs = signal([], ...(ngDevMode ? [{ debugName: "collabs" }] : /* istanbul ignore next */ []));
|
|
3357
3370
|
this.perms = [{ id: 'read', label: 'Read' }, { id: 'write', label: 'Write' }, { id: 'maintain', label: 'Maintain' }];
|
|
3358
3371
|
this.addable = computed(() => this.host.people().filter((p) => !this.collabs().some((c) => c.userId === p.id)), ...(ngDevMode ? [{ debugName: "addable" }] : /* istanbul ignore next */ []));
|
|
@@ -3419,12 +3432,19 @@ class RepoSettingsPage extends RepoPage {
|
|
|
3419
3432
|
parts.push('up to date');
|
|
3420
3433
|
if (p.requireCodeOwnerReview)
|
|
3421
3434
|
parts.push('code owners');
|
|
3435
|
+
if (p.requireSignedCommits)
|
|
3436
|
+
parts.push('signed commits');
|
|
3437
|
+
if (p.requireLinearHistory)
|
|
3438
|
+
parts.push('linear');
|
|
3422
3439
|
if (p.blockDeletion)
|
|
3423
3440
|
parts.push('no deletion');
|
|
3424
3441
|
return parts.join(' · ') || 'no restrictions';
|
|
3425
3442
|
}
|
|
3426
3443
|
edit(p) {
|
|
3427
|
-
this.form.set(p ? { ...BLANK, ...p, requiredChecks: [...(p.requiredChecks ?? [])] } : { ...BLANK, pattern: this.rules().length ? '' : this.repo()?.defaultBranch ?? 'main', requiredChecks: [] });
|
|
3444
|
+
this.form.set(p ? { ...BLANK, ...p, requiredChecks: [...(p.requiredChecks ?? [])], bypass: [...(p.bypass ?? [])] } : { ...BLANK, pattern: this.rules().length ? '' : this.repo()?.defaultBranch ?? 'main', requiredChecks: [] });
|
|
3445
|
+
}
|
|
3446
|
+
flipBypass(f, role) {
|
|
3447
|
+
f.bypass = f.bypass.includes(role) ? f.bypass.filter((x) => x !== role) : [...f.bypass, role];
|
|
3428
3448
|
}
|
|
3429
3449
|
flip(f, k) {
|
|
3430
3450
|
f[k] = !f[k];
|
|
@@ -3567,7 +3587,9 @@ class RepoSettingsPage extends RepoPage {
|
|
|
3567
3587
|
<input id="rule-check" class="o-in o-sm o-mono" style="width:160px" placeholder="+ check name, Enter" [ngModel]="check()" (ngModelChange)="check.set($event)" name="check" (keydown.enter)="$event.preventDefault(); addCheck(f)" />
|
|
3568
3588
|
</div>
|
|
3569
3589
|
</div>
|
|
3570
|
-
<div class="o-fld"><span class="o-lbl" style="padding:0">Allowed to bypass
|
|
3590
|
+
<div class="o-fld"><span class="o-lbl" style="padding:0">Allowed to bypass</span><div class="o-flex o-wrap">
|
|
3591
|
+
@for (b of bypassRoles; track b.id) {<button type="button" class="o-chip" style="cursor:pointer;border:none" [class.o-blu]="f.bypass.includes(b.id)" [attr.aria-pressed]="f.bypass.includes(b.id)" (click)="flipBypass(f, b.id)" [attr.data-testid]="'bypass-' + b.id">{{ b.label }}</button>}
|
|
3592
|
+
<span class="o-hint">Pushes by these roles go through this rule; every bypass is written to the audit log.</span></div></div>
|
|
3571
3593
|
<div class="o-fld"><span class="o-lbl" style="padding:0">What a blocked push sees</span><div class="o-term" style="font-size:11.5px"><div>$ git push origin {{ f.pattern || 'main' }}</div><div>remote: ✕ {{ f.pattern || 'main' }} is protected by rule “{{ f.pattern || 'main' }}”: direct pushes are blocked.</div><div>remote: Open a pull request instead.</div></div></div>
|
|
3572
3594
|
<div class="o-flex">
|
|
3573
3595
|
@if (f.id) {<button type="button" class="o-btn o-sm o-ghost" style="color:var(--o-bad-tx)" (click)="removeRule(f)">Delete rule</button>}
|
|
@@ -3693,7 +3715,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
3693
3715
|
<input id="rule-check" class="o-in o-sm o-mono" style="width:160px" placeholder="+ check name, Enter" [ngModel]="check()" (ngModelChange)="check.set($event)" name="check" (keydown.enter)="$event.preventDefault(); addCheck(f)" />
|
|
3694
3716
|
</div>
|
|
3695
3717
|
</div>
|
|
3696
|
-
<div class="o-fld"><span class="o-lbl" style="padding:0">Allowed to bypass
|
|
3718
|
+
<div class="o-fld"><span class="o-lbl" style="padding:0">Allowed to bypass</span><div class="o-flex o-wrap">
|
|
3719
|
+
@for (b of bypassRoles; track b.id) {<button type="button" class="o-chip" style="cursor:pointer;border:none" [class.o-blu]="f.bypass.includes(b.id)" [attr.aria-pressed]="f.bypass.includes(b.id)" (click)="flipBypass(f, b.id)" [attr.data-testid]="'bypass-' + b.id">{{ b.label }}</button>}
|
|
3720
|
+
<span class="o-hint">Pushes by these roles go through this rule; every bypass is written to the audit log.</span></div></div>
|
|
3697
3721
|
<div class="o-fld"><span class="o-lbl" style="padding:0">What a blocked push sees</span><div class="o-term" style="font-size:11.5px"><div>$ git push origin {{ f.pattern || 'main' }}</div><div>remote: ✕ {{ f.pattern || 'main' }} is protected by rule “{{ f.pattern || 'main' }}”: direct pushes are blocked.</div><div>remote: Open a pull request instead.</div></div></div>
|
|
3698
3722
|
<div class="o-flex">
|
|
3699
3723
|
@if (f.id) {<button type="button" class="o-btn o-sm o-ghost" style="color:var(--o-bad-tx)" (click)="removeRule(f)">Delete rule</button>}
|
|
@@ -4309,5 +4333,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
4309
4333
|
* Generated bundle index. Do not edit.
|
|
4310
4334
|
*/
|
|
4311
4335
|
|
|
4312
|
-
export { BranchesPage, CodeApi, CodeHost, CommitBox, CommitPage, CommitsPage, CurrentRepo, CurrentRepoPage, DiffView, FilePage, NewFilePage, NewRepoPage, People, PullPage, PullsPage, RefPicker, ReleasesPage, RepoHomePage, RepoPage, RepoSettingsPage, ReposPage, TOKEN_CSS, ago, apiMessage, checkDot, copy, dayLabel, initials, langColour, matchesPattern, pair, shortDate, size };
|
|
4336
|
+
export { BranchesPage, CodeApi, CodeHost, CommitBox, CommitPage, CommitsPage, CurrentRepo, CurrentRepoPage, DiffView, FilePage, NewFilePage, NewRepoPage, People, PullPage, PullsPage, RefPicker, ReleasesPage, RepoHomePage, RepoPage, RepoSettingsPage, ReposPage, TOKEN_CSS, ago, apiMessage, checkDot, copy, dayLabel, initials, langColour, matchesPattern, pair, shortDate, size, verifyWhy };
|
|
4313
4337
|
//# sourceMappingURL=chisquare-tech-origine-ngx-apps-code.mjs.map
|