@chisquare-tech/origine-ngx-apps-code 0.7.0 → 0.8.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.
|
@@ -210,6 +210,11 @@ class CodeApi {
|
|
|
210
210
|
comment(project, name, n, c) {
|
|
211
211
|
return this.api.post(`${this.repoPath(project, name)}/pulls/${n}/comments`, c).pipe(map((r) => data(r)));
|
|
212
212
|
}
|
|
213
|
+
/** Arms (method) or disarms (null) auto-merge on a pull request (DEV-25). */
|
|
214
|
+
autoMerge(project, name, n, method) {
|
|
215
|
+
const url = `${this.repoPath(project, name)}/pulls/${n}/auto-merge`;
|
|
216
|
+
return (method === null ? this.api.delete(url) : this.api.post(url, { method })).pipe(map((r) => data(r)));
|
|
217
|
+
}
|
|
213
218
|
/** Commits suggested changes of line comments onto the pull request's branch (DEV-20). */
|
|
214
219
|
applySuggestions(project, name, n, comments, message = '') {
|
|
215
220
|
return this.api.post(`${this.repoPath(project, name)}/pulls/${n}/suggestions`, { comments, message }).pipe(map((r) => data(r)));
|
|
@@ -2840,6 +2845,10 @@ class PullPage extends RepoPage {
|
|
|
2840
2845
|
this.run(this.api.comment(this.projectId(), this.name(), this.number, { body: c.body, path: c.path, side: c.side, line: c.line, pending: c.pending }), 'Could not add the comment.', () => { if (c.pending)
|
|
2841
2846
|
this.note.set('Added to your review. Submit it from Review changes to post your comments.'); });
|
|
2842
2847
|
}
|
|
2848
|
+
/** Arms auto-merge with a method, or disarms it (null). */
|
|
2849
|
+
setAutoMerge(method) {
|
|
2850
|
+
this.run(this.api.autoMerge(this.projectId(), this.name(), this.number, method), method === null ? 'Could not turn auto-merge off.' : 'Could not turn auto-merge on.', () => this.note.set(method === null ? 'Auto-merge is off.' : 'Auto-merge is on: this pull request merges as you once every requirement passes.'));
|
|
2851
|
+
}
|
|
2843
2852
|
toggleBatch(id) {
|
|
2844
2853
|
const b = this.batch();
|
|
2845
2854
|
this.batch.set(b.includes(id) ? b.filter((x) => x !== id) : [...b, id]);
|
|
@@ -3013,6 +3022,12 @@ class PullPage extends RepoPage {
|
|
|
3013
3022
|
<div class="o-flex o-wrap" style="padding:12px 14px;background:var(--o-well)">
|
|
3014
3023
|
@if (p.canReview && !approvedByMe()) {<button type="button" class="o-btn" (click)="approve()" [disabled]="busy()" data-testid="approve">Approve</button>}
|
|
3015
3024
|
@if (p.canEdit) {<button type="button" class="o-btn o-ghost" (click)="close(false)" [disabled]="busy()">Close</button>}
|
|
3025
|
+
@if (p.autoMergeBy) {
|
|
3026
|
+
<span class="o-chip o-blu" data-testid="auto-merge-on">Auto-merge on · {{ methodLabel(p.autoMergeMethod || 'merge') }} · by {{ people().name(p.autoMergeBy) }}</span>
|
|
3027
|
+
@if (canWrite()) {<button type="button" class="o-btn o-sm o-ghost" (click)="setAutoMerge(null)" [disabled]="busy()" data-testid="auto-merge-off">Disable auto-merge</button>}
|
|
3028
|
+
} @else if (repo()?.allowAutoMerge && canWrite() && !p.gate.mergeable) {
|
|
3029
|
+
<button type="button" class="o-btn o-sm" (click)="setAutoMerge(method())" [disabled]="busy()" data-testid="auto-merge-enable" title="Merges as you once every requirement passes">Enable auto-merge</button>
|
|
3030
|
+
}
|
|
3016
3031
|
@if (p.canMerge) {
|
|
3017
3032
|
<span class="o-faint o-sm">Delete branch after merge</span><button type="button" class="o-tog" role="switch" aria-label="Delete branch after merge" [class.o-on]="delBranch()" [attr.aria-checked]="delBranch()" (click)="delBranch.set(!delBranch())"></button>
|
|
3018
3033
|
<div class="merge o-r">
|
|
@@ -3190,6 +3205,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
3190
3205
|
<div class="o-flex o-wrap" style="padding:12px 14px;background:var(--o-well)">
|
|
3191
3206
|
@if (p.canReview && !approvedByMe()) {<button type="button" class="o-btn" (click)="approve()" [disabled]="busy()" data-testid="approve">Approve</button>}
|
|
3192
3207
|
@if (p.canEdit) {<button type="button" class="o-btn o-ghost" (click)="close(false)" [disabled]="busy()">Close</button>}
|
|
3208
|
+
@if (p.autoMergeBy) {
|
|
3209
|
+
<span class="o-chip o-blu" data-testid="auto-merge-on">Auto-merge on · {{ methodLabel(p.autoMergeMethod || 'merge') }} · by {{ people().name(p.autoMergeBy) }}</span>
|
|
3210
|
+
@if (canWrite()) {<button type="button" class="o-btn o-sm o-ghost" (click)="setAutoMerge(null)" [disabled]="busy()" data-testid="auto-merge-off">Disable auto-merge</button>}
|
|
3211
|
+
} @else if (repo()?.allowAutoMerge && canWrite() && !p.gate.mergeable) {
|
|
3212
|
+
<button type="button" class="o-btn o-sm" (click)="setAutoMerge(method())" [disabled]="busy()" data-testid="auto-merge-enable" title="Merges as you once every requirement passes">Enable auto-merge</button>
|
|
3213
|
+
}
|
|
3193
3214
|
@if (p.canMerge) {
|
|
3194
3215
|
<span class="o-faint o-sm">Delete branch after merge</span><button type="button" class="o-tog" role="switch" aria-label="Delete branch after merge" [class.o-on]="delBranch()" [attr.aria-checked]="delBranch()" (click)="delBranch.set(!delBranch())"></button>
|
|
3195
3216
|
<div class="merge o-r">
|
|
@@ -3322,7 +3343,7 @@ class RepoSettingsPage extends RepoPage {
|
|
|
3322
3343
|
this.check = signal('', ...(ngDevMode ? [{ debugName: "check" }] : /* istanbul ignore next */ []));
|
|
3323
3344
|
this.confirm = signal('', ...(ngDevMode ? [{ debugName: "confirm" }] : /* istanbul ignore next */ []));
|
|
3324
3345
|
this.busy = signal(false, ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
3325
|
-
this.g = { name: '', description: '', visibility: 'private', defaultBranch: '', mergeMethods: [], deleteBranchOnMerge: false };
|
|
3346
|
+
this.g = { name: '', description: '', visibility: 'private', defaultBranch: '', mergeMethods: [], deleteBranchOnMerge: false, allowAutoMerge: false };
|
|
3326
3347
|
this.methods = [{ id: 'merge', label: 'Merge commit' }, { id: 'squash', label: 'Squash' }, { id: 'rebase', label: 'Rebase' }];
|
|
3327
3348
|
this.toggles = [
|
|
3328
3349
|
{ key: 'blockDirectPush', label: 'Require a pull request before merging', hint: 'Direct pushes are blocked; changes arrive through pull requests.' },
|
|
@@ -3372,7 +3393,7 @@ class RepoSettingsPage extends RepoPage {
|
|
|
3372
3393
|
}
|
|
3373
3394
|
onRepo(r) {
|
|
3374
3395
|
this.loadCollabs(r);
|
|
3375
|
-
this.g = { name: r.name, description: r.description, visibility: r.visibility, defaultBranch: r.defaultBranch, mergeMethods: [...(r.mergeMethods ?? [])], deleteBranchOnMerge: r.deleteBranchOnMerge };
|
|
3396
|
+
this.g = { name: r.name, description: r.description, visibility: r.visibility, defaultBranch: r.defaultBranch, mergeMethods: [...(r.mergeMethods ?? [])], deleteBranchOnMerge: r.deleteBranchOnMerge, allowAutoMerge: !!r.allowAutoMerge };
|
|
3376
3397
|
if (!r.empty)
|
|
3377
3398
|
this.api.refs(this.projectId(), r.name, 'branch').subscribe({ next: (b) => this.branches.set(b), error: () => undefined });
|
|
3378
3399
|
this.api.protections(this.projectId(), r.name).subscribe({ next: (p) => this.rules.set(p), error: () => undefined });
|
|
@@ -3428,8 +3449,8 @@ class RepoSettingsPage extends RepoPage {
|
|
|
3428
3449
|
const renamed = this.g.name.trim() !== r.name;
|
|
3429
3450
|
// a maintain collaborator sends what they may change; the name and visibility stay a Maintainer's
|
|
3430
3451
|
const body = this.canAdmin()
|
|
3431
|
-
? { name: this.g.name.trim(), description: this.g.description, visibility: this.g.visibility, defaultBranch: this.g.defaultBranch, mergeMethods: this.g.mergeMethods, deleteBranchOnMerge: this.g.deleteBranchOnMerge }
|
|
3432
|
-
: { description: this.g.description, defaultBranch: this.g.defaultBranch, mergeMethods: this.g.mergeMethods, deleteBranchOnMerge: this.g.deleteBranchOnMerge };
|
|
3452
|
+
? { name: this.g.name.trim(), description: this.g.description, visibility: this.g.visibility, defaultBranch: this.g.defaultBranch, mergeMethods: this.g.mergeMethods, deleteBranchOnMerge: this.g.deleteBranchOnMerge, allowAutoMerge: this.g.allowAutoMerge }
|
|
3453
|
+
: { description: this.g.description, defaultBranch: this.g.defaultBranch, mergeMethods: this.g.mergeMethods, deleteBranchOnMerge: this.g.deleteBranchOnMerge, allowAutoMerge: this.g.allowAutoMerge };
|
|
3433
3454
|
this.api.update(this.projectId(), r.name, body).subscribe({
|
|
3434
3455
|
next: (n) => {
|
|
3435
3456
|
this.busy.set(false);
|
|
@@ -3520,6 +3541,7 @@ class RepoSettingsPage extends RepoPage {
|
|
|
3520
3541
|
@for (m of methods; track m.id) {<label class="o-flex"><input type="checkbox" [checked]="g.mergeMethods.includes(m.id)" (change)="flipMethod(m.id)" [disabled]="!canMaintain()" />{{ m.label }}</label>}
|
|
3521
3542
|
</div>
|
|
3522
3543
|
<div class="o-flex"><button type="button" class="o-tog" role="switch" aria-labelledby="rs-del" [class.o-on]="g.deleteBranchOnMerge" [attr.aria-checked]="g.deleteBranchOnMerge" (click)="g.deleteBranchOnMerge = !g.deleteBranchOnMerge" [disabled]="!canMaintain()"></button><span id="rs-del">Delete head branches after merge</span></div>
|
|
3544
|
+
<div class="o-flex"><button type="button" class="o-tog" role="switch" aria-labelledby="rs-auto" [class.o-on]="g.allowAutoMerge" [attr.aria-checked]="g.allowAutoMerge" (click)="g.allowAutoMerge = !g.allowAutoMerge" [disabled]="!canMaintain()" data-testid="allow-auto-merge"></button><span id="rs-auto">Allow auto-merge when all requirements pass</span></div>
|
|
3523
3545
|
<div class="o-flex"><button type="button" class="o-tog o-dis" disabled aria-label="Allow auto-merge"></button>Allow auto-merge when all requirements pass<b class="o-ph-tag o-ga">GA</b></div>
|
|
3524
3546
|
@if (canMaintain()) {<div class="o-flex">@if (!canAdmin()) {<span class="o-faint o-sm">As a maintain collaborator you change these settings; a project Maintainer renames the repository or changes its visibility.</span>}<button type="submit" class="o-btn o-dark o-r" [disabled]="busy() || !g.mergeMethods.length" data-testid="settings-save">Save</button></div>}
|
|
3525
3547
|
</form>
|
|
@@ -3645,6 +3667,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
3645
3667
|
@for (m of methods; track m.id) {<label class="o-flex"><input type="checkbox" [checked]="g.mergeMethods.includes(m.id)" (change)="flipMethod(m.id)" [disabled]="!canMaintain()" />{{ m.label }}</label>}
|
|
3646
3668
|
</div>
|
|
3647
3669
|
<div class="o-flex"><button type="button" class="o-tog" role="switch" aria-labelledby="rs-del" [class.o-on]="g.deleteBranchOnMerge" [attr.aria-checked]="g.deleteBranchOnMerge" (click)="g.deleteBranchOnMerge = !g.deleteBranchOnMerge" [disabled]="!canMaintain()"></button><span id="rs-del">Delete head branches after merge</span></div>
|
|
3670
|
+
<div class="o-flex"><button type="button" class="o-tog" role="switch" aria-labelledby="rs-auto" [class.o-on]="g.allowAutoMerge" [attr.aria-checked]="g.allowAutoMerge" (click)="g.allowAutoMerge = !g.allowAutoMerge" [disabled]="!canMaintain()" data-testid="allow-auto-merge"></button><span id="rs-auto">Allow auto-merge when all requirements pass</span></div>
|
|
3648
3671
|
<div class="o-flex"><button type="button" class="o-tog o-dis" disabled aria-label="Allow auto-merge"></button>Allow auto-merge when all requirements pass<b class="o-ph-tag o-ga">GA</b></div>
|
|
3649
3672
|
@if (canMaintain()) {<div class="o-flex">@if (!canAdmin()) {<span class="o-faint o-sm">As a maintain collaborator you change these settings; a project Maintainer renames the repository or changes its visibility.</span>}<button type="submit" class="o-btn o-dark o-r" [disabled]="busy() || !g.mergeMethods.length" data-testid="settings-save">Save</button></div>}
|
|
3650
3673
|
</form>
|