Skip to content

Commit 14a56fe

Browse files
DeviceInfracopybara-github
authored andcommitted
Internal change
PiperOrigin-RevId: 906840863
1 parent 1dc9bdf commit 14a56fe

53 files changed

Lines changed: 3340 additions & 211 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 98 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,47 @@ export declare interface PopularFlag {
5555
}
5656

5757
/**
58-
* A preset configuration for pass-through flags.
58+
* Response for GetPopularFlags API.
5959
*/
60-
export declare interface FlagPreset {
61-
readonly label: string;
62-
readonly value: string;
63-
readonly description: string;
60+
export declare interface GetPopularFlagsResponse {
61+
readonly flags: PopularFlag[];
6462
}
6563

64+
/**
65+
* Response for PreflightLabServerRelease API.
66+
*/
67+
export declare interface PreflightLabServerReleaseResponse {
68+
readonly permissionDenied?: PermissionDenied;
69+
readonly ready?: ReleaseReady;
70+
}
71+
72+
/**
73+
* No deploy permission.
74+
*/
75+
export declare interface PermissionDenied {}
76+
77+
/**
78+
* All checks passed. Here are the available versions to deploy.
79+
*/
80+
export declare interface ReleaseReady {
81+
readonly versions: DeployableVersion[];
82+
}
83+
84+
/**
85+
* Represents the status of a Lab Server release.
86+
*/
87+
export type ReleaseStatus = 'Latest' | 'Current' | 'Deprecated' | '';
88+
6689
/**
6790
* Configuration for a specific Lab Server release.
6891
*/
69-
export declare interface HostReleaseConfig {
92+
export declare interface DeployableVersion {
7093
readonly name: string;
7194
readonly version: string;
72-
readonly port: ReleasePort;
73-
readonly syncCMD: string[];
74-
readonly asyncCMD: string[];
95+
readonly status: ReleaseStatus;
96+
readonly buildTime: string;
97+
readonly ports?: ReleasePort[];
98+
readonly releaseDetails?: ReleaseDetails;
7599
}
76100

77101
/**
@@ -82,11 +106,76 @@ export declare interface ReleasePort {
82106
readonly portNumber: number;
83107
}
84108

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

174+
/**
175+
* Response for UpdatePassThroughFlags API.
176+
*/
177+
export declare interface UpdatePassThroughFlagsResponse {}
178+
90179
/**
91180
* Response for those rollout action
92181
*/

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: 57 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ import {Observable, of, throwError} from 'rxjs';
44
import {
55
DecommissionHostResponse,
66
GetHostDebugInfoResponse,
7+
GetPopularFlagsResponse,
78
HostHeaderInfo,
8-
HostReleaseConfig,
9-
PopularFlag,
9+
PreflightLabServerReleaseResponse,
1010
ReleaseLabServerRequest,
1111
ReleaseLabServerResponse,
1212
RestartLabServerResponse,
1313
StartLabServerResponse,
1414
StopLabServerResponse,
15+
UpdatePassThroughFlagsResponse,
1516
} from '../../models/host_action';
1617
import {
1718
CheckRemoteControlEligibilityResponse,
@@ -25,7 +26,10 @@ import {
2526
RemoteControlDevicesResponse,
2627
} from '../../models/host_overview';
2728
import {MOCK_HOST_SCENARIOS} from '../mock_data';
28-
import {createHostActions} from '../mock_data/hosts/ui_status_utils';
29+
import {
30+
createDefaultReleaseResponse,
31+
createHostActions,
32+
} from '../mock_data/hosts/ui_status_utils';
2933
import {HostService} from './host_service';
3034

3135
/**
@@ -110,34 +114,58 @@ export class FakeHostService extends HostService {
110114
});
111115
}
112116

113-
override getPopularFlags(hostName: string): Observable<PopularFlag[]> {
114-
return of([
115-
{
116-
name: 'No Mute Android',
117-
description: 'Disables muting of Android devices',
118-
cmd: '--nomute_android',
119-
},
120-
{
121-
name: 'No Binary Log',
122-
description: 'Disables binary logging to save space',
123-
cmd: '--nobinarylog',
124-
},
125-
{
126-
name: 'Enable Linux Device',
127-
description: 'Enables support for Linux devices',
128-
cmd: '--enable_linux_device',
129-
},
130-
]);
117+
override getPopularFlags(
118+
hostName: string,
119+
): Observable<GetPopularFlagsResponse> {
120+
return of({
121+
flags: [
122+
{
123+
name: 'Standard Satellite',
124+
cmd: '--nomute_android --noandroid_device_daemon',
125+
description: 'Default configuration for Android Satellite Labs',
126+
},
127+
{
128+
name: 'Linux Support',
129+
cmd: '--enable_linux_device',
130+
description: 'Enables detection of Linux devices',
131+
},
132+
{
133+
name: 'Debug Mode',
134+
cmd: '--debug_mode=true --verbose',
135+
description: 'Enables verbose logging for debugging',
136+
},
137+
{
138+
name: 'Flashstation Cache',
139+
cmd: '--flashstation_cache_dir=/tmp/fs_cache',
140+
description: 'Custom cache directory for Flashstation',
141+
},
142+
{
143+
name: 'No Binary Log',
144+
cmd: '--nobinarylog',
145+
description: 'Disables binary logging to save space',
146+
},
147+
{
148+
name: 'Custom Flag',
149+
cmd: `--my_message=":text: field_a: 'test' field_b: 123"`,
150+
description: 'Custom flag for testing',
151+
},
152+
{
153+
name: 'Custom Flag 2',
154+
cmd: `--flagD="some value"`,
155+
description: 'Custom flag for testing 2',
156+
},
157+
],
158+
});
131159
}
132160

133161
override updatePassThroughFlags(
134162
hostName: string,
135163
flags: string,
136-
): Observable<void> {
164+
): Observable<UpdatePassThroughFlagsResponse> {
137165
const scenario = MOCK_HOST_SCENARIOS.find((s) => s.hostName === hostName);
138166
if (scenario && scenario.overview) {
139167
scenario.overview.labServer.passThroughFlags = flags;
140-
return of(undefined);
168+
return of({});
141169
} else {
142170
return throwError(
143171
() =>
@@ -148,31 +176,13 @@ export class FakeHostService extends HostService {
148176
}
149177
}
150178

151-
override getReleaseConfigs(
179+
override preflightLabServerRelease(
152180
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-
]);
181+
): Observable<PreflightLabServerReleaseResponse> {
182+
const scenario = MOCK_HOST_SCENARIOS.find((s) => s.hostName === hostName);
183+
const preflightLabServerReleaseResponse =
184+
scenario?.releaseResponse || createDefaultReleaseResponse();
185+
return of(preflightLabServerReleaseResponse);
176186
}
177187

178188
override decommissionMissingDevices(

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import {InjectionToken} from '@angular/core';
22
import {Observable} from 'rxjs';
3+
34
import {
45
DecommissionHostResponse,
5-
ReleaseLabServerRequest,
6-
ReleaseLabServerResponse,
76
GetHostDebugInfoResponse,
7+
GetPopularFlagsResponse,
88
HostHeaderInfo,
9-
HostReleaseConfig,
10-
PopularFlag,
9+
PreflightLabServerReleaseResponse,
10+
ReleaseLabServerRequest,
11+
ReleaseLabServerResponse,
1112
RestartLabServerResponse,
1213
StartLabServerResponse,
1314
StopLabServerResponse,
15+
UpdatePassThroughFlagsResponse,
1416
} from '../../models/host_action';
1517
import {
1618
CheckRemoteControlEligibilityResponse,
@@ -57,20 +59,24 @@ export abstract class HostService {
5759
/**
5860
* Retrieves popular pass-through flags for a host.
5961
*/
60-
abstract getPopularFlags(hostName: string): Observable<PopularFlag[]>;
62+
abstract getPopularFlags(
63+
hostName: string,
64+
): Observable<GetPopularFlagsResponse>;
6165

6266
/**
6367
* Updates the pass through flags for a specific host.
6468
*/
6569
abstract updatePassThroughFlags(
6670
hostName: string,
6771
flags: string,
68-
): Observable<void>;
72+
): Observable<UpdatePassThroughFlagsResponse>;
6973

7074
/**
7175
* Retrieves release configurations for a host.
7276
*/
73-
abstract getReleaseConfigs(hostName: string): Observable<HostReleaseConfig[]>;
77+
abstract preflightLabServerRelease(
78+
hostName: string,
79+
): Observable<PreflightLabServerReleaseResponse>;
7480

7581
/**
7682
* Decommissions missing devices on a specific host.

0 commit comments

Comments
 (0)