mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 05:37:51 +00:00
Code formatting
Signed-off-by: Thodoris Greasidis <thodoris@balena.io>
This commit is contained in:
parent
79f33c749b
commit
c2df87bcc6
@ -59,9 +59,10 @@ export function generateBaseConfig(
|
||||
appUpdatePollInterval: options.appUpdatePollInterval || 10,
|
||||
};
|
||||
|
||||
const promise = resin.models.os.getConfig(application.app_name, options) as Promise<
|
||||
ImgConfig & { apiKey?: string; }
|
||||
>;
|
||||
const promise = resin.models.os.getConfig(
|
||||
application.app_name,
|
||||
options,
|
||||
) as Promise<ImgConfig & { apiKey?: string }>;
|
||||
return promise.tap(config => {
|
||||
// os.getConfig always returns a config for an app
|
||||
delete config.apiKey;
|
||||
|
@ -99,7 +99,7 @@ export function askLoginType() {
|
||||
|
||||
export function selectDeviceType() {
|
||||
return resin.models.config.getDeviceTypes().then(deviceTypes => {
|
||||
deviceTypes = _.sortBy(deviceTypes, 'name')
|
||||
deviceTypes = _.sortBy(deviceTypes, 'name');
|
||||
return form.ask({
|
||||
message: 'Device Type',
|
||||
type: 'list',
|
||||
|
@ -173,8 +173,10 @@ async function getOrSelectLocalDevice(deviceIp?: string): Promise<string> {
|
||||
return ip;
|
||||
}
|
||||
|
||||
async function getApplicationsWithOptionalUsers(sdk: ResinSdk.ResinSDK,
|
||||
options: ResinSdk.PineOptionsFor<ResinSdk.Application>) {
|
||||
async function getApplicationsWithOptionalUsers(
|
||||
sdk: ResinSdk.ResinSDK,
|
||||
options: ResinSdk.PineOptionsFor<ResinSdk.Application>,
|
||||
) {
|
||||
const _ = await import('lodash');
|
||||
|
||||
let applications = await sdk.models.application.getAll(options);
|
||||
@ -182,7 +184,7 @@ async function getApplicationsWithOptionalUsers(sdk: ResinSdk.ResinSDK,
|
||||
// user has access to a collab app with the same name as a personal app.
|
||||
if (applications.length !== _.uniqBy(applications, 'app_name').length) {
|
||||
options = _.merge(_.cloneDeep(options), {
|
||||
$expand: { user: { $select: ['username'] } }
|
||||
$expand: { user: { $select: ['username'] } },
|
||||
});
|
||||
applications = await sdk.models.application.getAll(options);
|
||||
}
|
||||
@ -190,7 +192,6 @@ async function getApplicationsWithOptionalUsers(sdk: ResinSdk.ResinSDK,
|
||||
return applications;
|
||||
}
|
||||
|
||||
|
||||
async function selectAppFromList(applications: ResinSdk.Application[]) {
|
||||
const _ = await import('lodash');
|
||||
const { selectFromList } = await import('../utils/patterns');
|
||||
@ -199,10 +200,13 @@ async function selectAppFromList(applications: ResinSdk.Application[]) {
|
||||
// user has access to a collab app with the same name as a personal app. We
|
||||
// present a list to the user which shows the fully qualified application
|
||||
// name (user/appname) and allows them to select.
|
||||
const hasSameNameApps = applications.length !== _.uniqBy(applications, 'app_name').length
|
||||
const hasSameNameApps =
|
||||
applications.length !== _.uniqBy(applications, 'app_name').length;
|
||||
|
||||
return selectFromList(
|
||||
hasSameNameApps ? 'Found multiple applications with that name; please select the one to use' : 'Select application',
|
||||
hasSameNameApps
|
||||
? 'Found multiple applications with that name; please select the one to use'
|
||||
: 'Select application',
|
||||
_.map(applications, app => {
|
||||
let name = app.app_name;
|
||||
if (hasSameNameApps) {
|
||||
@ -288,7 +292,8 @@ async function getOrSelectApplication(
|
||||
default: true,
|
||||
});
|
||||
if (shouldCreateApp) {
|
||||
return createApplication(sdk, deviceType, options.$filter.app_name as string);
|
||||
return createApplication(sdk, deviceType, options.$filter
|
||||
.app_name as string);
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
@ -300,7 +305,7 @@ async function getOrSelectApplication(
|
||||
);
|
||||
|
||||
if (validApplications.length === 0) {
|
||||
throw new Error('No application found with a matching device type')
|
||||
throw new Error('No application found with a matching device type');
|
||||
}
|
||||
|
||||
if (validApplications.length === 1) {
|
||||
|
Loading…
Reference in New Issue
Block a user