Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
cjlapao committed Jun 5, 2024
1 parent 6140abf commit 39f862a
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function activate(context: vscode.ExtensionContext) {
// Initializing the DevOps Remote Provider
const devopsRemoteProvider = new DevOpsRemoteHostsProvider(context);
vscode.commands.executeCommand(CommandsFlags.devopsRefreshRemoteHostProvider);
new DevOpsService(context)
new DevOpsService(context);
DevOpsService.startRemoteHostsViewAutoRefresh();

AllDevopsRemoteProviderManagementCommands.forEach(c => c.register(context, devopsRemoteProvider));
Expand Down
4 changes: 2 additions & 2 deletions src/models/devops/updateOrchestratorHostRequest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface UpdateOrchestratorHostRequest {
host?: string;
description?: string;
host?: string;
description?: string;
authentication?: UpdateOrchestratorHostRequestAuthentication;
}

Expand Down
50 changes: 25 additions & 25 deletions src/services/configurationService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { configurationInitialized } from "./../ioc/provider";
import { FeatureFlags } from "./../models/FeatureFlags";
import {configurationInitialized} from "./../ioc/provider";
import {FeatureFlags} from "./../models/FeatureFlags";
import * as vscode from "vscode";
import * as path from "path";
import * as fs from "fs";
Expand All @@ -15,27 +15,27 @@ import {
FLAG_PARALLELS_DESKTOP_EXISTS,
FLAG_VAGRANT_EXISTS
} from "../constants/flags";
import { getUserProfileFolder } from "../helpers/helpers";
import { Provider } from "../ioc/provider";
import { VirtualMachineGroup } from "../models/parallels/virtualMachineGroup";
import { ParallelsDesktopService } from "./parallelsDesktopService";
import { VirtualMachine } from "../models/parallels/virtualMachine";
import { HardwareInfo } from "../models/parallels/HardwareInfo";
import { HelperService } from "./helperService";
import { LogService } from "./logService";
import { ParallelsDesktopServerInfo } from "../models/parallels/ParallelsDesktopServerInfo";
import { Tools } from "../models/tools";
import { BrewService } from "./brewService";
import { GitService } from "./gitService";
import { PackerService } from "./packerService";
import { VagrantService } from "./vagrantService";
import { DockerRunItem } from "../models/docker/dockerRunItem";
import { DevOpsService } from "./devopsService";
import { DevOpsCatalogHostProvider } from "../models/devops/catalogHostProvider";
import { CatalogManifest, CatalogManifestItem } from "../models/devops/catalogManifest";
import { parseHost } from "../models/host";
import { DevOpsRemoteHostProvider } from "../models/devops/remoteHostProvider";
import { DevOpsRemoteHost } from "../models/devops/remoteHost";
import {getUserProfileFolder} from "../helpers/helpers";
import {Provider} from "../ioc/provider";
import {VirtualMachineGroup} from "../models/parallels/virtualMachineGroup";
import {ParallelsDesktopService} from "./parallelsDesktopService";
import {VirtualMachine} from "../models/parallels/virtualMachine";
import {HardwareInfo} from "../models/parallels/HardwareInfo";
import {HelperService} from "./helperService";
import {LogService} from "./logService";
import {ParallelsDesktopServerInfo} from "../models/parallels/ParallelsDesktopServerInfo";
import {Tools} from "../models/tools";
import {BrewService} from "./brewService";
import {GitService} from "./gitService";
import {PackerService} from "./packerService";
import {VagrantService} from "./vagrantService";
import {DockerRunItem} from "../models/docker/dockerRunItem";
import {DevOpsService} from "./devopsService";
import {DevOpsCatalogHostProvider} from "../models/devops/catalogHostProvider";
import {CatalogManifest, CatalogManifestItem} from "../models/devops/catalogManifest";
import {parseHost} from "../models/host";
import {DevOpsRemoteHostProvider} from "../models/devops/remoteHostProvider";
import {DevOpsRemoteHost} from "../models/devops/remoteHost";

export class ConfigurationService {
virtualMachinesGroups: VirtualMachineGroup[];
Expand Down Expand Up @@ -582,15 +582,15 @@ export class ConfigurationService {
this.catalogProviders[index].name = provider.name;
this.catalogProviders[index].username = provider.username;
this.catalogProviders[index].password = provider.password;
this.catalogProviders[index].authToken = '';
this.catalogProviders[index].authToken = "";
}
if (provider.class === "DevOpsRemoteHostProvider") {
const remoteProvider = foundProvider as DevOpsRemoteHostProvider;
const index = this.remoteHostProviders.indexOf(remoteProvider);
this.remoteHostProviders[index].name = provider.name;
this.remoteHostProviders[index].username = provider.username;
this.remoteHostProviders[index].password = provider.password;
this.remoteHostProviders[index].authToken = '';
this.remoteHostProviders[index].authToken = "";
}

this.save();
Expand Down
7 changes: 2 additions & 5 deletions src/services/devopsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import {AuthorizationRequest, AuthorizationToken} from "./../models/devops/autho
import {spawn} from "child_process";
import {Provider} from "../ioc/provider";
import {LogService} from "./logService";
import {
CommandsFlags,
FLAG_DEVOPS_PATH,
FLAG_DEVOPS_VERSION} from "../constants/flags";
import {CommandsFlags, FLAG_DEVOPS_PATH, FLAG_DEVOPS_VERSION} from "../constants/flags";
import {DevOpsCatalogHostProvider} from "../models/devops/catalogHostProvider";
import axios from "axios";
import {AuthorizationResponse} from "../models/devops/authorization";
Expand All @@ -32,7 +29,7 @@ import {
} from "../models/devops/rolesAndClaims";
import {HostHardwareInfo} from "../models/devops/hardwareInfo";
import {CreateCatalogMachine} from "../models/devops/createCatalogMachine";
import { UpdateOrchestratorHostRequest } from "../models/devops/updateOrchestratorHostRequest";
import {UpdateOrchestratorHostRequest} from "../models/devops/updateOrchestratorHostRequest";

const refreshThreshold = 5000;

Expand Down
2 changes: 1 addition & 1 deletion src/tree/commands/AllCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ import {DevOpsRemoveTagFromCatalogProviderManifestVersionCommand} from "./devops
import {DevOpsManagementProviderUpdateProviderCommand} from "./devopsManagementProvider/updateRemoteProvider";
import {DevOpsManagementProviderUpdateUserCommand} from "./devopsManagementProvider/updateRemoteProviderUser";
import {DevOpsPullCatalogManifestMachineOnHostCommand} from "./devopsRemoteHostProvider/pullCatalogManifestMachineOnHost";
import { DevOpsUpdateRemoteProviderOrchestratorHostCommand } from "./devopsRemoteHostProvider/updateRemoteProviderOrchestratorHost";
import {DevOpsUpdateRemoteProviderOrchestratorHostCommand} from "./devopsRemoteHostProvider/updateRemoteProviderOrchestratorHost";

export const AllVirtualMachineCommands: VirtualMachineCommand[] = [
AddVmCommand,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ const registerDevOpsPullCatalogProviderManifestCommand = (
version = manifest.items[0].version;
} else {
const versions: vscode.QuickPickItem[] = [];
for (const item of manifest.items.filter(item => item.architecture.toLowerCase() === architecture.toLowerCase() && !item.revoked && !item.tainted)) {
for (const item of manifest.items.filter(
item => item.architecture.toLowerCase() === architecture.toLowerCase() && !item.revoked && !item.tainted
)) {
versions.push({label: item.version, description: item.description});
}
versions.sort((a, b) => a.label.localeCompare(b.label));
Expand Down
35 changes: 19 additions & 16 deletions src/tree/commands/devopsManagementProvider/updateRemoteProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {DevOpsCatalogProvider} from "../../devopsCatalogProvider/devopsCatalogPr
import {DevOpsRemoteHostProvider} from "../../../models/devops/remoteHostProvider";
import {DevOpsCatalogHostProvider} from "../../../models/devops/catalogHostProvider";
import {YesNoQuestion, ANSWER_YES} from "../../../helpers/ConfirmDialog";
import { DevOpsService } from "../../../services/devopsService";
import {DevOpsService} from "../../../services/devopsService";

const registerDevOpsManagementProviderUpdateProviderCommand = (
context: vscode.ExtensionContext,
Expand All @@ -19,24 +19,24 @@ const registerDevOpsManagementProviderUpdateProviderCommand = (
return;
}

let providerType = '';
let providerType = "";
const config = Provider.getConfiguration();
const providerId = item.id.split("%%")[1];
let provider: DevOpsRemoteHostProvider | DevOpsCatalogHostProvider | undefined = undefined;
if (item.className === "DevOpsRemoteHostProvider") {
provider = config.findRemoteHostProviderById(providerId);
switch (provider?.type) {
case 'remote_host':
providerType = 'Remote Host';
case "remote_host":
providerType = "Remote Host";
break;
case 'orchestrator':
providerType = 'Orchestrator';
case "orchestrator":
providerType = "Orchestrator";
break;
}
}
if (item.className === "DevOpsCatalogHostProvider") {
provider = config.findCatalogProviderByIOrName(providerId);
providerType = 'Catalog';
providerType = "Catalog";
}
if (!provider) {
vscode.window.showErrorMessage(`Remote Host Provider User ${item.name} not found`);
Expand Down Expand Up @@ -64,7 +64,6 @@ const registerDevOpsManagementProviderUpdateProviderCommand = (
return;
}


switch (selectedOptions.label.toUpperCase()) {
case "NAME": {
const newName = await vscode.window.showInputBox({
Expand All @@ -78,7 +77,9 @@ const registerDevOpsManagementProviderUpdateProviderCommand = (
return;
}

const confirmation = await YesNoQuestion(`Are you sure you want to rename provider ${item.name} to ${newName}?`);
const confirmation = await YesNoQuestion(
`Are you sure you want to rename provider ${item.name} to ${newName}?`
);

if (confirmation !== ANSWER_YES) {
return;
Expand All @@ -102,7 +103,9 @@ const registerDevOpsManagementProviderUpdateProviderCommand = (
let retry = 3;
let foundError = false;

const confirmation = await YesNoQuestion(`Are you sure you want to update the credentials for provider ${item.name}?`);
const confirmation = await YesNoQuestion(
`Are you sure you want to update the credentials for provider ${item.name}?`
);

if (confirmation !== ANSWER_YES) {
return;
Expand All @@ -119,7 +122,7 @@ const registerDevOpsManagementProviderUpdateProviderCommand = (
vscode.window.showErrorMessage(`${providerType} Provider Name is required`);
return;
}

const password = await vscode.window.showInputBox({
prompt: `${providerType} Provider Password?`,
placeHolder: `Enter the ${providerType} Provider Password`,
Expand All @@ -131,10 +134,10 @@ const registerDevOpsManagementProviderUpdateProviderCommand = (
vscode.window.showErrorMessage(`${providerType} Provider Password is required`);
return;
}

provider.username = username;
provider.password = password;

const auth = await DevOpsService.authorize(provider).catch(error => {
foundError = true;
});
Expand All @@ -144,19 +147,19 @@ const registerDevOpsManagementProviderUpdateProviderCommand = (
if (!auth || !foundError) {
foundError = true;
}

if (retry === 0) {
break;
}
vscode.window.showErrorMessage(`Failed to connect to ${providerType} provider ${provider.host}`);

retry--;
}
if (foundError) {
vscode.window.showErrorMessage(`Failed to add ${providerType} Provider ${provider.host}`);
return;
}

const config = Provider.getConfiguration();
if (!config.updateRemoteProvider(provider)) {
vscode.window.showErrorMessage(`Failed to update ${providerType} Provider ${provider.host}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as vscode from "vscode";
import { Provider } from "../../../ioc/provider";
import { CommandsFlags } from "../../../constants/flags";
import { DevOpsRemoteHostsCommand } from "../BaseCommand";
import { DevOpsService } from "../../../services/devopsService";
import { DevOpsRemoteHostsProvider } from "../../devopsRemoteHostProvider/devOpsRemoteHostProvider";
import { UpdateOrchestratorHostRequest } from "../../../models/devops/updateOrchestratorHostRequest";
import {Provider} from "../../../ioc/provider";
import {CommandsFlags} from "../../../constants/flags";
import {DevOpsRemoteHostsCommand} from "../BaseCommand";
import {DevOpsService} from "../../../services/devopsService";
import {DevOpsRemoteHostsProvider} from "../../devopsRemoteHostProvider/devOpsRemoteHostProvider";
import {UpdateOrchestratorHostRequest} from "../../../models/devops/updateOrchestratorHostRequest";

const registerDevOpsUpdateRemoteProviderOrchestratorHostCommand = (
context: vscode.ExtensionContext,
Expand Down Expand Up @@ -116,9 +116,7 @@ const registerDevOpsUpdateRemoteProviderOrchestratorHostCommand = (
return;
}

vscode.window.showInformationMessage(
`Remote Host was updated successfully in the Orchestrator ${provider.name}`
);
vscode.window.showInformationMessage(`Remote Host was updated successfully in the Orchestrator ${provider.name}`);
await DevOpsService.refreshRemoteHostProviders(true);
vscode.commands.executeCommand(CommandsFlags.devopsRefreshRemoteHostProvider);
})
Expand Down
2 changes: 1 addition & 1 deletion src/tree/commands/virtualMachines/copyIpAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const registerCopyIpAddressCommand = (context: vscode.ExtensionContext, provider
if (!item) {
return;
}

if (item.configuredIpAddress !== undefined && item.configuredIpAddress !== "-") {
vscode.window.showInformationMessage(`Copied ${item.configuredIpAddress} to clipboard`);
return;
Expand Down

0 comments on commit 39f862a

Please sign in to comment.