mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-07 11:26:41 +00:00
fleet rm,restart,rename,purge: Stop fetching unnecessary app fields
Halves the amout of application data retrieved. Change-type: patch
This commit is contained in:
parent
bcadbdbed8
commit
9d8df0b781
@ -65,7 +65,9 @@ export default class FleetPurgeCmd extends Command {
|
||||
|
||||
// balena.models.application.purge only accepts a numeric id
|
||||
// so we must first fetch the app to get it's id,
|
||||
const application = await getApplication(balena, params.fleet);
|
||||
const application = await getApplication(balena, params.fleet, {
|
||||
$select: 'id',
|
||||
});
|
||||
|
||||
try {
|
||||
await balena.models.application.purge(application.id);
|
||||
|
@ -77,9 +77,10 @@ export default class FleetRenameCmd extends Command {
|
||||
// Disambiguate target application (if params.params is a number, it could either be an ID or a numerical name)
|
||||
const { getApplication } = await import('../../utils/sdk');
|
||||
const application = await getApplication(balena, params.fleet, {
|
||||
$select: ['id', 'app_name', 'slug'],
|
||||
$expand: {
|
||||
application_type: {
|
||||
$select: ['slug'],
|
||||
$select: 'slug',
|
||||
},
|
||||
},
|
||||
});
|
||||
@ -132,9 +133,9 @@ export default class FleetRenameCmd extends Command {
|
||||
}
|
||||
|
||||
// Get application again, to be sure of results
|
||||
const renamedApplication = await balena.models.application.get(
|
||||
application.id,
|
||||
);
|
||||
const renamedApplication = await getApplication(balena, application.id, {
|
||||
$select: ['app_name', 'slug'],
|
||||
});
|
||||
|
||||
// Output result
|
||||
console.log(`Fleet renamed`);
|
||||
|
@ -63,7 +63,9 @@ export default class FleetRestartCmd extends Command {
|
||||
const balena = getBalenaSdk();
|
||||
|
||||
// Disambiguate application
|
||||
const application = await getApplication(balena, params.fleet);
|
||||
const application = await getApplication(balena, params.fleet, {
|
||||
$select: 'slug',
|
||||
});
|
||||
|
||||
await balena.models.application.restart(application.slug);
|
||||
}
|
||||
|
@ -76,7 +76,9 @@ export default class FleetRmCmd extends Command {
|
||||
);
|
||||
|
||||
// Disambiguate application (if is a number, it could either be an ID or a numerical name)
|
||||
const application = await getApplication(balena, params.fleet);
|
||||
const application = await getApplication(balena, params.fleet, {
|
||||
$select: 'slug',
|
||||
});
|
||||
|
||||
// Remove
|
||||
await balena.models.application.remove(application.slug);
|
||||
|
Loading…
x
Reference in New Issue
Block a user