Skip to content
Open
1 change: 1 addition & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- Prevented data loss by modifying the save process to handle data sets with records that exceeded the logical record length. [#3791](https://github.com/zowe/zowe-explorer-vscode/issues/3791)
- Fixed cross-LPAR PDS transfers to preserve original DCB attributes and prevent binary data corruption. Data is now transferred as binary, and the encoding is respected if previously set by the user. [#3731](https://github.com/zowe/zowe-explorer-vscode/pull/3731)
- Fixed copy/paste functionality of data sets for extender-type profiles by using `SharedContext` helper functions. [#3815](https://github.com/zowe/zowe-explorer-vscode/pull/3815)
- Prevent drag-and-drop between profiles pointing to the same DASD/DSN by creating a check in the `DatasetTree.handleDrop` function. The operation is now blocked and an error message is shown instead; users should refresh the target profile to see any changes. [#3827](https://github.com/zowe/zowe-explorer-vscode/pull/3827)

## `3.2.2`

Expand Down
60 changes: 37 additions & 23 deletions packages/zowe-explorer/src/trees/dataset/DatasetTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,8 @@ export class DatasetTree extends ZoweTreeProvider<IZoweDatasetTreeNode> implemen
try {
const encodingInfo = await sourceNode.getEncoding();
// If the encoding is binary, we need to force upload it as binary
const queryString = `forceUpload=true${
encodingInfo?.kind === "binary" ? "&encoding=binary" : encodingInfo?.kind === "other" ? "&encoding=" + encodingInfo?.codepage : ""
}`;
const queryString = `forceUpload=true${encodingInfo?.kind === "binary" ? "&encoding=binary" : encodingInfo?.kind === "other" ? "&encoding=" + encodingInfo?.codepage : ""
}`;
await DatasetFSProvider.instance.writeFile(
destUri.with({
query: queryString,
Expand Down Expand Up @@ -227,6 +226,7 @@ export class DatasetTree extends ZoweTreeProvider<IZoweDatasetTreeNode> implemen
}

let target = targetNode;

if (target) {
for (const item of droppedItems.value) {
const node = this.draggedNodes[item.uri.path];
Expand All @@ -252,6 +252,20 @@ export class DatasetTree extends ZoweTreeProvider<IZoweDatasetTreeNode> implemen
Gui.errorMessage(vscode.l10n.t(message));
return;
}

// If moving to the same system/lpar but different profile, stop the drag entirely
const targetSys = target?.getProfile?.().profile.host;
const srcNode = this.draggedNodes[item.uri.path];
const sourceSys = srcNode?.getProfile?.().profile.host;

if (targetSys == sourceSys) {
await Gui.errorMessage(
vscode.l10n.t(
"Cannot move: the source and target are the same dataset on the same system. You're viewing it under a different profile. Any changes you need to view with target profile can be seen via a refresh."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested message:

Cannot move: The source and target are the same. You are using a different profile to view the target. Refresh to view changes.

)
);
return; // stop the drop entirely
}
}
}

Expand Down Expand Up @@ -1754,15 +1768,15 @@ export class DatasetTree extends ZoweTreeProvider<IZoweDatasetTreeNode> implemen
// Adapt menus to user based on the node that was interacted with
const specifier = isSession
? vscode.l10n.t({
message: "all PDS members in {0}",
args: [node.label as string],
comment: ["Node label"],
})
message: "all PDS members in {0}",
args: [node.label as string],
comment: ["Node label"],
})
: vscode.l10n.t({
message: "the PDS members in {0}",
args: [node.label as string],
comment: ["Node label"],
});
message: "the PDS members in {0}",
args: [node.label as string],
comment: ["Node label"],
});
const selection = await Gui.showQuickPick(
DatasetUtils.DATASET_SORT_OPTS.map((opt, i) => ({
label: sortOpts.method === i ? `${opt} $(check)` : opt,
Expand Down Expand Up @@ -1827,10 +1841,10 @@ export class DatasetTree extends ZoweTreeProvider<IZoweDatasetTreeNode> implemen
node.filter = newFilter;
node.description = newFilter
? vscode.l10n.t({
message: "Filter: {0}",
args: [newFilter.value],
comment: ["Filter value"],
})
message: "Filter: {0}",
args: [newFilter.value],
comment: ["Filter value"],
})
: null;
this.nodeDataChanged(node);

Expand Down Expand Up @@ -1891,15 +1905,15 @@ export class DatasetTree extends ZoweTreeProvider<IZoweDatasetTreeNode> implemen
// Adapt menus to user based on the node that was interacted with
const specifier = isSession
? vscode.l10n.t({
message: "all PDS members in {0}",
args: [node.label as string],
comment: ["Node label"],
})
message: "all PDS members in {0}",
args: [node.label as string],
comment: ["Node label"],
})
: vscode.l10n.t({
message: "the PDS members in {0}",
args: [node.label as string],
comment: ["Node label"],
});
message: "the PDS members in {0}",
args: [node.label as string],
comment: ["Node label"],
});
const clearFilter = isSession
? `$(clear-all) ${vscode.l10n.t("Clear filter for profile")}`
: `$(clear-all) ${vscode.l10n.t("Clear filter for PDS")}`;
Expand Down
Loading