diff --git a/cmd/ui/app/common/components/artifact_card/artifact_card.scss b/cmd/ui/app/common/components/artifact_card/artifact_card.scss
index e4464e216..bd66150ef 100644
--- a/cmd/ui/app/common/components/artifact_card/artifact_card.scss
+++ b/cmd/ui/app/common/components/artifact_card/artifact_card.scss
@@ -26,6 +26,11 @@
cursor: pointer;
}
+ .artifact-icon-link {
+ text-decoration: none;
+ color: inherit;
+ }
+
.card-main-content {
display: flex;
align-items: center;
diff --git a/cmd/ui/app/common/components/dashboard/dashboard_grid/dashboard_grid_test.ts b/cmd/ui/app/common/components/dashboard/dashboard_grid/dashboard_grid_test.ts
index 6c33bea3b..028a3c953 100644
--- a/cmd/ui/app/common/components/dashboard/dashboard_grid/dashboard_grid_test.ts
+++ b/cmd/ui/app/common/components/dashboard/dashboard_grid/dashboard_grid_test.ts
@@ -82,7 +82,6 @@ class TestHostComponent {
describe('DashboardGridComponent', () => {
let fixture: ComponentFixture;
- let host: TestHostComponent;
let harness: DashboardGridHarness;
let dashboardServiceSpy: jasmine.SpyObj;
@@ -100,7 +99,6 @@ describe('DashboardGridComponent', () => {
}).compileComponents();
fixture = TestBed.createComponent(TestHostComponent);
- host = fixture.componentInstance;
fixture.detectChanges();
const loader = TestbedHarnessEnvironment.loader(fixture);
harness = await loader.getHarness(DashboardGridHarness);
diff --git a/cmd/ui/app/common/components/resource_chip/resource_chip.ng.html b/cmd/ui/app/common/components/resource_chip/resource_chip.ng.html
index ab9d26f57..2b8143c1b 100644
--- a/cmd/ui/app/common/components/resource_chip/resource_chip.ng.html
+++ b/cmd/ui/app/common/components/resource_chip/resource_chip.ng.html
@@ -13,13 +13,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
+
{{ text() }}
diff --git a/cmd/ui/app/common/components/resource_chip/resource_chip.ts b/cmd/ui/app/common/components/resource_chip/resource_chip.ts
index 81bae50f4..2d0791bc0 100644
--- a/cmd/ui/app/common/components/resource_chip/resource_chip.ts
+++ b/cmd/ui/app/common/components/resource_chip/resource_chip.ts
@@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-import { ChangeDetectionStrategy, Component, input } from '@angular/core';
+import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
import { MatChipsModule } from '@angular/material/chips';
/** The resource type */
@@ -23,6 +23,14 @@ export enum ResourceType {
UNKNOWN = 'UNKNOWN',
}
+const RESOURCE_COLOR_MAP: Readonly> = {
+ [ResourceType.CPU]: 'grey',
+ [ResourceType.MEMORY]: 'grey',
+ [ResourceType.UNKNOWN]: 'grey',
+ [ResourceType.GPU]: 'green',
+ [ResourceType.TPU]: 'green',
+};
+
/** The resource chip component. */
@Component({
selector: 'xmc-resource-chip',
@@ -36,5 +44,5 @@ export class ResourceChip {
readonly resourceType = input.required();
readonly text = input.required();
- readonly ResourceType = ResourceType;
+ protected readonly chipColor = computed(() => RESOURCE_COLOR_MAP[this.resourceType()]);
}
diff --git a/cmd/ui/app/common/components/resource_chip/resource_chip_test.ts b/cmd/ui/app/common/components/resource_chip/resource_chip_test.ts
index 556b340c4..b9719a30e 100644
--- a/cmd/ui/app/common/components/resource_chip/resource_chip_test.ts
+++ b/cmd/ui/app/common/components/resource_chip/resource_chip_test.ts
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { getHarness } from '@angular/cdk/testing/catalyst/async';
+import { TestBed } from '@angular/core/testing';
import { MatChipHarness } from '@angular/material/chips/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
@@ -37,7 +38,9 @@ describe('ResourceChip Component', () => {
const testCases = [
{ name: 'CPU', type: ResourceType.CPU, expectedClass: 'grey' },
{ name: 'MEMORY', type: ResourceType.MEMORY, expectedClass: 'grey' },
+ { name: 'UNKNOWN', type: ResourceType.UNKNOWN, expectedClass: 'grey' },
{ name: 'GPU', type: ResourceType.GPU, expectedClass: 'green' },
+ { name: 'TPU', type: ResourceType.TPU, expectedClass: 'green' },
];
for (const tc of testCases) {
@@ -47,9 +50,30 @@ describe('ResourceChip Component', () => {
const chipHarness = await getHarness(MatChipHarness);
const host = await chipHarness.host();
+ expect(await host.hasClass('mat-mdc-chip'))
+ .withContext('Expected host Material chip class to be preserved')
+ .toBeTrue();
expect(await host.hasClass(tc.expectedClass))
.withContext(`Expected to have class "${tc.expectedClass}"`)
.toBeTrue();
});
}
+
+ it('updates chip class cleanly when resourceType changes without dropping host classes', () => {
+ const fixture = TestBed.createComponent(ResourceChip);
+ fixture.componentRef.setInput('resourceType', ResourceType.CPU);
+ fixture.componentRef.setInput('text', 'CPU');
+ fixture.detectChanges();
+
+ const chipEl = fixture.nativeElement.querySelector('mat-chip') as HTMLElement;
+ expect(chipEl.classList.contains('mat-mdc-chip')).toBeTrue();
+ expect(chipEl.classList.contains('grey')).toBeTrue();
+
+ fixture.componentRef.setInput('resourceType', ResourceType.GPU);
+ fixture.detectChanges();
+
+ expect(chipEl.classList.contains('mat-mdc-chip')).toBeTrue();
+ expect(chipEl.classList.contains('grey')).toBeFalse();
+ expect(chipEl.classList.contains('green')).toBeTrue();
+ });
});
diff --git a/cmd/ui/app/common/components/status_chip/status_chip.ng.html b/cmd/ui/app/common/components/status_chip/status_chip.ng.html
index 6df4626ef..afb72178a 100644
--- a/cmd/ui/app/common/components/status_chip/status_chip.ng.html
+++ b/cmd/ui/app/common/components/status_chip/status_chip.ng.html
@@ -13,20 +13,4 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
- {{ replicas() }} {{ status() }}
-
+{{ replicas() }} {{ status() }}
diff --git a/cmd/ui/app/common/components/status_chip/status_chip.ts b/cmd/ui/app/common/components/status_chip/status_chip.ts
index 8d087267f..53ce6155e 100644
--- a/cmd/ui/app/common/components/status_chip/status_chip.ts
+++ b/cmd/ui/app/common/components/status_chip/status_chip.ts
@@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-import { ChangeDetectionStrategy, Component, input } from '@angular/core';
+import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
import { MatChipsModule } from '@angular/material/chips';
/**
@@ -35,6 +35,25 @@ export enum StatusOption {
UNKNOWN = 'Unknown',
}
+const STATUS_COLOR_MAP: Readonly> = {
+ [StatusOption.SUCCESS]: 'green',
+ [StatusOption.COMPLETED]: 'green',
+ // TODO: Add .light-green and .grey CSS rules in status_chip.scss so STARTING/DESCHEDULING/SCHEDULING chips render distinct colors.
+ [StatusOption.STARTING]: 'light-green',
+ [StatusOption.FAILED]: 'red',
+ [StatusOption.RUNNING]: 'blue',
+ [StatusOption.NOT_RUNNING]: 'blue',
+ [StatusOption.PENDING]: 'yellow',
+ [StatusOption.INITIALIZING]: 'yellow',
+ [StatusOption.UNKNOWN]: 'yellow',
+ [StatusOption.RESTARTING]: 'yellow',
+ [StatusOption.DESCHEDULING]: 'grey',
+ [StatusOption.SCHEDULING]: 'grey',
+ [StatusOption.SCHEDULING_PAUSED]: 'orange',
+ [StatusOption.STOPPING]: 'black',
+ [StatusOption.STOPPED]: 'black',
+};
+
/**
* Display a status chip for an experiment, work unit, or job.
*/
@@ -53,5 +72,5 @@ export class StatusChip {
// jobs in a work unit.
readonly replicas = input(undefined);
- readonly StatusOption = StatusOption;
+ protected readonly statusColor = computed(() => STATUS_COLOR_MAP[this.status()]);
}
diff --git a/cmd/ui/app/common/components/status_chip/status_chip_test.ts b/cmd/ui/app/common/components/status_chip/status_chip_test.ts
new file mode 100644
index 000000000..76abda0c4
--- /dev/null
+++ b/cmd/ui/app/common/components/status_chip/status_chip_test.ts
@@ -0,0 +1,87 @@
+// Copyright 2026 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+import { getHarness } from '@angular/cdk/testing/catalyst/async';
+import { TestBed } from '@angular/core/testing';
+import { MatChipHarness } from '@angular/material/chips/testing';
+import { NoopAnimationsModule } from '@angular/platform-browser/animations';
+
+import { bootstrap, setupModule } from 'app/testing/test';
+
+import { StatusChip, StatusOption } from './status_chip';
+
+describe('StatusChip Component', () => {
+ beforeEach(() => {
+ setupModule({
+ imports: [StatusChip, NoopAnimationsModule],
+ });
+ });
+
+ it('displays status with optional replica count', async () => {
+ bootstrap(StatusChip, { status: StatusOption.RUNNING, replicas: 4 });
+
+ const chipHarness = await getHarness(MatChipHarness);
+ expect(await chipHarness.getText()).toBe('4 Running');
+ });
+
+ const expectedColors: ReadonlyArray<{ status: StatusOption; expectedClass: string }> = [
+ { status: StatusOption.SUCCESS, expectedClass: 'green' },
+ { status: StatusOption.COMPLETED, expectedClass: 'green' },
+ { status: StatusOption.STARTING, expectedClass: 'light-green' },
+ { status: StatusOption.FAILED, expectedClass: 'red' },
+ { status: StatusOption.RUNNING, expectedClass: 'blue' },
+ { status: StatusOption.NOT_RUNNING, expectedClass: 'blue' },
+ { status: StatusOption.PENDING, expectedClass: 'yellow' },
+ { status: StatusOption.INITIALIZING, expectedClass: 'yellow' },
+ { status: StatusOption.UNKNOWN, expectedClass: 'yellow' },
+ { status: StatusOption.RESTARTING, expectedClass: 'yellow' },
+ { status: StatusOption.DESCHEDULING, expectedClass: 'grey' },
+ { status: StatusOption.SCHEDULING, expectedClass: 'grey' },
+ { status: StatusOption.SCHEDULING_PAUSED, expectedClass: 'orange' },
+ { status: StatusOption.STOPPING, expectedClass: 'black' },
+ { status: StatusOption.STOPPED, expectedClass: 'black' },
+ ];
+
+ for (const tc of expectedColors) {
+ it(`applies ${tc.expectedClass} class and keeps mat-mdc-chip for ${tc.status}`, async () => {
+ bootstrap(StatusChip, { status: tc.status });
+
+ const chipHarness = await getHarness(MatChipHarness);
+ const host = await chipHarness.host();
+
+ expect(await host.hasClass('mat-mdc-chip'))
+ .withContext('Expected host Material chip class to be preserved')
+ .toBeTrue();
+ expect(await host.hasClass(tc.expectedClass))
+ .withContext(`Expected status "${tc.status}" to apply class "${tc.expectedClass}"`)
+ .toBeTrue();
+ });
+ }
+
+ it('updates chip color class dynamically when status changes without dropping host classes', () => {
+ const fixture = TestBed.createComponent(StatusChip);
+ fixture.componentRef.setInput('status', StatusOption.RUNNING);
+ fixture.detectChanges();
+
+ const chipEl = fixture.nativeElement.querySelector('mat-chip') as HTMLElement;
+ expect(chipEl.classList.contains('mat-mdc-chip')).toBeTrue();
+ expect(chipEl.classList.contains('blue')).toBeTrue();
+
+ fixture.componentRef.setInput('status', StatusOption.COMPLETED);
+ fixture.detectChanges();
+
+ expect(chipEl.classList.contains('mat-mdc-chip')).toBeTrue();
+ expect(chipEl.classList.contains('blue')).toBeFalse();
+ expect(chipEl.classList.contains('green')).toBeTrue();
+ });
+});
diff --git a/cmd/ui/app/common/components/status_message/status_message.ng.html b/cmd/ui/app/common/components/status_message/status_message.ng.html
index d0e2180be..93128942b 100644
--- a/cmd/ui/app/common/components/status_message/status_message.ng.html
+++ b/cmd/ui/app/common/components/status_message/status_message.ng.html
@@ -14,9 +14,9 @@
limitations under the License.
-->
@if (isVisible$ | async) {
-