Skip to content

Commit

Permalink
Remove usage of service_install resource on state get v2
Browse files Browse the repository at this point in the history
Change-type: patch
  • Loading branch information
otaviojacobi committed Nov 20, 2024
1 parent 5a618ab commit 6649bea
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/features/device-state/routes/state-get-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,13 @@ function buildAppFromRelease(
// extract the per-image information
const image = ipr.image[0];

const si = device.service_install.find(
({ service }) => service.__id === image.is_a_build_of__service[0].id,
);
const svc = image.is_a_build_of__service[0];
const environment: Dictionary<string> = {};
varListInsert(ipr.image_environment_variable, environment);
varListInsert(application.application_environment_variable, environment);
varListInsert(svc.service_environment_variable, environment);
varListInsert(device.device_environment_variable, environment);
if (si != null) {
varListInsert(si.device_service_environment_variable, environment);
}
varListInsert(svc.is_of__device_service_environment_variable, environment);

const labels: Dictionary<string> = {};
for (const { label_name, value } of [
Expand Down Expand Up @@ -188,6 +183,9 @@ const stateQuery = _.once(() =>
is_a_build_of__service: {
$select: ['id', 'service_name'],
$expand: {
is_of__device_service_environment_variable: {
$select: ['name', 'value'],
},
service_environment_variable: {
$select: ['name', 'value'],
},
Expand All @@ -208,14 +206,6 @@ const stateQuery = _.once(() =>
},
},
},
service_install: {
$select: ['id', 'service'],
$expand: {
device_service_environment_variable: {
$select: ['name', 'value'],
},
},
},
belongs_to__application: {
$select: ['id', 'app_name'],
$expand: {
Expand Down

0 comments on commit 6649bea

Please sign in to comment.