Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #734: Context menu & menu bar edits #957

Merged
merged 38 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
4dae960
:)
katelynienaber Jul 24, 2020
1a09bbe
- Added back Create File & Create Folder options to the context menu …
katelynienaber Jul 29, 2020
37cb321
Removing function createUSSNodeDialog because button is removed from …
katelynienaber Jul 30, 2020
6b8b6a8
Fixing dependency errors
katelynienaber Aug 3, 2020
184aa4f
Fixing package issues (?)
katelynienaber Aug 17, 2020
7b1eb5d
Changing text on context menu items according to Jelly's comment
katelynienaber Sep 1, 2020
1edeee5
Edited Copy too
katelynienaber Sep 1, 2020
70d51a5
Added test according to jelly's comment
katelynienaber Sep 4, 2020
78449a4
screwed up merge
katelynienaber Sep 9, 2020
ad37cb1
Fixes according to comments
katelynienaber Sep 29, 2020
910de59
Fixes according to comments
katelynienaber Sep 29, 2020
42b7fb2
Fixing stuff & merging after monorepo changes
katelynienaber Nov 10, 2020
685fe2e
Fixes for test YAML file and according to John's UI comment
katelynienaber Nov 11, 2020
cf0de76
More small fixes, see comment
katelynienaber Nov 11, 2020
e24af0b
Fix theia
katelynienaber Nov 19, 2020
2dd38a8
fix merge conflicts
zFernand0 Nov 19, 2020
7b92406
Adding more changes according to meeting Thursday/comments on issue #…
katelynienaber Nov 20, 2020
6db0336
Merge remote-tracking branch 'origin/master' into move-commands-to-co…
katelynienaber Dec 8, 2020
155eb25
Fixes according to Lauren's comments
katelynienaber Dec 8, 2020
db6a312
Merge branch 'master' into move-commands-to-context-menu
katelynienaber Dec 9, 2020
52aba42
Making changes according to call with John
katelynienaber Dec 10, 2020
fa339d7
Merge branch 'master' into move-commands-to-context-menu
katelynienaber Dec 10, 2020
25c65ac
Merge branch 'master' into move-commands-to-context-menu
katelynienaber Dec 11, 2020
8d9ebcd
Merge branch 'master' into move-commands-to-context-menu
katelynienaber Dec 11, 2020
f731351
Merge branch 'master' into move-commands-to-context-menu
katelynienaber Jan 4, 2021
90c90b5
Merge branch 'master' into move-commands-to-context-menu
katelynienaber Jan 12, 2021
ce2111a
Lauren fixes
katelynienaber Jan 14, 2021
7ffb1e9
fixing tests
katelynienaber Jan 14, 2021
ca2a34c
Merge branch 'master' into move-commands-to-context-menu
katelynienaber Jan 14, 2021
02c1d02
Merge branch 'master' into move-commands-to-context-menu
katelynienaber Jan 15, 2021
cf9fcae
fix tests
katelynienaber Jan 15, 2021
aa61b8a
Fixes according to Lauren's comments
katelynienaber Jan 19, 2021
829ae59
Added back the Remove search from favorites
katelynienaber Jan 21, 2021
74b399c
Fixed weird dropdown issue
katelynienaber Jan 22, 2021
8cf644c
Fixes for Lauren's comments
katelynienaber Jan 25, 2021
7fdec55
Fixes
katelynienaber Jan 25, 2021
d017277
Last fix for context menus?
katelynienaber Jan 26, 2021
7a55ec6
remove validate button from wrong menu
katelynienaber Jan 26, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/zowe-explorer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ Review the following use cases to understand how to work with data sets in Zowe
1. Navigate to the explorer tree.
2. Open the **DATA SETS** bar.
3. Select a member you want to copy.
4. Right-click the member and select the **Copy Data Set** option.
5. Right-click the data set where the member belongs and select the **Paste Data Set** option.
4. Right-click the member and select the **Copy Member** option.
5. Right-click the data set where the member belongs and select the **Paste Member** option.
6. Enter the name of the copied member.

![Copy Data Set](../../docs/images/ZE-copy.gif?raw=true "Copy Data Set")
Expand Down
6 changes: 4 additions & 2 deletions packages/zowe-explorer/__mocks__/mockCreators/uss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ export function createUSSNode(session, profile) {
false,
profile.name
);
ussNode.contextValue = globals.USS_SESSION_CONTEXT;
ussNode.fullPath = "/u/myuser";
mParent.contextValue = globals.USS_SESSION_CONTEXT;
ussNode.contextValue = globals.USS_DIR_CONTEXT;
mParent.fullPath = "/u/myuser";
ussNode.fullPath = "/u/myuser/usstest";
return ussNode;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ describe("Extension Integration Tests", () => {
);

await dsActions.copyDataSet(fromNode);
await dsActions.pasteDataSet(toNode, testTree);
await dsActions.pasteMember(toNode, testTree);

contents = await zowe.Get.dataSet(sessionNode.getSession(), fromDataSetName);
} catch (err) {
Expand Down Expand Up @@ -602,7 +602,7 @@ describe("Extension Integration Tests", () => {
inputBoxStub.returns(toMemberName);

await dsActions.copyDataSet(fromNode);
await dsActions.pasteDataSet(parentNode, testTree);
await dsActions.pasteMember(parentNode, testTree);

contents = await zowe.Get.dataSet(sessionNode.getSession(), `${dataSetName}(${toMemberName})`);
} catch (err) {
Expand Down Expand Up @@ -674,7 +674,7 @@ describe("Extension Integration Tests", () => {
inputBoxStub.returns(toMemberName);

await dsActions.copyDataSet(fromNode);
await dsActions.pasteDataSet(toNode, testTree);
await dsActions.pasteMember(toNode, testTree);

contents = await zowe.Get.dataSet(
sessionNode.getSession(),
Expand Down Expand Up @@ -753,7 +753,7 @@ describe("Extension Integration Tests", () => {
toNode.contextValue = DS_DS_CONTEXT;

await dsActions.copyDataSet(fromMemberNode);
await dsActions.pasteDataSet(toNode, testTree);
await dsActions.pasteMember(toNode, testTree);

contents = await zowe.Get.dataSet(sessionNode.getSession(), toDataSetName);
} catch (err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import * as vscode from "vscode";
import * as zowe from "@zowe/cli";
import * as imperative from "@zowe/imperative";
import { ValidProfileEnum } from "@zowe/zowe-explorer-api";
import {
createBasicZosmfSession,
Expand Down Expand Up @@ -808,7 +809,7 @@ describe("Dataset Actions Unit Tests - Function enterPattern", () => {
await dsActions.enterPattern(node, blockMocks.testDatasetTree);

expect(mocked(vscode.window.showInputBox)).toBeCalledWith({
prompt: "Search data sets by entering patterns: use a comma to separate multiple patterns",
prompt: "Search Data Sets: use a comma to separate multiple patterns",
value: node.pattern,
});
expect(mocked(vscode.window.showInformationMessage)).not.toBeCalled();
Expand Down Expand Up @@ -1617,12 +1618,7 @@ describe("Dataset Actions Unit Tests - Function copyDataSet", () => {

await dsActions.copyDataSet(node);

expect(clipboard.readText()).toBe(
JSON.stringify({
profileName: "sestest",
dataSetName: "HLQ.TEST.DELETE.NODE",
})
);
expect(clipboard.readText()).toBe('{"profileName":"sestest","dataSetName":"HLQ.TEST.DELETE.NODE"}');
});
it("Checking copy the label of a favorite node to the clipboard", async () => {
globals.defineGlobals("");
Expand All @@ -1638,12 +1634,7 @@ describe("Dataset Actions Unit Tests - Function copyDataSet", () => {

await dsActions.copyDataSet(node);

expect(clipboard.readText()).toBe(
JSON.stringify({
profileName: "sestest",
dataSetName: "HLQ.TEST.DELETE.NODE",
})
);
expect(clipboard.readText()).toBe('{"profileName":"sestest","dataSetName":"HLQ.TEST.DELETE.NODE"}');
});
it("Checking copy the label of a member to the clipboard", async () => {
globals.defineGlobals("");
Expand All @@ -1661,13 +1652,7 @@ describe("Dataset Actions Unit Tests - Function copyDataSet", () => {

await dsActions.copyDataSet(child);

expect(clipboard.readText()).toBe(
JSON.stringify({
profileName: "sestest",
dataSetName: "parent",
memberName: "child",
})
);
expect(clipboard.readText()).toBe('{"profileName":"sestest","dataSetName":"parent","memberName":"child"}');
});
it("Checking copy the label of a favorite member to the clipboard", async () => {
globals.defineGlobals("");
Expand All @@ -1685,17 +1670,11 @@ describe("Dataset Actions Unit Tests - Function copyDataSet", () => {

await dsActions.copyDataSet(child);

expect(clipboard.readText()).toBe(
JSON.stringify({
profileName: "sestest",
dataSetName: "parent",
memberName: "child",
})
);
expect(clipboard.readText()).toBe('{"profileName":"sestest","dataSetName":"parent","memberName":"child"}');
});
});

describe("Dataset Actions Unit Tests - Function pasteDataSet", () => {
describe("Dataset Actions Unit Tests - Function pasteMember", () => {
function createBlockMocks() {
const session = createISession();
const sessionWithoutCredentials = createISessionWithoutCredentials();
Expand Down Expand Up @@ -1754,7 +1733,7 @@ describe("Dataset Actions Unit Tests - Function pasteDataSet", () => {
})
);

await dsActions.pasteDataSet(node, blockMocks.testDatasetTree);
await dsActions.pasteMember(node, blockMocks.testDatasetTree);

expect(copySpy).toHaveBeenCalledWith(
{ dataSetName: "HLQ.TEST.BEFORE.NODE" },
Expand Down Expand Up @@ -1801,7 +1780,7 @@ describe("Dataset Actions Unit Tests - Function pasteDataSet", () => {
})
);

await dsActions.pasteDataSet(node, blockMocks.testDatasetTree);
await dsActions.pasteMember(node, blockMocks.testDatasetTree);

expect(copySpy).toHaveBeenCalledWith(
{ dataSetName: "HLQ.TEST.BEFORE.NODE" },
Expand Down Expand Up @@ -1833,7 +1812,7 @@ describe("Dataset Actions Unit Tests - Function pasteDataSet", () => {
});
clipboard.writeText("INVALID");

await expect(dsActions.pasteDataSet(node, blockMocks.testDatasetTree)).rejects.toEqual(
await expect(dsActions.pasteMember(node, blockMocks.testDatasetTree)).rejects.toEqual(
Error("Invalid clipboard. Copy from data set first")
);
expect(copySpy).not.toBeCalled();
Expand Down Expand Up @@ -1864,7 +1843,7 @@ describe("Dataset Actions Unit Tests - Function pasteDataSet", () => {
mocked(vscode.window.showInputBox).mockResolvedValueOnce("");
clipboard.writeText(JSON.stringify({ dataSetName: "HLQ.TEST.BEFORE.NODE", profileName: "sestest" }));

await dsActions.pasteDataSet(node, blockMocks.testDatasetTree);
await dsActions.pasteMember(node, blockMocks.testDatasetTree);
expect(copySpy).not.toBeCalled();
});
it("Should call zowe.Copy.dataSet when pasting to partitioned data set", async () => {
Expand Down Expand Up @@ -1902,7 +1881,7 @@ describe("Dataset Actions Unit Tests - Function pasteDataSet", () => {
mocked(vscode.window.showInputBox).mockResolvedValueOnce("mem1");
clipboard.writeText(JSON.stringify({ dataSetName: "HLQ.TEST.BEFORE.NODE", profileName: "sestest" }));

await dsActions.pasteDataSet(node, blockMocks.testDatasetTree);
await dsActions.pasteMember(node, blockMocks.testDatasetTree);

expect(copySpy).toHaveBeenCalledWith(
{ dataSetName: "HLQ.TEST.BEFORE.NODE" },
Expand Down Expand Up @@ -1941,7 +1920,7 @@ describe("Dataset Actions Unit Tests - Function pasteDataSet", () => {
mocked(vscode.window.showInputBox).mockResolvedValueOnce("mem1");
clipboard.writeText(JSON.stringify({ dataSetName: "HLQ.TEST.BEFORE.NODE", profileName: "sestest" }));

await expect(dsActions.pasteDataSet(node, blockMocks.testDatasetTree)).rejects.toEqual(
await expect(dsActions.pasteMember(node, blockMocks.testDatasetTree)).rejects.toEqual(
Error("HLQ.TEST.TO.NODE(mem1) already exists. You cannot replace a member")
);
expect(copySpy).not.toBeCalled();
Expand Down Expand Up @@ -1993,7 +1972,7 @@ describe("Dataset Actions Unit Tests - Function pasteDataSet", () => {
mocked(blockMocks.testDatasetTree.findNonFavoritedNode).mockReturnValueOnce(nonFavoritedNode);
clipboard.writeText(JSON.stringify({ dataSetName: "HLQ.TEST.BEFORE.NODE", profileName: "sestest" }));

await dsActions.pasteDataSet(favoritedNode, blockMocks.testDatasetTree);
await dsActions.pasteMember(favoritedNode, blockMocks.testDatasetTree);

expect(copySpy).toHaveBeenCalledWith(
{ dataSetName: "HLQ.TEST.BEFORE.NODE" },
Expand Down Expand Up @@ -2232,6 +2211,7 @@ describe("Dataset Actions Unit Tests - Function createFile", () => {
const mvsApi = createMvsApi(imperativeProfile);
const mockCheckCurrentProfile = jest.fn();
bindMvsApi(mvsApi);
mocked(treeView.reveal).mockReturnValue(new Promise((resolve) => resolve(null)));

return {
session,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ async function createGlobalMocks() {
"zowe.all.profilelink",
"zowe.createMember",
"zowe.deleteDataset",
"zowe.deletePDS",
"zowe.allocateLike",
"zowe.uploadDialog",
"zowe.deleteMember",
"zowe.editDataSet",
"zowe.editMember",
"zowe.removeSession",
"zowe.removeFavorite",
Expand All @@ -137,8 +137,9 @@ async function createGlobalMocks() {
"zowe.submitMember",
"zowe.showDSAttributes",
"zowe.renameDataSet",
"zowe.copyMember",
"zowe.copyDataSet",
"zowe.pasteDataSet",
"zowe.pasteMember",
"zowe.renameDataSetMember",
"zowe.hMigrateDataSet",
"zowe.hRecallDataSet",
Expand All @@ -163,7 +164,6 @@ async function createGlobalMocks() {
"zowe.uss.text",
"zowe.uss.renameNode",
"zowe.uss.uploadDialog",
"zowe.uss.createNode",
"zowe.uss.copyPath",
"zowe.uss.editFile",
"zowe.uss.saveSearch",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,14 @@ describe("USSTree Unit Tests - Function USSTree.checkDuplicateLabel()", () => {
it("Tests that checkDuplicateLabel() returns null if passed a unique name", async () => {
const globalMocks = await createGlobalMocks();

const returnVal = globalMocks.testTree.checkDuplicateLabel(
"totallyNewLabel",
[globalMocks.testUSSNode],
"file"
);
const returnVal = globalMocks.testTree.checkDuplicateLabel("totallyNewLabel", [globalMocks.testUSSNode]);
expect(returnVal).toEqual(null);
});
it("Tests that checkDuplicateLabel() returns an error message if passed a name that's already used for an existing folder", async () => {
const globalMocks = await createGlobalMocks();

const returnVal = globalMocks.testTree.checkDuplicateLabel("/u/myuser", [globalMocks.testUSSNode], "file");
expect(returnVal).toEqual("A file already exists with this name. Please choose a different name.");
const returnVal = globalMocks.testTree.checkDuplicateLabel("/u/myuser/usstest", [globalMocks.testUSSNode]);
expect(returnVal).toEqual("A folder already exists with this name. Please choose a different name.");
});
});

Expand Down
Loading