Skip to content

Commit 7469a7e

Browse files
committed
ENGAGE-243
1 parent ec4f199 commit 7469a7e

5 files changed

Lines changed: 122 additions & 21 deletions

File tree

scripts/validate-branch-name.husky.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#!/usr/bin/env node
22

3-
// Enforce branch naming: <developer-name>/AA-0000[anything]
3+
// Enforce branch naming: <developer-name>/AAAA-000[0][anything]
44
// - developer-name: lowercase letters, numbers, dot, underscore, hyphen (one or more)
5-
// - ticket: exactly 2 uppercase letters, hyphen, exactly 4 digits (e.g., PD-0000)
5+
// - ticket: 2+ uppercase letters, hyphen, 3 or 4 digits (e.g., EN-243, ENGAGE-243, or PD-0000)
66
// - suffix: any optional characters after the ticket (e.g., "/feature-x", "-refactor", etc.)
77
// Special allowed names: transifex
88
// Examples:
99
// yourname/PD-0000
1010
// yourname/PD-0000-my-feature
1111
// your.name/AB-0123/quick-fix
12+
// lmendoza/EN-243
13+
// lmendoza/ENGAGE-243
1214

1315
const { execSync } = require('child_process')
1416

@@ -67,15 +69,17 @@ function main() {
6769
process.exit(0)
6870
}
6971

70-
// developer-name / AA-0000 [anything]
71-
const pattern = /^[a-z0-9._-]+\/[A-Z]{2}-\d{4}.*$/
72+
// developer-name / AAAA-000[0] [anything]
73+
const pattern = /^[a-z0-9._-]+\/[A-Z]{2,}-\d{3,4}.*$/
7274

7375
if (!pattern.test(branch)) {
7476
console.error(
75-
'\u001b[31mBranch name must follow "<developer-name>/AA-0000[anything]" or be a special allowed name (e.g., "transifex").\u001b[0m'
77+
'\u001b[31mBranch name must follow "<developer-name>/AAAA-000[0][anything]" or be a special allowed name (e.g., "transifex").\u001b[0m'
7678
)
7779
console.error('\nExamples:')
7880
console.error(' yourname/PD-0000')
81+
console.error(' lmendoza/EN-243')
82+
console.error(' lmendoza/ENGAGE-243')
7983
console.error(' yourname/PD-0000-my-feature')
8084
console.error(' your.name/AB-0123/quick-fix')
8185
console.error(' transifex')

scripts/validate-commit-msg.husky.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/usr/bin/env node
22

3-
// Enforce commit message format: AA-0000 [optional message]
4-
// - AA: exactly 2 uppercase letters (A-Z)
5-
// - 0000: exactly 4 digits
3+
// Enforce commit message format: AAAA-000[0] [optional message]
4+
// - AAAA: 2+ uppercase letters (A-Z)
5+
// - 000[0]: 3 or 4 digits
66
// - Example: PD-0000 Add feature
77
// - Also valid: PD-0000
8+
// - Also valid: ENGAGE-243
89

910
const fs = require('fs')
1011

@@ -49,15 +50,16 @@ try {
4950
process.exit(0)
5051
}
5152

52-
// Pattern: start, 2 uppercase letters, hyphen, 4 digits, optional space and message
53-
const pattern = /^[A-Z]{2}-\d{4}(?:\s.+)?$/
53+
// Pattern: start, 2+ uppercase letters, hyphen, 3-4 digits, optional space and message
54+
const pattern = /^[A-Z]{2,}-\d{3,4}(?:\s.+)?$/
5455

5556
if (!pattern.test(firstLine)) {
5657
console.error(
57-
'\u001b[31mCommit message must start with an issue key like "AA-0000" followed by an optional message.\u001b[0m'
58+
'\u001b[31mCommit message must start with an issue key like "AAAA-000[0]" followed by an optional message.\u001b[0m'
5859
)
5960
console.error('\nExamples:')
6061
console.error(' PD-0000')
62+
console.error(' ENGAGE-243')
6163
console.error(' PD-0000 Fix broken tests')
6264
console.error('\nYour message was:')
6365
console.error(` ${firstLine || '(empty)'}`)
Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
1-
<div *ngFor="let recordImportWizard of recordImportWizards">
2-
<h2 class="orc-font-body-small">
1+
<ng-template #wizardItem let-recordImportWizard>
2+
<h2 class="orc-font-body-small wizard-header">
3+
<img
4+
*ngIf="recordImportWizard.redirectUriMetadata?.logoUrl"
5+
[src]="recordImportWizard.redirectUriMetadata.logoUrl"
6+
[alt]="recordImportWizard.name + ' logo'"
7+
class="wizard-logo"
8+
loading="lazy"
9+
/>
310
<a
411
target="_blank"
512
rel="noopener noreferrer"
613
[href]="openImportWizardUrlFilter(recordImportWizard)"
714
>
815
{{ recordImportWizard.name }}
916
</a>
17+
<span
18+
*ngIf="recordImportWizard.redirectUriMetadata?.type"
19+
class="orc-font-body-small wizard-type"
20+
>
21+
{{ recordImportWizard.redirectUriMetadata.type }}
22+
</span>
1023
</h2>
1124
<p class="orc-font-body-small">
12-
<ng-container *ngIf="recordImportWizard.description.length > 125">
25+
<ng-container *ngIf="displayDescription(recordImportWizard).length > 125">
1326
<ng-container *ngIf="!recordImportWizard.show">
14-
{{ recordImportWizard.description.substring(0, 125) + '...' }}
27+
{{ displayDescription(recordImportWizard).substring(0, 125) + '...' }}
1528
<a
1629
class="underline"
1730
i18n="@@shared.showMore"
@@ -21,7 +34,7 @@ <h2 class="orc-font-body-small">
2134
</a>
2235
</ng-container>
2336
<ng-container *ngIf="recordImportWizard.show">
24-
{{ recordImportWizard.description }}
37+
{{ displayDescription(recordImportWizard) }}
2538
<br />
2639
<a
2740
class="underline"
@@ -32,8 +45,29 @@ <h2 class="orc-font-body-small">
3245
</a>
3346
</ng-container>
3447
</ng-container>
35-
<ng-container *ngIf="recordImportWizard.description.length < 125">
36-
{{ recordImportWizard.description }}
48+
<ng-container *ngIf="displayDescription(recordImportWizard).length < 125">
49+
{{ displayDescription(recordImportWizard) }}
3750
</ng-container>
3851
</p>
39-
</div>
52+
</ng-template>
53+
54+
<h3 class="orc-font-body-small">Certified</h3>
55+
<ng-container
56+
*ngFor="let recordImportWizard of certifiedWizards"
57+
[ngTemplateOutlet]="wizardItem"
58+
[ngTemplateOutletContext]="{ $implicit: recordImportWizard }"
59+
></ng-container>
60+
61+
<h3 class="orc-font-body-small">Featured</h3>
62+
<ng-container
63+
*ngFor="let recordImportWizard of featuredWizards"
64+
[ngTemplateOutlet]="wizardItem"
65+
[ngTemplateOutletContext]="{ $implicit: recordImportWizard }"
66+
></ng-container>
67+
68+
<h3 class="orc-font-body-small">Default</h3>
69+
<ng-container
70+
*ngFor="let recordImportWizard of defaultWizards"
71+
[ngTemplateOutlet]="wizardItem"
72+
[ngTemplateOutletContext]="{ $implicit: recordImportWizard }"
73+
></ng-container>

src/app/record/components/search-link-wizard/search-link-wizard.component.ts

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input, OnInit } from '@angular/core'
1+
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'
22
import { RecordImportWizard } from '../../../types/record-peer-review-import.endpoint'
33

44
@Component({
@@ -7,13 +7,64 @@ import { RecordImportWizard } from '../../../types/record-peer-review-import.end
77
styleUrls: ['./search-link-wizard.component.scss'],
88
standalone: false,
99
})
10-
export class SearchLinkWizardComponent implements OnInit {
10+
export class SearchLinkWizardComponent implements OnInit, OnChanges {
1111
@Input() recordImportWizards: RecordImportWizard[]
1212

13+
certifiedWizards: RecordImportWizard[] = []
14+
featuredWizards: RecordImportWizard[] = []
15+
defaultWizards: RecordImportWizard[] = []
16+
1317
constructor() {}
1418

1519
ngOnInit(): void {}
1620

21+
ngOnChanges(changes: SimpleChanges): void {
22+
if (changes.recordImportWizards) {
23+
this.groupWizards()
24+
}
25+
}
26+
27+
displayDescription(recordImportWizard: RecordImportWizard): string {
28+
return (
29+
recordImportWizard?.redirectUriMetadata?.defaultDescription ||
30+
recordImportWizard?.description ||
31+
''
32+
)
33+
}
34+
35+
private groupWizards(): void {
36+
const wizards = this.recordImportWizards || []
37+
38+
const certified: RecordImportWizard[] = []
39+
const featured: RecordImportWizard[] = []
40+
const defaults: RecordImportWizard[] = []
41+
42+
for (const w of wizards) {
43+
const type = w?.redirectUriMetadata?.type || 'Default'
44+
if (type === 'Certified') {
45+
certified.push(w)
46+
} else if (type === 'Featured') {
47+
featured.push(w)
48+
} else {
49+
defaults.push(w)
50+
}
51+
}
52+
53+
const sortByIndexThenName = (a: RecordImportWizard, b: RecordImportWizard) => {
54+
const ai = a?.redirectUriMetadata?.index ?? Number.POSITIVE_INFINITY
55+
const bi = b?.redirectUriMetadata?.index ?? Number.POSITIVE_INFINITY
56+
if (ai !== bi) return ai - bi
57+
return (a?.name || '').localeCompare(b?.name || '')
58+
}
59+
60+
const sortByName = (a: RecordImportWizard, b: RecordImportWizard) =>
61+
(a?.name || '').localeCompare(b?.name || '')
62+
63+
this.certifiedWizards = certified.sort(sortByIndexThenName)
64+
this.featuredWizards = featured.sort(sortByIndexThenName)
65+
this.defaultWizards = defaults.sort(sortByName)
66+
}
67+
1768
openImportWizardUrlFilter(client: RecordImportWizard): string {
1869
if (client.status === 'RETIRED') {
1970
return client.clientWebsite

src/app/types/record-peer-review-import.endpoint.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
export type RecordImportWizardMetadataType = 'Featured' | 'Default' | 'Certified'
2+
3+
export interface RecordImportWizardMetadata {
4+
type?: RecordImportWizardMetadataType
5+
index?: number
6+
defaultDescription?: string
7+
logoUrl?: string
8+
}
9+
110
export interface RecordImportWizard {
211
actTypes: string[]
312
clientWebsite: string
@@ -6,6 +15,7 @@ export interface RecordImportWizard {
615
id: string
716
name: string
817
redirectUri: string
18+
redirectUriMetadata?: RecordImportWizardMetadata
919
scopes: string
1020
status: string
1121
show: boolean

0 commit comments

Comments
 (0)