Skip to content

Optimize console-webapp assets, bundle, and build - #3272

Open
ptkach wants to merge 1 commit into
google:masterfrom
ptkach:consoleAngularUpdate2
Open

ptkach wants to merge 1 commit into
google:masterfrom
ptkach:consoleAngularUpdate2

Conversation

@ptkach

@ptkach ptkach commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator
  • Compress billing.png and resources.png by 88% and add lazy loading
  • Remove deprecated @angular/animations and unused Material modules
  • Deduplicate alpha/crash/qa console builds and add Gradle task caching
  • Migrate remaining @input, @output, and @ViewChild decorators to signals

This change is Reviewable

@ptkach
ptkach force-pushed the consoleAngularUpdate2 branch 2 times, most recently from 8399ba7 to c1ad9f4 Compare November 19, 2026 20:15
- Compress billing.png and resources.png by 88% and add lazy loading
- Remove deprecated @angular/animations and unused Material modules
- Deduplicate alpha/crash/qa console builds and add Gradle task caching
- Migrate remaining @input, @output, and @ViewChild decorators to signals
@ptkach
ptkach force-pushed the consoleAngularUpdate2 branch from c1ad9f4 to 5231d95 Compare November 20, 2026 15:27
@ptkach
ptkach requested a review from CydeWeys November 20, 2026 15:44

@CydeWeys CydeWeys left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the bundle/build optimizations and signal-API cleanup! The signal migrations (input/output/viewChild), unused Material/CDK removals, and the domainList paginator detachment look solid overall.

A few items need attention before merging (details inline):

  1. [Blocker / CI] Adding MatSortModule enables mat-sort-header on the registrars table, which breaks ConsoleScreenshotTest.globalRole_registrars (kokoro-foss / kokoro-internal, 2,539 px diff). Please visually verify the header layout, regenerate the golden, and note in the PR description that column sorting is now active.
  2. [Should-fix] The registrar-switch resets in DomainListComponent, UsersComponent, ContactComponent, and HistoryComponent clear state synchronously but do not cancel in-flight HTTP requests, so a slow response for registrar A can still overwrite registrar B's state and stop B's loading indicator. For admins on DomainListComponent, this is especially risky because ConsoleBulkDomainAction runs EPP with isSuperuser = isAdmin (bypassing EPP's verifyResourceOwnership).
  3. [Should-fix] RdapComponent's effect keys on registrar() instead of registrarId() and lacks a unit test.
  4. [Should-fix] The crash/qa == alpha build alias in console-webapp/build.gradle is enforced only by a comment — an automated Gradle check would prevent silent drift.

Also, it would be helpful to update the PR description to mention the user-visible behavior changes included here (column sorting enabled, registrar-switch state resets, history load split, lists hidden while loading, domainList server-side paginator fix, and ./gradlew test now running runConsoleWebappUnitTests). Note also that the Gradle changes configure incremental up-to-date checks rather than build caching (Exec/Copy disable build caching by default).

MatRippleModule,
MatSelectModule,
MatSidenavModule,
MatSortModule,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Blocker] Adding MatSortModule activates the existing matSort / mat-sort-header directives on registrarsTable.component.html and usersList.component.html (which were previously inert). This changes the table header layout and is causing ConsoleScreenshotTest.globalRole_registrars to fail in CI (2,539 px diff against chrome-linux/ConsoleScreenshotTest_globalRole_registrars_registrarsPage.png).

Please visually inspect the new header rendering, regenerate the screenshot golden, and note in the PR description that column sorting is now live.

/**
* Clears registrar-scoped table, selection, and service state so stale data
* cannot bleed across registrars when switching context.
*/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Should-fix] This comment says stale data "cannot bleed across registrars", but the synchronous reset does not cancel in-flight HTTP requests from the previous registrar. If a user switches from registrar A to registrar B while A's retrieveDomains() or retrieveLocks() request is still pending:

  1. A's late response writes A's domains / checkpointTime / locks into state while B is selected.
  2. A's finalize/complete clears B's isLoading and GlobalLoader (which is keyed by component instance).

For admin users this is especially hazardous: if A's domains repopulate the table while B is selected and the admin runs a bulk delete/suspend, ConsoleBulkDomainAction only checks permission on registrarId (B) and executes EPP with isSuperuser = isAdmin, which bypasses verifyResourceOwnership in DomainDeleteFlow / DomainUpdateFlow.

The same in-flight cancellation gap affects users.component.ts (loadUsers), contact.component.ts (fetchContacts), and history.component.ts (fetchHistory).

Fix: cancel prior subscriptions on registrar change via effect((onCleanup) => { const sub = ...; onCleanup(() => sub.unsubscribe()); }) or toObservable(registrarId).pipe(switchMap(...)), and add a unit test that emits the stale Subject after switching registrars.

) {}
) {
effect(() => {
if (this.registrarService.registrar()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Should-fix] Keying this effect on registrarService.registrar() (which is a computed over registrars().find(...)) means it will also fire whenever the registrars array is reloaded/updated (loadRegistrars, updateRegistrar, createRegistrar), and it skips resetting editing when registrar() is undefined.

Consider tracking this.registrarService.registrarId() directly and resetting unconditionally, plus adding a unit test in rdap.component.spec.ts.

createConsoleBuildTask(env)
}

// 'crash' and 'qa' share the exact same unoptimized build configuration as 'alpha'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Should-fix] Right now crash and qa still have their own configurations in angular.json (and are still referenced by release/build_nomulus_for_env.sh), so relying solely on this comment means a future crash-only or qa-only edit in angular.json would silently ship alpha's output.

Could we add a small Gradle configuration/task assertion (parsing angular.json with JsonSlurper) that fails the build if the alpha, crash, and qa configurations diverge?

task npmInstallDeps(type: Exec) {
workingDir "${consoleDir}/"
inputs.files("${consoleDir}/package.json", "${consoleDir}/package-lock.json")
outputs.dir("${consoleDir}/node_modules")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: declaring the entire node_modules directory as an output causes Gradle to fingerprint tens of thousands of files on every run. Using outputs.file("${consoleDir}/node_modules/.package-lock.json") is much faster and still invalidates on clean or install changes.

<img
src="./assets/billing.png"
alt="Generic billing image"
loading="lazy"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: loading="lazy" on above-the-fold hero images (here and in resources.component.html) doesn't save bandwidth and can delay LCP.

Also, billing.png and resources.png were downscaled from 1600x1600 RGBA to 300x300 RGB (flattening transparency to white). Since the CSS caps them at 300px, 300x300 is 1x-only and looks soft on 2x/HiDPI displays — consider 600x600 WebP/PNG with alpha preserved.

<h1>No records found</h1>
</div>
} @else {
} @else if (!isLoading()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: because HistoryComponent shares a single isLoading signal across both tabs, searching user history now blanks out the already-loaded Registrar history tab while the user query is in flight.

const globalRole = this.userDataService?.userData()?.globalRole || 'NONE';
if (this.elementId === null) {
const elementId = this.elementId();
if (elementId === null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: if elementId ever transitions from a restricted value to null, returning early here leaves style.display = 'none' stuck. Resetting this.el.nativeElement.style.display = '' before returning keeps the reactive behavior consistent.

</div>
<div class="console-app__contacts">
@if (contactService.contacts().length === 0) {
@if (!isLoading()) { @if (contactService.contacts().length === 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this nested @if (!isLoading()) { @if (...) { can be flattened to @if (isLoading()) { } @else if (contactService.contacts().length === 0) { ... } @else { ... } for readability.

const first: Registrar = {
...sampleRegistrar,
registrarId: 'reg-1',
registrarName: 'zeta Corp',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: 'zeta Corp' vs 'Alpha Corp' sorts Alpha before zeta even under a case-sensitive comparison ('A' < 'z'). Using 'Zeta Corp' vs 'alpha Corp' would actually exercise case-insensitive sorting.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants