mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-06 19:19:56 +00:00
preload: Replace my_application query with the SDKs application.getAll()
Change-type: patch Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
This commit is contained in:
parent
dc59b7e4b0
commit
d793335287
@ -331,7 +331,6 @@ Can be repeated to add multiple certificates.\
|
|||||||
readonly applicationExpandOptions: PineExpand<Application> = {
|
readonly applicationExpandOptions: PineExpand<Application> = {
|
||||||
owns__release: {
|
owns__release: {
|
||||||
$select: ['id', 'commit', 'end_timestamp', 'composition'],
|
$select: ['id', 'commit', 'end_timestamp', 'composition'],
|
||||||
$orderby: [{ end_timestamp: 'desc' }, { id: 'desc' }],
|
|
||||||
$expand: {
|
$expand: {
|
||||||
contains__image: {
|
contains__image: {
|
||||||
$select: ['image'],
|
$select: ['image'],
|
||||||
@ -345,6 +344,7 @@ Can be repeated to add multiple certificates.\
|
|||||||
$filter: {
|
$filter: {
|
||||||
status: 'success',
|
status: 'success',
|
||||||
},
|
},
|
||||||
|
$orderby: [{ end_timestamp: 'desc' }, { id: 'desc' }],
|
||||||
},
|
},
|
||||||
should_be_running__release: {
|
should_be_running__release: {
|
||||||
$select: 'commit',
|
$select: 'commit',
|
||||||
@ -378,44 +378,37 @@ Can be repeated to add multiple certificates.\
|
|||||||
const balena = getBalenaSdk();
|
const balena = getBalenaSdk();
|
||||||
|
|
||||||
const deviceTypes = await this.getDeviceTypesWithSameArch(deviceTypeSlug);
|
const deviceTypes = await this.getDeviceTypesWithSameArch(deviceTypeSlug);
|
||||||
// TODO: remove the explicit types once https://github.com/balena-io/balena-sdk/pull/889 gets merged
|
return (await balena.models.application.getAll({
|
||||||
return balena.pine.get<
|
$select: ['id', 'app_name', 'should_track_latest_release'],
|
||||||
Application,
|
$expand: this.applicationExpandOptions,
|
||||||
Array<
|
$filter: {
|
||||||
ApplicationWithDeviceType & {
|
is_for__device_type: {
|
||||||
should_be_running__release: [Release?];
|
$any: {
|
||||||
}
|
$alias: 'dt',
|
||||||
>
|
$expr: {
|
||||||
>({
|
dt: {
|
||||||
resource: 'my_application',
|
slug: { $in: deviceTypes },
|
||||||
options: {
|
},
|
||||||
$filter: {
|
},
|
||||||
is_for__device_type: {
|
},
|
||||||
$any: {
|
},
|
||||||
$alias: 'dt',
|
owns__release: {
|
||||||
$expr: {
|
$any: {
|
||||||
dt: {
|
$alias: 'r',
|
||||||
slug: { $in: deviceTypes },
|
$expr: {
|
||||||
},
|
r: {
|
||||||
},
|
status: 'success',
|
||||||
},
|
|
||||||
},
|
|
||||||
owns__release: {
|
|
||||||
$any: {
|
|
||||||
$alias: 'r',
|
|
||||||
$expr: {
|
|
||||||
r: {
|
|
||||||
status: 'success',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
$expand: this.applicationExpandOptions,
|
|
||||||
$select: ['id', 'app_name', 'should_track_latest_release'],
|
|
||||||
$orderby: 'app_name asc',
|
|
||||||
},
|
},
|
||||||
});
|
$orderby: 'app_name asc',
|
||||||
|
})) as Array<
|
||||||
|
ApplicationWithDeviceType & {
|
||||||
|
should_be_running__release: [Release?];
|
||||||
|
}
|
||||||
|
>;
|
||||||
}
|
}
|
||||||
|
|
||||||
async selectApplication(deviceTypeSlug: string) {
|
async selectApplication(deviceTypeSlug: string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user