Skip to content

Commit 047058c

Browse files
OmniLab Teamcopybara-github
authored andcommitted
Internal change
PiperOrigin-RevId: 915305884
1 parent a99adc9 commit 047058c

19 files changed

Lines changed: 577 additions & 82 deletions

src/devtools/mobileharness/fe/v6/angular/app/core/models/host_action.ts

Lines changed: 90 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,41 @@ export declare interface FlagPreset {
6363
readonly description: string;
6464
}
6565

66+
/**
67+
* Response for PreflightLabServerRelease API.
68+
*/
69+
export declare interface PreflightLabServerReleaseResponse {
70+
readonly permissionDenied?: PermissionDenied;
71+
readonly ready?: ReleaseReady;
72+
}
73+
74+
/**
75+
* No deploy permission.
76+
*/
77+
export declare interface PermissionDenied {}
78+
79+
/**
80+
* All checks passed. Here are the available versions to deploy.
81+
*/
82+
export declare interface ReleaseReady {
83+
readonly versions: DeployableVersion[];
84+
}
85+
86+
/**
87+
* Represents the status of a Lab Server release.
88+
*/
89+
export type ReleaseStatus = 'Latest' | 'Current' | 'Deprecated' | '';
90+
6691
/**
6792
* Configuration for a specific Lab Server release.
6893
*/
69-
export declare interface HostReleaseConfig {
94+
export declare interface DeployableVersion {
7095
readonly name: string;
7196
readonly version: string;
72-
readonly port: ReleasePort;
73-
readonly syncCMD: string[];
74-
readonly asyncCMD: string[];
97+
readonly status: ReleaseStatus;
98+
readonly buildTime: string;
99+
readonly ports?: ReleasePort[];
100+
readonly releaseDetails?: ReleaseDetails;
75101
}
76102

77103
/**
@@ -82,6 +108,66 @@ export declare interface ReleasePort {
82108
readonly portNumber: number;
83109
}
84110

111+
/**
112+
* Details about a specific release.
113+
*/
114+
export declare interface ReleaseDetails {
115+
readonly changeLogs?: ChangeLogGroup[];
116+
readonly files?: FileRecord[];
117+
readonly syncCommands?: CommandRecord[];
118+
readonly asyncCommands?: CommandRecord[];
119+
}
120+
121+
/**
122+
* Represents a group of changes or bugs related to a release.
123+
*/
124+
export declare interface ChangeLogGroup {
125+
readonly name: string;
126+
readonly items: ChangeLogItem[];
127+
}
128+
129+
/**
130+
* Represents a single change record or bug record for a release.
131+
*/
132+
export declare interface ChangeLogItem {
133+
readonly change?: ChangeRecord;
134+
readonly bug?: BugRecord;
135+
}
136+
137+
/**
138+
* Represents a single change record for a release.
139+
*/
140+
export declare interface ChangeRecord {
141+
readonly cl: number;
142+
readonly author: string;
143+
readonly text: string;
144+
readonly bugs: number[];
145+
}
146+
147+
/**
148+
* Represents a single bug record for a release.
149+
*/
150+
export declare interface BugRecord {
151+
readonly bug: number;
152+
readonly text: string;
153+
}
154+
155+
/**
156+
* Represents a single file record for a release.
157+
*/
158+
export declare interface FileRecord {
159+
readonly name: string;
160+
readonly path: string;
161+
}
162+
163+
/**
164+
* Represents a single command record for a release.
165+
*/
166+
export declare interface CommandRecord {
167+
readonly name: string;
168+
readonly command: string;
169+
}
170+
85171
/**
86172
* Response for DecommissionHost API.
87173
*/

src/devtools/mobileharness/fe/v6/angular/app/core/services/config/fake_config_service.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ export class FakeConfigService extends ConfigService {
6363
const isHostManaged = scenario.overview.host.name === 'host-x.example.com';
6464
const hostName = scenario.overview.host.name;
6565

66-
let uiStatus: Partial<DeviceConfigUiStatus> | undefined;
66+
let uiStatus: Partial<DeviceConfigUiStatus> | undefined = {
67+
permissions: {visible: true, editability: {editable: true}},
68+
wifi: {visible: true, editability: {editable: true}},
69+
dimensions: {visible: true, editability: {editable: true}},
70+
settings: {visible: true, editability: {editable: true}},
71+
};
6772
if (deviceId === 'WIFI_DIMENSIONS_ONLY_DEVICE') {
6873
uiStatus = {
6974
permissions: {visible: false},

src/devtools/mobileharness/fe/v6/angular/app/core/services/host/fake_host_service.ts

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {
55
DecommissionHostResponse,
66
GetHostDebugInfoResponse,
77
HostHeaderInfo,
8-
HostReleaseConfig,
98
PopularFlag,
9+
PreflightLabServerReleaseResponse,
1010
ReleaseLabServerRequest,
1111
ReleaseLabServerResponse,
1212
RestartLabServerResponse,
@@ -25,7 +25,10 @@ import {
2525
RemoteControlDevicesResponse,
2626
} from '../../models/host_overview';
2727
import {MOCK_HOST_SCENARIOS} from '../mock_data';
28-
import {createHostActions} from '../mock_data/hosts/ui_status_utils';
28+
import {
29+
createDefaultReleaseResponse,
30+
createHostActions,
31+
} from '../mock_data/hosts/ui_status_utils';
2932
import {HostService} from './host_service';
3033

3134
/**
@@ -148,31 +151,13 @@ export class FakeHostService extends HostService {
148151
}
149152
}
150153

151-
override getReleaseConfigs(
154+
override preflightLabServerRelease(
152155
hostName: string,
153-
): Observable<HostReleaseConfig[]> {
154-
return of([
155-
{
156-
name: 'MH_SATELLITE_LAB',
157-
version: '4.349.0',
158-
port: {protocol: 'grpc', portNumber: 9994},
159-
syncCMD: [
160-
'sudo systemctl stop mobileharness-lab',
161-
'sudo /usr/bin/mh_lab_installer --version 4.349.0',
162-
],
163-
asyncCMD: ['sudo systemctl start mobileharness-lab'],
164-
},
165-
{
166-
name: 'MH_SATELLITE_LAB',
167-
version: '4.348.0',
168-
port: {protocol: 'grpc', portNumber: 9994},
169-
syncCMD: [
170-
'sudo systemctl stop mobileharness-lab',
171-
'sudo /usr/bin/mh_lab_installer --version 4.348.0',
172-
],
173-
asyncCMD: ['sudo systemctl start mobileharness-lab'],
174-
},
175-
]);
156+
): Observable<PreflightLabServerReleaseResponse> {
157+
const scenario = MOCK_HOST_SCENARIOS.find((s) => s.hostName === hostName);
158+
const preflightLabServerReleaseResponse =
159+
scenario?.releaseResponse || createDefaultReleaseResponse();
160+
return of(preflightLabServerReleaseResponse);
176161
}
177162

178163
override decommissionMissingDevices(

src/devtools/mobileharness/fe/v6/angular/app/core/services/host/host_service.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import {InjectionToken} from '@angular/core';
22
import {Observable} from 'rxjs';
33
import {
44
DecommissionHostResponse,
5-
ReleaseLabServerRequest,
6-
ReleaseLabServerResponse,
75
GetHostDebugInfoResponse,
86
HostHeaderInfo,
9-
HostReleaseConfig,
107
PopularFlag,
8+
PreflightLabServerReleaseResponse,
9+
ReleaseLabServerRequest,
10+
ReleaseLabServerResponse,
1111
RestartLabServerResponse,
1212
StartLabServerResponse,
1313
StopLabServerResponse,
@@ -70,7 +70,9 @@ export abstract class HostService {
7070
/**
7171
* Retrieves release configurations for a host.
7272
*/
73-
abstract getReleaseConfigs(hostName: string): Observable<HostReleaseConfig[]>;
73+
abstract preflightLabServerRelease(
74+
hostName: string,
75+
): Observable<PreflightLabServerReleaseResponse>;
7476

7577
/**
7678
* Decommissions missing devices on a specific host.

src/devtools/mobileharness/fe/v6/angular/app/core/services/host/http_host_service.spec.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import {TestBed} from '@angular/core/testing';
88
import {APP_DATA, AppData} from '../../models/app_data';
99
import {
1010
DecommissionHostResponse,
11+
DeployableVersion,
1112
GetHostDebugInfoResponse,
1213
HostHeaderInfo,
13-
HostReleaseConfig,
1414
PopularFlag,
15+
PreflightLabServerReleaseResponse,
1516
ReleaseLabServerRequest,
1617
ReleaseLabServerResponse,
1718
RestartLabServerResponse,
@@ -154,17 +155,19 @@ describe('HttpHostService', () => {
154155
});
155156

156157
it('should retrieve release configs', () => {
157-
const mockConfigs: HostReleaseConfig[] = [
158-
{name: 'config1'} as HostReleaseConfig,
159-
];
160-
service.getReleaseConfigs('test-host').subscribe((configs) => {
161-
expect(configs).toEqual(mockConfigs);
158+
const mockResponse: PreflightLabServerReleaseResponse = {
159+
ready: {
160+
versions: [{name: 'config1'} as DeployableVersion],
161+
},
162+
};
163+
service.preflightLabServerRelease('test-host').subscribe((response) => {
164+
expect(response).toEqual(mockResponse);
162165
});
163166
const req = httpMock.expectOne(
164-
'http://testdomain.com/v6/hosts/test-host/release-configs',
167+
`http://testdomain.com/v6/hosts/test-host/preflightLabServerRelease`,
165168
);
166169
expect(req.request.method).toBe('GET');
167-
req.flush(mockConfigs);
170+
req.flush(mockResponse);
168171
});
169172

170173
it('should decommission host', () => {

src/devtools/mobileharness/fe/v6/angular/app/core/services/host/http_host_service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {
99
DecommissionHostResponse,
1010
GetHostDebugInfoResponse,
1111
HostHeaderInfo,
12-
HostReleaseConfig,
1312
PopularFlag,
13+
PreflightLabServerReleaseResponse,
1414
ReleaseLabServerRequest,
1515
ReleaseLabServerResponse,
1616
RestartLabServerResponse,
@@ -85,11 +85,11 @@ export class HttpHostService extends HostService {
8585
);
8686
}
8787

88-
override getReleaseConfigs(
88+
override preflightLabServerRelease(
8989
hostName: string,
90-
): Observable<HostReleaseConfig[]> {
91-
return this.http.get<HostReleaseConfig[]>(
92-
`${this.apiUrl}/${hostName}/release-configs`,
90+
): Observable<PreflightLabServerReleaseResponse> {
91+
return this.http.get<PreflightLabServerReleaseResponse>(
92+
`${this.apiUrl}/${hostName}/preflightLabServerRelease`,
9393
);
9494
}
9595

src/devtools/mobileharness/fe/v6/angular/app/core/services/mock_data/hosts/01_no_config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ export const SCENARIO_HOST_NO_CONFIG: MockHostScenario = {
1818
},
1919
defaultDeviceConfig: null,
2020
actions: createHostActions(),
21+
releaseResponse: {
22+
permissionDenied: {},
23+
},
2124
};

src/devtools/mobileharness/fe/v6/angular/app/core/services/mock_data/hosts/02_basic_editable.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {HostConfig} from '../../../models/host_config_models';
55
import {MockHostScenario} from '../models';
66
import {
77
createDefaultHostOverview,
8+
createDefaultReleaseResponse,
89
createDefaultUiStatus,
910
createHostActions,
1011
} from './ui_status_utils';
@@ -44,4 +45,5 @@ export const SCENARIO_HOST_BASIC_EDITABLE: MockHostScenario = {
4445
},
4546
defaultDeviceConfig: DEFAULT_DEVICE_CONFIG,
4647
actions: createHostActions(),
48+
releaseResponse: createDefaultReleaseResponse(),
4749
};

src/devtools/mobileharness/fe/v6/angular/app/core/services/mock_data/hosts/multi_remote_control.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import {
66
HostOverview,
77
} from '../../../models/host_overview';
88
import {MockHostScenario} from '../models';
9-
import {createDefaultUiStatus, createHostActions} from './ui_status_utils';
9+
import {
10+
createDefaultUiStatus,
11+
createDeviceActions,
12+
createHostActions,
13+
} from './ui_status_utils';
1014

1115
// Helper to create a basic HostOverview
1216
function createHostOverview(
@@ -278,6 +282,7 @@ const DEVICES_PROXY_MISMATCH: DeviceSummary[] = [
278282
requiredDims: '',
279283
model: 'Pixel 8',
280284
version: '14',
285+
actions: createDeviceActions('ALL_PERMISSIONS'),
281286
},
282287
{
283288
id: 'RC-PROXY-MISMATCH-2',
@@ -292,6 +297,7 @@ const DEVICES_PROXY_MISMATCH: DeviceSummary[] = [
292297
requiredDims: '',
293298
model: 'Pixel 8 Pro',
294299
version: '21',
300+
actions: createDeviceActions('ALL_PERMISSIONS'),
295301
},
296302
{
297303
id: 'RC-NO-PROXY',
@@ -302,6 +308,7 @@ const DEVICES_PROXY_MISMATCH: DeviceSummary[] = [
302308
requiredDims: '',
303309
model: 'Pixel 8 Pro',
304310
version: '21',
311+
actions: createDeviceActions('ALL_PERMISSIONS'),
305312
},
306313
{
307314
id: 'RC-TESTBED-NO-PROXY',

src/devtools/mobileharness/fe/v6/angular/app/core/services/mock_data/hosts/overview_13.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {MockHostScenario} from '../models';
44
import {
55
createDefaultHostOverview,
66
createDefaultUiStatus,
7+
createDeviceActions,
78
createHostActions,
89
} from './ui_status_utils';
910

@@ -55,6 +56,7 @@ const deviceSummaries: DeviceSummary[] = [
5556
requiredDims: 'pool:missing',
5657
model: 'Pixel 6',
5758
version: '13',
59+
actions: createDeviceActions('ALL_PERMISSIONS'),
5860
},
5961
{
6062
id: 'MISSING-DEV-2',
@@ -69,6 +71,7 @@ const deviceSummaries: DeviceSummary[] = [
6971
requiredDims: 'pool:missing',
7072
model: 'Pixel 6 Pro',
7173
version: '13',
74+
actions: createDeviceActions('ALL_PERMISSIONS'),
7275
},
7376
{
7477
id: 'MISSING-DEV-3',
@@ -83,6 +86,7 @@ const deviceSummaries: DeviceSummary[] = [
8386
requiredDims: 'pool:missing',
8487
model: 'Pixel 7',
8588
version: '14',
89+
actions: createDeviceActions('ALL_PERMISSIONS'),
8690
},
8791
{
8892
id: 'ACTIVE-DEV-4',
@@ -97,6 +101,7 @@ const deviceSummaries: DeviceSummary[] = [
97101
requiredDims: 'pool:active',
98102
model: 'Pixel 8',
99103
version: '14',
104+
actions: createDeviceActions('ALL_PERMISSIONS'),
100105
},
101106
];
102107

0 commit comments

Comments
 (0)