From b6da31dfd063dbbcc7dc3241ca356d8d254b3fed Mon Sep 17 00:00:00 2001 From: Chinmay Das <55234150+chinmdas@users.noreply.github.com> Date: Thu, 12 Dec 2024 23:10:00 +0530 Subject: [PATCH] Initializing new Team Configuration File Initializing new Team Configuration File and remove the obsolete web page, Signed-off-by: Chinmay Das <55234150+chinmdas@users.noreply.github.com> --- packages/vsce/src/trees/CICSTree.ts | 37 +++-------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/packages/vsce/src/trees/CICSTree.ts b/packages/vsce/src/trees/CICSTree.ts index 58cb5392..6c3955f5 100644 --- a/packages/vsce/src/trees/CICSTree.ts +++ b/packages/vsce/src/trees/CICSTree.ts @@ -85,18 +85,11 @@ export class CICSTree implements TreeDataProvider { const configInstance = await ProfileManagement.getConfigInstance(); const allCICSProfiles = (await ProfileManagement.getProfilesCache().getProfileInfo()).getAllProfiles("cics"); // const allCICSProfiles = await ProfileManagement.getProfilesCache().getProfiles('cics'); - if (!allCICSProfiles) { - if (!configInstance.getTeamConfig().exists) { - window.showErrorMessage(`Could not find any CICS profiles`); - return; - } - window.showInformationMessage(`Could not find any CICS profiles`); - } const allCICSProfileNames: string[] = allCICSProfiles ? (allCICSProfiles.map((profile) => profile.profName) as unknown as [string]) : []; // No cics profiles needed beforhand for team config method if (configInstance.getTeamConfig().exists || allCICSProfileNames.length > 0) { const profileNameToLoad = await window.showQuickPick( - [{ label: "\uFF0B Create New CICS Profile..." }].concat( + [{ label: "\uFF0B Edit CICS Profile..." }].concat( allCICSProfileNames .filter((name) => { for (const loadedProfile of this.loadedProfiles) { @@ -118,7 +111,6 @@ export class CICSTree implements TreeDataProvider { if (profileNameToLoad) { // If Create New CICS Profile option chosen if (profileNameToLoad.label.includes("\uFF0B")) { - if (configInstance.getTeamConfig().exists) { // get all profiles of all types including zosmf const profiles = configInstance.getAllProfiles(); if (!profiles.length) { @@ -127,9 +119,6 @@ export class CICSTree implements TreeDataProvider { const currentProfile = await ProfileManagement.getProfilesCache().getProfileFromConfig(profiles[0].profName); const filePath = currentProfile?.profLoc.osLoc?.[0] ?? ""; await openConfigFile(filePath); - } else { - await this.createNewProfile(); - } } else { let profileToLoad; // TODO: Just use loadNamedProfile once the method is configured to v2 profiles @@ -491,28 +480,8 @@ export class CICSTree implements TreeDataProvider { window.showErrorMessage(error); } } else { - const column = window.activeTextEditor ? window.activeTextEditor.viewColumn : undefined; - const panel: WebviewPanel = window.createWebviewPanel("zowe", `Create CICS Profile`, column || 1, { enableScripts: true }); - panel.webview.html = addProfileHtml(); - panel.webview.onDidReceiveMessage(async (message) => { - try { - panel.dispose(); - const allCICSProfileNames = (await ProfileManagement.getProfilesCache().getProfileInfo()) - .getAllProfiles("cics") - .map((profile) => profile.profName); //await ProfileManagement.getProfilesCache().getNamesForType('cics'); - if (allCICSProfileNames.includes(message.name)) { - window.showErrorMessage(`Profile "${message.name}" already exists`); - return; - } - await ProfileManagement.createNewProfile(message); - await ProfileManagement.profilesCacheRefresh(); - await this.loadProfile(ProfileManagement.getProfilesCache().loadNamedProfile(message.name, "cics")); - } catch (error) { - console.log(error); - // @ts-ignore - window.showErrorMessage(error); - } - }); + // Initialize new team configuration file + commands.executeCommand("zowe.all.config.init"); } }