-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the hostApp to the state GET v3 result #1479
Conversation
0a5c671
to
c498245
Compare
dca2e2d
to
bc7fd4c
Compare
bc7fd4c
to
dea3586
Compare
cabe9c5
to
40ca521
Compare
40ca521
to
7dabc4d
Compare
7dabc4d
to
2070d1d
Compare
const supervisorRelease = device.should_be_managed_by__release[0]; | ||
if (!supervisorRelease) { | ||
return {}; | ||
const getSystemAppState = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be merged with getUserAppState
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to do so, but felt it was a bit too aggressive. We could combine all 3 getSystemAppState
, getUserAppState
& getAppState
to something like:
const getAppState = (
device: AnyObject,
targetReleaseField:
| 'should_be_running__release'
| 'should_be_managed_by__release'
| 'should_be_operated_by__release',
config: Dictionary<string>,
defaultLabels?: Dictionary<string>,
): StateV3[string]['apps'] | null => {
let application: AnyObject;
let release: AnyObject | undefined;
if (targetReleaseField === 'should_be_running__release') {
application = device.belongs_to__application[0];
release = getReleaseForDevice(device);
} else {
release = device[targetReleaseField][0];
if (!release) {
return null;
}
application = release.belongs_to__application[0];
}
return {
[application.uuid]: {
id: application.id,
name: application.app_name,
is_host: application.is_host,
class: application.is_of__class,
...(release != null && {
releases: buildAppFromRelease(
device,
application,
release,
config,
defaultLabels,
),
}),
},
};
};
What do you think?
7f21194
to
4c0a01c
Compare
4c0a01c
to
792d33a
Compare
Change-type: patch
Change-type: patch
792d33a
to
5cf3ced
Compare
Depends-on: #1502
Depends-on: https://github.com/balena-io/balena-api/pull/4825
Change-type: minor
See: https://balena.fibery.io/Work/Task/Add-hostOS-to-target-state-endpoint-1615