Skip to content

Commit

Permalink
FAKE COMMIT
Browse files Browse the repository at this point in the history
Signed-off-by: Billie Simmons <[email protected]>
  • Loading branch information
JillieBeanSim committed Sep 29, 2023
1 parent dd23341 commit 493be61
Show file tree
Hide file tree
Showing 17 changed files with 174 additions and 110 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"packages/zowe-explorer/webviews/*"
],
"engines": {
"vscode": "^1.79.0"
"vscode": "^1.63.0"
},
"dependencies": {
"@zowe/cli": "7.18.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/zowe-explorer-ftp-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"package": "vsce package --yarn && node ../../scripts/mv-pack.js zowe-explorer-ftp-extension vsix"
},
"engines": {
"vscode": "^1.79.0"
"vscode": "^1.63.0"
},
"dependencies": {
"@zowe/zos-ftp-for-zowe-cli": "2.1.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import * as sharedExtension from "../../../src/shared/init";
import { initDatasetProvider } from "../../../src/dataset/init";
import { Profiles } from "../../../src/Profiles";
import { IJestIt, ITestContext, processSubscriptions, spyOnSubscriptions } from "../../__common__/testUtils";
import { ZoweLogger } from "../../../src/utils/LoggerUtils";

describe("Test src/dataset/extension", () => {
describe("initDatasetProvider", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ describe("ZoweUSSNode Unit Tests - Function node.openUSS()", () => {
await node.openUSS(false, true, blockMocks.testUSSTree);
expect(globalMocks.existsSync.mock.calls.length).toBe(1);
expect(globalMocks.existsSync.mock.calls[0][0]).toBe(path.join(globals.USS_DIR, node.mProfileName || "", node.fullPath));
expect(globalMocks.setStatusBarMessage).toBeCalledWith("$(sync~spin) Opening USS file...");
expect(globalMocks.setStatusBarMessage).toBeCalledWith("$(sync~spin) Downloading USS file...");

// Tests that correct file is opened in editor
globalMocks.withProgress(globalMocks.downloadUSSFile);
Expand Down Expand Up @@ -1123,7 +1123,7 @@ describe("ZoweUSSNode Unit Tests - Function node.openUSS()", () => {
await node.openUSS(false, true, blockMocks.testUSSTree);
expect(globalMocks.existsSync.mock.calls.length).toBe(1);
expect(globalMocks.existsSync.mock.calls[0][0]).toBe(path.join(globals.USS_DIR, node.mProfileName || "", node.fullPath));
expect(globalMocks.setStatusBarMessage).toBeCalledWith("$(sync~spin) Opening USS file...");
expect(globalMocks.setStatusBarMessage).toBeCalledWith("$(sync~spin) Downloading USS file...");
// Tests that correct file is opened in editor
globalMocks.withProgress(globalMocks.downloadUSSFile);
expect(globalMocks.withProgress).toBeCalledWith(globalMocks.downloadUSSFile);
Expand Down Expand Up @@ -1275,7 +1275,7 @@ describe("ZoweUSSNode Unit Tests - Function node.openUSS()", () => {
await node.openUSS(false, true, blockMocks.testUSSTree);
expect(globalMocks.existsSync.mock.calls.length).toBe(1);
expect(globalMocks.existsSync.mock.calls[0][0]).toBe(path.join(globals.USS_DIR, node.getProfileName() || "", node.fullPath));
expect(globalMocks.setStatusBarMessage).toBeCalledWith("$(sync~spin) Opening USS file...");
expect(globalMocks.setStatusBarMessage).toBeCalledWith("$(sync~spin) Downloading USS file...");
// Make sure correct file is displayed in the editor
globalMocks.withProgress(globalMocks.downloadUSSFile);
expect(globalMocks.openTextDocument.mock.calls.length).toBe(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"createMember.creating": "Creating new data set member {0}",
"createMember.error": "Unable to create member.",
"dataSet.opening": "$(sync~spin) Opening data set...",
"openPS.error": "Invalid data set or member.",
"dsActions.downloadPS.downloading.log": "Downloading {0}",
"dsActions.downloadPS.downloading.message": "$(sync~spin) Downloading data set...",
"invalidDsMemberError.error": "Invalid data set or member.",
"createFile.allocatingNewDataSet": "Attempting to allocate new data set",
"handleUserSelection.qp.prompt": "Click on parameters to change them",
"createFile.inputBox.placeHolder": "Name of Data Set",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
"deleteUssPrompt.deleteCancelled": "Delete action was cancelled.",
"deleteUSSNode.error.node": "Unable to delete node: ",
"deleteUssNode.itemDeleted": "The item {0} has been deleted.",
"openUSS.error.invalidNode": "open() called from invalid node.",
"openUSS.name.exists": "There is already a file with the same name. Please change your OS file system settings if you want to give case sensitive file names",
"ussFile.opening": "$(sync~spin) Opening USS file...",
"refreshUSS.error.invalidNode": "refreshUSS() called from invalid node.",
"refreshUSS.error.notFound": "not found",
"refreshUSS.file1": "Unable to find file: ",
Expand Down
3 changes: 3 additions & 0 deletions packages/zowe-explorer/i18n/sample/src/uss/actions.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"createUSSNode.name": "Name of file or directory",
"createUSSNode.name.exists": "There is already a file with the same name. Please change your OS file system settings if you want to give case sensitive file names.",
"createUSSNode.error.create": "Unable to create node:",
"downloadUnixFile.invalidNode.error": "open() called from invalid node.",
"downloadUnixFile.name.exists": "There is already a file with the same name. Please change your OS file system settings if you want to give case sensitive file names",
"downloadUnixFile.downloading": "$(sync~spin) Downloading USS file...",
"uploadFile.putContents": "Uploading USS file",
"copyPath.infoMessage": "Copy Path is not yet supported in Theia.",
"saveUSSFile.log.debug.saveRequest": "save requested for USS file ",
Expand Down
2 changes: 1 addition & 1 deletion packages/zowe-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1995,7 +1995,7 @@
"createDemoNodes": "ts-node ./scripts/createDemoNodes.ts"
},
"engines": {
"vscode": "^1.79.0"
"vscode": "^1.63.0"
},
"devDependencies": {
"@napi-rs/cli": "^2.16.1",
Expand Down
1 change: 0 additions & 1 deletion packages/zowe-explorer/src/dataset/DatasetTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ export class DatasetTree extends ZoweTreeProvider implements IZoweTree<IZoweData
* @param log
*/
public initializeFavorites(): void {
ZoweLogger.trace("DatasetTree.initializeFavorites called.");
ZoweLogger.debug(localize("initializeFavorites.log.debug", "Initializing profiles with data set favorites."));
const lines: string[] = this.mHistory.readFavorites();
if (lines.length === 0) {
Expand Down
41 changes: 23 additions & 18 deletions packages/zowe-explorer/src/dataset/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
JOB_SUBMIT_DIALOG_OPTS,
getDefaultUri,
compareSavedFileContent,
localFileInfo,
} from "../shared/utils";
import { ZoweExplorerApiRegister } from "../ZoweExplorerApiRegister";
import { Profiles } from "../Profiles";
Expand Down Expand Up @@ -475,11 +476,11 @@ export async function openPS(
if (Profiles.getInstance().validProfile !== api.ValidProfileEnum.INVALID) {
const statusMsg = api.Gui.setStatusBarMessage(localize("dataSet.opening", "$(sync~spin) Opening data set..."));
try {
const { documentLabel } = await prepareDownloadPS(node);
const document = await vscode.workspace.openTextDocument(getDsDocumentFilePath(documentLabel, node));
const fileInfo = await downloadPS(node);
const document = await vscode.workspace.openTextDocument(getDsDocumentFilePath(fileInfo.name, node));
await api.Gui.showTextDocument(document, { preview: shouldPreview });
if (datasetProvider) {
datasetProvider.addFileHistory(`[${node.getProfileName()}]: ${documentLabel}`);
datasetProvider.addFileHistory(`[${node.getProfileName()}]: ${fileInfo.name}`);
}
} catch (err) {
statusMsg.dispose();
Expand All @@ -489,38 +490,36 @@ export async function openPS(
}
}

export async function prepareDownloadPS(node: api.IZoweDatasetTreeNode): Promise<{ documentLabel: string; documentFilePath: string }> {
let documentLabel: string;
const defaultMessage = localize("openPS.error", "Invalid data set or member.");
export async function downloadPS(node: api.IZoweDatasetTreeNode): Promise<localFileInfo> {
const fileInfo = {} as localFileInfo;
switch (true) {
// For favorited or non-favorited sequential DS:
case contextually.isFavorite(node):
case contextually.isSessionNotFav(node.getParent()):
documentLabel = node.label as string;
fileInfo.name = String(node.label);
break;
// For favorited or non-favorited data set members:
case contextually.isFavoritePds(node.getParent()):
case contextually.isPdsNotFav(node.getParent()):
documentLabel = String(node.getParent().getLabel()) + "(" + String(node.getLabel()) + ")";
fileInfo.name = `${String(node.getParent().getLabel())}(${String(node.getLabel())})`;
break;
default:
api.Gui.errorMessage(defaultMessage);
throw Error(defaultMessage);
invalidDsMemberError();
}
// if local copy exists, open that instead of pulling from mainframe
const documentFilePath = getDsDocumentFilePath(documentLabel, node);
if (!fs.existsSync(documentFilePath)) {
await downloadPS(node, documentFilePath, documentLabel);
fileInfo.path = getDsDocumentFilePath(fileInfo.name, node);
if (!fs.existsSync(fileInfo.path)) {
await downloadPsApiCall(node, fileInfo);
}
return { documentLabel, documentFilePath };
return fileInfo;
}

async function downloadPS(node: api.IZoweDatasetTreeNode, documentFilePath: string, label: string): Promise<void> {
async function downloadPsApiCall(node: api.IZoweDatasetTreeNode, fileInfo: localFileInfo): Promise<void> {
const prof = node.getProfile();
ZoweLogger.info(localize("dsActions.downloadPS.downloading.log", "Downloading {0}", label));
ZoweLogger.info(localize("dsActions.downloadPS.downloading.log", "Downloading {0}", fileInfo.name));
const statusMsg = api.Gui.setStatusBarMessage(localize("dsActions.downloadPS.downloading.message", "$(sync~spin) Downloading data set..."));
const response = await ZoweExplorerApiRegister.getMvsApi(prof).getContents(label, {
file: documentFilePath,
const response = await ZoweExplorerApiRegister.getMvsApi(prof).getContents(fileInfo.name, {
file: fileInfo.path,
returnEtag: true,
encoding: prof.profile?.encoding,
responseTimeout: prof.profile?.responseTimeout,
Expand All @@ -529,6 +528,12 @@ async function downloadPS(node: api.IZoweDatasetTreeNode, documentFilePath: stri
statusMsg.dispose();
}

function invalidDsMemberError(): void {
const defaultMessage = localize("invalidDsMemberError.error", "Invalid data set or member.");
api.Gui.errorMessage(defaultMessage);
throw Error(defaultMessage);
}

export function getDataSetTypeAndOptions(type: string): {
typeEnum: zowe.CreateDataSetTypeEnum;
createOptions: vscode.WorkspaceConfiguration;
Expand Down
2 changes: 1 addition & 1 deletion packages/zowe-explorer/src/dataset/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { ZoweLogger } from "../utils/LoggerUtils";
import { TreeViewUtils } from "../utils/TreeViewUtils";

export async function initDatasetProvider(context: vscode.ExtensionContext): Promise<IZoweTree<IZoweDatasetTreeNode>> {
ZoweLogger.trace("dataset.init.initDatasetProvider called.");
ZoweLogger.trace("Initializing the Data set provider.");
const datasetProvider: IZoweTree<IZoweDatasetTreeNode> = await createDatasetTree();
if (datasetProvider == null) {
return null;
Expand Down
3 changes: 1 addition & 2 deletions packages/zowe-explorer/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ export async function activate(context: vscode.ExtensionContext): Promise<ZoweEx
};

registerCommonCommands(context, providers);
globals.initializeFilesToCompare();
ZoweExplorerExtender.createInstance(providers.ds, providers.uss, providers.job);
await SettingsConfig.standardizeSettings();
await watchConfigProfile(context, providers);
watchConfigProfile(context, providers);
globals.setActivated(true);
return ZoweExplorerApiRegister.getInstance();
}
Expand Down
7 changes: 6 additions & 1 deletion packages/zowe-explorer/src/generators/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ export enum IconHierarchyType {
"derived" = "derived",
}

export type IconPathByTheme = {
light: string;
dark: string;
};

type TreeNode = TreeItem | ZoweTreeNode;

export interface IIconItem {
id: IconId;
type: IconHierarchyType;
path: { light: string; dark: string };
path: IconPathByTheme;
check: (node: TreeNode) => boolean;
}

Expand Down
1 change: 1 addition & 0 deletions packages/zowe-explorer/src/shared/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ export function registerCommonCommands(context: vscode.ExtensionContext, provide
return globals.FILE_SELECTED_TO_COMPARE;
})
);
globals.initializeFilesToCompare();
}
}

Expand Down
48 changes: 27 additions & 21 deletions packages/zowe-explorer/src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ import { IZosFilesResponse, imperative, IUploadOptions } from "@zowe/cli";
import { ZoweLogger } from "../utils/LoggerUtils";
import { isTypeUssTreeNode } from "./context";
import { markDocumentUnsaved } from "../utils/workspace";
import { prepareDownloadPS } from "../dataset/actions";
// import { downloadUnixFile, getUSSDocumentFilePath } from "../uss/actions";
// import { Spool } from "../job/ZoweJobNode";
// import SpoolProvider, { encodeJobFile } from "../SpoolProvider";
import { downloadPS } from "../dataset/actions";

import * as nls from "vscode-nls";
import { downloadUnixFile } from "../uss/actions";
import { IconPathByTheme } from "../generators/icons";

// Set up localization
nls.config({
Expand All @@ -47,6 +46,10 @@ export const JOB_SUBMIT_DIALOG_OPTS = [
localize("zowe.jobs.confirmSubmission.otherUserJobs", "Other user jobs"),
localize("zowe.jobs.confirmSubmission.allJobs", "All jobs"),
];
export type localFileInfo = {
name: string;
path: string;
};

export function filterTreeByString(value: string, treeItems: vscode.QuickPickItem[]): vscode.QuickPickItem[] {
ZoweLogger.trace("shared.utils.filterTreeByString called.");
Expand All @@ -66,14 +69,11 @@ export function filterTreeByString(value: string, treeItems: vscode.QuickPickIte
* @param iconFileName {string} Name of icon file with extension
* @returns {object}
*/
export function getIconPathInResources(iconFileName: string): {
light: string;
dark: string;
} {
return {
light: path.join(globals.ROOTPATH, "resources", "light", iconFileName),
dark: path.join(globals.ROOTPATH, "resources", "dark", iconFileName),
};
export function getIconPathInResources(iconFileName: string): IconPathByTheme {
const iconPaths = {} as IconPathByTheme;
iconPaths.light = path.join(globals.ROOTPATH, "resources", "light", iconFileName);
iconPaths.dark = path.join(globals.ROOTPATH, "resources", "dark", iconFileName);
return iconPaths;
}

/*************************************************************************************************************
Expand Down Expand Up @@ -397,9 +397,16 @@ export async function compareSavedFileContent(
*/
export async function compareChosenFileContent(): Promise<void> {
const docUriArray: vscode.Uri[] = [];
for (const node of globals.filesToCompare) {
const filepath = await getCompareFilePaths(node);
docUriArray.push(vscode.Uri.file(filepath));
let compareArray: IZoweTreeNode[];
if (globals.filesToCompare.length > 2) {
compareArray = globals.filesToCompare.slice(Math.max(globals.filesToCompare.length - 2, 0));
} else {
compareArray = globals.filesToCompare;
}
console.log(compareArray);

Check failure on line 406 in packages/zowe-explorer/src/shared/utils.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
for (const node of compareArray) {
const fileInfo = await getCompareFilePaths(node);
docUriArray.push(vscode.Uri.file(fileInfo.path));
}
vscode.commands.executeCommand("vscode.diff", docUriArray[0], docUriArray[1]);
compareFileCleanup();
Expand All @@ -411,19 +418,18 @@ export function compareFileCleanup(): void {
globals.setCompareSelectionFalse();
}

async function getCompareFilePaths(node: IZoweTreeNode): Promise<string> {
async function getCompareFilePaths(node: IZoweTreeNode): Promise<localFileInfo> {
ZoweLogger.info(`Getting files ${String(globals.filesToCompare[0].label)} and ${String(globals.filesToCompare[1].label)} for comparison.`);
let fileInfo: localFileInfo;
if (isZoweDatasetTreeNode(node)) {
const { documentFilePath } = await prepareDownloadPS(node);
return documentFilePath;
return downloadPS(node);
}
if (isZoweUSSTreeNode(node)) {
// do something with uss tree node
// documentFilePath = getUSSDocumentFilePath(node);
// if (!fs.existsSync(documentFilePath)) {
// await downloadUnixFile(node, documentFilePath);
return downloadUnixFile(node, true);
// }
return "";
}

// do something with job spool tree node
Expand All @@ -434,5 +440,5 @@ async function getCompareFilePaths(node: IZoweTreeNode): Promise<string> {
// // Fetch any changes to the spool file if it exists in the SpoolProvider
// await spoolFile.fetchContent();
// }
return "";
return fileInfo;
}
Loading

0 comments on commit 493be61

Please sign in to comment.